完成库存批次台账列表功能

This commit is contained in:
Stang 2024-11-20 17:13:28 +08:00
parent 4d5ab64fc3
commit c158c74f0b
11 changed files with 331 additions and 41 deletions

View File

@ -321,13 +321,13 @@ public class BaseKnifeController extends BaseController {
return AjaxResult.error("该计划单已存在,请更换重试");
// 齐套性检查
AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getProcessCodeList());
AjaxResult ajaxResult = this.checkForAlignment(productionArrangements.getProcessCodes());
if (Integer.parseInt(String.valueOf(ajaxResult.get("code"))) != 200) {
return AjaxResult.error(ajaxResult.get("msg").toString(), ajaxResult.get("data"));
}
// 验证bom工艺
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodeList());
List<BaseTechnologyBom> technologyBomList = baseTechnologyBomService.selectBaseTechnologyBomListByProcessCodeList(productionArrangements.getProcessCodes());
if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null)
return AjaxResult.error("未检测到工艺bom项");
@ -337,7 +337,7 @@ public class BaseKnifeController extends BaseController {
// 参数列表
Map<String, Object> params = new HashMap<>();
params.put("planCode", productionArrangements.getPlanSheet());
params.put("processCodeList", productionArrangements.getProcessCodeList());
params.put("processCodeList", productionArrangements.getProcessCodes());
params.put("processUnit", productionArrangements.getProcessUnit());
// 构建日志
@ -579,7 +579,7 @@ public class BaseKnifeController extends BaseController {
}
// 添加生产准备记录
productionArrangements.setProcessCode(productionArrangements.getProcessCodeList().toString());
productionArrangements.setProcessCode(productionArrangements.getProcessCodes().toString());
productionArrangements.setProcessUnit(productionArrangements.getProcessUnit());
productionArrangements.setStatus(0);
productionArrangements.setCreateTime(DateUtils.getNowDate());

View File

@ -12,10 +12,7 @@ import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.WmsOutPlanDetailEntityMapper;
import com.ktg.mes.md.mapper.WmsOutPlanMapper;
import com.ktg.mes.md.mapper.WmsOutTaskMapper;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IBaseTechnologyBomService;
import com.ktg.mes.md.service.IBomRouteService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.*;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanService;
@ -46,6 +43,9 @@ public class InventoryBatchController extends BaseController
@Autowired
private IBaseKnifeService baseKnifeService;
@Autowired
private IInventoryBatchService inventoryBatchService;
@Autowired
private IMdItemService mdItemService;
@ -78,25 +78,7 @@ public class InventoryBatchController extends BaseController
public TableDataInfo list(InventoryBatch inventoryBatch) {
startPage();
List<InventoryBatch> result = new ArrayList<>();
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
wmsOutTaskWrapper.setBatchNum(inventoryBatch.getBatchNum());
wmsOutTaskWrapper.setMdItemCode(inventoryBatch.getMdItemCode());
List<WmsOutTask> outTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
outTaskList.forEach(outTask -> {
InventoryBatch inventoryBatchOut = new InventoryBatch();
inventoryBatchOut.setId(outTask.getWmsOutTaskId());
inventoryBatchOut.setBatchNum(outTask.getBatchNum());
inventoryBatchOut.setMdItemCode(outTask.getMdItemCode());
inventoryBatchOut.setMdItemName(outTask.getMdItemName());
inventoryBatchOut.setMdItemUnit(outTask.getMdItemUnit());
inventoryBatchOut.setMdItemNum(outTask.getTaskNumber());
inventoryBatchOut.setInOrOut(0);
inventoryBatchOut.setDateTime(outTask.getCreateTime());
inventoryBatchOut.setStatus(outTask.getTaskState());
result.add(inventoryBatchOut);
});
List<InventoryBatch> result = inventoryBatchService.selectInventoryBatchList(inventoryBatch);
return getDataTable(result);
}

View File

@ -117,6 +117,12 @@ public class WmsOutPlanDetailEntity extends BaseEntity {
@Excel(name = "是否对刀")
private Integer isToolSetting;
/**
* 对刀参数
*/
@Excel(name = "对刀参数")
private String toolSettingParam;
public void setWmsOutPlanDetailEntityId(Long wmsOutPlanDetailEntityId) {
this.wmsOutPlanDetailEntityId = wmsOutPlanDetailEntityId;
}
@ -261,6 +267,14 @@ public class WmsOutPlanDetailEntity extends BaseEntity {
this.isToolSetting = isToolSetting;
}
public String getToolSettingParam() {
return toolSettingParam;
}
public void setToolSettingParam(String toolSettingParam) {
this.toolSettingParam = toolSettingParam;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,73 @@
package com.ktg.mes.md.service;
import com.ktg.mes.md.domain.BaseKnife;
import com.ktg.mes.md.domain.InventoryBatch;
import java.util.List;
/**
* 工具台账Service接口
*
* @author yinjinlu
* @date 2024-10-31
*/
public interface IInventoryBatchService
{
/**
* 查询工具台账
*
* @param baseKnifeId 工具台账主键
* @return 工具台账
*/
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询库存批次列表
*
* @param inventoryBatch 库存批次
* @return 库存批次集合
*/
public List<InventoryBatch> selectInventoryBatchList(InventoryBatch inventoryBatch);
/**
* 新增工具台账
*
* @param baseKnife 工具台账
* @return 结果
*/
public int insertBaseKnife(BaseKnife baseKnife);
/**
* 修改工具台账
*
* @param baseKnife 工具台账
* @return 结果
*/
public int updateBaseKnife(BaseKnife baseKnife);
/**
* 批量删除工具台账
*
* @param baseKnifeIds 需要删除的工具台账主键集合
* @return 结果
*/
public int deleteBaseKnifeByBaseKnifeIds(Long[] baseKnifeIds);
/**
* 删除工具台账信息
*
* @param baseKnifeId 工具台账主键
* @return 结果
*/
public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId);
public int resetBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询台账RFID是否重复
*
* @param rfid rfid
* @return 结果
*/
public Boolean isDuplicateRfid(String rfid);
}

View File

@ -110,7 +110,8 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态
hashMap.put("isToolSetting", nowWmsOutPlanDetailEntity.getIsToolSetting()); // 明细状态
hashMap.put("isToolSetting", nowWmsOutPlanDetailEntity.getIsToolSetting()); // 是否对刀
hashMap.put("toolSettingParam", nowWmsOutPlanDetailEntity.getToolSettingParam()); // 对刀参数
/* 实体 */
String outTime = null;
if (nowWmsOutPlanDetailEntity.getCreateTime() != null)

View File

@ -0,0 +1,184 @@
package com.ktg.mes.md.service.impl;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IInventoryBatchService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import static org.apache.commons.lang3.SystemUtils.getUserName;
/**
* 库存批次Service业务层处理
*
* @author yinjinlu
* @date 2024-10-31
*/
@Service
public class InventoryBatchServiceImpl implements IInventoryBatchService {
@Autowired
private BaseKnifeMapper baseKnifeMapper;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@Autowired
private WmsOutTaskMapper wmsOutTaskMapper;
@Autowired
private WmsInTaskMapper wmsInTaskMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
/**
* 查询工具台账
*
* @param baseKnifeId 工具台账主键
* @return 工具台账
*/
@Override
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId) {
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(baseKnifeId);
// 查询基础物料
if ("PRODUCT".equals(baseKnife.getItemOrProduct())) {
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setParentId(baseKnife.getBaseKnifeId());
baseKnife.setBaseKnifeList(baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper));
}
return baseKnife;
}
@Override
public List<InventoryBatch> selectInventoryBatchList(InventoryBatch inventoryBatch) {
List<InventoryBatch> result = new ArrayList<>();
WmsOutTask wmsOutTaskWrapper = new WmsOutTask();
wmsOutTaskWrapper.setBatchNum(inventoryBatch.getBatchNum());
wmsOutTaskWrapper.setMdItemCode(inventoryBatch.getMdItemCode());
List<WmsOutTask> outTaskList = wmsOutTaskMapper.selectWmsOutTaskList(wmsOutTaskWrapper);
outTaskList.forEach(outTask -> {
InventoryBatch inventoryBatchOut = new InventoryBatch();
inventoryBatchOut.setId(outTask.getWmsOutTaskId());
inventoryBatchOut.setBatchNum(outTask.getBatchNum());
inventoryBatchOut.setMdItemCode(outTask.getMdItemCode());
inventoryBatchOut.setMdItemName(outTask.getMdItemName());
inventoryBatchOut.setMdItemUnit(outTask.getMdItemUnit());
inventoryBatchOut.setMdItemNum(outTask.getTaskNumber());
inventoryBatchOut.setInOrOut(0);
inventoryBatchOut.setDateTime(outTask.getCreateTime());
inventoryBatchOut.setStatus(outTask.getTaskState());
result.add(inventoryBatchOut);
});
// 构建入库信息
WmsInTask wmsINTaskWrapper = new WmsInTask();
wmsINTaskWrapper.setBatch(inventoryBatch.getBatchNum());
wmsINTaskWrapper.setMaterialCode(inventoryBatch.getMdItemCode());
List<WmsInTask> inTaskList = wmsInTaskMapper.selectWmsInTaskList(wmsINTaskWrapper);
inTaskList.forEach(inTask -> {
InventoryBatch inventoryBatchIn = new InventoryBatch();
inventoryBatchIn.setId(inTask.getId());
inventoryBatchIn.setBatchNum(inTask.getBatch());
inventoryBatchIn.setMdItemCode(inTask.getMaterialCode());
inventoryBatchIn.setMdItemName(inTask.getMaterialName());
inventoryBatchIn.setMdItemUnit(inTask.getMaterialUnit());
inventoryBatchIn.setMdItemNum(inTask.getActualInQuantity());
inventoryBatchIn.setInOrOut(1);
inventoryBatchIn.setDateTime(inTask.getCreateTime());
inventoryBatchIn.setStatus("1");
result.add(inventoryBatchIn);
});
return result;
}
/**
* 新增工具台账
*
* @param baseKnife 工具台账
* @return 结果
*/
@Transactional
@Override
public int insertBaseKnife(BaseKnife baseKnife) {
baseKnife.setCreateTime(DateUtils.getNowDate());
baseKnife.setCreateBy(getUserName());
int rows = baseKnifeMapper.insertBaseKnife(baseKnife);
return rows;
}
/**
* 修改工具台账
*
* @param baseKnife 工具台账
* @return 结果
*/
@Transactional
@Override
public int updateBaseKnife(BaseKnife baseKnife) {
baseKnife.setUpdateTime(DateUtils.getNowDate());
baseKnife.setUpdateBy(getUserName());
return baseKnifeMapper.updateBaseKnife(baseKnife);
}
/**
* 批量删除工具台账
*
* @param baseKnifeIds 需要删除的工具台账主键
* @return 结果
*/
@Transactional
@Override
public int deleteBaseKnifeByBaseKnifeIds(Long[] baseKnifeIds) {
return baseKnifeMapper.deleteBaseKnifeByBaseKnifeIds(baseKnifeIds);
}
/**
* 删除工具台账信息
*
* @param baseKnifeId 工具台账主键
* @return 结果
*/
@Transactional
@Override
public int deleteBaseKnifeByBaseKnifeId(Long baseKnifeId) {
return baseKnifeMapper.deleteBaseKnifeByBaseKnifeId(baseKnifeId);
}
@Override
public int resetBaseKnifeByBaseKnifeId(Long baseKnifeId) {
return baseKnifeMapper.resetBaseKnife(baseKnifeId);
}
/**
* 查询台账RFID是否重复
*
* @param rfid rfid
* @return 结果
*/
public Boolean isDuplicateRfid(String rfid){
return baseKnifeMapper.isDuplicateRfid(rfid);
}
}

View File

@ -29,7 +29,7 @@ public class ProductionArrangements extends BaseEntity
private String processCode;
@Excel(name = "工序号")
private List<String> processCodeList;
private List<String> processCodes;
@Excel(name = "工序号")
private String processUnit;
@ -94,12 +94,12 @@ public class ProductionArrangements extends BaseEntity
this.processUnit = processUnit;
}
public List<String> getProcessCodeList() {
return processCodeList;
public List<String> getProcessCodes() {
return processCodes;
}
public void setProcessCodeList(List<String> processCodeList) {
this.processCodeList = processCodeList;
public void setProcessCodes(List<String> processCodes) {
this.processCodes = processCodes;
}
public Integer getStatus()
@ -149,7 +149,7 @@ public class ProductionArrangements extends BaseEntity
"productionArrangementsId='" + productionArrangementsId + '\'' +
", planSheet='" + planSheet + '\'' +
", processCode='" + processCode + '\'' +
", processCodeList=" + processCodeList +
", processCodes=" + processCodes +
", processUnit='" + processUnit + '\'' +
", status=" + status +
", attr1='" + attr1 + '\'' +

View File

@ -118,6 +118,11 @@ public class WmsInTask extends BaseEntity {
*/
private String materialName;
/**
* 物料单位
*/
private String materialUnit;
/**
* 入库明细ID
*/
@ -276,6 +281,14 @@ public class WmsInTask extends BaseEntity {
this.materialName = materialName;
}
public String getMaterialUnit() {
return materialUnit;
}
public void setMaterialUnit(String materialUnit) {
this.materialUnit = materialUnit;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -369,6 +369,12 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
public AjaxResult createInTaskByWmsZdTask(WmsZdTask zdTask) {
String batchNum = "ZZPC001";
// 获取订单下的台账集合
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setZdTaskId(zdTask.getWmsZdTaskId());
baseKnifeWrapper.setMbbBdMrlId(zdTask.getmProductId());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper);
// 整刀入库计划, 根据图号查询入库计划如果不存在生成计划存在则往计划中添加任务
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(zdTask.getAreaId());
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanCode(zdTask.getCode());
@ -392,6 +398,14 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetails.setPlanInStatus("0");
// 构建入库明细实体
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = new ArrayList<>();
baseKnifeList.forEach(baseKnife -> {
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
wmsInPlanDetailEntityList.add(wmsInPlanDetailEntity);
});
wmsInPlanDetails.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
@ -432,10 +446,6 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInTaskMapper.insertWmsInTask(wmsInTask);
// 刀台账设为有效
BaseKnife baseKnifeWrapper = new BaseKnife();
baseKnifeWrapper.setZdTaskId(zdTask.getWmsZdTaskId());
baseKnifeWrapper.setMbbBdMrlId(zdTask.getmProductId());
List<BaseKnife> baseKnifeList = baseKnifeMapper.selectBaseKnifeNotValidList(baseKnifeWrapper);
baseKnifeList.forEach(baseKnife -> {
baseKnife.setIsValid(0);
baseKnife.setCreateTime(DateUtils.getNowDate());

View File

@ -28,6 +28,7 @@
<result property="safeStock" column="SAFE_STOCK"/>
<result property="standardQuantity" column="STANDARD_QUANTITY"/>
<result property="isToolSetting" column="IS_TOOL_SETTING"/>
<result property="toolSettingParam" column="TOOL_SETTING_PARAM"/>
</resultMap>
<sql id="selectWmsOutPlanDetailEntityVo">
@ -53,7 +54,8 @@
KNIFE_UNIT,
SAFE_STOCK,
STANDARD_QUANTITY,
IS_TOOL_SETTING
IS_TOOL_SETTING,
TOOL_SETTING_PARAM
from WMS_OUT_PLAN_DETAIL_ENTITY
</sql>
@ -83,6 +85,9 @@
<if test="isToolSetting != null and isToolSetting != ''">and IS_TOOL_SETTING =
#{isToolSetting}
</if>
<if test="toolSettingParam != null and toolSettingParam != ''">and TOOL_SETTING_PARAM =
#{isToolSetting}
</if>
</where>
ORDER BY WMS_OUT_PLAN_DETAIL_ID DESC, CREATE_TIME DESC
</select>
@ -119,6 +124,7 @@
<if test="safeStock != null">SAFE_STOCK,</if>
<if test="standardQuantity != null">STANDARD_QUANTITY,</if>
<if test="isToolSetting != null">IS_TOOL_SETTING,</if>
<if test="toolSettingParam != null">TOOL_SETTING_PARAM,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wmsOutPlanDetailId != null">#{wmsOutPlanDetailId},</if>
@ -143,6 +149,7 @@
<if test="safeStock != null">#{safeStock},</if>
<if test="standardQuantity != null">#{standardQuantity},</if>
<if test="isToolSetting != null">#{isToolSetting},</if>
<if test="toolSettingParam != null">#{toolSettingParam},</if>
</trim>
</insert>
@ -171,6 +178,7 @@
<if test="safeStock != null">SAFE_STOCK = #{safeStock},</if>
<if test="standardQuantity != null">STANDARD_QUANTITY = #{standardQuantity},</if>
<if test="isToolSetting != null">IS_TOOL_SETTING = #{isToolSetting},</if>
<if test="toolSettingParam != null">TOOL_SETTING_PARAM = #{toolSettingParam},</if>
</trim>
where WMS_OUT_PLAN_DETAIL_ENTITY_ID = #{wmsOutPlanDetailEntityId}
</update>

View File

@ -27,6 +27,8 @@
<result property="planInStatus" column="PLAN_IN_STATUS"/>
<result property="planInCode" column="PLAN_IN_CODE"/>
<result property="materialCode" column="MATERIAL_CODE"/>
<result property="materialUnit" column="MATERIAL_UNIT"/>
<result property="materialName" column="MATERIAL_NAME"/>
<result property="detailInId" column="DETAIL_IN_ID"/>
</resultMap>
@ -53,9 +55,12 @@
a.MATERIAL_CODE,
a.DETAIL_IN_ID,
b.AREA_CODE as CELL_CODE,
b.AREA_NAME as CELL_NAME
b.AREA_NAME as CELL_NAME,
c.UNIT_NAME AS MATERIAL_UNIT,
c.ITEM_NAME AS MATERIAL_NAME
from WMS_IN_TASK a
left join WM_STORAGE_AREA b on b.AREA_ID = a.CELL_TGT
left join MD_ITEM c on c.ITEM_ID = a.MATERIAL_ID
</sql>
<select id="selectWmsInTaskList" parameterType="WmsInTask" resultMap="WmsInTaskResult">
@ -76,7 +81,7 @@
<if test="updateTime != null and updateTime != ''">and UPDATE_TIME = #{updateTime}</if>
<if test="isActive != null and isActive != ''">and IS_ACTIVE = #{isActive}</if>
<if test="isDelete != null and isDelete != ''">and IS_DELETE = #{isDelete}</if>
<if test="batch != null and batch != ''">and BATCH = #{batch}</if>
<if test="batch != null and batch != ''">and BATCH like concat('%', #{batch}, '%')</if>
<if test="materialId != null and materialId != ''">and MATERIAL_ID = #{materialId}</if>
<if test="planTypeId != null and planTypeId != ''">and PLAN_TYPE_ID = #{planTypeId}</if>
<if test="planInStatus != null and planInStatus != ''">and PLAN_IN_STATUS = #{planInStatus}</if>