forked from I3-YF/i3plus-mes-yfai
bto-job第一个版本完成,按时圆整
parent
68af7786cf
commit
9338f4870a
@ -0,0 +1,19 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.api.base;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/2 11:47
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface IMesBtoJobService {
|
||||||
|
/**
|
||||||
|
* 定时job生成bto工单
|
||||||
|
* @param organizeCode
|
||||||
|
* @param groupCodeList
|
||||||
|
*/
|
||||||
|
void doCreateBto(String organizeCode, List<String> groupCodeList);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.api.base;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/2 20:38
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface IMesCustSoftInfoService extends IBaseMesService<MesCustSortInfo> {
|
||||||
|
/**
|
||||||
|
* 获取客户排序信息
|
||||||
|
* @param custCode
|
||||||
|
* @param custOrganizeCode
|
||||||
|
* @param infoPointCode
|
||||||
|
* @param organizeCode
|
||||||
|
* @param custPartNoList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MesCustSortInfo> queryCustSortInfoList(String custCode,String custOrganizeCode,String infoPointCode,String organizeCode,List<String> custPartNoList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新custSortInfo
|
||||||
|
* @param custSortInfo
|
||||||
|
*/
|
||||||
|
void updateCustSortInfo(MesCustSortInfo custSortInfo);
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.api.base.strategy;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroup;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartProdGroupDetail;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 圆整策略
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/2 21:21
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface IRoundnessStrategy {
|
||||||
|
|
||||||
|
void execute(MesPartProdGroup partProdGroup, List<MesCustSortInfo> sortInfoList, List<MesPartProdGroupDetail> details);
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
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.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.shipping.MesCustSortInfo;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/2 11:51
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class MesBtoJobServiceImpl implements IMesBtoJobService {
|
||||||
|
@Autowired
|
||||||
|
private MesPartProdGroupService mesPartProdGroupService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesCustomerMessagePointService mesCustomerMessagePointService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MesCustSoftInfoServiceImpl mesCustSoftInfoService;
|
||||||
|
@Override
|
||||||
|
public void doCreateBto(String organizeCode, List<String> groupCodeList) {
|
||||||
|
//1. 根据 organizeCode 和 groupCodeList 查询零件生产组
|
||||||
|
List<MesPartProdGroup> mesPartProdGroups = mesPartProdGroupService.findMesPartProdGroups(organizeCode, groupCodeList);
|
||||||
|
for (MesPartProdGroup prodGroup : mesPartProdGroups) {
|
||||||
|
//2. 根据生产组的infoPointId 获取 过点信息TM_BAS_INFO_POINT
|
||||||
|
MesCustomerMessagePoint messagePoint = mesCustomerMessagePointService.getPointByCode(prodGroup.getCustInfoPoint(),organizeCode);
|
||||||
|
if (messagePoint == null){
|
||||||
|
log.info("客户的信息点{}不存在",prodGroup.getCustInfoPoint());
|
||||||
|
}
|
||||||
|
//3. 根据零件生产组中reuseSoftInfo 获取排序信息
|
||||||
|
// Integer isReuseSortInfo = prodGroup.getIsReuseSortInfo();
|
||||||
|
List<MesPartProdGroupDetail> details = mesPartProdGroupService.findDetailByCode(prodGroup.getPartProdGroupCode(), organizeCode);
|
||||||
|
List<String> custPartNoList = details.stream().map(MesPartProdGroupDetail::getCustPartNo).collect(Collectors.toList());
|
||||||
|
List<MesCustSortInfo> sortInfoList = mesCustSoftInfoService.queryCustSortInfoList(prodGroup.getCustCode(), prodGroup.getCustOrganizeCode(), prodGroup.getCustInfoPoint(), organizeCode, custPartNoList);
|
||||||
|
//4. 如果没有订单需要更新窗口时间 TM_BAS_PRODUCT_GROUP_WINDOW_TIME
|
||||||
|
//5. 根据零件生产组中是否有assyCode(总成类型),去校验 客户排序信息中,是否包含了零件发运组的零件
|
||||||
|
// custsortinfolist.where(c=> partproductgroupinfo.AssCode.contains(c.AssCode)) == 0 直接返回
|
||||||
|
List<MesCustSortInfo> countInfo = sortInfoList.stream().filter(item -> item.getAssyCode().equals(prodGroup.getPartType())).collect(Collectors.toList());
|
||||||
|
if (countInfo.isEmpty()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参
|
||||||
|
String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundType());
|
||||||
|
IRoundnessStrategy roundnessStrategy = (IRoundnessStrategy)SpringContextsUtil.getBean(roundnessService);
|
||||||
|
roundnessStrategy.execute(prodGroup,sortInfoList, details);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序信息不复用的时候
|
||||||
|
* @param infoPointCode
|
||||||
|
* @param organizeCode
|
||||||
|
* @param partGroupId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<MesCustSortInfo> getCustSortInfoList(String infoPointCode, String organizeCode, Long partGroupId,String partGroupCode){
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.api.base.IMesCustSoftInfoService;
|
||||||
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||||
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesCustSortInfo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : Castle
|
||||||
|
* @CreateDate : 2024/6/2 20:39
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class MesCustSoftInfoServiceImpl extends BaseMesService<MesCustSortInfo> implements IMesCustSoftInfoService {
|
||||||
|
@Override
|
||||||
|
public List<MesCustSortInfo> queryCustSortInfoList(String custCode, String custOrganizeCode, String infoPointCode, String organizeCode, List<String> custPartNoList) {
|
||||||
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
||||||
|
DdlPreparedPack.getStringEqualPack(custCode,"custCode", ddlPackBean);
|
||||||
|
DdlPreparedPack.getStringEqualPack(custOrganizeCode, "custOrganizeCode", ddlPackBean);
|
||||||
|
DdlPreparedPack.getStringEqualPack(infoPointCode, "infoPointCode", ddlPackBean);
|
||||||
|
DdlPreparedPack.getInPackList(custPartNoList,"custPartNo", ddlPackBean);
|
||||||
|
return baseRDao.findByHqlWhere(ddlPackBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCustSortInfo(MesCustSortInfo custSortInfo) {
|
||||||
|
ConvertBean.saveOrUpdate(custSortInfo,"edi");
|
||||||
|
baseRDao.update(custSortInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue