完成出库计划执行时自动匹配库位
This commit is contained in:
parent
f6a2554263
commit
48cc27d3c6
@ -90,6 +90,11 @@ public interface BaseKnifeMapper {
|
||||
@Param("isLocked") Integer isLocked
|
||||
);
|
||||
|
||||
List<BaseKnife> selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked(
|
||||
@Param("mbbBdMrlId") Long mbbBdMrlId,
|
||||
@Param("isLocked") Integer isLocked
|
||||
);
|
||||
|
||||
int updateBaseKnifeIsLockedByBaseKnifeId(
|
||||
@Param("baseKnifeId") Long baseKnifeId,
|
||||
@Param("isLocked") Integer isLocked
|
||||
|
@ -141,9 +141,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
|
||||
);
|
||||
|
||||
@ -160,6 +159,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService {
|
||||
);
|
||||
|
||||
// 开始遍历出库计划子项
|
||||
HashMap<String, List<BaseKnife>> baseKnifeListHashMap = new HashMap<>();
|
||||
baseKnifeList.subList(0, wmsOutPlanDetail.getPlannedQuantity()).forEach(baseKnife -> {
|
||||
// 构建出库计划明细实体
|
||||
WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity();
|
||||
@ -181,29 +181,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);
|
||||
});
|
||||
});
|
||||
|
||||
// 更新出库计划状态为已执行
|
||||
|
@ -549,6 +549,18 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBaseKnifeListByMbbBdMrlIdAndKnifeFineStateAndIsLocked" resultMap="BaseKnifeResult">
|
||||
<include refid="selectBaseKnifeVo"/>
|
||||
<where>
|
||||
<if test="mbbBdMrlId != null and mbbBdMrlId != ''">
|
||||
and MBB_BD_MRL_ID = #{mbbBdMrlId}
|
||||
</if>
|
||||
<if test="isLocked != null">
|
||||
and IS_LOCKED = #{isLocked}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateBaseKnifeIsLockedByBaseKnifeId">
|
||||
update BASE_KNIFE
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
Loading…
Reference in New Issue
Block a user