From 15c5f128371882886c29b469131c906ae0f36dc0 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 18 Jul 2024 13:49:31 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IMesProductionProcessContextStepService.java | 3 + .../schedulejob/MesWorkCellOperationLogJob.java | 1 + .../busi/MesWorkCellScanMonitorLogServiceImpl.java | 101 +++++++++++---------- .../MesWorkCellScanMonitorLogExtService.java | 32 +++++++ .../rulematch/MesEvcRuleMatchBackValueService.java | 16 +++- .../MesProductionProcessContextStepService.java | 6 ++ .../MesProductionProcessMonitorService.java | 8 ++ .../context/MesEquipVariableCollectContext.java | 11 ++- .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 + 9 files changed, 127 insertions(+), 53 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java index aea27f1..539274d 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java @@ -124,6 +124,9 @@ public interface IMesProductionProcessContextStepService { @ApiOperation(value = "获取上下文工位扫描监控信息") MesScanMonitorContext getScanMonitorContext(String organizeCode, String workCenterCode, String workCellCode); + @ApiOperation(value = "获取上下文工位扫描监控信息的开模记录ID") + String getScanMonitorContextMouldRecordId(StationRequestBean reqBean); + @ApiOperation(value = "删除上下文工位扫描监控信息") void deleteScanMonitorContext(StationRequestBean reqBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java index e411f89..b7aac0a 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java @@ -36,6 +36,7 @@ public class MesWorkCellOperationLogJob extends BaseMesScheduleJob { @Override public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) { + if (true) return; /** * 入参 * { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java index 677d642..5f9edc8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java @@ -1,23 +1,24 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkCellScanMonitorLogService; -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; -import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; -import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog; import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellScanMonitorLogRepository; -import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import com.netflix.discovery.converters.Auto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +//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; +//import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +//import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; +//import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog; +//import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +//import com.netflix.discovery.converters.Auto; + +//import java.util.List; +//import java.util.Map; +//import java.util.stream.Collectors; /** * @Description : @@ -43,44 +44,44 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon */ @Override public void doRecordCellOperationLog(String organizeCode, Integer pageSize, Integer times) { - //查询serviceFlag是未处理状态,mouldRecordId不为空的记录,每次查询pageSize 默认50条 - DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue(), "dealStatus", logPackBean); - DdlPreparedPack.getNumberSmallerEqualPack(times, "times", logPackBean); - DdlPreparedPack.getIsNotNull("mouldRecordId", logPackBean); - DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, logPackBean); - List monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize); - - if (!monitorLogs.isEmpty()) { - List mouldRecordIdList = monitorLogs.stream().map(MesWorkCellScanMonitorLog::getMouldRecordId).distinct().collect(Collectors.toList()); - Map> logs = monitorLogs.stream().collect(Collectors.groupingBy(MesWorkCellScanMonitorLog::getMouldRecordId)); - for (Long mouldRecordId : mouldRecordIdList) { - DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean); - - List recordList = productionRecordRao.findByHqlWhere(recordPackBean); - //需要补录如下字段 - DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", monitorLogPackBean); - int newTimes = logs.get(mouldRecordId).get(0).getTimes() + 1; - if (!recordList.isEmpty()) { - String workOrderNoStr = recordList.stream().map(MesProductionRecord::getWorkOrderNo).collect(Collectors.joining(",")); - String serialNoStr = recordList.stream().map(MesProductionRecord::getSerialNumber).collect(Collectors.joining(",")); - String productSnStr = recordList.stream().map(MesProductionRecord::getProductSn).collect(Collectors.joining(",")); - String custSnStr = recordList.stream().map(MesProductionRecord::getCustSn).collect(Collectors.joining(",")); - String partNoStr = recordList.stream().map(MesProductionRecord::getPartNo).collect(Collectors.joining(",")); - String partNameStr = recordList.stream().map(MesProductionRecord::getPartName).collect(Collectors.joining(",")); - monitorLogRao.updateByProperties(new String[]{"workOrderNo", "serialNumber", "productSn", "custSn", "partNo", "partName", "modifyDatetime", "modifyUser", "dealStatus", "times"}, - new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean); - } else { - if (newTimes > times) { - monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean); - } else { - monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean); - } - } - } - } +// //查询serviceFlag是未处理状态,mouldRecordId不为空的记录,每次查询pageSize 默认50条 +// DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode); +// DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue(), "dealStatus", logPackBean); +// DdlPreparedPack.getNumberSmallerEqualPack(times, "times", logPackBean); +// DdlPreparedPack.getIsNotNull("mouldRecordId", logPackBean); +// DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, logPackBean); +// List monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize); +// +// if (!monitorLogs.isEmpty()) { +// List mouldRecordIdList = monitorLogs.stream().map(MesWorkCellScanMonitorLog::getMouldRecordId).distinct().collect(Collectors.toList()); +// Map> logs = monitorLogs.stream().collect(Collectors.groupingBy(MesWorkCellScanMonitorLog::getMouldRecordId)); +// for (Long mouldRecordId : mouldRecordIdList) { +// DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode); +// DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", recordPackBean); +// +// List recordList = productionRecordRao.findByHqlWhere(recordPackBean); +// //需要补录如下字段 +// DdlPackBean monitorLogPackBean = DdlPackBean.getDdlPackBean(organizeCode); +// DdlPreparedPack.getNumEqualPack(mouldRecordId, "mouldRecordId", monitorLogPackBean); +// int newTimes = logs.get(mouldRecordId).get(0).getTimes() + 1; +// if (!recordList.isEmpty()) { +// String workOrderNoStr = recordList.stream().map(MesProductionRecord::getWorkOrderNo).collect(Collectors.joining(",")); +// String serialNoStr = recordList.stream().map(MesProductionRecord::getSerialNumber).collect(Collectors.joining(",")); +// String productSnStr = recordList.stream().map(MesProductionRecord::getProductSn).collect(Collectors.joining(",")); +// String custSnStr = recordList.stream().map(MesProductionRecord::getCustSn).collect(Collectors.joining(",")); +// String partNoStr = recordList.stream().map(MesProductionRecord::getPartNo).collect(Collectors.joining(",")); +// String partNameStr = recordList.stream().map(MesProductionRecord::getPartName).collect(Collectors.joining(",")); +// monitorLogRao.updateByProperties(new String[]{"workOrderNo", "serialNumber", "productSn", "custSn", "partNo", "partName", "modifyDatetime", "modifyUser", "dealStatus", "times"}, +// new Object[]{workOrderNoStr, serialNoStr, productSnStr, custSnStr, partNoStr, partNameStr, TimeTool.getNowTime(true), "JOB", MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue(), newTimes}, monitorLogPackBean); +// } else { +// if (newTimes > times) { +// monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes}, monitorLogPackBean); +// } else { +// monitorLogRao.updateByProperties(new String[]{"modifyDatetime", "modifyUser", "times", "dealStatus"}, new Object[]{TimeTool.getNowTime(true), "JOB", newTimes, MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_FAILURE.getValue()}, monitorLogPackBean); +// } +// } +// } +// } } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java index 5d73101..830fc51 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java @@ -1,10 +1,12 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.equiplog; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesScanMonitorContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.swslog.ISwsWriteDbLogService; 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; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; @@ -17,8 +19,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; 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; +import java.util.stream.Collectors; + @Slf4j @Service public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogService { @@ -81,5 +87,31 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic } + @Override + public void doRestoreDbLog(StationResultBean resultBean) { + + if (StringUtils.isEmpty(resultBean.getScanInfo()) || CollectionUtils.isEmpty(resultBean.getResultList())) return; + + List productionPsOutContextList = resultBean.getResultList(); + + String workOrderNo = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkOrderNo()))).map(MesProductionPsOutContext::getWorkOrderNo).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + String serialNumber = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getSerialNumber()))).map(MesProductionPsOutContext::getSerialNumber).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + String productSn = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getProductSn()))).map(MesProductionPsOutContext::getProductSn).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + String custSn = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCustSn()))).map(MesProductionPsOutContext::getCustSn).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + String partNo = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartNo()))).map(MesProductionPsOutContext::getPartNo).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + String partName = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartName()))).map(MesProductionPsOutContext::getPartName).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); + + DdlPackBean packBean = DdlPackBean.getDdlPackBean(resultBean.getOrganizeCode()); + DdlPreparedPack.getNumEqualPack(Long.valueOf(resultBean.getScanInfo()), MesPcnExtConstWords.MOULD_RECORD_ID, packBean); + + workCellScanMonitorLogRepository.updateByProperties( + new String[]{MesPcnExtConstWords.WORK_ORDER_NO, MesPcnExtConstWords.SERIAL_NUMBER, MesPcnExtConstWords.PRODUCT_SN, MesPcnExtConstWords.CUST_SN, + MesPcnExtConstWords.PART_NO, MesPcnExtConstWords.PART_NAME, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.DEAL_STATUS}, + new Object[]{workOrderNo, serialNumber, productSn, custSn, + partNo, partName, TimeTool.getNowTime(true), resultBean.getUserInfo(), MesExtEnumUtil.MES_LOG_DEAL_STATUS.DEAL_SUCCESS.getValue()}, + packBean); + + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesEvcRuleMatchBackValueService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesEvcRuleMatchBackValueService.java index 9d6028d..336d51c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesEvcRuleMatchBackValueService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/MesEvcRuleMatchBackValueService.java @@ -6,9 +6,9 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; @@ -35,7 +35,7 @@ public class MesEvcRuleMatchBackValueService implements IMesEquipVariableCfgRule if (CollectionUtils.isEmpty(backList)) backList = new ArrayList<>(); - backList.add(equipVariableCollectContext); + backList.add(filterSpecialChar(equipVariableCollectContext)); } @@ -45,4 +45,16 @@ public class MesEvcRuleMatchBackValueService implements IMesEquipVariableCfgRule } + //不过滤":",tesla零件号带冒号 + //不过滤[)>字符 + private MesEquipVariableCollectContext filterSpecialChar(MesEquipVariableCollectContext equipVariableCollectContext) { + + String realEquipVariableValue = equipVariableCollectContext.getEquipVariableValue(); + + String equipVariableValue = StringUtils.removePattern(equipVariableCollectContext.getEquipVariableValue(), "[^A-Z^a-z0-9_^\\s^\\-^/^\\.^\\[^\\)^\\>^\\:]"); + + return realEquipVariableValue.equals(equipVariableValue) ? equipVariableCollectContext : equipVariableCollectContext.replaceValue(realEquipVariableValue, equipVariableValue); + + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java index e2d6967..f8fb8d3 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java @@ -450,6 +450,12 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return !StringUtils.isEmpty(scanMonitorContextJson) ? JSONObject.parseObject(scanMonitorContextJson, MesScanMonitorContext.class) : null; } + @Override + public String getScanMonitorContextMouldRecordId(StationRequestBean reqBean) { + MesScanMonitorContext scanMonitorContext = getScanMonitorContext(reqBean); + return (null != scanMonitorContext && !StringUtils.isEmpty(scanMonitorContext.getMouldRecordId())) ? scanMonitorContext.getMouldRecordId().toString() : null; + } + private String getContextKey(String organizeCode, String workCenterCode, String workCellCode) { return new StringJoiner(":").add(organizeCode).add(workCenterCode).add(workCellCode).add(MesPcnExtConstWords.PRODUCTION_PROCESS_CONTEXT).add(MesPcnExtConstWords.BASE_DATA_CONTEXT).toString(); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessMonitorService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessMonitorService.java index e859833..afa3d1e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessMonitorService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessMonitorService.java @@ -3,9 +3,11 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step.context; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmCommonService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.process.BaseProcessMonitorService; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.swslog.ISwsWriteDbLogService; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; @@ -29,6 +31,9 @@ public class MesProductionProcessMonitorService extends BaseProcessMonitorServic @Autowired private IFsmCommonService fsmCommonService; + @Autowired + private ISwsWriteDbLogService writeDbLogService; + //工序开始 @Override public Boolean doProcessStart(StationRequestBean requestBean) { @@ -42,6 +47,9 @@ public class MesProductionProcessMonitorService extends BaseProcessMonitorServic //工序结束 @Override public Boolean doProcessComplete(StationRequestBean requestBean) { + //补DB日志 [获取开模ID赋值scanInfo] [获取上下文产出条码数据信息集合赋值resultList] + writeDbLogService.doRestoreDbLog(requestBean, new StationResultBean().restoreDbLog(). + scanInfo(productionProcessContextStepService.getScanMonitorContextMouldRecordId(requestBean)).resultList(productionDispatchContextStepService.getProductionPsOutContext(requestBean))); //清除上下文中的所有业务数据 productionDispatchContextStepService.doFlushProductionDispatchContext(requestBean); //发送工序完成音 diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesEquipVariableCollectContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesEquipVariableCollectContext.java index 4b8a8d9..79ab324 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesEquipVariableCollectContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesEquipVariableCollectContext.java @@ -77,7 +77,10 @@ public class MesEquipVariableCollectContext implements Serializable { @ApiParam("数据类型") private String dataType; - @ApiParam("变量当前值") + @ApiParam("变量当前值[读到的equipVariableValue值如果存在特殊字符, 原始值赋给此字段后再过滤特殊字符]") + private String realEquipVariableValue; + + @ApiParam("变量当前值[非匹配参考值的读取信息需要过滤特殊字符]") private String equipVariableValue; @ApiParam("变量状态") @@ -127,4 +130,10 @@ public class MesEquipVariableCollectContext implements Serializable { return this; } + public MesEquipVariableCollectContext replaceValue(String realEquipVariableValue, String equipVariableValue) { + this.realEquipVariableValue = realEquipVariableValue; + this.equipVariableValue = equipVariableValue; + return this; + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 7b22bfa..9d2b4f8 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -153,6 +153,8 @@ public class MesPcnExtConstWords { public static final String PRODUCE_SEQ = "produceSeq"; // URL public static final String URL = "url"; + // 处理状态 + public static final String DEAL_STATUS = "dealStatus"; // 时间格式 public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; From 79c2082e9c2f227a43c95b678042231a63af1b1d Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 18 Jul 2024 14:26:54 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java index 830fc51..90f9c7f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java @@ -76,6 +76,8 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic if (resultBean.getIsCheckRepeat().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0) return false; DdlPackBean packBean = DdlPackBean.getDdlPackBean(resultBean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(resultBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + DdlPreparedPack.getStringEqualPack(resultBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); DdlPreparedPack.getNumEqualPack(scanMonitorContext.getMouldRecordId(), MesPcnExtConstWords.MOULD_RECORD_ID, packBean); DdlPreparedPack.getStringEqualPack(resultBean.getStepCode(), MesPcnExtConstWords.STEP_CODE, packBean); if (resultBean.getCheckRepeatType().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0) DdlPreparedPack.getStringEqualPack(resultBean.getMessage(), MesPcnExtConstWords.MESSAGE, packBean); @@ -102,6 +104,8 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic String partName = productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartName()))).map(MesProductionPsOutContext::getPartName).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); DdlPackBean packBean = DdlPackBean.getDdlPackBean(resultBean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(resultBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + DdlPreparedPack.getStringEqualPack(resultBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); DdlPreparedPack.getNumEqualPack(Long.valueOf(resultBean.getScanInfo()), MesPcnExtConstWords.MOULD_RECORD_ID, packBean); workCellScanMonitorLogRepository.updateByProperties( From 62a45210fdf9197118a0ffdd463c909fd4baa2f6 Mon Sep 17 00:00:00 2001 From: jun Date: Thu, 18 Jul 2024 14:56:27 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/busi/IMesPartShippingGroupService.java | 3 +++ .../busi/MesInputDefectRecordService.java | 27 +++++++++++++++++----- .../busi/MesPartShippingGroupService.java | 7 ++++++ .../busi/MesShippingLoadingCheckService.java | 27 ++++++++++++++++++---- .../busi/MesSortShippingCheckService.java | 25 +++++++++++++++++--- .../serviceimpl/busi/MesSpotCheckOrderService.java | 7 ++++-- .../pojo/model/MesPartInspectionInputModel.java | 2 ++ 7 files changed, 83 insertions(+), 15 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java index c1575f8..02f55c0 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPartShippingGroupService.java @@ -17,4 +17,7 @@ public interface IMesPartShippingGroupService { @ApiOperation(value = "查询发运组数据") public List findAll(DdlPackBean packBean); + @ApiOperation(value = "查询发运组数据") + MesPartShippingGroup getMesPartShippingGroup(String organizeCode,String shippingGroupCode); + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 5d9f283..cc4f3f0 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -98,7 +98,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //检查物料 MesPart part; //获取NC-零件检测-单据 - MesPartInspection partInspection; + MesPartInspection partInspection = null; Integer sourceType = null; if (!StringUtils.isEmpty(inputModel.getSn())) { // 数据校验 @@ -125,7 +125,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService part = checkPartByPartNo(inputModel.getPartNo(), org); //获取NC-零件检测-单据 - partInspection = getPartInspectionByPartAndLot(inputModel, org); + if(!Objects.isNull(inputModel.getId())){ + partInspection = getPartInspectionByPartAndLot(inputModel, org); + } sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); } @@ -332,16 +334,21 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspectionDetailRepository.saveAll(model.getPartInspectionDetailList()); + String srcLocateNo = null; //若是扫描条码 则判定条码可疑 if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { MesProduceSn produceSn = checkProduceSn(model.getSn(), org); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); produceSnExtService.update(produceSn); + //查询条码所在库位 + srcLocateNo = getDestLocateNo(model, org); + } + if (Objects.isNull(srcLocateNo)) { + srcLocateNo = configService.getCfgValue(org, "LGORT"); } - //移库 - MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org); + MesMove move = createMove(model,srcLocateNo, configService.getCfgValue(org, "UMLGO"), org); moveRepository.save(move); } else { @@ -399,12 +406,19 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } } + private String getDestLocateNo(MesPartInspectionInputModel model, String org) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", packBean); + DdlPreparedPack.getOrderBy(null, null, packBean); + MesMove mesMove = moveRepository.getByProperty(packBean); + return Objects.isNull(mesMove) ? null : mesMove.getUmlgo(); + } + private MesMove getMesMove(MesPartInspectionInputModel model, String org) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getNumEqualPack(model.getPartInspection().getId(),"partInspectionId",packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE.getValue(),"moveType",packBean); - MesMove mesMove = moveRepository.getByProperty(packBean); - return mesMove; + return moveRepository.getByProperty(packBean); } /** @@ -438,6 +452,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService private MesPartInspection getPartInspectionByPartAndLot(MesPartInspectionInputModel inputModel, String org) { //根据扫描的条码查询条码是否存在 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getNumEqualPack(inputModel.getId(), "id", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean); DdlPreparedPack.getNumEqualPack(inputModel.getQty().intValue(), "qty", packBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java index 31dbae5..452654e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java @@ -24,4 +24,11 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService return detailDeleteList; } + @Override + public MesPartShippingGroup getMesPartShippingGroup(String organizeCode, String shippingGroupCode) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(shippingGroupCode, "partShippingGroupCode", packBean); + return shippingGroupRepository.getByProperty(packBean); + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java index 2e63f96..7c705ba 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingLoadingCheckService.java @@ -10,6 +10,7 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool; 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.mes.bean.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail; @@ -23,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * @Description : @@ -54,6 +53,9 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS @Autowired private MesJisShippingRepository jisShippingRepository; + @Autowired + private MesPartShippingGroupService mesPartShippingGroupService; + @Override public MesShippingLoadingCheckModel queryLoadingOrderNo(MesLoadingList loadingList) { @@ -139,15 +141,24 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS if (StringUtils.isEmpty(vehiclesOrderDetail)) { throw new ImppBusiException(String.format("【%s】此发运单不存在或还未生成装车单明细,请检查数据!", model.getShippingCode())); } + //查询零件发运组 + MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, loadingList.getPartShippingGroupCode()); //根据扫描的发运单以及前端传的发运单明细,进行匹配,若没有找到扫描的发运单,则提示扫描的发运单号不在此装车单中,请检查数据!。 Boolean scanflg = false; for (MesLoadingListDetail loadingListDetail : model.getDetailList()) { if (loadingListDetail.getShippingCode().equals(model.getShippingCode())) { - if (loadingListDetail.getTempStatus() == MesCommonConstant.TRUE_INTEGER) { + if (Objects.equals(loadingListDetail.getTempStatus(), MesCommonConstant.TRUE_INTEGER)) { throw new ImppBusiException(String.format("【%s】此发运单已经扫描过,请检查数据!", model.getShippingCode())); } + //校验发运单明细顺序 + if(CommonEnumUtil.VALID == shippingGroup.getIsEnableLoadingFailSafe()){ + Optional detail = model.getDetailList().stream().filter(k -> k.getShippingCode().compareTo(loadingListDetail.getShippingCode()) < 0 && !Objects.equals(k.getTempStatus(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if(detail.isPresent()){ + throw new ImppBusiException(String.format("装车单【%s】启用明细顺序防错,发运单【%s】前还有未扫描的发运单,请检查数据!", loadingList.getOrderCode(), model.getShippingCode())); + } + } //判断是否需要排序校验 默认排序则需要校验 if (loadingList.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) { @@ -232,6 +243,14 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS return model; } + private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) { + MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode); + if(Objects.isNull(shippingGroup)){ + throw new ImppBusiException(String.format("零件发运组【%s】信息不存在,请检查数据!", partShippingGroupCode)); + } + return shippingGroup; + } + /** * 校验装车单 * diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index 6d7ad12..b0f0bee 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -7,6 +7,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesSortShippingCheckService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.aspect.MonitorLog; 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.MesShippingLoadingCheckModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSortShippingCheckModel; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -15,6 +16,7 @@ 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.MesJisShipping; +import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList; import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail; @@ -78,6 +80,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService @Autowired private MesCustomerPartRepository mesCustomerPartRepository; + @Autowired + private MesPartShippingGroupService mesPartShippingGroupService; + @Override public MesSortShippingCheckModel queryShippingOrderNo(MesShippingOrderManagement shippingOrderManagement) { @@ -209,13 +214,19 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService //校验发运单是否存在 MesShippingOrderManagement orderManagement = checkMesShippingOrderManagement(model, org); - - + //零件发运组 + MesPartShippingGroup shippingGroup = getMesPartShippingGroup(org, orderManagement.getShippingGroupCode()); //根据条码找到对应的物料号,若物料号一致,则修改扫描flg,将flg改为true. boolean scanFlg = false; for (MesShippingOrderManagementDetail detail : model.getDetailList()) { if (detail.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(detail.getBarcode())) { - + //校验发运单明细顺序 + if(CommonEnumUtil.VALID == shippingGroup.getIsEnableShippingFailSafe()){ + Optional first = model.getDetailList().stream().filter(k -> k.getCustInfoSeq().compareTo(detail.getCustInfoSeq()) < 0 && !Objects.equals(k.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)).findFirst(); + if(first.isPresent()){ + throw new ImppBusiException(String.format("发运单【%s】启用明细顺序防错,序号【%s】前还有未扫描的发运单明细,请检查数据!", orderManagement.getShippingCode(), detail.getCustInfoSeq())); + } + } //判断是否需要排序校验 默认排序则需要校验 if (orderManagement.getScanSeqWay() == MesExtEnumUtil.SHIPPING_GROUP_SCAN_CONFIRM_SEQ_MODE.DEFAULT_SORT.getValue()) { @@ -332,6 +343,14 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService } + private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) { + MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode); + if(Objects.isNull(shippingGroup)){ + throw new ImppBusiException(String.format("零件发运组【%s】信息不存在,请检查数据!", partShippingGroupCode)); + } + return shippingGroup; + } + private MesProduceSn checkSn(MesSortShippingCheckModel model, String org) { //校验条码是否重复扫描 Optional optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().equals(model.getSn())).findFirst(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java index 0720a8a..065a163 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java @@ -100,13 +100,16 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){ return null; } - Map> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode)); + Map> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().filter(t->!StringUtils.isEmpty(t.getEquipCode())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode)); + if(Objects.isNull(mesEquipmentSpotCheckMap)){ + return null; + } List mesEquipmentSpotCheckModelList = new ArrayList<>(); for (Map.Entry> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) { MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next(); MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel(); BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel); - Map> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType)); + Map> listMap = mesEquipmentSpotCheckEntry.getValue().stream().filter(t->!StringUtils.isEmpty(t.getSpotCheckOrderType())).collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType)); for (Map.Entry> entry : listMap.entrySet()) { MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel(); mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey()); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java index edcad96..0267209 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartInspectionInputModel.java @@ -18,6 +18,8 @@ import java.util.List; @Data public class MesPartInspectionInputModel { + @ApiParam("NC-零件检测-单据id") + private Long id; @ApiParam("物料") private MesPartSap part; From 4c00b71b0709490cf0a984ff46ef631bd5fc7938 Mon Sep 17 00:00:00 2001 From: jun Date: Thu, 18 Jul 2024 16:24:51 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesInputDefectRecordService.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index cc4f3f0..dda017a 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -208,16 +208,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesPartInspection partInspection; //返工单返修完成,需可疑品移正常库 - if (model.isTransferFlg()) { - String srcLocate = configService.getCfgValue(org, "UMLGO"); - if(!Objects.isNull(model.getPartInspection())){ - MesMove mesMove = getMesMove(model, org); - if(!Objects.isNull(mesMove)){ - srcLocate = mesMove.getUmlgo(); - } - } + if (model.isTransferFlg() && model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //移库 - MesMove move = createMove(model,srcLocate,configService.getCfgValue(org, "LGORT"), org); + MesMove move = createMove(model,getDestLocateNo(model, org),configService.getCfgValue(org, "LGORT"), org); moveRepository.save(move); } From c3e0967093ded0749eb6d624b1dac0c184a10069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E7=AC=91=E7=9D=80=E9=9D=A2=E5=AF=B9=E6=98=8E?= =?UTF-8?q?=E5=A4=A9?= <752558143@qq.com> Date: Thu, 18 Jul 2024 20:04:30 +0800 Subject: [PATCH 5/7] =?UTF-8?q?mqtt=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/ext/mes/pcn/apiservice/config/MqttConfig.java | 2 ++ .../apiservice/controller/mqtt/PcnMqttController.java | 5 ++++- .../ext/mes/pcn/apiservice/mqtt/PcnMqttCallback.java | 4 ++-- .../serviceimpl/base/MesEquipmentLogService.java | 16 +++++++++++++++- .../apiservice/serviceimpl/busi/MesWorkOrderService.java | 6 ++++++ .../pcn/apiservice/serviceimpl/mqtt/MqttServiceImpl.java | 8 +++++--- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/MqttConfig.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/MqttConfig.java index 61d0416..2ac2cf8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/MqttConfig.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/MqttConfig.java @@ -9,12 +9,14 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.MqttException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Arrays; import java.util.List; +@ConditionalOnExpression("'${pcn.mqtt.flag:false}' == 'true'") @Slf4j @Configuration public class MqttConfig { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/mqtt/PcnMqttController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/mqtt/PcnMqttController.java index b1c2b31..df9e02c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/mqtt/PcnMqttController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/mqtt/PcnMqttController.java @@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; + /** * */ @@ -19,7 +21,8 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping(MesCommonConstant.MES_YANFEN + "/mqtt") @Slf4j public class PcnMqttController { - @Autowired + + @Autowired(required = false) private MqttService mqttService; @GetMapping("/addTopic") diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/mqtt/PcnMqttCallback.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/mqtt/PcnMqttCallback.java index 850ea70..862cb92 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/mqtt/PcnMqttCallback.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/mqtt/PcnMqttCallback.java @@ -27,7 +27,7 @@ public class PcnMqttCallback implements MqttCallbackExtended { private static ExecutorService executorService = new ThreadPoolExecutor(1, 20, 0L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<>(200), r -> { + new LinkedBlockingQueue<>(10000), r -> { Thread thread = new Thread(r); thread.setName("executorService--"+r.hashCode()); return thread; @@ -35,7 +35,7 @@ public class PcnMqttCallback implements MqttCallbackExtended { private static ExecutorService executorServiceTwo = new ThreadPoolExecutor(1, 20, 0L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<>(200), r -> { + new LinkedBlockingQueue<>(10000), r -> { Thread thread = new Thread(r); thread.setName("executorServiceTwo--"+r.hashCode()); return thread; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentLogService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentLogService.java index d81e29d..1b53c4d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentLogService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentLogService.java @@ -157,15 +157,24 @@ public class MesEquipmentLogService implements IMesEquipmentLogService { @Override public void updateValue(EquipLogMqttMsg equipLogMqttMsg) { + + log.info("== equipLogMqttMsg ==> messageArrived ,异步处理开始 消息内容: {}", equipLogMqttMsg); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); DdlPreparedPack.getStringEqualPack(equipLogMqttMsg.getKey(), "tagName", ddlPackBean); DdlPreparedPack.getNumEqualPack(Integer.valueOf(equipLogMqttMsg.getPTCode()), "equipId", ddlPackBean); + log.info("== mesEquipmentVariable查询开始"); MesEquipmentVariable mesEquipmentVariable = equipmentVariableRepository.getByProperty(ddlPackBean); + log.info("== mesEquipmentVariable查询结束"); + if (mesEquipmentVariable == null) { LOGGER.info("tagAddress 不存在【{}】", equipLogMqttMsg.getTagAddress()); } + log.info("== MesEquipmentLog查询开始"); MesEquipmentLog equipmentLog = mesEquipmentLogExtService.queryMesEquipmentLog(mesEquipmentVariable.getOrganizeCode(), Integer.valueOf(equipLogMqttMsg.getPTCode()), mesEquipmentVariable.getId()); + log.info("== MesEquipmentLog查询结束"); + /*ConvertBean.serviceModelUpdate(equipmentLog, "mqtt"); equipmentLog.setEquipVariableValue(equipLogMqttMsg.getValue()); equipmentLog.setEquipVariableStatus(MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus()); @@ -174,13 +183,18 @@ public class MesEquipmentLogService implements IMesEquipmentLogService { DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEquipmentVariable.getOrganizeCode()); DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipId(), MesPcnExtConstWords.EQUIP_ID, packBean); DdlPreparedPack.getNumEqualPack(equipmentLog.getEquipVariableId(), MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean); + log.info("== MesEquipmentLog修改开始"); mesEquipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS,"equipVariableValue"}, new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(),equipLogMqttMsg.getValue() }, packBean); + log.info("== MesEquipmentLog修改结束"); MesEquipmentLogDetail mesEquipmentLogDetail = new MesEquipmentLogDetail(); BeanUtils.copyProperties(equipmentLog, mesEquipmentLogDetail); ConvertBean.serviceModelInitialize(mesEquipmentLogDetail, "mqtt"); - mesEquipmentLogDetailRepository.saveAll(Arrays.asList(mesEquipmentLogDetail)); + log.info("== mesEquipmentLogDetail新增开始"); + mesEquipmentLogDetailRepository.insert(mesEquipmentLogDetail); + log.info("== mesEquipmentLogDetail新增结束"); + log.info("== equipLogMqttMsg ==> messageArrived ,异步处理结束 消息内容: {}", equipLogMqttMsg); } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java index ec555a1..cd8d2c0 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderService.java @@ -506,10 +506,13 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean); MesWorkCenter mesWorkCenter = mesWorkCenterRDao.getByProperty(ddlPackBean); if (Objects.isNull(mesWorkCenter)) { + LOGGER.error(String.format("产线【%s】不存在", productionRecord.getWorkCenterCode())); throw new ImppBusiException(String.format("产线【%s】不存在", productionRecord.getWorkCenterCode())); } MesWorkOrder oldMesWorkOrder = getBestWorkOrder(productionRecord, oldMesWorkOrderList, mesWorkCenter); if (oldMesWorkOrder == null) { + LOGGER.error(String.format("未找到匹配的加工单")); + throw new ImppBusiException(String.format("未找到匹配的加工单")); } //获取生产版本 @@ -519,6 +522,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPreparedPack.getStringEqualPack(oldMesWorkOrder.getProductVersion(), "productVersion", ddlPackBean); MesProductVersion mesProductVersion = mesProductVersionRDao.getByProperty(ddlPackBean); if (null == mesProductVersion) { + LOGGER.error(String.format("物料【%s】生产版本信息不存在", productionRecord.getPartNo())); throw new ImppBusiException(String.format("物料【%s】生产版本信息不存在", productionRecord.getPartNo())); } @@ -528,6 +532,8 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPreparedPack.getStringEqualPack(mesProductVersion.getAlternativePartList(), "bomVersion", ddlPackBean); List mesBoms = mesBomRDao.findByHqlWhere(ddlPackBean); if (CollectionUtils.isEmpty(mesBoms)) { + LOGGER.error(String.format("物料【%s】生产版本【%s】对应bom信息不存在", + productionRecord.getPartNo(), mesProductVersion.getProductVersion())); throw new ImppBusiException(String.format("物料【%s】生产版本【%s】对应bom信息不存在", productionRecord.getPartNo(), mesProductVersion.getProductVersion())); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/mqtt/MqttServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/mqtt/MqttServiceImpl.java index d026f43..d2b46af 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/mqtt/MqttServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/mqtt/MqttServiceImpl.java @@ -13,11 +13,13 @@ import com.google.common.collect.Lists; import org.eclipse.paho.client.mqttv3.MqttException; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +@ConditionalOnExpression("'${pcn.mqtt.flag:false}' == 'true'") @Service public class MqttServiceImpl implements MqttService { @@ -152,9 +154,9 @@ public class MqttServiceImpl implements MqttService { @Override public void testSendList() { String start ="["; - for (int i=0; i<100 ; i++) { - String aa = "{\"PTCode\":\"156\",\"key\":\"aa " + i + - "\",\"value\":2,\"time\":\"2024-07-17 16:18:13\"}"; + for (int i=0; i<10000 ; i++) { + String aa = "{\"PTCode\":\"300\",\"key\":\"aa499" + i + + "\",\"value\":5,\"time\":\"2024-07-17 16:18:13\"}"; start += aa; } From 0f31bc01a58b6fbaf391b17754d7b89063a76cfb Mon Sep 17 00:00:00 2001 From: jun Date: Thu, 18 Jul 2024 21:19:54 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java | 2 +- .../pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java index 452654e..998b4f6 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java @@ -27,7 +27,7 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService @Override public MesPartShippingGroup getMesPartShippingGroup(String organizeCode, String shippingGroupCode) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(shippingGroupCode, "partShippingGroupCode", packBean); + DdlPreparedPack.getStringEqualPack(shippingGroupCode, "shippingGroupCode", packBean); return shippingGroupRepository.getByProperty(packBean); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index b0f0bee..6e1031b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -378,7 +378,7 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService } private MesShippingOrderManagementDetail getMesShippingOrderManagementDetail(MesSortShippingCheckModel model, String org) { - List detailList = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getCustPartNo()) && model.getSn().startsWith(k.getCustPartNo()) && !StringUtils.isEmpty(k.getBarcode())).collect(Collectors.toList()); + List detailList = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getCustPartNo()) && model.getSn().startsWith(k.getCustPartNo()) && StringUtils.isEmpty(k.getBarcode())).collect(Collectors.toList()); MesShippingOrderManagementDetail mesShippingOrderManagementDetail = null; for (MesShippingOrderManagementDetail managementDetail : detailList) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); From aa828063a76cbc44d16631e1f552fb33e096d32b Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Fri, 19 Jul 2024 14:57:19 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=AD=96=E7=95=A5?= =?UTF-8?q?=EF=BC=9A=20gqxnyNumberRuleStrategyService=20=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E5=B7=A5=E6=AD=A5=E6=9C=AA=E4=BC=A0=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E9=9B=B6=E4=BB=B6=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../numberrule/GqxnyNumberRuleStrategyService.java | 42 ++++++++++++++++------ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 5 +++ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/GqxnyNumberRuleStrategyService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/GqxnyNumberRuleStrategyService.java index a5ba133..ecfafcd 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/GqxnyNumberRuleStrategyService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/GqxnyNumberRuleStrategyService.java @@ -4,15 +4,18 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.INumberRulePackAttributeStrategyService; 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.MesConfig; import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.repository.MesCustomerPartRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import java.util.Date; -import java.util.HashMap; import java.util.Map; /** @@ -24,8 +27,13 @@ import java.util.Map; **/ @Component public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeStrategyService { + @Autowired private IConfigService configService; + + @Autowired + private MesCustomerPartRepository customerPartRepository; + @Override public GenSerialNoModel execute(GenSerialNoModel genSerialNoModel) { Date date = new Date(); @@ -35,20 +43,27 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS //零件长号---17位,不足17位 右边补* //获取客户零件号 Map dataMap = genSerialNoModel.getDataMap(); - MesCustomerPart mesCustomerPart = (MesCustomerPart)dataMap.get("mesCustomerPart"); - String custPartNo = mesCustomerPart.getCustPartNo(); - String custPartNoFormat = stringFormat(custPartNo, 17); - genSerialNoModel.setCustPartNo(custPartNoFormat); + MesCustomerPart customerPart = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(MesCustomerPart.class.getSimpleName())) ? + (MesCustomerPart)dataMap.get(MesCustomerPart.class.getSimpleName()) : getMesCustomerPart(genSerialNoModel.getOrganizeCode(), genSerialNoModel.getPartNo()); + if (null != customerPart) { + String custPartNo = customerPart.getCustPartNo(); + String custPartNoFormat = stringFormat(custPartNo, 17); + genSerialNoModel.setCustPartNo(custPartNoFormat); + } + //拓展位 2位 00 包含0~9,A~Z 不使用时,补“0”填充 {SPILTRULE} //供应商代码 7位 供应商代码 0~9,A~Z;不足7位 右测补* MesConfig supplierConfig = configService.getMesConfigByCfgCodeKeyOrg(MesPcnExtConstWords.SUPPLIER_CODE, MesExtEnumUtil.MES_PRINT_TEMPLATE.GQXNY.getValue(), genSerialNoModel.getOrganizeCode()); - String supplierCode = supplierConfig.getCfgValue(); - String supplierCodeFormat = stringFormat(supplierCode, 7); - genSerialNoModel.setCustCode(supplierCodeFormat); + if (null != supplierConfig) { + String supplierCode = supplierConfig.getCfgValue(); + String supplierCodeFormat = stringFormat(supplierCode, 7); + genSerialNoModel.setCustCode(supplierCodeFormat); + } + //扩展位 3位 预留扩展位0~9 A~Z 不使用时,补 0 {SPILTRULE} //产线 1位 供应商产线号,表示由数字1~9 和字母A~Z(I/O除外)组成; {SPILTRULE} //年月日 6位 yyMMdd 零部件生产日期,年月日各2位 - String year = TimeTool.pareDateToString("yyMMdd", date); + String year = TimeTool.pareDateToString(MesPcnExtConstWords.DATE_FORMAT_SHORT, date); genSerialNoModel.setYear(year); //流水号 4位 采用34进制 0001~ZZZZ (I、O除外)顺位进行标注 (同广汽 & 广新) {serialNo} //扩展位 4位 预留扩展位信息,包含0~9和字母A~Z,不使用时,补“0” 填充; {SPILTRULE} @@ -58,7 +73,7 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS } private String stringFormat(String data, Integer length) { - return stringFormat(data, length, true, "*"); + return stringFormat(data, length, true, MesPcnExtConstWords.ASTERISK); } private String stringFormat(String data, Integer length, boolean left, String symbol) { @@ -85,4 +100,11 @@ public class GqxnyNumberRuleStrategyService implements INumberRulePackAttributeS return dataBuffer.toString(); } + private MesCustomerPart getMesCustomerPart(String orgaizeCode, String partNo) { + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(orgaizeCode); + DdlPreparedPack.getStringEqualPack(partNo, MesPcnExtConstWords.ERP_PART_NO, ddlPackBean); + MesCustomerPart customerPart = customerPartRepository.getByProperty(ddlPackBean); + return customerPart; + } + } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 9d2b4f8..eea9d9d 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -155,9 +155,12 @@ public class MesPcnExtConstWords { public static final String URL = "url"; // 处理状态 public static final String DEAL_STATUS = "dealStatus"; + // erp物料编码 + public static final String ERP_PART_NO = "erpPartNo"; // 时间格式 public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; + public static final String DATE_FORMAT_SHORT = "yyMMdd"; //设备数据变量读写访问配置 @@ -266,6 +269,8 @@ public class MesPcnExtConstWords { public static final String SQUARE_BRACKETS_L = "["; // ] public static final String SQUARE_BRACKETS_R = "]"; + // * + public static final String ASTERISK = "*";