根据拉动组和生产工单产生拉动单JOB-1

tags/yfai-mes-ext-v2.3
gsz 8 months ago
parent e9bc105f43
commit 8f751f8330

@ -12,4 +12,6 @@ import java.util.Map;
public interface IMesPullingOrderInfoService extends IBaseMesService<MesPullingOrderInfo> {
Map doSPSForEquipment( String assemblyLine, String pullingGroupCode,String organizeCode );
void doCreatePullOrderByPullGroupAndWorkOrder(String organizeCode, String userName);
}

@ -0,0 +1,71 @@
package cn.estsh.i3plus.ext.mes.apiservice.schedulejob;
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
import cn.estsh.i3plus.ext.mes.api.base.IMesPullingOrderInfoService;
import cn.estsh.i3plus.mes.apiservice.schedulejob.BaseMesScheduleJob;
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.util.List;
/**
* @Description : JOB
* @Reference :
* @Author : gsz
* @CreateDate 2024/9/4 10:01
* @Modify:
**/
// 禁止 JOB 并发执行
@DisallowConcurrentExecution
@ApiOperation("根据拉动组和生产工单产生拉动单JOB")
public class MesCreatePullOrderByPullGroupAndWorkOrderJob extends BaseMesScheduleJob {
public static final Logger LOGGER = LoggerFactory.getLogger(MesCreatePullOrderByPullGroupAndWorkOrderJob.class);
private static final long serialVersionUID = 9072058154235836696L;
@Autowired
private IMesPullingOrderInfoService pullingOrderInfoService;
@Autowired
private IMesConfigService mesConfigService;
@Value("${server.port}")
private String serverPort;
@Value("${impp.server.ip}")
private String ip;
public MesCreatePullOrderByPullGroupAndWorkOrderJob() {
super(MesCreatePullOrderByPullGroupAndWorkOrderJob.class, "根据拉动组和生产工单产生拉动单JOB");
this.setMultiInstance(true);
}
@Override
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
try {
String jobParam = this.getJobParam();
if (StringUtils.isBlank(jobParam)) {
throw new IllegalArgumentException("job参数为空请检查参数");
}
String[] organizeCodeList = jobParam.split(",");
LOGGER.info("根据拉动组和生产工单产生拉动单JOB开始 -----start");
String userName = "job";
for (String organizeCode : organizeCodeList) {
pullingOrderInfoService.doCreatePullOrderByPullGroupAndWorkOrder(organizeCode,userName);
}
LOGGER.info("根据拉动组和生产工单产生拉动单JOB开始结束 ----- end");
} catch (Exception e) {
LOGGER.error("根据拉动组和生产工单产生拉动单JOB任务结束e:{}", e.toString());
}
}
}

@ -2,26 +2,29 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.api.base.IMesPartPullService;
import cn.estsh.i3plus.ext.mes.api.base.IMesPullingOrderInfoService;
import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPartPull;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
import cn.estsh.i3plus.pojo.mes.repository.MesPullingOrderPartInfoRepository;
import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.repository.*;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -29,7 +32,14 @@ public class MesPullingOrderInfoService extends BaseMesService<MesPullingOrderIn
@Autowired
private MesPullingOrderPartInfoRepository mesPullingOrderPartInfoRepository;
@Autowired
private MesPartPullRepository mesPartPullRDao;
@Autowired
private MesPartPullDetailRepository mesPartPullDetailRDao;
@Autowired
private MesWorkOrderRepository mesWorkOrderRepository;
@Autowired
private MesWorkCenterRepository mesWorkCenterRepository;
protected void setPackQueryBean(MesPullingOrderInfo bean, DdlPackBean packBean) {
DdlPreparedPack.getStringEqualPack(bean.getPullCode(), "pullCode", packBean);
DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), "pullingOrderNo", packBean);
@ -63,6 +73,27 @@ public class MesPullingOrderInfoService extends BaseMesService<MesPullingOrderIn
}
@Override
public void doCreatePullOrderByPullGroupAndWorkOrder(String organizeCode, String userName) {
//1.拉动组集合+拉动组明细集合pullingGroupList+ pullingpartlist
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
List<MesPartPull> pulliGroupList = mesPartPullRDao.findByHqlWhere(ddlPackBean);
if (CollectionUtils.isEmpty(pulliGroupList)){
return;
}
DdlPackBean ddlPackBeanDetail = DdlPackBean.getDdlPackBean(organizeCode);
List<MesPartPullDetail> pullDetailList = mesPartPullDetailRDao.findByHqlWhere(ddlPackBeanDetail);
if (CollectionUtils.isEmpty(pullDetailList)){
return;
}
//2.客户物料集合 [PART_NO] in 拉动组明细物料集合
//3.产线数据
DdlPackBean workPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getInPackList(pulliGroupList.stream().map(MesPartPull::getWorkCenterCode).collect(Collectors.toList()), "workCenterCode", workPackBean);
List<MesWorkCenter> mesWorkCenterList = mesWorkCenterRepository.findByHqlWhere(workPackBean);
}
@Override
public Map doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode) {
Map resultMap = new HashMap();
//查询拉动单状态为已扫描=20的 拉动单

Loading…
Cancel
Save