Merge branch 'dev-wuhan' into dev-wuhan-temp

tags/yfai-pcn-ext-v2.3
王杰 8 months ago
commit d379ad543e

@ -6,6 +6,8 @@ import cn.estsh.i3plus.pojo.mes.bean.MesPart;
import cn.estsh.i3plus.pojo.mes.bean.MesPartSap;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
@ -21,6 +23,12 @@ public interface IMesPartService {
@ApiOperation(value = "根据物料代码查询物料信息")
MesPart getMesPartByPartNo(String partNo,String organizeCode);
@ApiOperation(value = "根据物料代码查询物料信息")
List<MesPart> findMesPartByPartNo(List<String> partNoList, String organizeCode);
@ApiOperation(value = "根据物料代码查询SAP物料信息")
MesPartSap getMesPartSapByPartNo(String partNo, String organizeCode);
@ApiOperation(value = "根据物料代码查询SAP物料信息")
List<MesPartSap> findMesPartSapByPartNo(List<String> partNoList, String organizeCode);
}

@ -0,0 +1,22 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.mes.bean.MesMoveRule;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 12:14
* @Modify:
**/
public interface IMesMoveRuleService {
@ApiOperation("根据规则代码查询移库规则")
List<MesMoveRule> findMesMoveRuleByPartProdGroupCode(String code, String organizeCode);
@ApiOperation("根据规则代码查询移库规则")
List<MesMoveRule> findMesMoveRuleByPartProdGroupCode(List<String> codeList, String organizeCode);
}

@ -3,9 +3,17 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.mes.bean.MesProductVersion;
import io.swagger.annotations.ApiOperation;
import java.util.List;
public interface IMesProductVersionService {
@ApiOperation(value = "查询生产版本")
MesProductVersion getMesProductVersion(String organizeCode,String partNo,String productVersion);
@ApiOperation(value = "根据零件号查询生产版本")
List<MesProductVersion> findMesProductVersionByPartNo(String organizeCode, String partNo);
@ApiOperation(value = "根据零件号查询生产版本")
List<MesProductVersion> findMesProductVersionByPartNo(String organizeCode,List<String> partNoList);
}

@ -33,4 +33,7 @@ public interface IMesProductionRecordService {
@ApiOperation(value = "根据零件条码查询加工记录信息")
List<MesProductionRecordModel> findMesProductionRecordList(String organizeCode, String productSn);
@ApiOperation(value = "更新加工记录")
void updateProductionRecord(List<MesProductionRecord> recordList,String userName,Integer reportStatus,String msg);
}

@ -64,4 +64,10 @@ public interface IMesWorkOrderService {
@ApiOperation(value = "报工调整")
void doProductReportReversal(MesWorkOrder mesWorkOrder,MesProductVersion mesProductVersion,String userName);
@ApiOperation("排序汇报job")
void doMesWorkOrderSortReport(String organizeCode, Integer pageSize, String userName);
@ApiOperation("根据工单查询工单零件信息")
List<MesWorkOrderPart> findMesWorkOrderPartByOrderNo(String organizeCode,List<String> workOrderNoList);
}

@ -128,6 +128,12 @@ public class TestController {
}
@GetMapping("/MesReportSortJob")
@ApiOperation(value = "排序工单汇报")
public void doMesReportSortJob(String organizeCode,Integer pageSize,String userName) {
workOrderService.doMesWorkOrderSortReport(organizeCode,pageSize,userName);
}
@GetMapping("/testInsert")
@ApiOperation(value = "批量")
public void testInsert() {

@ -0,0 +1,19 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.dao;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 10:28
* @Modify:
**/
public interface IMesProductionRecordDao {
@ApiOperation("查询汇报的加工记录")
List<MesProductionRecord> findMesProductionRecordNoReport(String organizeCode, Integer workOrderType, Integer pageSize);
}

@ -0,0 +1,51 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.daoimpl;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.dao.IMesProductionRecordDao;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 10:29
* @Modify:
**/
@Service
@Slf4j
public class MesMesProductionRecordImpl implements IMesProductionRecordDao {
@Autowired
private EntityManager entityManager;
@Override
public List<MesProductionRecord> findMesProductionRecordNoReport(String organizeCode, Integer workOrderType, Integer pageSize) {
StringBuilder hql = new StringBuilder();
hql.append(" select record from MesProductionRecord record left join MesWorkCenter center on record.workCenterCode = center.workCenterCode where 1=1");
hql.append(" and record.organizeCode = :organizeCode and record.isValid = :isValid and record.isDeleted = :isDeleted ");
hql.append(" and center.organizeCode = :organizeCode and center.isValid = :isValid and center.isDeleted = :isDeleted ");
hql.append(" and center.centerType = :centerType and record.reportStatus in (:reportStatus) and record.reportType != :reportType ");
hql.append(" order by record.reportStatus asc,record.createDatetime asc ");
Query hqlQuery = entityManager.createQuery(hql.toString(), MesProductionRecord.class);
hqlQuery.setParameter("organizeCode", organizeCode);
hqlQuery.setParameter("isValid", CommonEnumUtil.VALID);
hqlQuery.setParameter("isDeleted", CommonEnumUtil.FALSE);
hqlQuery.setParameter("centerType", workOrderType);
hqlQuery.setParameter("reportType", MesExtEnumUtil.MES_REPORT_TYPE.NO_REPORT.getValue());
hqlQuery.setParameter("reportStatus", Stream.of(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_10.getValue(), MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_40.getValue()).collect(Collectors.toList()));
hqlQuery.setFirstResult(MesPcnExtConstWords.ZERO).setMaxResults(Objects.isNull(pageSize) ? MesPcnExtConstWords.ONE_HUNDRED : pageSize);
return hqlQuery.getResultList();
}
}

@ -0,0 +1,53 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderService;
import cn.estsh.i3plus.platform.common.tool.JsonUtilTool;
import cn.estsh.i3plus.pojo.model.wms.WmsJobParamModel;
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description : job
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 11:17
* @Modify:
**/
@Slf4j
@DisallowConcurrentExecution
@Component
@ApiOperation("排序报工job")
public class MesReportSortJob extends BaseMesScheduleJob {
@Autowired
private IMesWorkOrderService workOrderService;
public MesReportSortJob() {
super(MesReportSortJob.class, "排序报工job");
}
@Override
public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
List<WmsJobParamModel> wmsJobParamModelList = JsonUtilTool.toList(this.getJobParam(), WmsJobParamModel.class);
if (!CollectionUtils.isEmpty(wmsJobParamModelList)) {
for (WmsJobParamModel wmsJobParamModel : wmsJobParamModelList) {
try {
long startTime = System.currentTimeMillis();
workOrderService.doMesWorkOrderSortReport(wmsJobParamModel.getOrganizeCode(), wmsJobParamModel.getPageSize(), "job");
long endTime = System.currentTimeMillis();
log.info("工厂{}排序报工job --- END --- 耗时: {} ms", wmsJobParamModel.getOrganizeCode(), endTime - startTime);
} catch (Exception e) {
log.info("工厂{}排序报工job 执行失败{}", wmsJobParamModel.getOrganizeCode(), e);
}
}
}
}
}

@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -11,8 +12,10 @@ import cn.estsh.i3plus.pojo.mes.bean.MesPart;
import cn.estsh.i3plus.pojo.mes.bean.MesPartSap;
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesPartSapRepository;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Objects;
@ -55,6 +58,15 @@ public class MesPartServiceImpl implements IMesPartService {
}
@Override
public List<MesPart> findMesPartByPartNo(List<String> partNoList, String organizeCode) {
if(StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(partNoList)) return null;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
if(partNoList.size() == MesPcnExtConstWords.ONE) DdlPreparedPack.getStringEqualPack(partNoList.iterator().next(),"partNo",packBean);
DdlPreparedPack.getInPackList(partNoList,"partNo",packBean);
return mesPartRDao.findByHqlWhere(packBean);
}
@Override
public MesPartSap getMesPartSapByPartNo(String partNo, String organizeCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean);
@ -64,4 +76,13 @@ public class MesPartServiceImpl implements IMesPartService {
}
return mesPartSap;
}
@Override
public List<MesPartSap> findMesPartSapByPartNo(List<String> partNoList, String organizeCode) {
if(StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(partNoList)) return null;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
if(partNoList.size() == MesPcnExtConstWords.ONE) DdlPreparedPack.getStringEqualPack(partNoList.iterator().next(),"partNo",packBean);
DdlPreparedPack.getInPackList(partNoList,"partNo",packBean);
return mesPartSapRDao.findByHqlWhere(packBean);
}
}

@ -0,0 +1,47 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesMoveRuleService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesMoveRule;
import cn.estsh.i3plus.pojo.mes.repository.IMesMoveRuleRepository;
import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 12:15
* @Modify:
**/
@Service
@Slf4j
public class MesMoveRuleServiceImpl implements IMesMoveRuleService {
@Autowired
private IMesMoveRuleRepository mesMoveRuleRepository;
@Override
public List<MesMoveRule> findMesMoveRuleByPartProdGroupCode(String code, String organizeCode) {
if (StringUtils.isEmpty(code) || StringUtils.isEmpty(organizeCode)) return null;
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(code, "code", ddlPackBean);
return mesMoveRuleRepository.findByHqlWhere(ddlPackBean);
}
@Override
public List<MesMoveRule> findMesMoveRuleByPartProdGroupCode(List<String> codeList, String organizeCode) {
if (CollectionUtils.isEmpty(codeList) || StringUtils.isEmpty(organizeCode)) return null;
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
if (codeList.size() == MesPcnExtConstWords.ONE) DdlPreparedPack.getStringEqualPack(codeList.iterator().next(), "code", ddlPackBean);
DdlPreparedPack.getInPackList(codeList, "code", ddlPackBean);
return mesMoveRuleRepository.findByHqlWhere(ddlPackBean);
}
}

@ -1,6 +1,7 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductVersionService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesProductVersion;
@ -8,8 +9,11 @@ import cn.estsh.i3plus.pojo.mes.repository.MesProductVersionRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* @Description :
* @Reference :
@ -34,4 +38,21 @@ public class MesProductVersionServiceImpl implements IMesProductVersionService {
DdlPreparedPack.getStringEqualPack(productVersion, "productVersion", ddlPackBean);
return mesProductVersionRepository.getByProperty(ddlPackBean);
}
@Override
public List<MesProductVersion> findMesProductVersionByPartNo(String organizeCode, String partNo) {
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(partNo)) return null;
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
return mesProductVersionRepository.findByHqlWhere(ddlPackBean);
}
@Override
public List<MesProductVersion> findMesProductVersionByPartNo(String organizeCode, List<String> partNoList) {
if (CollectionUtils.isEmpty(partNoList) || StringUtils.isEmpty(organizeCode)) return null;
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
if (partNoList.size() == MesPcnExtConstWords.ONE) DdlPreparedPack.getStringEqualPack(partNoList.iterator().next(), "partNo", ddlPackBean);
DdlPreparedPack.getInPackList(partNoList, "partNo", ddlPackBean);
return mesProductVersionRepository.findByHqlWhere(ddlPackBean);
}
}

@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
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.enumutil.CommonEnumUtil;
@ -126,6 +127,18 @@ public class MesProductionRecordService implements IMesProductionRecordService {
return mesProductionRecordModelList;
}
@Override
public void updateProductionRecord(List<MesProductionRecord> recordList, String userName, Integer reportStatus, String msg) {
recordList.forEach(record->{
record.setReportStatus(reportStatus);
record.setRemark(msg);
record.setSystemSyncStatus(CommonEnumUtil.FALSE);
record.setSystemSyncDatetime(MesPcnExtConstWords.EMPTY);
ConvertBean.serviceModelUpdate(record,userName);
});
productionRecordRepository.saveAll(recordList);
}
private Map<String, MesCraft> getStringMesCraftMap(String organizeCode, List<String> craftCodeList) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getInPackList(craftCodeList, MesPcnExtConstWords.CRAFT_CODE,packBean);

@ -4,8 +4,10 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.dao.IMesProductionRecordDao;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesWorkOrderSortReportModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
@ -30,6 +32,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.format.DateParser;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -117,6 +120,18 @@ public class MesWorkOrderService implements IMesWorkOrderService {
@Autowired
private IMesProductVersionService mesProductVersionService;
@Autowired
private IMesProductionRecordDao mesProductionRecordDao;
@Autowired
private IMesMoveRuleService mesMoveRuleService;
@Autowired
private MesWorkOrderPartRepository mesWorkOrderPartRepository;
@Autowired
private MesMoveRepository mesMoveRepository;
@Override
public MesWorkOrder queryMesWorkOrder(MesWorkOrder workOrder) {
@ -1075,6 +1090,75 @@ public class MesWorkOrderService implements IMesWorkOrderService {
}
}
@Override
public void doMesWorkOrderSortReport(String organizeCode, Integer pageSize, String userName) {
//数据初始化
MesWorkOrderSortReportModel model = initMesWorkOrderSortReportModel(organizeCode, pageSize, userName);
if (CollectionUtils.isEmpty(model.getMesProductionRecordList())) {
log.info("不存在未处理的加工记录信息");
return;
}
//排序汇报
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
List<MesMove> mesMoveList = new ArrayList<>();
boolean isReport = false;
boolean isMove = false;
for (String orderNo : model.getMesProductionRecordMap().keySet()) {
try {
//加工记录
MesProductionRecord record = model.getMesProductionRecordMap().get(orderNo).iterator().next();
//工单信息
MesWorkOrder workOrder = getMesWorkOrder(model.getMesWorkOrderMap(), record.getWorkOrderNo());
//生产版本
MesProductVersion mesProductVersion = getMesProductVersion(model.getMesProductVersionMap(), record.getReportPartNo(), workOrder.getProductVersion());
isReport = false;
isMove = false;
if (MesExtEnumUtil.MES_REPORT_TYPE.REPORT.getValue() == record.getReportType()) {
isReport = true;
} else if (MesExtEnumUtil.MES_REPORT_TYPE.MOVE.getValue() == record.getReportType()) {
isMove = true;
} else if (MesExtEnumUtil.MES_REPORT_TYPE.REPORT_MOVE.getValue() == record.getReportType()) {
isReport = true;
isMove = true;
} else if (MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue() == record.getReportType()) {
customerSupplyMove(model, workOrder, record, mesProductVersion, findMesWorkOrderPartList(model.getMesWorkOrderPartMap(), record.getWorkOrderNo()), mesProductOffLineList, mesMoveList);
} else {
MesPcnException.throwMesBusiException("工单:%s汇报类型报工类型未维护", record.getWorkOrderNo());
}
//非客供品移库类型
if (MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue() != record.getReportType()) {
//成品汇报
if (isReport) {
for (MesWorkOrderPart mesWorkOrderPart : findMesWorkOrderPartList(model.getMesWorkOrderPartMap(), record.getWorkOrderNo())) {
mesProductOffLineList.add(getMesProductOffLine(model, record, workOrder, mesProductVersion, mesWorkOrderPart,false));
}
}
//todo 来源目标获取成品移库
if (isMove) {
mesMoveList.add(createMove(getMesPartSap(model.getMesPartSapMap(), record.getReportPartNo()), record, "SrcErpLocation", "destErpLocation", workOrder.getErpWorkCenter(), 1d, MesExtEnumUtil.MOVE_TYPE.FINISH_PRODUCTS_MOVE.getValue(),userName));
}
}
//保存报工记录 试制单不报工
if (CollectionUtils.isNotEmpty(mesProductOffLineList)) {
mesProductOffLineRDao.saveAll(mesProductOffLineList);
}
//保存移库记录
if (CollectionUtils.isNotEmpty(mesMoveList)) {
mesMoveRepository.saveAll(mesMoveList);
}
//更新加工记录
productionRecordService.updateProductionRecord(model.getMesProductionRecordMap().get(orderNo), userName, MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue(), "");
} catch (Exception e) {
String msg = e.getMessage();
if (e instanceof ImppBusiException) {
msg = ((ImppBusiException) e).getErrorMsg();
}
log.error("工单:{}报工失败{}", orderNo, ExceptionUtils.getStackTrace(e));
productionRecordService.updateProductionRecord(model.getMesProductionRecordMap().get(orderNo), userName, MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_40.getValue(), msg);
}
}
}
private MesProductVersion getProductVersion(MesWorkOrder mesWorkOrderDb) {
MesProductVersion mesProductVersion = mesProductVersionService.getMesProductVersion(mesWorkOrderDb.getOrganizeCode(),mesWorkOrderDb.getPartNo(),mesWorkOrderDb.getProductVersion());
if (null == mesProductVersion) {
@ -1373,5 +1457,155 @@ public class MesWorkOrderService implements IMesWorkOrderService {
productionRecordRao.insert(productionRecord);
}
public MesWorkOrderSortReportModel initMesWorkOrderSortReportModel(String organizeCode, Integer pageSize, String userName) {
MesWorkOrderSortReportModel model = new MesWorkOrderSortReportModel(organizeCode, userName, mesProductionRecordDao.findMesProductionRecordNoReport(organizeCode, MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue(), pageSize));
model.setMesWorkOrderList(workOrderExtService.getWorkOrderList(organizeCode, model.getWorkOrderList()));
model.setMesMoveRuleList(mesMoveRuleService.findMesMoveRuleByPartProdGroupCode(model.getPartProdGroupCodeList(), organizeCode));
model.setMesWorkOrderPartList(findMesWorkOrderPartByOrderNo(organizeCode, model.getWorkOrderList()));
model.setMesPartList(iMesPartService.findMesPartByPartNo(model.getPartNoAllList(), organizeCode));
model.setMesPartSapList(iMesPartService.findMesPartSapByPartNo(model.getPartNoAllList(), organizeCode));
model.setMesProductVersionList(mesProductVersionService.findMesProductVersionByPartNo(organizeCode, model.getPartNoList()));
return model;
}
private void customerSupplyMove(MesWorkOrderSortReportModel model, MesWorkOrder workOrder, MesProductionRecord record, MesProductVersion mesProductVersion, List<MesWorkOrderPart> mesWorkOrderPartList, List<MesProductOffLine> mesProductOffLineList, List<MesMove> mesMoveList) {
boolean isItemMove;
boolean isItemReport;
MesMoveRule moveRule;
//移库规则
Map<String, List<MesMoveRule>> mesMoveRuleMap = findMesMoveRuleList(model.getMesMoveRuleMap(), workOrder.getPartProdGroupCode()).stream().filter(t -> Objects.nonNull(t.getSrcType())).collect(Collectors.groupingBy(MesMoveRule::getSrcType));
for (MesWorkOrderPart orderPart : mesWorkOrderPartList) {
isItemReport = false;
isItemMove = false;
MesPart itemPart = getMesPart(model.getMesPartMap(), orderPart.getPartNo());
if (StringUtil.isEmpty(itemPart.getEsd()) || !mesMoveRuleMap.containsKey(itemPart.getEsd())) {
MesPcnException.throwMesBusiException("客供品移库零件【%s】维护的ESD属性未匹配到零件生产组【%s】中的移库规则", orderPart.getPartNo(),workOrder.getPartProdGroupCode());
}
moveRule = mesMoveRuleMap.get(itemPart.getEsd()).iterator().next();
if (MesExtEnumUtil.MOVE_TYPE_REPORT_TYPE.REPORT_MOVE.getValue() == moveRule.getReportType()) {
isItemMove = true;
isItemReport = true;
} else if (MesExtEnumUtil.MOVE_TYPE_REPORT_TYPE.REPORT.getValue() == moveRule.getReportType()) {
isItemReport = true;
} else if (MesExtEnumUtil.MOVE_TYPE_REPORT_TYPE.MOVE.getValue() == moveRule.getReportType()) {
isItemMove = true;
} else {
MesPcnException.throwMesBusiException("客供品移库零件【%s】在零件生产组【%s】的移库规则中汇报类型未维护", orderPart.getPartNo(), workOrder.getPartProdGroupCode());
}
//汇报
if (isItemReport) {
mesProductOffLineList.add(getMesProductOffLine(model, record, workOrder, mesProductVersion,orderPart,true));
}
//移库
if (isItemMove) {
mesMoveList.add(createMove(getMesPartSap(model.getMesPartSapMap(), orderPart.getPartNo()), record, moveRule.getErpSrcLocateNo(), moveRule.getErpDestLocateNo(), workOrder.getErpWorkCenter(), orderPart.getItemQty(), MesExtEnumUtil.MOVE_TYPE.RAW_MATERIAL_MOVE.getValue(),model.getUserName()));
}
}
}
private MesWorkOrder getMesWorkOrder(Map<String, List<MesWorkOrder>> workOrderMap, String workOrderNo) {
MesWorkOrder workOrder = Objects.isNull(workOrderMap) || StringUtils.isEmpty(workOrderNo) || !workOrderMap.containsKey(workOrderNo) ? null : workOrderMap.get(workOrderNo).iterator().next();
if (Objects.isNull(workOrder)) {
MesPcnException.throwMesBusiException("工单:【%s】信息不存在", workOrderNo);
}
return workOrder;
}
private List<MesMoveRule> findMesMoveRuleList(Map<String, List<MesMoveRule>> mesMoveRuleMap, String code) {
List<MesMoveRule> moveRuleList = Objects.isNull(mesMoveRuleMap) || StringUtils.isEmpty(code) || !mesMoveRuleMap.containsKey(code) ? null : mesMoveRuleMap.get(code);
if (CollectionUtils.isEmpty(moveRuleList)) {
MesPcnException.throwMesBusiException("零件生产组:【%s】移库规则信息不存在", code);
}
return moveRuleList;
}
private List<MesWorkOrderPart> findMesWorkOrderPartList(Map<String, List<MesWorkOrderPart>> workOrderPartMap, String workOrderNo) {
List<MesWorkOrderPart> workOrderPartList = Objects.isNull(workOrderPartMap) || StringUtils.isEmpty(workOrderNo) || !workOrderPartMap.containsKey(workOrderNo) ? null : workOrderPartMap.get(workOrderNo);
if (CollectionUtils.isEmpty(workOrderPartList)) {
MesPcnException.throwMesBusiException("工单:【%s】零件信息表数据不存在", workOrderNo);
}
return workOrderPartList;
}
private MesPartSap getMesPartSap(Map<String, List<MesPartSap>> partSapMap, String partNo) {
MesPartSap partSap = Objects.isNull(partSapMap) || StringUtils.isEmpty(partNo) || !partSapMap.containsKey(partNo) ? null : partSapMap.get(partNo).iterator().next();
if (Objects.isNull(partSap)) {
MesPcnException.throwMesBusiException("零件号:【%s】信息不存在", partNo);
}
return partSap;
}
private MesPart getMesPart(Map<String, List<MesPart>> partMap, String partNo) {
MesPart partSap = Objects.isNull(partMap) || StringUtils.isEmpty(partNo) || !partMap.containsKey(partNo) ? null : partMap.get(partNo).iterator().next();
if (Objects.isNull(partSap)) {
MesPcnException.throwMesBusiException("零件号:【%s】信息不存在", partNo);
}
return partSap;
}
private MesProductVersion getMesProductVersion(Map<String, List<MesProductVersion>> productVersionMap, String reportPartNo, String productVersion) {
Optional<MesProductVersion> optional = Objects.isNull(productVersionMap) || !productVersionMap.containsKey(reportPartNo) ? Optional.empty() : productVersionMap.get(reportPartNo).stream().filter(t -> t.getProductVersion().equals(productVersion)).findFirst();
if (!optional.isPresent()) {
MesPcnException.throwMesBusiException("零件:【%s】生产版本:【%s】信息存在", reportPartNo, productVersion);
}
return optional.get();
}
@Override
public List<MesWorkOrderPart> findMesWorkOrderPartByOrderNo(String organizeCode, List<String> workOrderNoList) {
if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(workOrderNoList)) return null;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
if (workOrderNoList.size() == MesPcnExtConstWords.ONE)
DdlPreparedPack.getStringEqualPack(workOrderNoList.iterator().next(), "workOrderNo", packBean);
DdlPreparedPack.getInPackList(workOrderNoList, "workOrderNo", packBean);
return mesWorkOrderPartRepository.findByHqlWhere(packBean);
}
private MesProductOffLine getMesProductOffLine(MesWorkOrderSortReportModel model, MesProductionRecord record, MesWorkOrder workOrder, MesProductVersion mesProductVersion, MesWorkOrderPart mesWorkOrderPart,boolean isItemReport) {
MesProductOffLine newMesProductOffLine = new MesProductOffLine();
if(!isItemReport){
newMesProductOffLine.setReportPartNo(record.getPartNo());
newMesProductOffLine.setReportPartNameRdd(record.getPartName());
}
newMesProductOffLine.setItemPartNo(mesWorkOrderPart.getPartNo());
newMesProductOffLine.setItemPartName(mesWorkOrderPart.getPartName());
newMesProductOffLine.setItemQty(mesWorkOrderPart.getItemQty());
newMesProductOffLine.setAlort(mesProductVersion.getReceiveInventoryPoint());
newMesProductOffLine.setStgeLoc(mesProductVersion.getShipInventoryPoint());
newMesProductOffLine.setQty(1d);
newMesProductOffLine.setReportSn(record.getProductSn());
newMesProductOffLine.setBomVersion(workOrder.getProductVersion());
newMesProductOffLine.setSerialNumber(record.getSerialNumber());
newMesProductOffLine.setItemUnit(mesWorkOrderPart.getItemUnit());
newMesProductOffLine.setWorkOrderNo(workOrder.getWorkOrderNo());
newMesProductOffLine.setWorkOrderType(workOrder.getWorkOrderType());
newMesProductOffLine.setWorkCenterCode(record.getWorkCenterCode());
newMesProductOffLine.setWorkCellCode(record.getWorkCellCode());
newMesProductOffLine.setReportType(record.getReportType());
newMesProductOffLine.setSapWorkCenter(mesProductVersion.getWorkCenterCode());
newMesProductOffLine.setOrganizeCode(model.getOrganizeCode());
newMesProductOffLine.setDescription(record.getCompleteDateTime());
ConvertBean.serviceModelInitialize(newMesProductOffLine, model.getUserName());
return newMesProductOffLine;
}
private MesMove createMove(MesPartSap mesPart, MesProductionRecord record, String source, String target, String erpWorkCenterCode, Double qty, Integer moveType,String userName) {
MesMove move = new MesMove();
move.setMeins(record.getReportPartNo());
if (!Objects.isNull(mesPart)) {
move.setMeins(mesPart.getUnit());
}
move.setOrganizeCode(record.getOrganizeCode());
move.setFactoryCode(record.getOrganizeCode());
move.setLgort(source);
move.setUmlgo(target);
move.setMenge(qty);
move.setPostDate(TimeTool.getToday());
move.setProductSn(record.getProductSn());
move.setMoveType(moveType);
move.setPostTime(TimeTool.getTimeShortWithColon());
move.setWorkCenter(erpWorkCenterCode);
ConvertBean.serviceModelInitialize(move, userName);
return move;
}
}

@ -131,38 +131,6 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
}
private List<MesProdRuleContext> resetAssembly(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList) {
//是否支持混腔扫描[工位参数]
String cavityNosortCfg = getCavityNosortCfg(reqBean);
prodRuleContextList.forEach(o -> {
if (!StringUtils.isEmpty(o.getAssemblyDataJson())) {
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = o.getNosortAssemblyDataContext();
if (!StringUtils.isEmpty(cavityNosortCfg) || hasUnBindAssemblyOptional(productionAssemblyNosortContextList)) {
productionAssemblyNosortContextList.forEach(i -> { if (i.getIsResetScan().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) i.assemblyStatusReset(); });
o.assemblyDataJson(productionAssemblyNosortContextList);
}
}
});
return prodRuleContextList;
}
//是否支持混腔扫描[工位参数]
private String getCavityNosortCfg(StationRequestBean reqBean) {
String cavityNosortCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CAVITY_NOSORT_CFG);
return (!StringUtils.isEmpty(cavityNosortCfg) && cavityNosortCfg.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? cavityNosortCfg : null;
}
//验证当前是否属于装配件跳过码
private Boolean checkIsSkip(MesProductionProcessContext productionProcessContext, List<MesEquipVariableCollectContext> equipVariableCollectContextList) {
if (equipVariableCollectContextList.size() > 1) return false;
@ -190,16 +158,16 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
Boolean hasUnBindAssembly = false;
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
if (!hasUnBindAssemblyOptional(productionAssemblyNosortContextList)) continue;
List<MesProductionAssemblySortContext> productionAssemblySortContextList = prodRuleContext.getSortAssemblyDataContext();
if (!hasUnBindAssemblyOptional(productionAssemblySortContextList)) continue;
hasUnBindAssembly = true;
break;
}
return hasUnBindAssembly;
}
private Boolean hasUnBindAssemblyOptional(List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList) {
Optional<MesProductionAssemblyNosortContext> optional = productionAssemblyNosortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
private Boolean hasUnBindAssemblyOptional(List<MesProductionAssemblySortContext> productionAssemblySortContextList) {
Optional<MesProductionAssemblySortContext> optional = productionAssemblySortContextList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).findFirst();
return (null == optional || !optional.isPresent()) ? false : true;
}
@ -278,7 +246,7 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
continue;
}
MesProductionAssemblyNosortContext filter = (MesProductionAssemblyNosortContext) result.get(MesPcnExtConstWords.DATA);
MesProductionAssemblySortContext filter = (MesProductionAssemblySortContext) result.get(MesPcnExtConstWords.DATA);
//前道防错
if (!StringUtils.isEmpty(filter.getProductSnId()) && !StringUtils.isEmpty(productionAssemblySortContext.getPreCraftCode())) {

@ -71,12 +71,17 @@ public class MesWorkOrderCheckSortStepService extends MesWorkOrderCheckStepServi
//获取上下文产出零件信息
List<MesProductionPartContext> cachedProductionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
//获取工单对应的条码数据信息
List<MesProductionPsInContext> cachedProductionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
List<MesProductionPsInContext> cachedProductionPsInContextList = null;
List<MesProductionPsOutContext> cachedProductionPsOutContextList = null;
if (!CollectionUtils.isEmpty(cachedProductionPartContextList)) {
//获取工单对应的条码数据信息
cachedProductionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
//获取工单对应的产出条码数据信息
cachedProductionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean);
}
//非扫描场景 清除历史产出零件信息
if (MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue() != equipVariableCollectContextList.get(0).getMessageSource() &&
(!CollectionUtils.isEmpty(cachedProductionPartContextList) || !CollectionUtils.isEmpty(cachedProductionPsInContextList))) cachedProductionPartContextList = removeBusiData(reqBean);
if (MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue() != equipVariableCollectContextList.get(0).getMessageSource() && !CollectionUtils.isEmpty(cachedProductionPartContextList)) cachedProductionPartContextList = removeBusiData(reqBean);
//验证扫描信息是否属于工艺强过码
Boolean isCraftJumpCode = matchCraftJumpCode(productionProcessContext, equipVariableCollectContextList);
@ -113,10 +118,10 @@ public class MesWorkOrderCheckSortStepService extends MesWorkOrderCheckStepServi
equipVariableCollectContextList, productionPartContextList, productionPsInContextList, productionPsOutContextList).isCompleted()) return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, stepResult.getMsg());
//扫描场景下合并历史产出零件信息/产品条码信息
if (MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue() == equipVariableCollectContextList.get(0).getMessageSource() &&
(!CollectionUtils.isEmpty(cachedProductionPartContextList) || !CollectionUtils.isEmpty(productionPsInContextList))) {
if (MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue() == equipVariableCollectContextList.get(0).getMessageSource() && !CollectionUtils.isEmpty(cachedProductionPartContextList)) {
productionPartContextList.addAll(cachedProductionPartContextList);
productionPsInContextList.addAll(cachedProductionPsInContextList);
productionPsOutContextList.addAll(cachedProductionPsOutContextList);
}
//验证是否全部为空腔

@ -8,6 +8,7 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.StringUtil;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
@ -100,14 +101,14 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService {
workOrderRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID},
new Object[]{productionPartContext.getId()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()});
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.ONLINE_TIME},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue(), TimeTool.getNowTime(true)});
} else {
workOrderRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID},
new Object[]{productionPartContext.getId()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLATED_QTY, MesPcnExtConstWords.UN_COMPLATED_QTY},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0)});
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLATED_QTY, MesPcnExtConstWords.UN_COMPLATED_QTY, MesPcnExtConstWords.OFFLINE_TIME},
new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0), TimeTool.getNowTime(true)});
}
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:[{}:{}]",

@ -111,7 +111,7 @@ public class MesProductionAssemblyContext implements Serializable {
public Integer foreignKey;
@ApiParam(value = "是否可复用条码")
public Integer isRepeat;
public Integer isRepeat = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
@ApiParam(value = "是否可复用条码是否写入上下文进行复用")
public Integer isRepeat2Cache = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue();

@ -50,6 +50,7 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon
this.partNo = prodRuleContext.getOutPartNo();
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.isRepeat)) this.isRepeat = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();

@ -128,6 +128,8 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.processSeq)) this.processSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType))
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();
@ -152,6 +154,8 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.processSeq)) this.processSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType))
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();

@ -0,0 +1,117 @@
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
import cn.estsh.i3plus.pojo.mes.bean.*;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/9/28 12:32
* @Modify:
**/
@Data
public class MesWorkOrderSortReportModel {
@ApiParam("工厂代码")
private String organizeCode;
@ApiParam("用户名")
private String userName;
@ApiParam("移库规则")
private List<MesMoveRule> mesMoveRuleList;
@ApiParam("加工记录")
private List<MesProductionRecord> mesProductionRecordList;
@ApiParam("工单")
private List<MesWorkOrder> mesWorkOrderList;
@ApiParam("工单零件")
private List<MesWorkOrderPart> mesWorkOrderPartList;
@ApiParam("零件信息-sap下发的零件")
private List<MesPartSap> mesPartSapList;
@ApiParam("零件信息")
private List<MesPart> mesPartList;
@ApiParam("生产版本")
private List<MesProductVersion> mesProductVersionList;
public MesWorkOrderSortReportModel() {
}
public MesWorkOrderSortReportModel(String organizeCode, String userName, List<MesProductionRecord> mesProductionRecordList) {
this.organizeCode = organizeCode;
this.userName = userName;
this.mesProductionRecordList = mesProductionRecordList;
}
public List<String> getWorkOrderList() {
if (CollectionUtils.isEmpty(mesProductionRecordList)) return null;
return this.mesProductionRecordList.stream().map(MesProductionRecord::getWorkOrderNo).distinct().filter(t -> !StringUtils.isEmpty(t)).collect(Collectors.toList());
}
public List<String> getPartNoList() {
if (CollectionUtils.isEmpty(mesProductionRecordList)) return null;
return this.mesProductionRecordList.stream().map(MesProductionRecord::getReportPartNo).distinct().filter(t -> !StringUtils.isEmpty(t)).collect(Collectors.toList());
}
public List<String> getPartNoAllList() {
List<String> partNoList = new ArrayList<>();
if (!CollectionUtils.isEmpty(mesProductionRecordList)) partNoList.addAll(this.mesProductionRecordList.stream().map(MesProductionRecord::getReportPartNo).distinct().filter(t -> !StringUtils.isEmpty(t)).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(mesWorkOrderPartList)) partNoList.addAll(this.mesWorkOrderPartList.stream().map(MesWorkOrderPart::getPartNo).distinct().filter(t -> !StringUtils.isEmpty(t)).collect(Collectors.toList()));
return partNoList;
}
public List<String> getPartProdGroupCodeList() {
if (CollectionUtils.isEmpty(mesWorkOrderList)) return null;
return this.mesWorkOrderList.stream().map(MesWorkOrder::getPartProdGroupCode).distinct().filter(t -> !StringUtils.isEmpty(t)).collect(Collectors.toList());
}
public Map<String, List<MesProductionRecord>> getMesProductionRecordMap() {
if (CollectionUtils.isEmpty(mesProductionRecordList)) return null;
return mesProductionRecordList.stream().collect(Collectors.groupingBy(MesProductionRecord::getWorkOrderNo));
}
public Map<String, List<MesWorkOrder>> getMesWorkOrderMap() {
if (CollectionUtils.isEmpty(mesWorkOrderList)) return null;
return mesWorkOrderList.stream().collect(Collectors.groupingBy(MesWorkOrder::getWorkOrderNo));
}
public Map<String, List<MesMoveRule>> getMesMoveRuleMap() {
if (CollectionUtils.isEmpty(mesMoveRuleList)) return null;
return mesMoveRuleList.stream().collect(Collectors.groupingBy(MesMoveRule::getCode));
}
public Map<String, List<MesPartSap>> getMesPartSapMap() {
if (CollectionUtils.isEmpty(mesPartSapList)) return null;
return mesPartSapList.stream().collect(Collectors.groupingBy(MesPartSap::getPartNo));
}
public Map<String, List<MesPart>> getMesPartMap() {
if (CollectionUtils.isEmpty(mesPartList)) return null;
return mesPartList.stream().collect(Collectors.groupingBy(MesPart::getPartNo));
}
public Map<String, List<MesWorkOrderPart>> getMesWorkOrderPartMap() {
if (CollectionUtils.isEmpty(mesWorkOrderPartList)) return null;
return mesWorkOrderPartList.stream().collect(Collectors.groupingBy(MesWorkOrderPart::getWorkOrderNo));
}
public Map<String, List<MesProductVersion>> getMesProductVersionMap() {
if (CollectionUtils.isEmpty(mesProductVersionList)) return null;
return mesProductVersionList.stream().collect(Collectors.groupingBy(MesProductVersion::getPartNo));
}
}

@ -205,6 +205,10 @@ public class MesPcnExtConstWords {
public static final String REMARK = "remark";
//状态
public static final String STATUS = "status";
//上线时间
public static final String ONLINE_TIME = "onlineTime";
//下线时间
public static final String OFFLINE_TIME = "offlineTime";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)
public static final String[] BASE_BEAN_FIELDS = {ID, IS_DELETED, IS_VALID, CREATE_DATE_TIME, CREATE_USER, MODIFY_DATE_TIME, MODIFY_USER, DESCRIPTION, REMARK, SYSTEM_SYNC_DATE_TIME, SYSTEM_SYNC_STATUS};
@ -327,6 +331,8 @@ public class MesPcnExtConstWords {
public static final Integer FOURTEEN = 14;
//60
public static final Integer SIXTY = 60;
//100
public static final Integer ONE_HUNDRED = 100;
// 中括号
public static final String SQUARE_BRACKETS = "[]";
// &

Loading…
Cancel
Save