|
|
|
@ -2,17 +2,18 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesBtoJobService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.strategy.IRoundnessStrategy;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.config.AuthUtilExt;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerMessagePoint;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroup;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupWindowTime;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustSoftInfoRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartProdGroupWindowTimeRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -41,7 +42,8 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustSoftInfoServiceImpl mesCustSoftInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustSoftInfoRepository mesCustSoftInfoRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartProdGroupWindowTimeRepository windowTimeRao;
|
|
|
|
|
|
|
|
|
@ -49,6 +51,9 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
|
|
|
|
|
public void doCreateBto(String organizeCode, List<String> groupCodeList) {
|
|
|
|
|
//1. 根据 organizeCode 和 groupCodeList 查询零件生产组
|
|
|
|
|
List<MesPartProdGroup> mesPartProdGroups = mesPartProdGroupService.findMesPartProdGroups(organizeCode, groupCodeList);
|
|
|
|
|
// 初始找原因
|
|
|
|
|
updateCustsort(organizeCode, mesPartProdGroups);
|
|
|
|
|
|
|
|
|
|
for (MesPartProdGroup prodGroup : mesPartProdGroups) {
|
|
|
|
|
//2. 根据生产组的infoPointCode 获取 过点信息MES_CUSTOMER_MESSAGE_POINT
|
|
|
|
|
MesCustomerMessagePoint messagePoint = mesCustomerMessagePointService.getPointByCode(prodGroup.getCustInfoPoint(),organizeCode);
|
|
|
|
@ -61,6 +66,9 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
|
|
|
|
|
List<String> custPartNoList = details.stream().map(MesPartProdGroupDetail::getCustPartNo).collect(Collectors.toList());
|
|
|
|
|
List<MesCustSortInfo> sortInfoList = mesCustSoftInfoService.queryCustSortInfoList(prodGroup.getCustCode(), prodGroup.getCustOrganizeCode(), prodGroup.getCustInfoPoint(), organizeCode, custPartNoList);
|
|
|
|
|
|
|
|
|
|
// List<MesCustSortInfo> allSortInfoList = mesCustSoftInfoService.queryAllCustSortInfoList(organizeCode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参
|
|
|
|
|
String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundMethod());
|
|
|
|
|
if (sortInfoList.isEmpty()){
|
|
|
|
@ -85,6 +93,23 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateCustsort(String organizeCode, List<MesPartProdGroup> mesPartProdGroups) {
|
|
|
|
|
List<MesPartProdGroupDetail> allDetails = new ArrayList<>();
|
|
|
|
|
for (MesPartProdGroup prodGroup : mesPartProdGroups) {
|
|
|
|
|
List<MesPartProdGroupDetail> details = mesPartProdGroupService.findDetailByCode(prodGroup.getPartProdGroupCode(), organizeCode);
|
|
|
|
|
allDetails.addAll(details);
|
|
|
|
|
}
|
|
|
|
|
List<String> allCustPartNoList = allDetails.stream().map(MesPartProdGroupDetail::getCustPartNo).distinct().collect(Collectors.toList());
|
|
|
|
|
List<MesCustSortInfo> allCustSortInfoList = mesCustSoftInfoService.queryAllCustSortInfoList(organizeCode);
|
|
|
|
|
for (MesCustSortInfo mesCustSortInfo : allCustSortInfoList) {
|
|
|
|
|
if (!allCustPartNoList.contains(mesCustSortInfo.getCustPartNo())) {
|
|
|
|
|
String msg = String.format("客户零件号:%s,零件号:%s,未配置零件生产组明细", mesCustSortInfo.getCustPartNo(), mesCustSortInfo.getErpPartNo());
|
|
|
|
|
mesCustSortInfo.setDescription(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mesCustSoftInfoRepository.saveAll(allCustSortInfoList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 排序信息不复用的时候
|
|
|
|
|
* @param infoPointCode
|
|
|
|
|