|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package com.ktg.mes.md.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.ktg.common.constant.UserConstants;
|
|
|
|
|
import com.ktg.common.utils.DateUtils;
|
|
|
|
|
import com.ktg.common.utils.StringUtils;
|
|
|
|
@ -154,9 +153,8 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
|
|
|
|
|
List<WmsOutPlanDetail> wmsOutPlanDetailList = wmsOutPlan.getWmsOutPlanDetailList();
|
|
|
|
|
wmsOutPlanDetailList.forEach(wmsOutPlanDetail -> {
|
|
|
|
|
// 获得该出库计划子项对应的工具台账实体
|
|
|
|
|
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndAreaCodeAndKnifeFineStateAndIsLocked(
|
|
|
|
|
List<BaseKnife> baseKnifeList = this.baseKnifeMapper.selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
|
|
|
|
|
wmsOutPlanDetail.getMdItemId(),
|
|
|
|
|
wmsOutPlanDetail.getWmStorageAreaCode(),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
@ -173,6 +171,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 开始遍历出库计划子项
|
|
|
|
|
HashMap<String, List<BaseKnife>> baseKnifeListHashMap = new HashMap<>();
|
|
|
|
|
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
|
|
|
|
|
// 构建出库计划明细实体
|
|
|
|
|
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
|
|
|
@ -194,29 +193,40 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
|
|
|
|
|
|
|
|
|
|
// 锁定工具台账中的物料实体
|
|
|
|
|
this.baseKnifeMapper.updateBaseKnifeIsLockedByBaseKnifeId(baseKnife.getBaseKnifeId(), 1);
|
|
|
|
|
|
|
|
|
|
// 加入进MAP
|
|
|
|
|
if (!baseKnifeListHashMap.containsKey(baseKnife.getAreaCode()))
|
|
|
|
|
baseKnifeListHashMap.put(baseKnife.getAreaCode(), new ArrayList<>());
|
|
|
|
|
baseKnifeListHashMap.get(baseKnife.getAreaCode()).add(baseKnife);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 构建出库任务
|
|
|
|
|
WmsOutTask wmsOutTask = new WmsOutTask();
|
|
|
|
|
wmsOutTask.setWmsOutPlanId(wmsOutPlanId);
|
|
|
|
|
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
|
|
|
|
|
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
|
|
|
|
|
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
|
|
|
|
|
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
|
|
|
|
wmsOutTask.setTaskNumber(wmsOutPlanDetail.getPlannedQuantity());
|
|
|
|
|
wmsOutTask.setOutNumber(wmsOutPlanDetail.getPlannedQuantity());
|
|
|
|
|
wmsOutTask.setWmStorageAreaId(wmsOutPlanDetail.getWmStorageAreaId());
|
|
|
|
|
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
|
|
|
|
|
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
|
|
|
|
|
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
|
|
|
|
|
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
|
|
|
|
|
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
|
|
|
|
|
wmsOutTask.setTaskState("0");
|
|
|
|
|
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
|
|
|
|
|
wmsOutTask.setCreateTime(new Date());
|
|
|
|
|
// 根据库位遍历台账
|
|
|
|
|
baseKnifeListHashMap.keySet().forEach(key -> {
|
|
|
|
|
// 获取库位信息
|
|
|
|
|
WmStorageArea wmStorageAreaByAreaCode = this.wmStorageAreaMapper.selectWmStorageAreaByAreaCode(key);
|
|
|
|
|
|
|
|
|
|
// 插入出库任务
|
|
|
|
|
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
|
|
|
|
// 构建出库任务
|
|
|
|
|
WmsOutTask wmsOutTask = new WmsOutTask();
|
|
|
|
|
wmsOutTask.setWmsOutPlanId(wmsOutPlanId);
|
|
|
|
|
wmsOutTask.setWmsOutPlanCode(wmsOutPlan.getPlanCode());
|
|
|
|
|
wmsOutTask.setWmsOutPlanDetailId(wmsOutPlanDetail.getWmsOutPlanDetailId());
|
|
|
|
|
wmsOutTask.setWmsBusinessTypeId(wmsOutPlan.getWmsBusinessTypeId());
|
|
|
|
|
wmsOutTask.setTaskCode(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
|
|
|
|
wmsOutTask.setTaskNumber(baseKnifeListHashMap.get(key).size());
|
|
|
|
|
wmsOutTask.setOutNumber(baseKnifeListHashMap.get(key).size());
|
|
|
|
|
wmsOutTask.setWmStorageAreaId(wmStorageAreaByAreaCode.getAreaId());
|
|
|
|
|
wmsOutTask.setBatchNum(wmsOutPlanDetail.getDetailBatchNum());
|
|
|
|
|
wmsOutTask.setMdItemId(wmsOutPlanDetail.getMdItemId());
|
|
|
|
|
wmsOutTask.setMdItemCode(wmsOutPlanDetail.getMdItemCode());
|
|
|
|
|
wmsOutTask.setMdItemName(wmsOutPlanDetail.getMdItemName());
|
|
|
|
|
wmsOutTask.setMdItemUnit(wmsOutPlanDetail.getMdItemUnit());
|
|
|
|
|
wmsOutTask.setTaskState("0");
|
|
|
|
|
wmsOutTask.setRecipientUsername(wmsOutPlan.getRecipientUsername());
|
|
|
|
|
wmsOutTask.setCreateTime(new Date());
|
|
|
|
|
|
|
|
|
|
// 插入出库任务
|
|
|
|
|
this.wmsOutTaskMapper.insertWmsOutTask(wmsOutTask);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 更新出库计划状态为已执行
|
|
|
|
|