feat: 增加 执行入库计划
This commit is contained in:
parent
a56d6c5752
commit
de37f12a8d
@ -17,7 +17,7 @@ public interface IWmsInPlanService
|
|||||||
* @param planId 入库计划主键
|
* @param planId 入库计划主键
|
||||||
* @return 入库计划
|
* @return 入库计划
|
||||||
*/
|
*/
|
||||||
public WmsInPlan selectWmsInPlanByPlanId(String planId);
|
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
|
||||||
|
|
||||||
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
|
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
|
||||||
|
|
||||||
@ -67,4 +67,11 @@ public interface IWmsInPlanService
|
|||||||
* @return 是否重复
|
* @return 是否重复
|
||||||
*/
|
*/
|
||||||
public Boolean isDuplicatePlanCode(String planCode);
|
public Boolean isDuplicatePlanCode(String planCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行入库计划
|
||||||
|
* @param planId 入库计划ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int issueWmsInPlan(Long planId);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package com.ktg.mes.wm.service.impl;
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.mes.md.domain.MdItem;
|
||||||
|
import com.ktg.mes.md.service.IMdItemService;
|
||||||
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
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.WmsInPlanDetailEntityMapper;
|
||||||
|
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -31,6 +37,12 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
|
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWmsInTaskService wmsInTaskService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMdItemService mdItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询入库计划
|
* 查询入库计划
|
||||||
*
|
*
|
||||||
@ -38,7 +50,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
|||||||
* @return 入库计划
|
* @return 入库计划
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WmsInPlan selectWmsInPlanByPlanId(String planId) {
|
public WmsInPlan selectWmsInPlanByPlanId(Long planId) {
|
||||||
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
||||||
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
|
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
|
||||||
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
|
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
|
||||||
@ -140,7 +152,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
|||||||
}
|
}
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
wmsInPlanMapper.batchWmsInPlanDetails(list);
|
wmsInPlanMapper.batchWmsInPlanDetails(list);
|
||||||
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId.toString());
|
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId);
|
||||||
List<WmsInPlanDetails> wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList();
|
List<WmsInPlanDetails> wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList();
|
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList();
|
||||||
@ -178,10 +190,51 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库计划ID是否重复
|
* 入库计划ID是否重复
|
||||||
|
*
|
||||||
* @param planCode 入库计划ID
|
* @param planCode 入库计划ID
|
||||||
* @return 是否重复
|
* @return 是否重复
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Boolean isDuplicatePlanCode(String planCode) {
|
public Boolean isDuplicatePlanCode(String planCode) {
|
||||||
return wmsInPlanMapper.isDuplicatePlanCode(planCode);
|
return wmsInPlanMapper.isDuplicatePlanCode(planCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行入库计划
|
||||||
|
*
|
||||||
|
* @param planId 入库计划ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int issueWmsInPlan(Long planId) {
|
||||||
|
WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId);
|
||||||
|
WmsInTask wmsInTask = new WmsInTask();
|
||||||
|
|
||||||
|
AtomicInteger atomicInteger = new AtomicInteger();
|
||||||
|
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
|
||||||
|
int index = atomicInteger.getAndIncrement();
|
||||||
|
|
||||||
|
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
|
||||||
|
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
|
||||||
|
wmsInTask.setTaskInQuantity(Integer.parseInt(detail.getQuantity()));
|
||||||
|
wmsInTask.setActualInQuantity(Integer.parseInt(detail.getQuantityIn()));
|
||||||
|
wmsInTask.setCellTgt(detail.getCellId());
|
||||||
|
wmsInTask.setCellOrig(new Date().toString() + index);
|
||||||
|
wmsInTask.setRemark(detail.getRemark());
|
||||||
|
wmsInTask.setBatch(detail.getBatch());
|
||||||
|
wmsInTask.setMaterialId(detail.getMaterialId());
|
||||||
|
|
||||||
|
MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInTask.getMaterialId()));
|
||||||
|
wmsInTask.setMaterialCode(mdItem.getItemCode());
|
||||||
|
wmsInTask.setPlanTypeId(wmsInPlan.getPlanTypeId().toString());
|
||||||
|
wmsInTask.setPlanTypeCode(wmsInPlan.getPlanTypeCode());
|
||||||
|
wmsInTask.setPlanInStatus("0");
|
||||||
|
wmsInTask.setDetailInId(detail.getDetailsId());
|
||||||
|
|
||||||
|
wmsInTaskService.insertWmsInTask(wmsInTask);
|
||||||
|
});
|
||||||
|
|
||||||
|
wmsInPlan.setState("1");
|
||||||
|
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user