From 3e308b130cf962d009847b8b48ddb299dfd6ff13 Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Fri, 13 Dec 2024 18:37:13 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=2044281=20=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=8A=A0=E5=B7=A5=E8=AE=B0=E5=BD=95=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E7=94=B5=E6=B5=8B=E8=AF=95=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=92=8C=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E6=B2=A1=E8=B5=8B?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java index 98308ef..29f90b7 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/DcsForEquipmentServiceImpl.java @@ -157,6 +157,8 @@ public class DcsForEquipmentServiceImpl implements IDcsForEquipmentService { mesProductionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue()); mesProductionRecord.setReportType(MesExtEnumUtil.MES_REPORT_TYPE.NO_REPORT.getValue()); mesProductionRecord.setOrganizeCode(organizeCode); + mesProductionRecord.setStartDateTime(TimeTool.getNowTime(true)); + mesProductionRecord.setCompleteDateTime(TimeTool.getNowTime(true)); mesProductionRecord.setRemark("电测试:"+result); ConvertBean.saveOrUpdate(mesProductionRecord,"电测试"); recordRao.insert(mesProductionRecord); From e14d75261877506b3aeae176e65f795d65ea239f Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Fri, 13 Dec 2024 18:39:20 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E9=9B=B6=E4=BB=B6=E6=9D=A1=E7=A0=81?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=B7=A5=E6=AD=A5;=20=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=BF=80=E5=85=89=E8=A3=85=E9=85=8D=E4=BB=B6=E5=B7=A5=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...BarcodeCountShareAssemblySnSaveStepService.java | 71 ++++++++++++++++ .../MesBarcodeCountShareInfoSaveStepService.java | 99 ++++++++++++++++++++++ ...sBarcodeCountShareProductSnSaveStepService.java | 55 ++++++++++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 + 4 files changed, 227 insertions(+) create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareAssemblySnSaveStepService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareInfoSaveStepService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareProductSnSaveStepService.java diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareAssemblySnSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareAssemblySnSaveStepService.java new file mode 100644 index 0000000..151df06 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareAssemblySnSaveStepService.java @@ -0,0 +1,71 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesBarcodeCountShareInfo; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.List; + +/** + * @Description : 保存激光装配件工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesBarcodeCountShareAssemblySnSaveStepService") +public class MesBarcodeCountShareAssemblySnSaveStepService extends MesBarcodeCountShareInfoSaveStepService { + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //获取上下文产出条码数据信息集合 + List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); + + if (CollectionUtils.isEmpty(productionPsOutContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产出零件条码信息,请重置工序解决!"); + + //获取上下文产品加工规则数据信息集合 + List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + + if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!"); + + prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getAssemblyDataJson()))).forEach(o -> { + List productionAssemblyNosortContextList = o.getNosortAssemblyDataContext(); + if (!CollectionUtils.isEmpty(productionAssemblyNosortContextList)) { + MesProductionPsOutContext productionPsOutContext = productionPsOutContextList.stream().filter(i -> (null != i && i.getForeignKey().compareTo(o.getForeignKey()) == 0)).findFirst().get(); + for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) { + if (StringUtils.isEmpty(productionAssemblyNosortContext.getAssemblySn())) continue; + saveBarcodeCountShareInfo(reqBean, productionProcessContext, new MesBarcodeCountShareInfo( + MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.BARCODE_COUNT_SHARE_INFO_20.getValue(), + productionAssemblyNosortContext.getAssemblySn(), productionPsOutContext.getPartNo(), productionPsOutContext.getPartName())); + } + } + }); + + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "保存激光装配件信息成功!"); + + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareInfoSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareInfoSaveStepService.java new file mode 100644 index 0000000..f50c9df --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareInfoSaveStepService.java @@ -0,0 +1,99 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +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.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.serviceimpl.fsm.IStepService; +import cn.estsh.i3plus.mes.pcn.util.StringUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesBarcodeCountShareInfo; +import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.repository.MesBarcodeCountShareInfoRepository; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import cn.estsh.impp.framework.boot.util.SpringContextsUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +/** + * @Description : 保存零件条码统计OEE共享信息工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesBarcodeCountShareInfoSaveStepService") +public class MesBarcodeCountShareInfoSaveStepService extends BaseStepService { + + @Autowired + public IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + public IMesProductionDispatchContextStepService productionDispatchContextStepService; + + @Autowired + private MesBarcodeCountShareInfoRepository barcodeCountShareInfoRepository; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取工步参数 + Optional> stepParamMap = getStepParams(reqBean); + + String stepParam = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.BARCODE_COUNT_SHARE_INFO)) ? stepParamMap.get().get(MesPcnExtConstWords.BARCODE_COUNT_SHARE_INFO).getParamValue() : null; + + if (StringUtils.isEmpty(stepParam) && StringUtils.isEmpty(MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.valueOfDescription(stepParam))) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, + resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("未配置有效的工步参数[{}]跳过执行保存零件条码统计共享信息工步!", MesPcnExtConstWords.BARCODE_COUNT_SHARE_INFO)); + } + + Boolean isAllExec = false; + if (MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.BARCODE_COUNT_SHARE_INFO_30.getValue().equals(stepParam)) isAllExec = true; + + //零件条码统计工步 + if (isAllExec || MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.BARCODE_COUNT_SHARE_INFO_10.getValue().equals(stepParam)) { + ((IStepService) SpringContextsUtil.getBean("mesBarcodeCountShareProductSnSaveStepService")).executeInState(reqBean); + } + //保存激光装配件工步 + if (isAllExec || MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.BARCODE_COUNT_SHARE_INFO_20.getValue().equals(stepParam)) { + ((IStepService) SpringContextsUtil.getBean("mesBarcodeCountShareAssemblySnSaveStepService")).executeInState(reqBean); + } + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- {}={}[{}]", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), MesPcnExtConstWords.BARCODE_COUNT_SHARE_INFO, stepParam, MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.valueOfDescription(stepParam)); + + return stepResult; + + } + + public void saveBarcodeCountShareInfo(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesBarcodeCountShareInfo barcodeCountShareInfo) { + barcodeCountShareInfo.setAreaCode(reqBean.getAreaCode()); + barcodeCountShareInfo.setWorkCenterCode(reqBean.getWorkCenterCode()); + barcodeCountShareInfo.setWorkCellCode(reqBean.getWorkCellCode()); + barcodeCountShareInfo.setProcessCode(reqBean.getProcessCode()); + barcodeCountShareInfo.setCraftCode(productionProcessContext.getCraftCode()); + barcodeCountShareInfo.setEquipmentCode(productionProcessContext.getCurCellEquip().getEquipmentCode()); + barcodeCountShareInfo.setOrganizeCode(reqBean.getOrganizeCode()); + barcodeCountShareInfo.setFid(UUID.randomUUID().toString()); + ConvertBean.serviceModelInitialize(barcodeCountShareInfo, reqBean.getUserInfo()); + barcodeCountShareInfo.setProductEndTime(barcodeCountShareInfo.getModifyDatetime()); + barcodeCountShareInfoRepository.insert(barcodeCountShareInfo); + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareProductSnSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareProductSnSaveStepService.java new file mode 100644 index 0000000..342f44f --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesBarcodeCountShareProductSnSaveStepService.java @@ -0,0 +1,55 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; + +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesBarcodeCountShareInfo; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StationResultBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * @Description : 保存零件条码统计工步 + * @Author : wangjie + **/ +@Slf4j +@Service("mesBarcodeCountShareProductSnSaveStepService") +public class MesBarcodeCountShareProductSnSaveStepService extends MesBarcodeCountShareInfoSaveStepService { + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //获取上下文产出条码数据信息集合 + List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); + + if (CollectionUtils.isEmpty(productionPsOutContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产出零件条码信息,请重置工序解决!"); + + productionPsOutContextList.stream().filter(o -> null != o).forEach(o -> + saveBarcodeCountShareInfo(reqBean, productionProcessContext, new MesBarcodeCountShareInfo( + MesExtEnumUtil.BARCODE_COUNT_SHARE_INFO.BARCODE_COUNT_SHARE_INFO_10.getValue(), o.getProductSn(), o.getPartNo(), o.getPartName())) + ); + + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "保存零件条码统计信息成功!"); + + } + +} 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 871df7f..c8e9257 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 @@ -351,6 +351,8 @@ public class MesPcnExtConstWords { public static final String NEED_CHECK_IS_PS = "NEED_CHECK_IS_PS"; // 流程包含解绑工步[工步参数] public static final String CONTEXT_UNBINDING_STEP = "CONTEXT_UNBINDING_STEP"; + // 零件条码统计OEE共享信息[工步参数] + public static final String BARCODE_COUNT_SHARE_INFO = "BARCODE_COUNT_SHARE_INFO"; // 装配件显示规则配置[工位参数] public static final String ASSEMBLY_SHOW_MR_CFG = "ASSEMBLY_SHOW_MR_CFG"; From 56efc172969fae37083da7867fdc2b01e5aad20e Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Mon, 16 Dec 2024 09:27:32 +0800 Subject: [PATCH 03/14] =?UTF-8?q?1.=20=E7=94=9F=E4=BA=A7=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=20=20=E5=B7=A5=E6=AD=A5=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=9F=B3(=E5=8C=B9=E9=85=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=8A=A0=E5=B7=A5=E8=A7=84=E5=88=99/=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E6=88=90=E5=8A=9F=E8=A3=85=E9=85=8D=E4=BB=B6);2.?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=BF=87=E7=A8=8B=E6=8E=A7=E5=88=B6=20=20?= =?UTF-8?q?=E5=B7=A5=E6=AD=A5=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF(=E6=89=AB=E6=8F=8F/=E8=AF=BB?= =?UTF-8?q?=E8=A3=85=E9=85=8D=E4=BB=B6/=E5=8C=B9=E9=85=8D=E8=A3=85?= =?UTF-8?q?=E9=85=8D=E4=BB=B6/=E4=BF=9D=E5=AD=98=E8=A3=85=E9=85=8D?= =?UTF-8?q?=E4=BB=B6=20=20=E7=B2=BE=E7=AE=80=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF);3.=E7=94=9F=E4=BA=A7=E8=BF=87=E7=A8=8B=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=20=20=E5=B7=A5=E6=AD=A5=E4=BF=9D=E5=AD=98=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E6=95=B0/=E6=98=BE=E7=A4=BA=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E6=95=B0/=E6=B8=85=E9=99=A4=E5=8A=A0=E5=B7=A5=E6=95=B0=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4=20(=E5=B7=A5=E4=BD=8D?= =?UTF-8?q?=E5=9B=BE=E8=B7=9F=E5=8A=A0=E5=B7=A5=E6=95=B0=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E6=97=B6,=20=E4=BC=98=E5=85=88=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=B7=A5=E4=BD=8D=E5=9B=BE,=20=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E4=BB=8D=E7=BB=9F=E8=AE=A1=E5=8A=A0=E5=B7=A5=E6=95=B0(?= =?UTF-8?q?=E5=8E=9F=E9=80=BB=E8=BE=91:=E5=8A=A0=E5=B7=A5=E6=95=B0?= =?UTF-8?q?=E4=BC=98=E5=85=88=E5=B1=95=E7=A4=BA));4.=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=8E=A7=E5=88=B6=20=20=E5=B7=A5=E6=AD=A5?= =?UTF-8?q?=E9=9D=9E=E6=8E=92=E5=BA=8F=E6=89=93=E5=8D=B0,=20=E4=B8=8D?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=B6=E4=B8=8D=E5=86=8D=E5=8F=91=E9=80=81?= =?UTF-8?q?=E7=A9=BA=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF=E7=BB=99=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF,=20=E5=90=8C=E6=97=B6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E6=9D=A1=E7=A0=81=E7=9A=84=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E7=8A=B6=E6=80=81,=20=E5=B9=B6=E4=B8=8D=E5=86=8D=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=89=93=E5=8D=B0=E6=88=90=E5=8A=9F;5.=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=BF=87=E7=A8=8B=E6=8E=A7=E5=88=B6=20=20=E5=B7=A5?= =?UTF-8?q?=E6=AD=A5=E6=8E=92=E5=BA=8F=E6=89=93=E5=8D=B0,=20=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=B7=A5=E5=8D=95=20=E6=9F=A5=E8=AF=A2=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=20=E8=B0=83=E6=95=B4,=20=E4=B8=8D=E4=BD=BF=E7=94=A8in?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2;6.=E7=94=9F=E4=BA=A7=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=20=20=E5=B1=95=E7=A4=BA=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91=E5=8F=98?= =?UTF-8?q?=E6=9B=B4:=20=E6=8E=92=E5=BA=8F/=E9=9D=9E=E6=8E=92=E5=BA=8F=20?= =?UTF-8?q?=20=E5=B7=A5=E5=8D=95=E4=BF=A1=E6=81=AF/=E7=8F=AD=E6=AC=A1?= =?UTF-8?q?=E7=8F=AD=E7=BB=84/=E5=B7=A5=E4=BD=8D=E5=9B=BE(=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E6=95=B0)/=E9=98=9F=E5=88=97=E8=A1=A8=E6=A0=BC=20=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=80=E6=AC=A1=E6=80=A7=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=88=B0=E5=AE=A2=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/api/base/IMesProdShiftRecordService.java | 7 + .../IMesProductionCustomContextStepService.java | 14 +- .../mes/pcn/api/busi/IWriteVariableService.java | 33 ----- .../base/MesProdShiftRecordServiceImpl.java | 27 ++++ .../equiplog/MesEquipmentRwExtService.java | 3 +- .../rulematch/WriteVariableService.java | 162 --------------------- .../station/MesProductionNoSortModuleService.java | 124 ++++++++-------- .../station/MesProductionSortModuleService.java | 76 ++++++---- .../MesFunctionProductionStatisticsService.java | 103 ++++--------- .../step/MesAssemblyGeneratePartNoStepService.java | 6 +- ...MesAssemblyMatchNosortRetrodictStepService.java | 6 +- .../step/MesAssemblyMatchNosortStepService.java | 12 +- .../step/MesAssemblyMatchSortStepService.java | 22 ++- .../step/MesAssemblyReadStepService.java | 6 +- .../step/MesAssemblySaveStepService.java | 17 ++- .../step/MesAssemblyScanStepService.java | 22 ++- .../step/MesAssemblyScanStepServiceBak.java | 2 +- .../step/MesAssemblyShowNosortStepService.java | 8 +- .../step/MesAssemblyShowSortStepService.java | 7 +- .../step/MesProductSnGenerateStepService.java | 10 +- .../step/MesProductSnPrintNosortStepService.java | 5 + .../step/MesProductSnPrintSortStepService.java | 42 ++---- .../step/MesProductSnSaveStepService.java | 10 +- .../step/MesProductionPartNoScanStepService.java | 5 +- .../MesProductionRecordGenerateStepService.java | 7 +- .../step/MesSendEquipParamsCmdStepService.java | 10 +- .../step/MesSendEquipParamsCmdStepService2.java | 10 +- .../MesWorkOrderCutProductSnSaveStepService.java | 79 ++-------- .../MesProductionCustomContextStepService.java | 40 ++--- 29 files changed, 330 insertions(+), 545 deletions(-) delete mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IWriteVariableService.java delete mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/WriteVariableService.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java index 76fc589..efcb687 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdShiftRecordService.java @@ -1,6 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.api.base; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord; @@ -40,4 +41,10 @@ public interface IMesProdShiftRecordService { @ApiOperation(value = "获取展示组件班组班次内容") List getShiftRecordStationKvBeans(String organizeCode, String workCenterCode); + @ApiOperation(value = "获取生产线的当前班组班次信息") + MesProdShiftContext getMesProdShiftKvBean(String organizeCode, String workCenterCode); + + @ApiOperation(value = "封装当前班组班次信息") + MesProdShiftContext getMesProdShiftKvBean(List prodShiftDataContext); + } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java index dabbeac..1bb121b 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionCustomContextStepService.java @@ -42,12 +42,12 @@ public interface IMesProductionCustomContextStepService { @ApiOperation(value = "发送工步内容") void sendStepContextMessage(StationRequestBean reqBean, List resultList); - @ApiOperation(value = "验证上下文班次班组信息是否存在") - Boolean checkProdShiftDataIsExistContext(String orgainzeCode, String workCenterCode); - @ApiOperation(value = "获取上下文班次班组信息") List getProdShiftDataContext(String orgainzeCode, String workCenterCode); + @ApiOperation(value = "验证上下文班次班组信息是否存在") + Boolean checkProdShiftDataIsExistContext(String orgainzeCode, String workCenterCode); + @ApiOperation(value = "保存上下文班次班组信息", notes = "[JSON]List") Boolean dispatchProdShiftDataContext(String orgainzeCode, String workCenterCode, List prodShiftDatList); @@ -57,18 +57,18 @@ public interface IMesProductionCustomContextStepService { @ApiOperation(value = "获取上下文工位加工数统计信息") List getProductionStatisticsContext(StationRequestBean reqBean); + @ApiOperation(value = "封装加工数信息") + List getProductionStatisticsContext(MesProdShiftContext mesProdShiftKvBean, String countStr); + @ApiOperation(value = "保存上下文工位加工数统计信息", notes = "[JSON]List") Boolean dispatchProductionStatisticsContext(StationRequestBean reqBean, List prodShiftDatList); @ApiOperation(value = "新增上下文工位加工数统计信息") - Integer dispatchProductionStatisticsContext(StationRequestBean reqBean, int count); + Integer dispatchProductionStatisticsContext(StationRequestBean reqBean, int count, MesProdShiftContext mesProdShiftKvBean); @ApiOperation(value = "删除上下文工位加工数统计信息") void removeProductionStatisticsContext(StationRequestBean reqBean); - @ApiOperation(value = "获取生产线的当前班组班次信息") - MesProdShiftContext getMesProdShiftKvBean(String organizeCode, String workCenterCode); - @ApiOperation(value = "根据装配件信息获取可复用条码") String getRepeatAssemblySn(String organizeCode, String workCenterCode, String workCellCode, MesProductionAssemblyContext productionAssemblyContext); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IWriteVariableService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IWriteVariableService.java deleted file mode 100644 index 6be41a8..0000000 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IWriteVariableService.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.estsh.i3plus.ext.mes.pcn.api.busi; - - -import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable; -import cn.estsh.i3plus.pojo.mes.model.MesEquipVariableRwResult; -import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * @Description : 发送加工参数的抽象类 - * @Author : zxw - **/ -public interface IWriteVariableService { - - /** - * 写值 - * @param value - * @param equipmentVariable - * @param kepwareFlag - */ - MesEquipVariableRwResult writeVariable(StationRequestBean reqBean, String value, MesEquipmentVariable equipmentVariable, String kepwareFlag, Integer foreignKey, Integer index,Integer maxRetryTimes); - - /** - * 转成需要的值 - * @param reqBean - * @param value - * @param foreignKey - * @param index - * @return - */ - String transferValue(StationRequestBean reqBean, String value, Integer foreignKey, Integer index); - -} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java index 2af058b..67f7a09 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdShiftRecordServiceImpl.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.util.StationKvBeanUtil; import cn.estsh.i3plus.platform.common.convert.ConvertBean; @@ -256,6 +257,7 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService //获取展示组件班组班次内容 @Override public List getShiftRecordStationKvBeans(String organizeCode, String workCenterCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workCenterCode)) return null; // 获取班次信息 redis List prodShiftDataContext = productionCustomContextStepService.getProdShiftDataContext(organizeCode, workCenterCode); if (CollectionUtils.isEmpty(prodShiftDataContext)) { @@ -268,4 +270,29 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService } return prodShiftDataContext; } + + //获取生产线的当前班组班次信息 + @Override + public MesProdShiftContext getMesProdShiftKvBean(String organizeCode, String workCenterCode) { + + List prodShiftDataContext = getShiftRecordStationKvBeans(organizeCode, workCenterCode); + if (CollectionUtils.isEmpty(prodShiftDataContext)) return null; + + return getMesProdShiftKvBean(prodShiftDataContext); + } + + //封装当前班组班次信息 + @Override + public MesProdShiftContext getMesProdShiftKvBean(List prodShiftDataContext) { + if (CollectionUtils.isEmpty(prodShiftDataContext)) return null; + + StationKvBean shiftGroupKvBean = prodShiftDataContext.stream().filter(stationKvBean -> com.google.common.base.Objects.equal(stationKvBean.getKey(), MesPcnExtConstWords.SHIFT_GROUP)).findFirst().orElse(null); + StationKvBean shiftCodeKvBean = prodShiftDataContext.stream().filter(stationKvBean -> com.google.common.base.Objects.equal(stationKvBean.getKey(), MesPcnExtConstWords.SHIFT_CODE)).findFirst().orElse(null); + + MesProdShiftContext mesProdShiftContext = new MesProdShiftContext(); + mesProdShiftContext.setShiftCode(shiftGroupKvBean == null ? null : shiftCodeKvBean.getValue()); + mesProdShiftContext.setShiftGroup(shiftCodeKvBean == null ? null : shiftGroupKvBean.getValue()); + return mesProdShiftContext; + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentRwExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentRwExtService.java index 2a9950b..e55e29c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentRwExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentRwExtService.java @@ -1,7 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.equiplog; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipVariableRwExtService; -import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch.WriteVariableService; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; import cn.estsh.i3plus.platform.common.tool.HttpClientTool; @@ -32,7 +31,7 @@ import java.util.stream.Collectors; @Service public class MesEquipmentRwExtService implements IMesEquipVariableRwExtService { - public static final Logger LOGGER = LoggerFactory.getLogger(WriteVariableService.class); + public static final Logger LOGGER = LoggerFactory.getLogger(MesEquipmentRwExtService.class); @Autowired private IConfigService configService; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/WriteVariableService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/WriteVariableService.java deleted file mode 100644 index b8d187a..0000000 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/rulematch/WriteVariableService.java +++ /dev/null @@ -1,162 +0,0 @@ -package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch; - - -import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; -import cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob.BaseMesScheduleJob; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsInContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; -import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable; -import cn.estsh.i3plus.pojo.mes.model.MesEquipVariableRwResult; -import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; -import cn.hutool.core.date.DatePattern; -import cn.hutool.core.date.DateUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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.Date; -import java.util.List; -import java.util.Objects; - -/** - * @Description : 发送加工参数的抽象类 - * @Author : zxw - **/ -@Service -public class WriteVariableService implements IWriteVariableService { - - public static final Logger LOGGER = LoggerFactory.getLogger(WriteVariableService.class); - - - @Autowired - private IMesEquipVariableRwExtService equipVariableRwExtService; - - @Autowired - private IMesProductionDispatchContextStepService mesProductionDispatchContextStepService; - - @Autowired - private IMesProductionDispatchContextStepService productionDispatchContextStepService; - - @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - /** - * 写值 - * @param value - * @param equipmentVariable - * @param kepwareFlag - */ - public MesEquipVariableRwResult writeVariable(StationRequestBean reqBean, String value, MesEquipmentVariable equipmentVariable, String kepwareFlag, Integer foreignKey, Integer index, Integer maxTimes) { - // 需要不同的策略不同的转换方式 - String newValue = transferValue(reqBean, value, foreignKey, index); - if (StringUtils.isEmpty(newValue)) { - LOGGER.info("发送的值为空,不予发送"); - return null; - } - MesEquipVariableRwResult mesEquipVariableRwResult = equipVariableRwExtService.writeVariable(newValue, equipmentVariable, kepwareFlag); - if (!mesEquipVariableRwResult.getIsSuccessed() && mesEquipVariableRwResult.getIsNoCfg()) { - for (int i = 0;i < maxTimes; i++) { - - mesEquipVariableRwResult = equipVariableRwExtService.writeVariable(newValue, equipmentVariable, kepwareFlag); - if (mesEquipVariableRwResult.getIsSuccessed()){ - break; - } - } - } - return mesEquipVariableRwResult; - } - - - @Override - public String transferValue(StationRequestBean reqBean, String value, Integer foreignKey, Integer index) { - List productionPartContextList = mesProductionDispatchContextStepService.getProductionPartContext(reqBean); - List productionPsOutContexts = mesProductionDispatchContextStepService.getProductionPsOutContext(reqBean); - List productionPsInContexts = mesProductionDispatchContextStepService.getProductionPsInContext(reqBean); - - - - String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); - MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); - - - - MesProductionPartContext mesProductionPartContext = null; - MesProductionPsOutContext productionPsOutSn = null; - - if (!Objects.isNull(foreignKey)) { - if (!CollectionUtils.isEmpty(productionPartContextList)) { - mesProductionPartContext = productionPartContextList.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null); - } - if (!CollectionUtils.isEmpty(productionPsOutContexts)) { - productionPsOutSn = productionPsOutContexts.stream().filter(context -> Objects.equals(context.getForeignKey(), foreignKey)).findFirst().orElse(null); - } - String newValue = ""; - if (StringUtils.isEmpty(value)) { - return null; - } - if (mesProductionPartContext == null) { - mesProductionPartContext = new MesProductionPartContext(); - } - if (productionPsOutSn == null) { - productionPsOutSn = new MesProductionPsOutContext(); - } - switch (value.toUpperCase()) { - case "%RESULT%" : newValue = mesProductionPartContext.getPartNo(); break; - case "%PARAM%": newValue = mesProductionPartContext.getWorkOrderNo(); break; - case "%ORDERCODE%": newValue = mesProductionPartContext.getWorkOrderNo(); break; - case "%CUSTPARTNO%": newValue = mesProductionPartContext.getCustPartNo(); break; - case "%EMPLOYEENO%": newValue = reqBean.getUserInfo(); break;///当前操作员工号 用户名 - case "%BARCODE%": newValue = productionPsOutSn.getProductSn(); break;// 条码 - case "%BARCODE2%": newValue = productionPsOutContexts.get(1).getProductSn(); break;///条码 - case "%BARCODE3%": newValue = productionPsOutContexts.get(2).getProductSn(); break;///条码 - case "%BARCODE4%": newValue = productionPsOutContexts.get(3).getProductSn(); break;///条码 - case "%BARCODE5%": newValue = productionPsOutContexts.get(4).getProductSn(); break;///条码 - case "%BARCODE6%": newValue = productionPsOutContexts.get(5).getProductSn(); break;///条码 - case "%BARCODE7%": newValue = productionPsOutContexts.get(6).getProductSn(); break;///条码 - case "%BARCODE8%": newValue = productionPsOutContexts.get(7).getProductSn(); break;///条码 - case "%BARCODE9%": newValue = productionPsOutContexts.get(8).getProductSn(); break;///条码 - case "%BARCODE10%": newValue = productionPsOutContexts.get(9).getProductSn(); break;///条码 - case "%BARCODE11%": newValue = productionPsOutContexts.get(10).getProductSn(); break;///条码 - case "%BARCODE12%": newValue = productionPsOutContexts.get(11).getProductSn(); break;///条码 - case "%BARCODE13%": newValue = productionPsOutContexts.get(12).getProductSn(); break;///条码 - case "%BARCODE14%": newValue = productionPsOutContexts.get(13).getProductSn(); break;///条码 - case "%BARCODE15%": newValue = productionPsOutContexts.get(14).getProductSn(); break;///条码 - case "%BARCODE16%": newValue = productionPsOutContexts.get(15).getProductSn(); break;///条码 - case "%BARCODE17%": newValue = productionPsOutContexts.get(16).getProductSn(); break;///条码 - case "%BARCODE18%": newValue = productionPsOutContexts.get(17).getProductSn(); break;///条码 - case "%BARCODE19%": newValue = productionPsOutContexts.get(18).getProductSn(); break;///条码 - case "%BARCODE20%": newValue = productionPsOutContexts.get(19).getProductSn(); break;///条码 - case "%CREATEDATE%": newValue = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); break;///加工记录的创建时间 - case "%CREATEUSER%": newValue = reqBean.getUserInfo(); break;///当前操作员工号 用户名 - case "%SHIFT%": newValue = mesProdShiftKvBean.getShiftGroup(); break;///当前操作员工号 用户名 - //case "%STATUS%": newValue = productionPsInContexts.get(0).get() +"" ; break;//进料条码状态 - // case "%CUSTORDERCOD%": newValue = mesProductionPartContext.getCustOrderNo(); break;///客户订单号 - case "%PARTNO%": newValue = mesProductionPartContext.getPartNo(); break;///工单对应的零件号 - //case "%VINCODE%": newValue = mesProductionPartContext.getv(); break;///工单对应的vincode - case "%SEQUENCE%": newValue = reqBean.getUserInfo(); break;///工单顺序号 不是生产顺序号 - case "%CUSTBARCODE%": newValue = productionPsOutSn.getCustSn(); break;///客户条码 - case "%GETDATE%": newValue = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN); break;///客户条码 - - default: - newValue = value; - } - return newValue; - } else { - if (index != null && foreignKey == null) { - mesProductionPartContext = productionPartContextList.get(index); - if (mesProductionPartContext == null || Objects.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), mesProductionPartContext.getIsFinishCode())) { - return null; - } - return value; - } - } - return null; - } - - -} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java index 84df841..c6011f2 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java @@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepServi 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.api.busi.IMesWorkOrderExtService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function.MesFunctionProductionStatisticsService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; @@ -73,37 +74,44 @@ public class MesProductionNoSortModuleService extends BaseModuleService { MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getProductionProcessContext(reqBean, false); //配置错误 抛出异常 if (!productionProcessContext.getSuccess()) { - this.sendMessage(reqBean, new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN), String.format("信息: %s!", productionProcessContext.getMessage()), MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE, MesPcnEnumUtil.STATION_DATA_TYPE.TITLE); - this.sendMessage(reqBean, new StationResultBean().writeDbLog(), productionProcessContext.getMessage(), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + this.sendMessage(reqBean, new StationResultBean() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()) + .addStationResultBeans(new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN) + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TITLE.getValue()).message(String.format("信息: %s!", productionProcessContext.getMessage()))) + .addStationResultBeans(new StationResultBean().writeDbLog() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()).message(productionProcessContext.getMessage())) + ); + MesPcnException.throwBusiException(productionProcessContext.getMessage()); } - // 获取工单信息 - List> moduleContentContext = productionDispatchContextStepService.getModuleContentContext(reqBean); - //获取班次信息,先查询缓存,缓存没有在查询数据库 List prodShiftDataContext = prodShiftRecordService.getShiftRecordStationKvBeans(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); if (CollectionUtils.isEmpty(prodShiftDataContext)) { - this.sendMessage(reqBean, new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN), "信息: 请先开班!", MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE, MesPcnEnumUtil.STATION_DATA_TYPE.TITLE); - this.sendMessage(reqBean, new StationResultBean().writeDbLog(), "请先开班!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, new StationResultBean() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()) + .addStationResultBeans(new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN) + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TITLE.getValue()).message("信息: 请先开班!")) + .addStationResultBeans(new StationResultBean().writeDbLog() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()).message("请先开班!")) + ); + MesPcnException.throwBusiException("请先开班!"); } - // 发送班次班组和工单 + + // 获取工单信息 + List> moduleContentContext = productionDispatchContextStepService.getModuleContentContext(reqBean); + + //封装数据: 班次班组和工单 StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext); - this.sendMessage(reqBean, resultBean); - - //获取生产线的当前班组班次信息 - MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); - // 整合班次加工数量 - List productionStatisticsContext = productionCustomContextStepService.getProductionStatisticsContext(reqBean); - if (CollectionUtils.isEmpty(productionStatisticsContext)) { - productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), - new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", MesPcnExtConstWords.ZERO_STR), - new StationKvBean(MesPcnExtConstWords.COLOR, "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); - } - StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext, productionProcessContext.getWorkCell(), mesProdShiftKvBean); - this.sendMessage(reqBean, shiftCountBean); + //封装当前班组班次信息 + MesProdShiftContext mesProdShiftKvBean = prodShiftRecordService.getMesProdShiftKvBean(prodShiftDataContext); + //封装工位展示的客制化信息 (优先级: 工位图/视频/柱状图-->加工数) + StationResultBean resultBeanCustom = getStationResultBean(reqBean, productionProcessContext.getWorkCell(), mesProdShiftKvBean); + + if (null == resultBeanCustom) this.sendMessage(reqBean, resultBean); + else this.sendMessage(reqBean, new StationResultBean().busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()).addStationResultBeans(resultBean).addStationResultBeans(resultBeanCustom)); //验证工位是否锁定 reqBean.getDataMap().put(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_INIT_MODULE.getCode(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()); @@ -126,65 +134,61 @@ public class MesProductionNoSortModuleService extends BaseModuleService { return resultBean; } - private StationResultBean getStationResultBean(StationRequestBean reqBean, List productionStatisticsContext, MesWorkCell mesWorkCell, MesProdShiftContext mesProdShiftKvBean) { + //封装工位展示的客制化信息(优先级: 工位图/视频/柱状图-->加工数) + private StationResultBean getStationResultBean(StationRequestBean reqBean, MesWorkCell workCell, MesProdShiftContext mesProdShiftKvBean) { + StationResultBean resultBean = new StationResultBean(); resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()); - String dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); - JSONObject reqJson = new JSONObject(); - String url = ""; - - List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); - - List> orderQtyKvBeans = new ArrayList<>(); - if (!StringUtils.isEmpty(mesWorkCell.getFileId())) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL); - DdlPreparedPack.getNumEqualPack(Long.parseLong(mesWorkCell.getFileId()), MesPcnExtConstWords.ID, packBean); - MesFile mesFile = mesFileRepository.getByProperty(packBean); - if (mesFile != null) { - url = mesFile.getFileUrl(); - } - } - if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); - List workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), mesWorkCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode()); + //验证是否展示柱状图 + if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && workCell.getIsShowMsg().compareTo(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue()) == 0) { + List workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), workCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode()); + List> stationKvBeans = new ArrayList<>(); if (CollectionUtils.isEmpty(workOrderList)) { - StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), + StationKvBeanUtil.addStationKvBeanList(stationKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", MesPcnExtConstWords.ZERO_STR), new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR)); } else { Double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); Double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); - StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), + StationKvBeanUtil.addStationKvBeanList(stationKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty.toString()), new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty.toString())); } - if (!CollectionUtils.isEmpty(productionPartContextList)) { - + resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue()); + resultBean.setResultList(stationKvBeans); + return resultBean; + } + //判断是否配置的是展示文件 + String url = null; + if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && !StringUtils.isEmpty(MesExtEnumUtil.WORK_FILE_TYPE.valueOfDescription(workCell.getIsShowMsg()))) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getNumEqualPack(Long.parseLong(workCell.getFileId()), MesPcnExtConstWords.ID, packBean); + MesFile mesFile = mesFileRepository.getByProperty(packBean); + url = (null != mesFile && !StringUtils.isEmpty(mesFile.getFileUrl())) ? mesFile.getFileUrl() : null; + if (!StringUtils.isEmpty(url)) { + JSONObject reqJson = new JSONObject(); + if (workCell.getIsShowMsg().compareTo(MesExtEnumUtil.WORK_FILE_TYPE.WORK_CELL_PICTURE.getValue()) == 0) resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.IMAGE.getValue()); + else resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.VIDEO.getValue()); + reqJson.put(MesPcnExtConstWords.URL, url); + resultBean.setResultObj(reqJson); + return resultBean; } - resultBean.setResultList(orderQtyKvBeans); - } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.VIDEO.getValue(); - reqJson.put(MesPcnExtConstWords.URL, url); - resultBean.setResultObj(reqJson); - } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.WORK_CELL_PICTURE.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.IMAGE.getValue(); - reqJson.put(MesPcnExtConstWords.URL, url); - resultBean.setResultObj(reqJson); } - if (Objects.equal(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),mesWorkCell.getIsCountFinish())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue(); + if (StringUtils.isEmpty(url) && !StringUtils.isEmpty(workCell.getIsCountFinish()) && workCell.getIsCountFinish().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) { + //获取上下文工位加工数统计信息 + List productionStatisticsContext = productionCustomContextStepService.getProductionStatisticsContext(reqBean); + if (CollectionUtils.isEmpty(productionStatisticsContext)) productionStatisticsContext = productionCustomContextStepService.getProductionStatisticsContext(mesProdShiftKvBean, MesPcnExtConstWords.ZERO_STR); + resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()); resultBean.setResultList(productionStatisticsContext); + return resultBean; } - resultBean.setDataType(dataType); - resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL); - - - return resultBean; + return null; } @Override diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java index 6c3da5e..8085874 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java @@ -18,6 +18,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder; +import cn.estsh.i3plus.pojo.mes.bean.MesStateMachineStatus; import cn.estsh.i3plus.pojo.mes.model.AttrBean; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; @@ -34,6 +35,7 @@ import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -64,33 +66,47 @@ public class MesProductionSortModuleService extends BaseModuleService { MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getProductionProcessContext(reqBean, false); //配置错误 抛出异常 if (!productionProcessContext.getSuccess()) { - this.sendMessage(reqBean, new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN), String.format("信息: %s!", productionProcessContext.getMessage()), MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE, MesPcnEnumUtil.STATION_DATA_TYPE.TITLE); - this.sendMessage(reqBean, new StationResultBean().writeDbLog(), productionProcessContext.getMessage(), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + this.sendMessage(reqBean, new StationResultBean() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()) + .addStationResultBeans(new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN) + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TITLE.getValue()).message(String.format("信息: %s!", productionProcessContext.getMessage()))) + .addStationResultBeans(new StationResultBean().writeDbLog() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()).message(productionProcessContext.getMessage())) + ); + MesPcnException.throwBusiException(productionProcessContext.getMessage()); } - // 获取工单信息 - List> moduleContentContext = productionDispatchContextStepService.getModuleContentContext(reqBean); - - // 获取产成零件信息 - List productionPartContext = productionDispatchContextStepService.getProductionPartContext(reqBean); - // 排除掉空腔的产成零件 - productionPartContext = CollectionUtils.isEmpty(productionPartContext) ? null : productionPartContext.stream().filter(o -> o.getForeignKey() != null).collect(Collectors.toList()); - //获取班次信息,先查询缓存,缓存没有在查询数据库 List prodShiftDataContext = prodShiftRecordService.getShiftRecordStationKvBeans(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); if (CollectionUtils.isEmpty(prodShiftDataContext)) { - this.sendMessage(reqBean, new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN), "信息: 请先开班!", MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE, MesPcnEnumUtil.STATION_DATA_TYPE.TITLE); - this.sendMessage(reqBean, new StationResultBean().writeDbLog(), "请先开班!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, new StationResultBean() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()) + .addStationResultBeans(new StationResultBean().resultObj(MesPcnExtConstWords.STEP_DISABLE_SCAN) + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.STEP_TITLE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TITLE.getValue()).message("信息: 请先开班!")) + .addStationResultBeans(new StationResultBean().writeDbLog() + .busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE.getValue()).dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()).message("请先开班!")) + ); + MesPcnException.throwBusiException("请先开班!"); } + + // 获取工单信息 + List> moduleContentContext = productionDispatchContextStepService.getModuleContentContext(reqBean); + // 发送班次班组和工单 StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext); - this.sendMessage(reqBean, resultBean); - // 获取当前工位最新修改的完成状态的队列单据数据 并根据其零件生产组代码按生产序号倒序前50条 - resultBean = getStationResultBean(queryQueueOrderTopFiftyProductSeq(reqBean, getNewPartProdGroupCode(reqBean, productionPartContext))); - this.sendMessage(reqBean, resultBean); + // 获取产成零件信息 + List productionPartContext = productionDispatchContextStepService.getProductionPartContext(reqBean); + // 排除掉空腔的产成零件 + productionPartContext = CollectionUtils.isEmpty(productionPartContext) ? null : productionPartContext.stream().filter(o -> !StringUtils.isEmpty(o.getForeignKey())).collect(Collectors.toList()); + + //封装工位展示的客制化信息 (获取当前工位最新修改的完成状态的队列单据数据 并根据其零件生产组代码按生产序号倒序前50条) + StationResultBean resultBeanCustom = getStationResultBean(queryQueueOrderTopFiftyProductSeq(reqBean, getNewPartProdGroupCode(reqBean, productionPartContext))); + + if (null == resultBeanCustom) this.sendMessage(reqBean, resultBean); + else this.sendMessage(reqBean, new StationResultBean().busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.BUSI_LIST.getValue()).addStationResultBeans(resultBean).addStationResultBeans(resultBeanCustom)); //验证工位是否锁定 reqBean.getDataMap().put(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_INIT_MODULE.getCode(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()); @@ -99,9 +115,9 @@ public class MesProductionSortModuleService extends BaseModuleService { } private StationResultBean getStationResultBean(List mesQueueOrderModelList) { + if (CollectionUtils.isEmpty(mesQueueOrderModelList)) return null; return new StationResultBean().busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()) - .customPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL) - .dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()) + .dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).customPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL) .dataAttrList(dataAttrList()).resultList(mesQueueOrderModelList); } @@ -117,9 +133,9 @@ public class MesProductionSortModuleService extends BaseModuleService { private List queryQueueOrderTopFiftyProductSeq(StationRequestBean reqBean, List partProdGroupCodeList) { - if (CollectionUtils.isEmpty(partProdGroupCodeList)) return new ArrayList<>(); + if (CollectionUtils.isEmpty(partProdGroupCodeList)) return null; - List queueOrderModels = new ArrayList<>(); + List queueOrderModelList = null; for (String partProdGroupCode : partProdGroupCodeList) { Pager pager = new Pager(); pager.setStartRow(1); @@ -133,9 +149,8 @@ public class MesProductionSortModuleService extends BaseModuleService { List queueOrderList = queueOrderRepository.findByHqlWherePage(packBean, pager); if (!CollectionUtils.isEmpty(queueOrderList)) { - - boolean isComplete = false; - int index = MesPcnExtConstWords.ONE; + Boolean isComplete = false; + Integer index = MesPcnExtConstWords.ONE; for (MesQueueOrder mesQueueOrder : queueOrderList) { MesQueueOrderModel queueOrderModel = new MesQueueOrderModel(); BeanUtils.copyProperties(mesQueueOrder, queueOrderModel); @@ -145,13 +160,15 @@ public class MesProductionSortModuleService extends BaseModuleService { //跳号标黄色 if (index < queueOrderList.size() && checkJumpNumber(queueOrderList.get(index).getWorkOrderSeq(), mesQueueOrder.getWorkOrderSeq())) color = MesExtEnumUtil.COLOR.YELLOW.getValue(); queueOrderModel.setColor(color); - queueOrderModels.add(queueOrderModel); - index++; + + if (CollectionUtils.isEmpty(queueOrderModelList)) queueOrderModelList = new ArrayList<>(); + queueOrderModelList.add(queueOrderModel); + index ++; } } } - return queueOrderModels; + return queueOrderModelList; } private List getNewPartProdGroupCode(StationRequestBean reqBean, List productionPartContext) { @@ -165,7 +182,6 @@ public class MesProductionSortModuleService extends BaseModuleService { return queueOrder == null ? null : Stream.of(queueOrder.getPartProdGroupCode()).collect(Collectors.toList()); } - private boolean checkJumpNumber(String nextWorkOrderSeq, String currentWorkOrderSeq) { if (StringUtils.isEmpty(nextWorkOrderSeq) || StringUtils.isEmpty(currentWorkOrderSeq) || !CheckTool.isNumber(nextWorkOrderSeq) || !CheckTool.isNumber(currentWorkOrderSeq)) return false; return Integer.parseInt(currentWorkOrderSeq) != Integer.parseInt(nextWorkOrderSeq) + MesPcnExtConstWords.ONE; @@ -192,4 +208,10 @@ public class MesProductionSortModuleService extends BaseModuleService { return resultBean; } + @Override + public boolean execStateModule(StationRequestBean reqBean, List states, Map wcpcMap) { + init(reqBean); + return true; + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java index 2460337..a7a9ced 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java @@ -1,39 +1,29 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; 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.api.busi.IMesWorkOrderExtService; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; -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.BaseSwsService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; -import cn.estsh.i3plus.mes.pcn.util.StationKvBeanUtil; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.mes.bean.MesFile; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; -import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.repository.MesFileRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import com.alibaba.fastjson.JSONObject; -import com.google.common.base.Objects; 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.ArrayList; import java.util.List; -import java.util.StringJoiner; /** * @Description : 清除加工数【按钮】 @@ -48,91 +38,56 @@ public class MesFunctionProductionStatisticsService extends BaseSwsService imple private MesFileRepository mesFileRepository; @Autowired - private IMesWorkOrderExtService workOrderExtService; - - @Autowired - private IMesProductionDispatchContextStepService productionDispatchContextStepService; + private IMesProductionProcessContextStepService productionProcessContextStepService; @Autowired - private IMesProductionProcessContextStepService productionProcessContextStepService; + private IMesProdShiftRecordService prodShiftRecordService; @Override public Boolean doFunction(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) { productionCustomContextStepService.removeProductionStatisticsContext(reqBean); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PICK.getValue()).scanInfo(buttonDynamicModel.getFunctionValue()), String.format("生产线[%s]工位[%s]%s成功!", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), buttonDynamicModel.getButtonName()), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); - // 刷新加工数 - MesProductionProcessContext productionProcessContext = productionProcessContextStepService.getEquipmentVariableList(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PRODUCTION.getValue()); - MesWorkCell mesWorkCell = productionProcessContext.getWorkCell(); - - MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + //重置页面的加工数 + resetStationData(reqBean, productionProcessContextStepService.getProductionProcessContext(reqBean, false).getWorkCell()); - List productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", "0"), - new StationKvBean("color", "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); + return true; - StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell, mesProdShiftKvBean); + } - this.sendMessage(reqBean, shiftCountBean); + //重置页面的加工数 + private void resetStationData(StationRequestBean reqBean, MesWorkCell workCell) { + if (null == workCell) return; - return true; + //如果工位当前配置的是展示柱状图则无须重置加工数 + if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && workCell.getIsShowMsg().compareTo(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue()) == 0) return; - } - private StationResultBean getStationResultBean(StationRequestBean reqBean, List productionStatisticsContext, MesWorkCell mesWorkCell, MesProdShiftContext mesProdShiftKvBean) { - StationResultBean resultBean = new StationResultBean(); - resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()); - String dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); - JSONObject reqJson = new JSONObject(); - String url = ""; - - List> orderQtyKvBeans = new ArrayList<>(); - if (!StringUtils.isEmpty(mesWorkCell.getFileId())) { + //判断是否配置的是展示文件 + String url = null; + if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && !StringUtils.isEmpty(MesExtEnumUtil.WORK_FILE_TYPE.valueOfDescription(workCell.getIsShowMsg()))) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - - DdlPreparedPack.getNumEqualPack(Long.parseLong(mesWorkCell.getFileId()), "id", packBean); + DdlPreparedPack.getNumEqualPack(Long.parseLong(workCell.getFileId()), MesPcnExtConstWords.ID, packBean); MesFile mesFile = mesFileRepository.getByProperty(packBean); - if (mesFile != null) { - url = mesFile.getFileUrl(); - } - } - if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); - List workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), mesWorkCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode()); - if (CollectionUtils.isEmpty(workOrderList)) { - StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), - new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""), - new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", 0 + "")); - } else { - double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); - double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); - - StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), - new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""), - new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty + "")); - } - resultBean.setResultList(orderQtyKvBeans); - } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.VIDEO.getValue(); - reqJson.put("url", url); - resultBean.setResultObj(reqJson); - } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.WORK_CELL_PICTURE.getValue(), mesWorkCell.getIsShowMsg())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.IMAGE.getValue(); - reqJson.put("url", url); - resultBean.setResultObj(reqJson); + url = (null != mesFile && !StringUtils.isEmpty(mesFile.getFileUrl())) ? mesFile.getFileUrl() : null; } - if (Objects.equal(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),mesWorkCell.getIsCountFinish())) { - dataType = MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue(); + //如果不存在文件, 且当前工位配置需要统计加工数的情况下才进行重置加工数 + if (StringUtils.isEmpty(url) && !StringUtils.isEmpty(workCell.getIsCountFinish()) && workCell.getIsCountFinish().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) { + //获取生产线的当前班组班次信息 + MesProdShiftContext mesProdShiftKvBean = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + List productionStatisticsContext = productionCustomContextStepService.getProductionStatisticsContext(mesProdShiftKvBean, MesPcnExtConstWords.ZERO_STR); + + StationResultBean resultBean = new StationResultBean(); + resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()); + resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.TEXT.getValue()); + resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL); resultBean.setResultList(productionStatisticsContext); + this.sendMessage(reqBean, resultBean); } - resultBean.setDataType(dataType); - resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL); - - - return resultBean; } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyGeneratePartNoStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyGeneratePartNoStepService.java index 962be3d..e825e69 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyGeneratePartNoStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyGeneratePartNoStepService.java @@ -184,10 +184,12 @@ public class MesAssemblyGeneratePartNoStepService extends BaseStepService { return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, isEnoughQty ? true : stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN).isCompleted(), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, - String.format("%s装配件条码%s匹配成功!当前扫描的主条码数量[%s]%s设备腔数[%s]!", suffix, assemblySn, productionPsInContextList.size(), isEnoughQty ? "已满足" : "未满足", cellEquipContext.getCavity())); + String.format("%s装配件条码%s匹配成功!当前扫描的主条码数量[%s]%s设备腔数[%s]!", suffix, assemblySn, productionPsInContextList.size(), isEnoughQty ? "已满足" : "未满足", cellEquipContext.getCavity()), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, String.format("装配件条码%s匹配成功!", assemblySn)); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, String.format("装配件条码%s匹配成功!", assemblySn), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortRetrodictStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortRetrodictStepService.java index 02bae7e..ac4d690 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortRetrodictStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortRetrodictStepService.java @@ -184,10 +184,12 @@ public class MesAssemblyMatchNosortRetrodictStepService extends BaseStepService return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, isEnoughQty ? true : stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN).isCompleted(), MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, - String.format("%s装配件条码%s匹配成功!当前扫描的主条码数量[%s]%s设备腔数[%s]!", suffix, assemblySn, productionPsInContextList.size(), isEnoughQty ? "已满足" : "未满足", cellEquipContext.getCavity())); + String.format("%s装配件条码%s匹配成功!当前扫描的主条码数量[%s]%s设备腔数[%s]!", suffix, assemblySn, productionPsInContextList.size(), isEnoughQty ? "已满足" : "未满足", cellEquipContext.getCavity()), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, String.format("装配件条码%s匹配成功!", assemblySn)); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, String.format("装配件条码%s匹配成功!", assemblySn), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java index c1ea8f5..2def437 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchNosortStepService.java @@ -100,7 +100,7 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { if (!isNeedScanAssembly || !hasUnBindAssembly) { return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, (CollectionUtils.isEmpty(productionPsInContextList) || productionPsInContextList.size() >= needQty) ? true : stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN).isCompleted(), - MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, !isNeedScanAssembly ? "当前加工规则未配置装配件扫描项,当前无需匹配装配件条码!" : "当前加工规则对应的装配件扫描项均匹配完毕!"); + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, !isNeedScanAssembly ? "当前加工规则无装配件清单,当前无需匹配装配件条码!" : "当前加工规则对应的装配件清单均匹配完毕!"); } //获取上下文生产扫/读信息:装配件条码 @@ -136,12 +136,16 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { if (!hasUnBindAssembly) { return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult, (CollectionUtils.isEmpty(productionPsInContextList) || productionPsInContextList.size() >= needQty) ? true : stepResult.isCompleted(false).nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_PRODUCT_SN).isCompleted(), - MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("%s当前加工规则对应的装配件扫描项均匹配完毕!", suffix)); + MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("%s当前加工规则对应的装配件清单均匹配完毕!", suffix), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } //单次匹配成功 - if (result) return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), - stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, suffix); + if (result) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), + stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, suffix, + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); + } //匹配失败验证是否重置装配件扫描项 MesWorkCell workCell = productionProcessContext.getWorkCell(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java index 74a0d9a..13604e6 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java @@ -72,11 +72,17 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!"); //判断是否存在装配件清单 - if (!checkIsNeedScanAssembly(prodRuleContextList)) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则未配置装配件扫描项,当前无需匹配装配件条码!"); + if (!checkIsNeedScanAssembly(prodRuleContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则无装配件清单,当前无需匹配装配件条码!"); + } //验证是否存在待绑定数据 Boolean hasUnBindAssembly = hasUnBindAssembly(prodRuleContextList); - if (!hasUnBindAssembly) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则对应的装配件扫描项均匹配完毕!"); + if (!hasUnBindAssembly) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则对应的装配件清单均匹配完毕!"); + } //获取上下文生产扫/读信息:装配件条码 List equipVariableCollectContextList = productionDispatchContextStepService.getScanAssemblySnContext(reqBean); @@ -113,11 +119,17 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { } //验证是否存在待绑定数据 - if (!hasUnBindAssembly) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("%s当前加工规则对应的装配件扫描项均匹配完毕!", suffix)); + if (!hasUnBindAssembly) { + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("%s当前加工规则对应的装配件清单均匹配完毕!", suffix), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); + } //单次匹配成功 - if (result) return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), - stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, suffix); + if (result) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), + stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, suffix, + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); + } stepResult.msg(String.format("装配件条码%s匹配失败!%s", assemblySn, StringUtils.isEmpty(stepResult.getMsg()) ? MesPcnExtConstWords.EMPTY : stepResult.getMsg())); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java index 87756d6..b97e488 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyReadStepService.java @@ -106,8 +106,10 @@ public class MesAssemblyReadStepService extends BaseStepService { List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); //验证当前是否需要读装配件条码: 是否存在装配件清单 - if (!CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedReedAssembly(prodRuleContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("当前加工规则未配置装配件扫描项,无需读设备[%s]装配件条码!", cellEquipContext.getEquipmentName())); + if (!CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedReedAssembly(prodRuleContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("当前加工规则未装配件清单,无需读设备[%s]装配件条码!", cellEquipContext.getEquipmentName())); + } //获取生产过程上下文对象有异常信息 抛出异常 if (!productionProcessContextStepService.getEquipmentVariableCfgList(productionProcessContext).getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java index e0dd654..fc20a1b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblySaveStepService.java @@ -25,10 +25,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; /** @@ -78,6 +75,12 @@ public class MesAssemblySaveStepService extends BaseStepService { if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!"); + //判断是否存在装配件清单 + if (!checkIsNeedScanAssembly(prodRuleContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则无装配件清单,当前无需保存装配件记录!"); + } + //获取上下文产出条码数据信息集合 List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); @@ -101,6 +104,12 @@ public class MesAssemblySaveStepService extends BaseStepService { } + //判断是否存在装配件清单 + private Boolean checkIsNeedScanAssembly(List prodRuleContextList) { + Optional optional = prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getAssemblyDataJson()))).findFirst(); + return (null == optional || !optional.isPresent()) ? false : true; + } + private void saveProductionAssemblyData(StationRequestBean reqBean, List productSnIdList, MesProductionProcessContext productionProcessContext, MesProdRuleContext prodRuleContext, Map ppMap, MesCellEquipContext cellEquipContext, MesScanMonitorContext scanMonitorContext) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java index c55acaf..f4da625 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java @@ -86,19 +86,25 @@ public class MesAssemblyScanStepService extends BaseStepService { Integer busiType = getBusiType(productionPsInContextListNoFinishCode, prodRuleContextList); //验证场景1 当前是否需要扫描装配件条码: 是否存在装配件清单 【当前验证只能对内部触发生效】 - if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedScanAssembly(prodRuleContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则未配置装配件扫描项,当前无需扫描装配件条码!"); + if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedScanAssembly(prodRuleContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则无装配件清单,当前无需扫描装配件条码!"); + } //场景1 处理装配件的装配爆炸图和音频文件 if (busiType == BUSI_TYPE.ONE.value) doHandleAssemblyFile(reqBean, productionProcessContext.getWorkCenter(), prodRuleContextList); //验证场景1 当前是否需要扫描装配件条码: 验证是否存在待绑定数据 【当前验证只能对内部触发生效】 - if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !hasUnBindAssembly(prodRuleContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则对应的装配件清单已扫描完毕,当前无需扫描装配件条码!"); + if (busiType == BUSI_TYPE.ONE.value && !CollectionUtils.isEmpty(prodRuleContextList) && !hasUnBindAssembly(prodRuleContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则对应的装配件清单已扫描完毕,当前无需扫描装配件条码!"); + } //验证场景3的当前未匹配的主条码是否是空腔码 - if (busiType == BUSI_TYPE.THREE.value && CollectionUtils.isEmpty(curProductionPsInContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前主条码对应的装配件清单已扫描完毕,当前无需扫描装配件条码!"); + if (busiType == BUSI_TYPE.THREE.value && CollectionUtils.isEmpty(curProductionPsInContextList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前主条码对应的装配件清单已扫描完毕,当前无需扫描装配件条码!"); + } if (StringUtils.isEmpty(scanInfo)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描装配件条码!"); @@ -274,9 +280,9 @@ public class MesAssemblyScanStepService extends BaseStepService { ONE(1, "唯一加工规则场景或排序线"),//通过 产出零件 + 进料条码零件 + 设备 找到唯一的非排序产品加工规则, 产出零件与进料条码零件至少存在1个 或者 排序线 - TWO(2, "无进无出扫装配件生成零件号场景"),//产出零件与进料条码零件均不扫描, 直接扫描装配件, 通过生成零件号工步反向匹配非排序产品加工规则 + TWO(2, "无出无进扫装配件,非排序无显示装配件匹配场景"),//产出零件与进料条码零件均不扫描, 直接扫描装配件, 通过非排序无显示装配件匹配工步反向匹配非排序产品加工规则 - THREE(3, "有进未匹配加工规则扫装配件生成零件号场景");//产出零件不扫描, 扫描进料条码零件 + 设备 会对应多个非排序产品加工规则, 通过扫描装配件, 生成零件号工步反向匹配非排序产品加工规则, 将匹配的规则再匹配进料条码零件 + THREE(3, "无出有进扫装配件,非排序无显示装配件匹配场景");//产出零件不扫描, 扫描进料条码零件, 扫描装配, 通过非排序无显示装配件匹配工步反向匹配非排序产品加工规则, 将匹配的规则再匹配进料条码零件 private Integer value; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepServiceBak.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepServiceBak.java index 82b5b64..33b5616 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepServiceBak.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepServiceBak.java @@ -74,7 +74,7 @@ public class MesAssemblyScanStepServiceBak extends BaseStepService { //验证当前是否需要扫描装配件条码: 是否存在装配件清单 【当前验证只能对内部触发生效】 if (!CollectionUtils.isEmpty(prodRuleContextList) && !checkIsNeedScanAssembly(prodRuleContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则未配置装配件扫描项,当前无需扫描装配件条码!"); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则无配置装配件清单,当前无需扫描装配件条码!"); //处理装配件的装配爆炸图和音频文件 doHandleAssemblyFile(reqBean, productionProcessContext.getWorkCenter(), prodRuleContextList); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java index b660cc8..8eab749 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowNosortStepService.java @@ -110,9 +110,11 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } //显示装配件信息 - showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList); + Boolean isShow = showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList); - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "装配件扫描项已查询完毕,请查看!"); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, + isShow ? "已显示装配件清单,请查看!" : "当前腔匹配的加工规则无装配件清单!", + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } private StepResult doHandleProdRuleData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, MesWorkCenter workCenter, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, @@ -455,6 +457,8 @@ public class MesAssemblyShowNosortStepService extends BaseStepService { } + if (CollectionUtils.isEmpty(allAssemblyList)) return false; + //获取前端置顶信息 【sourceId&MatchDatetime】 String topRowInfo = getTopRowInfo(allAssemblyList); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java index 9a84aa3..aba1cfa 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java @@ -104,10 +104,11 @@ public class MesAssemblyShowSortStepService extends BaseStepService { } //显示装配件信息 - if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList)) - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "当前未查询到相关的装配件清单"); + Boolean isShow = showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList); - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "显示装配件扫描项成功!"); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, + isShow ? "已显示装配件清单,请查看!" : "当前腔匹配的加工规则无装配件清单!", + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java index 5c0ba2f..65f14b2 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnGenerateStepService.java @@ -1,7 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; -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.apiservice.serviceimpl.step.method.MesPartDataMapSaveStepService; @@ -54,9 +54,6 @@ public class MesProductSnGenerateStepService extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - - @Autowired private MesPartDataMapSaveStepService partDataMapSaveStepService; @Autowired @@ -74,6 +71,9 @@ public class MesProductSnGenerateStepService extends BaseStepService { @Autowired private IFsmRouteDataService fsmRouteDataService; + @Autowired + private IMesProdShiftRecordService prodShiftRecordService; + @Override public StepResult execute(StationRequestBean reqBean) { @@ -105,7 +105,7 @@ public class MesProductSnGenerateStepService extends BaseStepService { if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在加工规则信息,请重置工序解决!"); //获取生产线的当前班组班次信息 - MesProdShiftContext prodShiftContext = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext prodShiftContext = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); if (null == prodShiftContext) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在生产开班记录,请重新开班!"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintNosortStepService.java index a602f3d..2d6575d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintNosortStepService.java @@ -138,6 +138,11 @@ public class MesProductSnPrintNosortStepService extends BaseStepService { } } + if (CollectionUtils.isEmpty(printModelList) && CollectionUtils.isEmpty(resultMapList)) { + return stepDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, true, + MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "当前加工规则无需执行打印!"); + } + //前端接收到busiTyep是customComponent,并且 dataType是file类型的消息,就需要打印后续消息里的数据,一个模板对应多个打印数据 resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.CUSTOM_COMPONENT.getValue()); resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.FILE.getValue()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java index a9103c9..e37e7da 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java @@ -109,16 +109,11 @@ public class MesProductSnPrintSortStepService extends BaseStepService { // 根据工单号获取工单信息 MesWorkOrder workOrder = workOrderMap.get(sn.getWorkOrderNo()); - if (workOrder == null) { - log.error("MesCustSnPrintStepService --- exec --- 工单号:{}无效", sn.getWorkOrderNo()); - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号:{}无效!", sn.getWorkOrderNo())); - continue; - } - - if ((partDataContext == null) || (!partDataContext.containsKey(workOrder.getPartNo()))) { - log.error("MesCustSnPrintStepService --- exec --- 工单号:{}零件{}丢失缓存", sn.getWorkOrderNo(), sn.getPartNo()); + if (null == workOrder) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号:{}无效!", sn.getWorkOrderNo())); + + if (CollectionUtils.isEmpty(partDataContext) || !partDataContext.containsKey(workOrder.getPartNo())) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]丢失零件信息缓存!", sn.getWorkOrderNo(), sn.getPartNo())); - } + MesPart mesPart = partDataContext.get(sn.getPartNo()); String custMatchRule = StringUtils.isEmpty(mesPart.getCustMatchRule()) ? "WH_CUST_SN_RULE" : mesPart.getCustMatchRule(); @@ -126,25 +121,18 @@ public class MesProductSnPrintSortStepService extends BaseStepService { DdlPreparedPack.getStringEqualPack(custMatchRule, MesPcnExtConstWords.RULE_CODE, packBean); MesNumberRule numberRule = numberRuleRepository.getByProperty(packBean); - if (numberRule == null) { - log.error("MesCustSnPrintStepService --- exec --- 客户条码编码规则[WH_CUST_SN_RULE]无效"); - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]客户条码编码规则[%s]无效!", sn.getWorkOrderNo(), sn.getPartNo(), custMatchRule)); - } + if (null == numberRule) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]客户条码编码规则[%s]无效!", sn.getWorkOrderNo(), sn.getPartNo(), custMatchRule)); // 从物料信息中获取标签模板 String labelTemplateCode = partDataContext.get(sn.getPartNo()).getCustLabelTemplate(); - if (labelTemplateCode == null) { - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]未在ERP物料信息维护打印模板,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo())); - } + if (null == labelTemplateCode) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]未在ERP物料信息维护打印模板,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo())); MesProduceSnPrintModel mesProduceSnPrintModel = new MesProduceSnPrintModel(); // 查模板代码 MesLabelTemplate labelTemplate = mesTemplateService.getLabelTemplate(labelTemplateCode, organizeCode); - if (labelTemplate == null) { - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]无效,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); - } + if (null == labelTemplate) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]无效,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); mesProduceSnPrintModel.setMesLabelTemplate(labelTemplate); mesProduceSnPrintModel.setPrinter(partDataContext.get(sn.getPartNo()).getProductPrinterCode()); @@ -155,11 +143,9 @@ public class MesProductSnPrintSortStepService extends BaseStepService { //根据反射获取策略类--封装打印数据 String methodCode = labelTemplate.getMethodCode(); //模板信息丢失抛出异常 - if (StringUtils.isEmpty(methodCode)) { - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]的反射类丢失,请配置!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); - } + if (StringUtils.isEmpty(methodCode)) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]的反射类丢失,请配置!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); + IPrintTemplateStrategyService strategyService = (IPrintTemplateStrategyService) SpringContextsUtil.getBean(methodCode); - // GenSerialNoModel model , MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep MesProduceSnPrintModel printModel = strategyService.execute(null, mesProduceSnPrintModel, numberRule, stepResult, reqBean, true); resultMap.addAll(printModel.getPrintContextList()); snLogList.add(getMesPrintedSnLog(reqBean, workOrder, JSONObject.toJSONString(printModel.getPrintContextList().iterator().next().get(MesPcnExtConstWords.TEMPLATE_DATA)))); @@ -192,13 +178,17 @@ public class MesProductSnPrintSortStepService extends BaseStepService { private Map getMesWorkOrderMap(StationRequestBean reqBean, List productionPartContextList) { // 从产成物料上下文中获取 工单号集合 - List workOrderNoList = productionPartContextList.stream().map(MesProductionPartContext::getWorkOrderNo).distinct().collect(Collectors.toList()); + List workOrderNoList = (productionPartContextList.stream().filter(o -> + (null != o && !StringUtils.isEmpty(o.getForeignKey()))).map(MesProductionPartContext::getWorkOrderNo).collect(Collectors.toList())).stream().filter(o -> !StringUtils.isEmpty(o) + ).distinct().collect(Collectors.toList()); DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); - DdlPreparedPack.getInPackList(workOrderNoList, MesPcnExtConstWords.WORK_ORDER_NO, packBean); + if (workOrderNoList.size() == 1) DdlPreparedPack.getStringEqualPack(workOrderNoList.get(0), MesPcnExtConstWords.WORK_ORDER_NO, packBean); + else DdlPreparedPack.getInPackList(workOrderNoList, MesPcnExtConstWords.WORK_ORDER_NO, packBean); List workOrderList = workOrderRepository.findByHqlWhere(packBean); // 根据工单号分组 - return workOrderList.stream().collect(Collectors.toMap(MesWorkOrder::getWorkOrderNo, Function.identity(), (x, y) -> y)); + return CollectionUtils.isEmpty(workOrderList) ? null : + workOrderList.stream().collect(Collectors.toMap(MesWorkOrder::getWorkOrderNo, Function.identity(), (x, y) -> y)); } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnSaveStepService.java index 34af48d..47efa99 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnSaveStepService.java @@ -1,7 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; -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.apiservice.serviceimpl.step.method.MesPartDataMapSaveStepService; @@ -49,9 +49,6 @@ public class MesProductSnSaveStepService extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - - @Autowired private MesPartDataMapSaveStepService partDataMapSaveStepService; @Autowired @@ -60,6 +57,9 @@ public class MesProductSnSaveStepService extends BaseStepService { @Autowired private MesProduceSnRepository produceSnRepository; + @Autowired + private IMesProdShiftRecordService prodShiftRecordService; + @Override public StepResult execute(StationRequestBean reqBean) { @@ -82,7 +82,7 @@ public class MesProductSnSaveStepService extends BaseStepService { if (CollectionUtils.isEmpty(productionPsOutContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产出零件条码信息,请重置工序解决!"); //获取生产线的当前班组班次信息 - MesProdShiftContext prodShiftContext = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext prodShiftContext = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); if (null == prodShiftContext) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在生产开班记录,请重新开班!"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoScanStepService.java index 6cd6ad2..08039ae 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoScanStepService.java @@ -10,6 +10,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.StationKvBeanUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.MesPart; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; @@ -82,7 +83,7 @@ public class MesProductionPartNoScanStepService extends BaseStepService { if (CollectionUtils.isEmpty(chooseCavityPart) && StringUtils.isEmpty(scanInfo)) stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描产成零件!"); - List productionPartContextList = null; + List productionPartContextList; List readList; List partNoList; String cellMessageSorce = null; @@ -152,7 +153,7 @@ public class MesProductionPartNoScanStepService extends BaseStepService { if (cellEquipContext.getCavity().compareTo(productionPartContextList.size()) > 0) return stepDynamicsCompleteAndSendMsgReturn( reqBean, resultBean.writeDbLog().scanInfo(scanInfo), stepResult, false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, - String.format("当前%s验证成功,已知腔数[%s],还需要再连续扫描[%s]次加工单!", suffix, cellEquipContext.getCavity(), cellEquipContext.getCavity() - productionPartContextList.size())); + String.format("当前%s验证成功,已知腔数[%s],还需要再连续扫描[%s]次产成零件!", suffix, cellEquipContext.getCavity(), cellEquipContext.getCavity() - productionPartContextList.size())); } //存储展示组件MODULE_CONTENT内容 diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java index 3d4212e..5feb21d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionRecordGenerateStepService.java @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; 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; @@ -56,6 +57,9 @@ public class MesProductionRecordGenerateStepService extends BaseStepService { @Autowired private IMesProductionRecordService productionRecordService; + @Autowired + private IMesProdShiftRecordService prodShiftRecordService; + //当前非排序线, 排序线有差异 @Override public StepResult execute(StationRequestBean reqBean) { @@ -106,7 +110,8 @@ public class MesProductionRecordGenerateStepService extends BaseStepService { if (Objects.equal(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), workCell.getIsCountFinish())) { // 保存班次加工数量上下文 - Integer amount = productionCustomContextStepService.dispatchProductionStatisticsContext(reqBean, productionPsOutContextList.size()); + MesProdShiftContext mesProdShiftKvBean = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + Integer amount = productionCustomContextStepService.dispatchProductionStatisticsContext(reqBean, productionPsOutContextList.size(), mesProdShiftKvBean); this.sendMessage(reqBean, new StationResultBean().writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), String.format("生产线[%s]工位[%s]当前累加数[%s]已累计加工数[%s]", reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), productionPsOutContextList.size(), amount), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java index d8cd1f7..2e9b57d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService.java @@ -2,8 +2,8 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentProdParamCfgService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipVariableRwExtService; -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.*; @@ -46,9 +46,6 @@ public class MesSendEquipParamsCmdStepService extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - - @Autowired private IMesEquipmentProdParamCfgService equipmentProdParamCfgService; @Autowired @@ -57,6 +54,9 @@ public class MesSendEquipParamsCmdStepService extends BaseStepService { @Autowired private IMesEquipmentExtService equipmentExtService; + @Autowired + private IMesProdShiftRecordService prodShiftRecordService; + @Override public StepResult execute(StationRequestBean reqBean) { @@ -107,7 +107,7 @@ public class MesSendEquipParamsCmdStepService extends BaseStepService { List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); List productionPsInContexts = productionDispatchContextStepService.getProductionPsInContext(reqBean); List productionPsOutContexts = productionDispatchContextStepService.getProductionPsOutContext(reqBean); - MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext mesProdShiftKvBean = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); //发送设备加工参数 prodRuleContextList.stream().filter(o -> null != o).forEach(o -> { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService2.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService2.java index 1287d9a..fcfa0f0 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService2.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesSendEquipParamsCmdStepService2.java @@ -2,8 +2,8 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentProdParamCfgService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipVariableRwExtService; -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.*; @@ -46,9 +46,6 @@ public class MesSendEquipParamsCmdStepService2 extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - - @Autowired private IMesEquipmentProdParamCfgService equipmentProdParamCfgService; @Autowired @@ -57,6 +54,9 @@ public class MesSendEquipParamsCmdStepService2 extends BaseStepService { @Autowired private IMesEquipmentExtService equipmentExtService; + @Autowired + private IMesProdShiftRecordService prodShiftRecordService; + @Override public StepResult execute(StationRequestBean reqBean) { @@ -107,7 +107,7 @@ public class MesSendEquipParamsCmdStepService2 extends BaseStepService { List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); List productionPsInContexts = productionDispatchContextStepService.getProductionPsInContext(reqBean); List productionPsOutContexts = productionDispatchContextStepService.getProductionPsOutContext(reqBean); - MesProdShiftContext mesProdShiftKvBean = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext mesProdShiftKvBean = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); //发送设备加工参数 prodRuleContextList.stream().filter(o -> null != o).forEach(o -> { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java index 7f841d5..9dc1ede 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java @@ -1,13 +1,14 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; +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.*; -import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesWorkOrderCutDetailModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.actor.shipping.dispatch.IFsmRouteDataService; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; -import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; import cn.estsh.i3plus.mes.pcn.util.StringUtil; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -15,12 +16,13 @@ import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.*; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.model.StepResult; -import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderCutDetailRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderCutRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; @@ -54,9 +56,6 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { private IMesProductionDispatchContextStepService productionDispatchContextStepService; @Autowired - private IMesProductionCustomContextStepService productionCustomContextStepService; - - @Autowired private MesWorkOrderCutRepository workOrderCutRepository; @Autowired @@ -69,10 +68,10 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { private IFsmRouteDataService fsmRouteDataService; @Autowired - private MesProductionAssemblyRepository productionAssemblyRepository; + private MesWorkOrderCutDetailRepository workOrderCutDetailRepository; @Autowired - private MesWorkOrderCutDetailRepository workOrderCutDetailRepository; + private IMesProdShiftRecordService prodShiftRecordService; @Override public StepResult execute(StationRequestBean reqBean) { @@ -88,11 +87,6 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { //存储生产过程上下文对象 productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); - ////获取上下文生产扫/读信息:加工单 - //List equipVariableCollectContextList = productionDispatchContextStepService.getScanWorkOrderNoContext(reqBean); - // - //String cutWorkOrderNo = equipVariableCollectContextList.get(0).getEquipVariableValue(); - //看是否修改裁片工单状态 //获取上下文进料零件条码信息集合 List productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean); @@ -121,7 +115,7 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { MesWorkCell workCell = productionProcessContext.getWorkCell(); //获取生产线的当前班组班次信息 - MesProdShiftContext prodShiftContext = productionCustomContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext prodShiftContext = prodShiftRecordService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); // 无进料条码则生成条码 if (CollectionUtils.isEmpty(productionPsInContextList)) { @@ -193,9 +187,6 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { new String[]{MesPcnExtConstWords.PRODUCT_SN, MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME}, new Object[]{cutWorkOrderNo, reqBean.getUserInfo(), TimeTool.getNowTime(true)}); - // 新增装配件加工记录 - //saveProductionAssembly(reqBean, productionProcessContext, cellEquipContext, mesProdRuleContext, productionPsOutContext); - } //保存上下文产出条码数据信息集合 @@ -218,11 +209,6 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { if (productionPsOutContext == null) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("产出零件号[%s]不存在,请重置工序解决!", mesProductionPartContext.getPartNo())); - //MesProdRuleContext mesProdRuleContext = prodRuleContextMapByOutPartNo.get(mesProductionPartContext.getPartNo()); - - // 新增装配件加工记录 - //saveProductionAssembly(reqBean, productionProcessContext, cellEquipContext, mesProdRuleContext, productionPsOutContext); - } } @@ -267,51 +253,6 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { } - - private void saveProductionAssembly(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, - MesCellEquipContext cellEquipContext, MesProdRuleContext mesProdRuleContext, - MesProductionPsOutContext productionPsOutContext) { - - MesProductionAssembly productionAssembly = new MesProductionAssembly(); - - productionAssembly.setAssemblySn(""); - productionAssembly.setDataSource(MesExtEnumUtil.PRODUCTION_ASSEMBLY_DATA_SOURCE.NOSORT.getValue()); - productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); - productionAssembly.setIsSkip(CommonEnumUtil.FALSE); - - productionAssembly.setAreaCode(reqBean.getAreaCode()); - productionAssembly.setWorkCenterCode(reqBean.getWorkCenterCode()); - productionAssembly.setWorkCellCode(reqBean.getWorkCellCode()); - productionAssembly.setProcessCode(reqBean.getProcessCode()); - - productionAssembly.setProcessName(productionProcessContext.getProcessName()); - productionAssembly.setCraftCode(productionProcessContext.getCraftCode()); - productionAssembly.setCraftName(productionProcessContext.getCraftName()); - - productionAssembly.setEquipmentCode(cellEquipContext.getEquipmentCode()); - - productionAssembly.setProductionRecordId(mesProdRuleContext.getProductionRecordId()); - productionAssembly.setMouldNo(mesProdRuleContext.getMouldNo()); - - if (null != productionPsOutContext) { - productionAssembly.setPartNo(productionPsOutContext.getPartNo()); - productionAssembly.setPartName(productionPsOutContext.getPartName()); - productionAssembly.setSerialNumber(productionPsOutContext.getSerialNumber()); - productionAssembly.setProductSn(productionPsOutContext.getProductSn()); - productionAssembly.setCustSn(productionPsOutContext.getCustSn()); - } - - MesScanMonitorContext scanMonitorContext = productionProcessContextStepService.dispatchScanMonitorContext(reqBean, true); - if (null != scanMonitorContext) productionAssembly.setMouldRecordId(scanMonitorContext.getMouldRecordId()); - - productionAssembly.setOrganizeCode(reqBean.getOrganizeCode()); - ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo()); - - productionAssembly.setFid(UUID.randomUUID().toString()); - - productionAssemblyRepository.insert(productionAssembly); - } - private void updateWorkOrderCutStatus(StationRequestBean reqBean, String cutWorkOrderNo, Integer status) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(cutWorkOrderNo, MesPcnExtConstWords.CUT_WORK_ORDER_NO, packBean); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java index 7a1d6d5..4023d86 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionCustomContextStepService.java @@ -14,7 +14,6 @@ import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import com.alibaba.fastjson.JSONObject; -import com.google.common.base.Objects; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -110,22 +109,6 @@ public class MesProductionCustomContextStepService extends BaseStepService imple this.sendMessage(reqBean, resultBean); } - //获取生产线的当前班组班次信息 - @Override - public MesProdShiftContext getMesProdShiftKvBean(String organizeCode, String workCenterCode) { - - List stationKvBeans = getProdShiftDataContext(organizeCode, workCenterCode); - if (CollectionUtils.isEmpty(stationKvBeans)) return null; - - StationKvBean shiftGroupKvBean = stationKvBeans.stream().filter(stationKvBean -> Objects.equal(stationKvBean.getKey(), MesPcnExtConstWords.SHIFT_GROUP)).findFirst().orElse(null); - StationKvBean shiftCodeKvBean = stationKvBeans.stream().filter(stationKvBean -> Objects.equal(stationKvBean.getKey(), MesPcnExtConstWords.SHIFT_CODE)).findFirst().orElse(null); - - MesProdShiftContext mesProdShiftContext = new MesProdShiftContext(); - mesProdShiftContext.setShiftCode(shiftGroupKvBean == null ? null : shiftCodeKvBean.getValue()); - mesProdShiftContext.setShiftGroup(shiftCodeKvBean == null ? null : shiftGroupKvBean.getValue()); - return mesProdShiftContext; - } - //开班信息KEY 【PS:生产线级别】 private String getProdShiftContextKey(String orgainzeCode, String workCenterCode) { return new StringJoiner(MesPcnExtConstWords.COLON).add(orgainzeCode).add(MesPcnExtConstWords.PROD_SHIFT_DATA_CONTEXT).add(workCenterCode).toString(); } @@ -166,6 +149,13 @@ public class MesProductionCustomContextStepService extends BaseStepService imple return !StringUtils.isEmpty(productionStatisticsJson) ? JSONObject.parseArray(productionStatisticsJson, StationKvBean.class) : null; } + //封装加工数信息 + @Override + public List getProductionStatisticsContext(MesProdShiftContext mesProdShiftKvBean, String countStr) { + return StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), + new StationKvBean(mesProdShiftKvBean.getShiftGroup(), "加工数", countStr), new StationKvBean(MesPcnExtConstWords.COLOR, "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); + } + //保存上下文工位加工数统计信息 [JSON]List @Override public Boolean dispatchProductionStatisticsContext(StationRequestBean reqBean, List productionStatisticsList) { @@ -180,9 +170,9 @@ public class MesProductionCustomContextStepService extends BaseStepService imple } @Override - public Integer dispatchProductionStatisticsContext(StationRequestBean reqBean, int count) { + public Integer dispatchProductionStatisticsContext(StationRequestBean reqBean, int count, MesProdShiftContext mesProdShiftKvBean) { - MesProdShiftContext mesProdShiftKvBean = getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + if (null == mesProdShiftKvBean) return null; List stationKvBeans = getProductionStatisticsContext(reqBean); @@ -191,9 +181,7 @@ public class MesProductionCustomContextStepService extends BaseStepService imple amount.set(count); if (CollectionUtils.isEmpty(stationKvBeans)) { - String name = "加工数"; - stationKvBeans = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), - new StationKvBean(mesProdShiftKvBean.getShiftGroup(), name, countStr), new StationKvBean(MesPcnExtConstWords.COLOR, "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); + stationKvBeans = getProductionStatisticsContext(mesProdShiftKvBean, countStr); } else { AtomicReference flag = new AtomicReference<>(false); stationKvBeans.stream().forEach(stationKvBean -> { @@ -203,13 +191,7 @@ public class MesProductionCustomContextStepService extends BaseStepService imple flag.set(true); } }); - - if (!flag.get()) { - String name = "加工数"; - stationKvBeans = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), - new StationKvBean(mesProdShiftKvBean.getShiftGroup(), name, countStr), new StationKvBean(MesPcnExtConstWords.COLOR, "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); - } - + if (!flag.get()) stationKvBeans = getProductionStatisticsContext(mesProdShiftKvBean, countStr); } dispatchProductionStatisticsContext(reqBean, stationKvBeans); From 3a1ddfe31822463d53feaace0068405bc4f4c3b3 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Mon, 16 Dec 2024 14:30:53 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E6=AD=A6=E6=B1=89=E6=B2=B9=E6=BC=86?= =?UTF-8?q?=E7=BA=BF=E6=89=B9=E9=87=8F=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../strategy/WuHanPaintCenterPrintStrategy.java | 103 +++++++++++++++++++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 5 + 2 files changed, 108 insertions(+) create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java new file mode 100644 index 0000000..697a470 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java @@ -0,0 +1,103 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; +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.tool.TimeTool; +import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Description : 武汉 油漆线 条码打印(批量打印) + * @Reference : + * @Author : wangjie + * @CreateDate 2024/9/27 18:25 + * @Modify: + **/ +@Component +@Slf4j +public class WuHanPaintCenterPrintStrategy implements IPrintTemplateStrategyService { + + @Autowired + private ISyncFuncService syncFuncService; + + @Autowired + private SnowflakeIdMaker snowflakeIdMaker; + + @Autowired + private IMesPartService mesPartService; + + @Autowired + private IMesPrintedSnLogService mesPrintedSnLogService; + + @Autowired + private IMesCustomerPartService mesCustomerPartService; + + private static final String SUPPLIER_CODE_DEFAULT = "V280156"; + + @Override + public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { + + if (isStep) return mesProduceSnPrintModel; + + String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + + MesPart mesPart = (!CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesPart.class.getSimpleName())) ? + (MesPart) genSerialNoModel.getDataMap().get(MesPart.class.getSimpleName()) :mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); + + if (null == mesPart) MesPcnException.throwBusiException("物料[%s]信息不存在!", mesProduceSnPrintModel.getPartNo()); + if (StringUtils.isEmpty(mesPart.getPartSnParam())) MesPcnException.throwBusiException("物料[%s]信息未维护[零件条码参数]!", mesProduceSnPrintModel.getPartNo()); + + String nowTime = TimeTool.getNowTime(true); + + //{PREFIX}{SPILTRULE}{PARTSNPARAM}{SPILTRULE}{YEAR}{}{MONTH}{DAY}{SPILTRULE} prefix字段维护成:WuHanPaint spiltRule字段维护成: P,#T,#V280156# + genSerialNoModel.partSnParam(mesPart.getPartSnParam()).year(nowTime.substring(2, 4)); + String qrCode = syncFuncService.syncSerialNo(genSerialNoModel, mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(); + + if (StringUtils.isEmpty(qrCode)) MesPcnException.throwBusiException("根据编码规则[%s]生成条码失败!", numberRule.getRuleCode()); + if (!StringUtils.isEmpty(numberRule.getPrefix())) qrCode.replace(numberRule.getPrefix(), MesPcnExtConstWords.EMPTY); + + String[] barCodeArr = qrCode.split(MesPcnExtConstWords.WELL_NO); + + for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) { + Map printTemplateData = new HashMap<>(); + printTemplateData.put(MesPcnExtConstWords.QR_CODE, qrCode); + if (barCodeArr.length >= 1) printTemplateData.put(MesPcnExtConstWords.PART_SN_PARAM, barCodeArr[0] + MesPcnExtConstWords.WELL_NO); + if (barCodeArr.length >= 2) printTemplateData.put(MesPcnExtConstWords.CREATE_DATE_TIME, barCodeArr[1] + MesPcnExtConstWords.WELL_NO); + if (barCodeArr.length >= 3) printTemplateData.put(MesPcnExtConstWords.SUPPLIER_CODE_L, barCodeArr[2] + MesPcnExtConstWords.WELL_NO); + mesProduceSnPrintModel.getPrintContextList().add(printTemplateData); + } + + //保存打印记录 + MesProduceSnPrintDataModel printDataModel = new MesProduceSnPrintDataModel(); + printDataModel.setBarcode(qrCode); + printDataModel.setPartNo(mesPart.getPartNo()); + printDataModel.setPartName(mesPart.getPartName()); + printDataModel.setPrintDate(nowTime); + printDataModel.setProductDate(TimeTool.getToday()); + printDataModel.setUserName(mesProduceSnPrintModel.getUserName()); + printDataModel.setPrintData(String.format("{%s:%s, %s:%s}", MesPcnExtConstWords.QR_CODE, qrCode, MesPcnExtConstWords.QTY, mesProduceSnPrintModel.getPrintQty())); + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + + return mesProduceSnPrintModel; + } + +} 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 871df7f..c814d29 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 @@ -37,6 +37,7 @@ public class MesPcnExtConstWords { public static final String ORGANIZE_NAME = "ORGANIZE_NAME"; //供应商常量 public static final String SUPPLIER_CODE = "SUPPLIER_CODE"; + public static final String SUPPLIER_CODE_L = "supplierCode"; //获取供应商广州key public static final String SUPPLIER_CODE_NO_SORT_GZ = "SUPPLIER_CODE_NO_SORT_GZ"; // 系统配置代码 @@ -279,6 +280,8 @@ public class MesPcnExtConstWords { public static final String REPORT_TYPE = "reportType"; //发运时间 public static final String SHIPPING_TIME = "shippingTime"; + //零件条码参数 + public static final String PART_SN_PARAM = "partSnParam"; //BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties) @@ -460,6 +463,8 @@ public class MesPcnExtConstWords { public static final String DECIMAL_POINT_ESCAPE = "\\."; //. public static final String DECIMAL_POINT = "."; + // # + public static final String WELL_NO = "#"; // 自动初始化工位按钮URL public static final String AUTO_INIT_WORK_CELL_MODULE_URL = "AUTO_INIT_WORK_CELL_MODULE_URL"; From b024cfd6d4b87f8d2af4ff65946f462911e01161 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Mon, 16 Dec 2024 19:37:52 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=9B=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BE=9D=E7=84=B6=E5=8A=A0=E5=B7=A5=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=8A=A5=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedulejob/MesReportWorkByPreDayJob.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesReportWorkByPreDayJob.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesReportWorkByPreDayJob.java index b71fc0a..fc7800e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesReportWorkByPreDayJob.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesReportWorkByPreDayJob.java @@ -89,20 +89,22 @@ public class MesReportWorkByPreDayJob extends BaseMesScheduleJob { w -> w.getWorkCenterCode().equalsIgnoreCase(mesWorkOrder.getWorkCenterCode()) && w.getPartNo().equalsIgnoreCase(mesWorkOrder.getPartNo())).collect(Collectors.toList()); workOrderService.doPcnJobProductReport(mesProductionRecords, mesShiftList, wmsJobParamModel.getOrganizeCode(), userName, mesWorkOrder); - } - for (MesProductionRecord mesProductionRecord : mesProductionRecordList) { - if(StringUtil.isEmpty(mesProductionRecord.getWorkOrderNo())){ - List collect = mesWorkOrders.stream().filter(w -> w.getWorkCenterCode().equalsIgnoreCase(mesProductionRecord.getWorkCenterCode()) - && w.getPartNo().equalsIgnoreCase(mesProductionRecord.getPartNo())).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(collect)){ - mesProductionRecord.setWorkOrderNo(collect.get(0).getWorkOrderNo()); + + for (MesProductionRecord mesProductionRecord : mesProductionRecords) { + if(StringUtil.isEmpty(mesProductionRecord.getWorkOrderNo())){ + List collect = mesWorkOrders.stream().filter(w -> w.getWorkCenterCode().equalsIgnoreCase(mesProductionRecord.getWorkCenterCode()) + && w.getPartNo().equalsIgnoreCase(mesProductionRecord.getPartNo())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(collect)){ + mesProductionRecord.setWorkOrderNo(collect.get(0).getWorkOrderNo()); + } } + mesProductionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue()); + mesProductionRecord.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); + ConvertBean.serviceModelUpdate(mesProductionRecord, userName); } - mesProductionRecord.setReportStatus(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue()); - mesProductionRecord.setSystemSyncStatus(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); - ConvertBean.serviceModelUpdate(mesProductionRecord, userName); + productionRecordRao.saveAll(mesProductionRecords); } - productionRecordRao.saveAll(mesProductionRecordList); + } catch (ImppBusiException e) { LOGGER.error("产线:{}报工失败:{}", workCenterCode, e.getErrorDetail()); } From 5b22c555e2524c1f8eb58f65a7f757fde7090e58 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Tue, 17 Dec 2024 16:03:05 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E6=AD=A6=E6=B1=89=E6=B2=B9=E6=BC=86?= =?UTF-8?q?=E7=BA=BF=E6=89=B9=E9=87=8F=E6=89=93=E5=8D=B0=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=20=E6=B2=A1=E6=9C=89=E5=8E=BB=E6=8E=89=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E5=88=99=E9=87=8C=E9=9D=A2=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java index 697a470..cf57237 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/WuHanPaintCenterPrintStrategy.java @@ -73,7 +73,7 @@ public class WuHanPaintCenterPrintStrategy implements IPrintTemplateStrategyServ String qrCode = syncFuncService.syncSerialNo(genSerialNoModel, mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(); if (StringUtils.isEmpty(qrCode)) MesPcnException.throwBusiException("根据编码规则[%s]生成条码失败!", numberRule.getRuleCode()); - if (!StringUtils.isEmpty(numberRule.getPrefix())) qrCode.replace(numberRule.getPrefix(), MesPcnExtConstWords.EMPTY); + if (!StringUtils.isEmpty(numberRule.getPrefix())) qrCode = qrCode.replace(numberRule.getPrefix(), MesPcnExtConstWords.EMPTY); String[] barCodeArr = qrCode.split(MesPcnExtConstWords.WELL_NO); From f6326549ae32806d2e994d21e220196b3a557377 Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Tue, 17 Dec 2024 17:08:39 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=2044178=20=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E4=BF=AE=E6=94=B9NC=E5=88=A4=E5=AE=9A=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java index b9aa4bf..e12c19f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java @@ -288,7 +288,10 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { mesPartInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.DISASSEMBLY.getValue()); } mesPartInspection.setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); - ConvertBean.serviceModelUpdate(mesPartInspection, requestModel.getUserName()); + /** + * 修复bug 44178 不要修改NC判定人 + */ +// ConvertBean.serviceModelUpdate(mesPartInspection, requestModel.getUserName()); mesPartInspectionRepository.update(mesPartInspection); } } From 35a7dce7f9357c41b65881be535cb42410721398 Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Wed, 18 Dec 2024 15:10:06 +0800 Subject: [PATCH 08/14] =?UTF-8?q?fix=20bug=2044247=20=20=E8=A3=85=E7=AE=B1?= =?UTF-8?q?=E9=98=B2=E9=94=99=E5=88=86=E5=A4=96=E5=8D=8F=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E8=87=AA=E5=88=B6=E4=BB=B6=EF=BC=8C=E8=87=AA=E5=88=B6=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E5=8F=AF=E4=BB=A5=E4=B8=8D?= =?UTF-8?q?=E7=94=A8=E7=BB=B4=E6=8A=A4=E6=89=AB=E6=8F=8F=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesBoxingErrorProofingService.java | 41 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java index 6c26e92..3f9f064 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java @@ -123,7 +123,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer if (StringUtils.isEmpty(packingDefine.getSplitChar())) { MesPcnException.throwMesBusiException("箱类别代号【%s】分隔符不能为空,请检查数据!", packingDefine.getPackCode()); } - String[] split = mesPackageDetail.getPackageNo().split("\\" + packingDefine.getSplitChar()); + String[] split = mesPackageDetail.getPackageNo().split("\\\\" + packingDefine.getSplitChar()); //获取序列号 checkSerial(packingDefine, split); //工厂校验 @@ -277,9 +277,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer //获取包装定义明细 List defineDetails = getMesPackingDefineDetails(mesPackageDetail.getOrganizeCode(), mesPackage.getPackageSn()); //校验是否包含 - String partNo = getPartNo(mesPackageDetail, mesPackage, defineDetails); +// String partNo = getPartNo(mesPackageDetail, mesPackage, defineDetails); //校验条码信息 - checkSn(mesPackageDetail, packingDefine,partNo); + String partNo = checkSn(mesPackageDetail, packingDefine, mesPackage, defineDetails); //物料信息 return getPart(mesPackageDetail.getOrganizeCode(), partNo); } @@ -387,8 +387,39 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer return saveMesPackageDetail; } - private void checkSn(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine,String partNo) { + private String checkSn(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine,MesPackage mesPackage,List defineDetails ) { List produceSnList = mesProduceSnExtService.getProduceSnList(mesPackageDetail.getOrganizeCode(), mesPackageDetail.getSerialNumber()); + String packageBarcodeRule; + String partNo = null; + if (!produceSnList.isEmpty()){ + /** + * 自制件不需要校验规则 by castle 2024-12-18 bug 44247 + * + */ + partNo = produceSnList.get(0).getPartNo(); + }else { + for (MesPackingDefineDetails defineDetail : defineDetails) { + //条码规则为空 + if (StringUtils.isEmpty(defineDetail.getPackageBarcodeRule())) { + MesPcnException.throwMesBusiException("箱类别代号【%s】零件号【%s】条码规则未维护,请检查数据!", mesPackage.getPackageSn(), defineDetail.getPartNo()); + } + packageBarcodeRule = defineDetail.getPackageBarcodeRule().replace("*", ""); + //包含箱条码 + if (mesPackageDetail.getSerialNumber().contains(packageBarcodeRule)) { + partNo = defineDetail.getPartNo(); + break; + } + } + } + if (Objects.isNull(partNo)) { + MesPcnException.throwMesBusiException("零件条码【%s】未匹配到符合条码规则的数据,请检查数据!", mesPackageDetail.getSerialNumber()); + } + //校验零件是否一致 + if (!partNo.equals(mesPackage.getPartNo())) { + MesPcnException.throwMesBusiException("零件条码【%s】包装定义明细零件【%s】和箱零件【%s】不一致,请检查数据!", mesPackageDetail.getSerialNumber(), partNo, mesPackage.getPartNo()); + } + + if (!CollectionUtils.isEmpty(produceSnList)) { MesProduceSn nextMesProduceSn = produceSnList.stream().sorted(Comparator.comparing(MesProduceSn::getCreateDatetime).reversed()).collect(Collectors.toList()).iterator().next(); if (!MesExtEnumUtil.PRODUCE_SN_STATUS.checkAllowBoxingErrorProofing(nextMesProduceSn.getSnStatus()) || !MesExtEnumUtil.PRODUCE_QC_STATUS.checkAllowBoxingErrorProofing(nextMesProduceSn.getQcStatus())) { @@ -414,6 +445,8 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺【%s】失败,请检查数据!", mesPackageDetail.getSerialNumber(),packingDefine.getCraft()); } } + + return partNo; } private String getPartNo(MesPackageDetail mesPackageDetail, MesPackage mesPackage, List defineDetails) { From dd3dddd97fba0000f9bd943baa75f7692bfa38ea Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 18 Dec 2024 16:04:44 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=20=E6=9F=A5=E8=AF=A2=20=E6=8A=A5=E8=A1=A8=20?= =?UTF-8?q?=20=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20(=E5=A2=9E=E5=8A=A0=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=E7=9A=84=E6=9C=80=E6=96=B0=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E8=B4=A8=E9=87=8F=E7=AD=89=E4=BF=A1=E6=81=AF?= =?UTF-8?q?,=20=E4=BF=AE=E5=A4=8D=E5=8A=A0=E5=B7=A5=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=9B=B6=E4=BB=B6=E7=8A=B6=E6=80=81=E7=A9=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/base/IMesProdOrgExtService.java | 20 ++ .../mes/pcn/api/busi/IMesProduceSnExtService.java | 3 + .../pcn/api/busi/IMesProductionRecordService.java | 8 +- .../controller/busi/MesBusiController.java | 6 +- .../serviceimpl/base/MesProdOrgExtService.java | 73 ++++++- .../serviceimpl/busi/MesProduceSnExtService.java | 12 ++ .../busi/MesProductionRecordService.java | 213 ++++++++++++--------- .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 12 ++ 8 files changed, 252 insertions(+), 95 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdOrgExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdOrgExtService.java index e5b08f3..e9049d1 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdOrgExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesProdOrgExtService.java @@ -1,11 +1,13 @@ package cn.estsh.i3plus.ext.mes.pcn.api.base; +import cn.estsh.i3plus.pojo.mes.bean.MesCraft; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellExtendCfg; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; import io.swagger.annotations.ApiOperation; import java.util.List; +import java.util.Map; public interface IMesProdOrgExtService { @@ -24,6 +26,24 @@ public interface IMesProdOrgExtService { @ApiOperation(value = "根据生产线代码查询工位信息") List getWorkCellList(String organizeCode, String workCenterCode); + @ApiOperation(value = "根据生产线代码查询生产线信息") + List getWorkCenterList(String organizeCode, List workCenterCodeList); + + @ApiOperation(value = "根据生产线代码查询生产线信息") + Map getWorkCenterCodeMap(String organizeCode, List workCenterCodeList); + + @ApiOperation(value = "根据工位代码查询工位信息") + List getWorkCellList(String organizeCode, List workCellCodeList); + + @ApiOperation(value = "根据工位代码查询工位信息") + Map getWorkCellCodeMap(String organizeCode, List workCellCodeList); + + @ApiOperation(value = "根据工艺代码查询工艺信息") + List getCraftList(String organizeCode, List craftCodeList); + + @ApiOperation(value = "根据工艺代码查询工艺信息") + Map getCraftCodeMap(String organizeCode, List craftCodeList); + @ApiOperation(value = "根据子生产线代码,子工位代码,关系类型查询主子工位关系信息") MesWorkCellExtendCfg getWorkCellExtendCfg(String organizeCode, String workCenterCodeBak, String workCellCodeBak, Integer extendType); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java index 9d89691..3948785 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java @@ -18,6 +18,9 @@ public interface IMesProduceSnExtService { @ApiOperation(value = "根据零件条码查询零件条码信息") List getProduceSnList(String organizeCode, String productSn); + @ApiOperation(value = "根据零件条码查询零件条码信息, 创建时间倒序") + List getProduceSnListCreateDatetimeDesc(String organizeCode, String productSn); + @ApiOperation(value = "根据客户条码查询零件条码信息[排序]") MesProduceSn getProduceSnByCustSn(String organizeCode, String custSn); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java index 7d1aad7..3717001 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionRecordService.java @@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi; import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; import cn.estsh.i3plus.pojo.mes.model.MesProductionRecordModel; +import cn.estsh.impp.framework.boot.util.ResultBean; import io.swagger.annotations.ApiOperation; import java.util.List; @@ -18,6 +19,9 @@ public interface IMesProductionRecordService { @ApiOperation(value = "根据零件条码查询加工记录信息") List findProductionRecordList(String organizeCode, String productSn); + @ApiOperation(value = "查询加工记录, 根据完成时间倒序") + List findProductionRecordListCompleteDateTimeDesc(String organizeCode, String productSn); + @ApiOperation(value = "根据零件条码,零件编码查询加工记录信息") List findProductionRecordList(String organizeCode, String productSn, String partNo); @@ -34,8 +38,8 @@ public interface IMesProductionRecordService { void updateProductionRecord(String organizeCode, String userName, Long id, String errorMsg); - @ApiOperation(value = "根据零件条码查询加工记录信息") - List findMesProductionRecordList(String organizeCode, String productSn); + @ApiOperation(value = "查询加工记录信息PDA报表") + ResultBean queryMesProductionRecordReport(String organizeCode, String productSn); @ApiOperation(value = "更新加工记录") void updateProductionRecord(List recordList,String userName,Integer reportStatus,String msg); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesBusiController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesBusiController.java index bf6f2ae..03f802d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesBusiController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesBusiController.java @@ -63,12 +63,12 @@ public class MesBusiController { } @GetMapping("/mesProductionRecord/query") - @ApiOperation(value = "查询加工记录信息") - public ResultBean queryMesProductionRecord(MesProductionRecord mesProductionRecord) { + @ApiOperation(value = "查询加工记录信息PDA报表") + public ResultBean queryMesProductionRecordReport(MesProductionRecord mesProductionRecord) { try { ValidatorBean.checkNotNull(mesProductionRecord.getOrganizeCode(), "工厂代码不能为空"); ValidatorBean.checkNotNull(mesProductionRecord.getProductSn(), "零件条码不能为空"); - return ResultBean.success("查询成功").setResultList(mesProductionRecordService.findMesProductionRecordList(mesProductionRecord.getOrganizeCode(), mesProductionRecord.getProductSn())); + return mesProductionRecordService.queryMesProductionRecordReport(mesProductionRecord.getOrganizeCode(), mesProductionRecord.getProductSn()); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdOrgExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdOrgExtService.java index 77b33e0..30749c1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdOrgExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesProdOrgExtService.java @@ -2,11 +2,14 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable; +import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.MesCraft; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellExtendCfg; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; +import cn.estsh.i3plus.pojo.mes.repository.MesCraftRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellExtendCfgRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellRepository; import cn.estsh.i3plus.pojo.mes.repository.MesWorkCenterRepository; @@ -31,6 +34,9 @@ public class MesProdOrgExtService implements IMesProdOrgExtService { private MesWorkCellRepository workCellRepository; @Autowired + private MesCraftRepository craftRepository; + + @Autowired private MesWorkCellExtendCfgRepository workCellExtendCfgRepository; @Override @@ -77,6 +83,71 @@ public class MesProdOrgExtService implements IMesProdOrgExtService { } @Override + public List getWorkCenterList(String organizeCode, List workCenterCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(workCenterCodeList)) return null; + if (workCenterCodeList.size() != 1) workCenterCodeList = workCenterCodeList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + if (workCenterCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(workCenterCodeList.get(0), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + else DdlPreparedPack.getInPackList(workCenterCodeList, MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + return workCenterRepository.findByHqlWhere(packBean); + } + + @Override + public Map getWorkCenterCodeMap(String organizeCode, List workCenterCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(workCenterCodeList)) return null; + List workCenterList = getWorkCenterList(organizeCode, workCenterCodeList); + if (CollectionUtils.isEmpty(workCenterList)) return null; + workCenterList = workCenterList.stream().filter(o -> null != o).distinct().collect( + Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MesWorkCenter::getWorkCenterCode))), ArrayList::new) + ); + return workCenterList.stream().filter(o -> null != o).collect(Collectors.toMap(MesWorkCenter::getWorkCenterCode, MesWorkCenter::getWorkCenterName)); + } + + @Override + public List getWorkCellList(String organizeCode, List workCellCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(workCellCodeList)) return null; + if (workCellCodeList.size() != 1) workCellCodeList = workCellCodeList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + if (workCellCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(workCellCodeList.get(0), MesPcnExtConstWords.WORK_CELL_CODE, packBean); + else DdlPreparedPack.getInPackList(workCellCodeList, MesPcnExtConstWords.WORK_CELL_CODE, packBean); + return workCellRepository.findByHqlWhere(packBean); + } + + @Override + public Map getWorkCellCodeMap(String organizeCode, List workCellCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(workCellCodeList)) return null; + List workCellList = getWorkCellList(organizeCode, workCellCodeList); + if (CollectionUtils.isEmpty(workCellList)) return null; + workCellList = workCellList.stream().filter(o -> null != o).distinct().collect( + Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing( + o -> new StringJoiner(MesPcnExtConstWords.AND).add(o.getWorkCenterCode()).add(o.getWorkCellCode()).toString()))), ArrayList::new) + ); + return workCellList.stream().filter(o -> null != o).collect(Collectors.toMap( + o -> new StringJoiner(MesPcnExtConstWords.AND).add(o.getWorkCenterCode()).add(o.getWorkCellCode()).toString(), MesWorkCell::getWorkCellName)); + } + + @Override + public List getCraftList(String organizeCode, List craftCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(craftCodeList)) return null; + if (craftCodeList.size() != 1) craftCodeList = craftCodeList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + if (craftCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(craftCodeList.get(0), MesPcnExtConstWords.CRAFT_CODE, packBean); + else DdlPreparedPack.getInPackList(craftCodeList, MesPcnExtConstWords.CRAFT_CODE, packBean); + return craftRepository.findByHqlWhere(packBean); + } + + @Override + public Map getCraftCodeMap(String organizeCode, List craftCodeList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(craftCodeList)) return null; + List craftList = getCraftList(organizeCode, craftCodeList); + if (CollectionUtils.isEmpty(craftList)) return null; + craftList = craftList.stream().filter(o -> null != o).distinct().collect( + Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MesCraft::getCraftCode))), ArrayList::new) + ); + return craftList.stream().filter(o -> null != o).collect(Collectors.toMap(MesCraft::getCraftCode, MesCraft::getCraftName)); + } + + @Override public MesWorkCellExtendCfg getWorkCellExtendCfg(String organizeCode, String workCenterCodeBak, String workCellCodeBak, Integer extendType) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workCenterCodeBak) || StringUtils.isEmpty(workCellCodeBak) || StringUtils.isEmpty(extendType)) return null; return workCellExtendCfgRepository.getByProperty( diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java index 0708879..724d978 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java @@ -11,6 +11,7 @@ import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.repository.MesProduceSnRepository; @@ -49,6 +50,7 @@ public class MesProduceSnExtService implements IMesProduceSnExtService { return produceSnRepository.findByHqlWhere(packBean); } + //根据零件条码查询零件条码信息 @Override public List getProduceSnList(String organizeCode, String productSn) { @@ -60,6 +62,15 @@ public class MesProduceSnExtService implements IMesProduceSnExtService { return produceSnRepository.findByHqlWhere(packBean); } + //根据零件条码查询零件条码信息, 创建时间倒序 + @Override + public List getProduceSnListCreateDatetimeDesc(String organizeCode, String productSn) { + List produceSnList = getProduceSnList(organizeCode, productSn); + if (CollectionUtils.isEmpty(produceSnList)) return produceSnList; + return produceSnList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesProduceSn::getCreateDatetime).reversed()).collect(Collectors.toList()); + } + + //根据客户条码查询零件条码信息[排序] @Override public MesProduceSn getProduceSnByCustSn(String organizeCode, String custSn) { @@ -71,6 +82,7 @@ public class MesProduceSnExtService implements IMesProduceSnExtService { return produceSnRepository.getByProperty(packBean); } + //根据产品条码查询零件条码信息[排序] @Override public MesProduceSn getProduceSn(String organizeCode, String productSn, String workOrderNo) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java index ffd667b..37a5864 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProductionRecordService.java @@ -1,5 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; 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; @@ -7,11 +9,11 @@ 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.*; -import cn.estsh.i3plus.pojo.mes.model.MesProductionRecordModel; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; import cn.estsh.i3plus.pojo.mes.repository.*; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import org.springframework.beans.BeanUtils; +import cn.estsh.impp.framework.boot.util.ResultBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -31,6 +33,12 @@ import java.util.stream.Collectors; public class MesProductionRecordService implements IMesProductionRecordService { @Autowired + private IMesProduceSnExtService produceSnExtService; + + @Autowired + private IMesProdOrgExtService prodOrgExtService; + + @Autowired private MesTimeEfficientCfgRepository timeEfficientCfgRepository; @Autowired @@ -59,6 +67,14 @@ public class MesProductionRecordService implements IMesProductionRecordService { new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), productSn}); } + //查询加工记录, 根据完成时间倒序 + @Override + public List findProductionRecordListCompleteDateTimeDesc(String organizeCode, String productSn) { + List productionRecordList = findProductionRecordList(organizeCode, productSn); + if (CollectionUtils.isEmpty(productionRecordList)) return productionRecordList; + return productionRecordList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesProductionRecord::getCompleteDateTime).reversed()).collect(Collectors.toList()); + } + @Override public List findProductionRecordList(String organizeCode, String productSn, String partNo) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn) || StringUtils.isEmpty(partNo)) return null; @@ -114,30 +130,113 @@ public class MesProductionRecordService implements IMesProductionRecordService { } @Override - public List findMesProductionRecordList(String organizeCode, String productSn) { - List productionRecordList = findProductionRecord(organizeCode, productSn); - List mesProductionRecordModelList = new ArrayList<>(); - if (!CollectionUtils.isEmpty(productionRecordList)) { - //数据查询 - Map craftMap = getStringMesCraftMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getCraftCode).distinct().collect(Collectors.toList())); - Map produceSnMap = getStringMesProduceSnMap(organizeCode, productSn); - Map mesWorkCenterMap = getStringMesWorkCenterMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getWorkCenterCode).distinct().collect(Collectors.toList())); - Map workCellMap = getStringMesWorkCellMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getWorkCellCode).distinct().collect(Collectors.toList())); - //数据组装 - MesProductionRecordModel mesProductionRecordModel = null; - for (MesProductionRecord mesProductionRecord : productionRecordList) { - mesProductionRecordModel = new MesProductionRecordModel(); - BeanUtils.copyProperties(mesProductionRecord, mesProductionRecordModel); - mesProductionRecordModel.setCraftName(Objects.isNull(craftMap) || Objects.isNull(craftMap.get(mesProductionRecord.getCraftCode())) || StringUtils.isEmpty(mesProductionRecord.getCraftCode()) ? "" : craftMap.get(mesProductionRecord.getCraftCode()).getCraftName()); - mesProductionRecordModel.setSnStatus(Objects.isNull(produceSnMap.get(mesProductionRecord.getSerialNumber())) || StringUtils.isEmpty(mesProductionRecord.getSerialNumber()) ? 0 : produceSnMap.get(mesProductionRecord.getSerialNumber()).getSnStatus()); - mesProductionRecordModel.setSnStatusDesc(0 == mesProductionRecordModel.getSnStatus() ?"" : MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesProductionRecordModel.getSnStatus())); - mesProductionRecordModel.setReportStatusDesc(MesExtEnumUtil.REPORT_STATUS.valueOfDescription(mesProductionRecordModel.getReportStatus())); - mesProductionRecordModel.setWorkCenterName(Objects.isNull(mesWorkCenterMap.get(mesProductionRecord.getWorkCenterCode())) || StringUtils.isEmpty(mesProductionRecord.getWorkCenterCode()) ? "" : mesWorkCenterMap.get(mesProductionRecord.getWorkCenterCode()).getWorkCenterName()); - mesProductionRecordModel.setWorkCellName(Objects.isNull(workCellMap.get(mesProductionRecord.getWorkCellCode())) || StringUtils.isEmpty(mesProductionRecord.getWorkCellCode()) ? "" : workCellMap.get(mesProductionRecord.getWorkCellCode()).getWorkCellName()); - mesProductionRecordModelList.add(mesProductionRecordModel); + public ResultBean queryMesProductionRecordReport(String organizeCode, String productSn) { + + //查询条码信息, 根据创建时间倒序 + List produceSnList = produceSnExtService.getProduceSnListCreateDatetimeDesc(organizeCode, productSn); + + if (CollectionUtils.isEmpty(produceSnList)) return ResultBean.fail(String.format("零件条码[%s]信息不存在!", productSn)); + + MesProduceSn produceSnDb = produceSnList.get(0); + + //查询加工记录, 根据完成时间倒序 + List productionRecordList = findProductionRecordListCompleteDateTimeDesc(organizeCode, productSn); + + //查询生产线名称 + Map workCenterCodeMap = getProductionRecordReportCenterMap(organizeCode, produceSnDb.getWorkCenterCode(), productionRecordList); + //查询工位名称 + Map workCellCodeMap = getProductionRecordReportCellMap(organizeCode, produceSnDb.getWorkCellCode(), productionRecordList); + //查询工艺名称 + Map craftCodeMap = getProductionRecordReportCraftMap(organizeCode, produceSnDb.getCraftCode(), productionRecordList); + + Map produceSnMap = new HashMap<>(); + produceSnMap.put(MesPcnExtConstWords.PRODUCT_SN, productSn); + produceSnMap.put(MesPcnExtConstWords.PART_NO, produceSnDb.getPartNo()); + produceSnMap.put(MesPcnExtConstWords.PART_NAME, produceSnDb.getPartName()); + produceSnMap.put(MesPcnExtConstWords.WORK_CENTER_CODE, produceSnDb.getWorkCenterCode()); + produceSnMap.put(MesPcnExtConstWords.WORK_CELL_CODE, produceSnDb.getWorkCellCode()); + produceSnMap.put(MesPcnExtConstWords.CRAFT_CODE, produceSnDb.getCraftCode()); + produceSnMap.put(MesPcnExtConstWords.WORK_CENTER_NAME, getMap2Value(workCenterCodeMap, produceSnDb.getWorkCenterCode())); + produceSnMap.put(MesPcnExtConstWords.WORK_CELL_NAME, getMap2Value(workCellCodeMap, getCellCodeSuffix(produceSnDb.getWorkCenterCode(), produceSnDb.getWorkCellCode()))); + produceSnMap.put(MesPcnExtConstWords.CRAFT_NAME, getMap2Value(craftCodeMap, produceSnDb.getCraftCode())); + produceSnMap.put(MesPcnExtConstWords.SN_STATUS, produceSnDb.getSnStatus()); + produceSnMap.put(MesPcnExtConstWords.QC_STATUS, produceSnDb.getQcStatus()); + produceSnMap.put(MesPcnExtConstWords.SN_STATUS_NAME, MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSnDb.getSnStatus())); + produceSnMap.put(MesPcnExtConstWords.QC_STATUS_NAME, MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(produceSnDb.getQcStatus())); + produceSnMap.put(MesPcnExtConstWords.MODIFY_USER, produceSnDb.getModifyUser()); + produceSnMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, produceSnDb.getModifyDatetime()); + + ResultBean resultBean = ResultBean.success("查询成功!").setResultObject(produceSnMap); + + if (CollectionUtils.isEmpty(productionRecordList)) return resultBean; + + Map> produceSnMap2Part = produceSnList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartNo()))).collect(Collectors.groupingBy(MesProduceSn::getPartNo)); + + List> productionRecordMapList = new ArrayList<>(); + + MesProduceSn produceSnItem; + for (MesProductionRecord productionRecord : productionRecordList) { + if (null == productionRecord) continue; + Map productionRecordMap = new HashMap<>(); + productionRecordMap.put(MesPcnExtConstWords.PRODUCT_SN, productSn); + productionRecordMap.put(MesPcnExtConstWords.PART_NO, productionRecord.getPartNo()); + productionRecordMap.put(MesPcnExtConstWords.PART_NAME, productionRecord.getPartName()); + productionRecordMap.put(MesPcnExtConstWords.WORK_CENTER_CODE, productionRecord.getWorkCenterCode()); + productionRecordMap.put(MesPcnExtConstWords.WORK_CELL_CODE, productionRecord.getWorkCellCode()); + productionRecordMap.put(MesPcnExtConstWords.CRAFT_CODE, productionRecord.getCraftCode()); + productionRecordMap.put(MesPcnExtConstWords.WORK_CENTER_NAME, getMap2Value(workCenterCodeMap, productionRecord.getWorkCenterCode())); + productionRecordMap.put(MesPcnExtConstWords.WORK_CELL_NAME, getMap2Value(workCellCodeMap, getCellCodeSuffix(productionRecord.getWorkCenterCode(), productionRecord.getWorkCellCode()))); + productionRecordMap.put(MesPcnExtConstWords.CRAFT_NAME, getMap2Value(craftCodeMap, productionRecord.getCraftCode())); + if (!CollectionUtils.isEmpty(produceSnMap2Part) && !StringUtils.isEmpty(productionRecord.getPartNo()) && produceSnMap2Part.containsKey(productionRecord.getPartNo())) { + produceSnItem = produceSnMap2Part.get(productionRecord.getPartNo()).get(0); + productionRecordMap.put(MesPcnExtConstWords.SN_STATUS, produceSnItem.getSnStatus()); + productionRecordMap.put(MesPcnExtConstWords.QC_STATUS, produceSnItem.getQcStatus()); + productionRecordMap.put(MesPcnExtConstWords.SN_STATUS_NAME, !StringUtils.isEmpty(produceSnItem.getSnStatus()) ? MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSnItem.getSnStatus()) : MesPcnExtConstWords.EMPTY); + productionRecordMap.put(MesPcnExtConstWords.QC_STATUS_NAME, !StringUtils.isEmpty(produceSnItem.getQcStatus()) ? MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(produceSnItem.getQcStatus()) : MesPcnExtConstWords.EMPTY); } + productionRecordMap.put(MesPcnExtConstWords.COMPLETE_DATE_TIME, productionRecord.getCompleteDateTime()); + productionRecordMap.put(MesPcnExtConstWords.CREATE_USER, productionRecord.getCreateUser()); + productionRecordMap.put(MesPcnExtConstWords.REPORT_STATUS, productionRecord.getReportStatus()); + productionRecordMap.put(MesPcnExtConstWords.REPORT_STATUS_NAME, !StringUtils.isEmpty(productionRecord.getReportStatus()) ? MesExtEnumUtil.REPORT_STATUS.valueOfDescription(productionRecord.getReportStatus()) : MesPcnExtConstWords.EMPTY); + productionRecordMapList.add(productionRecordMap); } - return mesProductionRecordModelList; + + return resultBean.setResultList(productionRecordMapList); + } + + private String getCellCodeSuffix(String workCenterCode, String workCellCode) { + if (StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return null; + return new StringJoiner(MesPcnExtConstWords.AND).add(workCenterCode).add(workCellCode).toString(); + } + + private String getMap2Value(Map map, String key) { + if (StringUtils.isEmpty(key)) return MesPcnExtConstWords.EMPTY; + if (CollectionUtils.isEmpty(map) || !map.containsKey(key)) return MesPcnExtConstWords.EMPTY; + return map.get(key); + } + + private Map getProductionRecordReportCenterMap(String organizeCode, String workCenterCode, List productionRecordList) { + List workCenterCodeList = CollectionUtils.isEmpty(productionRecordList) ? null : + productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkCenterCode()))).map(MesProductionRecord::getWorkCenterCode).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(workCenterCodeList) && !StringUtils.isEmpty(workCenterCode)) workCenterCodeList = new ArrayList<>(); + if (!StringUtils.isEmpty(workCenterCode)) workCenterCodeList.add(workCenterCode); + return prodOrgExtService.getWorkCenterCodeMap(organizeCode, workCenterCodeList); + } + + private Map getProductionRecordReportCellMap(String organizeCode, String workCellCode, List productionRecordList) { + List workCellCodeList = CollectionUtils.isEmpty(productionRecordList) ? null : + productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkCellCode()))).map(MesProductionRecord::getWorkCellCode).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(workCellCodeList) && !StringUtils.isEmpty(workCellCode)) workCellCodeList = new ArrayList<>(); + if (!StringUtils.isEmpty(workCellCode)) workCellCodeList.add(workCellCode); + return prodOrgExtService.getWorkCellCodeMap(organizeCode, workCellCodeList); + } + + private Map getProductionRecordReportCraftMap(String organizeCode, String craftCode, List productionRecordList) { + List craftCodeList = CollectionUtils.isEmpty(productionRecordList) ? null : + productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCraftCode()))).map(MesProductionRecord::getCraftCode).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(craftCodeList) && !StringUtils.isEmpty(craftCode)) craftCodeList = new ArrayList<>(); + if (!StringUtils.isEmpty(craftCode)) craftCodeList.add(craftCode); + return prodOrgExtService.getCraftCodeMap(organizeCode, craftCodeList); } @Override @@ -152,68 +251,4 @@ public class MesProductionRecordService implements IMesProductionRecordService { productionRecordRepository.saveAll(recordList); } - private Map getStringMesCraftMap(String organizeCode, List craftCodeList) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getInPackList(craftCodeList, MesPcnExtConstWords.CRAFT_CODE,packBean); - List craftList = mesCraftRepository.findByHqlWhere(packBean); - Map craftMap = null; - if(!CollectionUtils.isEmpty(craftList)){ - craftMap = craftList.stream().collect(Collectors.toMap(MesCraft::getCraftCode, t -> t)); - } - return craftMap; - } - - private Map getStringMesProduceSnMap(String organizeCode, String productSn) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(productSn, MesPcnExtConstWords.PRODUCT_SN,packBean); - List mesProduceSns = mesProduceSnRepository.findByHqlWhere(packBean); - Map mesProduceSnMap = new HashMap<>(); - if(!CollectionUtils.isEmpty(mesProduceSns)){ - for (MesProduceSn mesProduceSn : mesProduceSns) { - if(!mesProduceSnMap.containsKey(mesProduceSn.getSerialNumber())){ - mesProduceSnMap.put(mesProduceSn.getSerialNumber(),mesProduceSn); - } - } - } - return mesProduceSnMap; - } - - - private Map getStringMesWorkCenterMap(String organizeCode, List workCenterNoList) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getInPackList(workCenterNoList, MesPcnExtConstWords.WORK_CENTER_CODE,packBean); - List mesWorkCenterList = mesWorkCenterRepository.findByHqlWhere(packBean); - Map mesWorkCenterMap = new HashMap<>(); - if(!CollectionUtils.isEmpty(mesWorkCenterList)){ - for (MesWorkCenter workCenter : mesWorkCenterList) { - if(!mesWorkCenterMap.containsKey(workCenter.getWorkCenterCode())){ - mesWorkCenterMap.put(workCenter.getWorkCenterCode(),workCenter); - } - } - } - return mesWorkCenterMap; - } - - private Map getStringMesWorkCellMap(String organizeCode, List workCenterNoList) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getInPackList(workCenterNoList, MesPcnExtConstWords.WORK_CELL_CODE,packBean); - List mesWorkCellList = mesWorkCellRepository.findByHqlWhere(packBean); - Map mesProduceSnMap = new HashMap<>(); - if(!CollectionUtils.isEmpty(mesWorkCellList)){ - for (MesWorkCell mesWorkCell : mesWorkCellList) { - if(!mesProduceSnMap.containsKey(mesWorkCell.getWorkCellCode())){ - mesProduceSnMap.put(mesWorkCell.getWorkCellCode(),mesWorkCell); - } - } - } - return mesProduceSnMap; - } - - public List findProductionRecord(String organizeCode, String productSn) { - if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn)) return null; - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(productSn,MesPcnExtConstWords.PRODUCT_SN,packBean); - DdlPreparedPack.getOrderBy(MesPcnExtConstWords.CREATE_DATE_TIME,CommonEnumUtil.ASC_OR_DESC.DESC.getValue(),packBean); - return productionRecordRepository.findByHqlWhere(packBean); - } } 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 871df7f..338ef39 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 @@ -187,8 +187,12 @@ public class MesPcnExtConstWords { public static final String CUST_SN = "custSn"; // 条码状态 public static final String SN_STATUS = "snStatus"; + // 条码状态 + public static final String SN_STATUS_NAME = "snStatusName"; // 质量状态 public static final String QC_STATUS = "qcStatus"; + // 质量状态 + public static final String QC_STATUS_NAME = "qcStatusName"; // 过程标签模板 public static final String PROCESS_LABEL_TEMPLATE = "processLabelTemplate"; // 产品标签模板 @@ -279,6 +283,12 @@ public class MesPcnExtConstWords { public static final String REPORT_TYPE = "reportType"; //发运时间 public static final String SHIPPING_TIME = "shippingTime"; + //完成时间 + public static final String COMPLETE_DATE_TIME = "completeDateTime"; + //汇报状态 + public static final String REPORT_STATUS = "reportStatus"; + //汇报状态 + public static final String REPORT_STATUS_NAME = "reportStatusName"; //BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties) @@ -717,6 +727,8 @@ public class MesPcnExtConstWords { // 产线名称 public static final String WORK_CENTER_NAME = "workCenterName"; + // 工位名称 + public static final String WORK_CELL_NAME = "workCellName"; // public static final int PALLET_CODE_93_WIDTH = 93; From 103f2dcd07503cbb03d047a7a26cf5156ce2187d Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 18 Dec 2024 16:49:57 +0800 Subject: [PATCH 10/14] =?UTF-8?q?44399=20=E5=B7=A5=E4=BD=8D=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E4=BD=8D=E5=9B=BE=E7=9A=84file=5FID=E5=8F=96?= =?UTF-8?q?=20mes=5Fmedia=5Ffile=5Fcfg=E8=A1=A8=E7=9A=84ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/base/IMesMediaFileCfgService.java | 36 +++++++++++ .../serviceimpl/base/MesMediaFileCfgService.java | 72 ++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesMediaFileCfgService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesMediaFileCfgService.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesMediaFileCfgService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesMediaFileCfgService.java new file mode 100644 index 0000000..e518b56 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesMediaFileCfgService.java @@ -0,0 +1,36 @@ +package cn.estsh.i3plus.ext.mes.pcn.api.base; + +import cn.estsh.i3plus.pojo.mes.bean.MesMediaFileCfg; +import io.swagger.annotations.ApiOperation; + +import java.util.List; +import java.util.Map; + +/** + * @Description : 媒体文件维护信息 + * @Reference : + * @Author : wangjie + * @CreateDate 2024/6/13 15:18 + * @Modify: + **/ +public interface IMesMediaFileCfgService { + + @ApiOperation(value = "根据ID查询资源文件信息") + MesMediaFileCfg getMediaFileCfg(String organizeCode, Long id); + + @ApiOperation(value = "根据ID查询资源文件信息") + MesMediaFileCfg getMediaFileCfg(String organizeCode, String idStr); + + @ApiOperation(value = "根据ID查询资源文件信息") + String getMediaFileUrl(String organizeCode, Long id); + + @ApiOperation(value = "根据ID查询资源文件信息") + String getMediaFileUrl(String organizeCode, String idStr); + + @ApiOperation(value = "根据ID集合查询资源文件信息") + List getMediaFileCfgList(String organizeCode, List idList); + + @ApiOperation(value = "根据ID集合查询资源文件信息") + Map getMediaFileCfgMap(String organizeCode, List idList); + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesMediaFileCfgService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesMediaFileCfgService.java new file mode 100644 index 0000000..4246e2a --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesMediaFileCfgService.java @@ -0,0 +1,72 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesMediaFileCfgService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +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.MesMediaFileCfg; +import cn.estsh.i3plus.pojo.mes.repository.MesMediaFileCfgRepository; +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; +import java.util.Map; +import java.util.stream.Collectors; + +@Slf4j +@Service +public class MesMediaFileCfgService implements IMesMediaFileCfgService { + + @Autowired + private MesMediaFileCfgRepository mediaFileCfgRepository; + + @Override + public MesMediaFileCfg getMediaFileCfg(String organizeCode, Long id) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(id)) return null; + MesMediaFileCfg mediaFileCfg = mediaFileCfgRepository.getByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.ID}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), id}); + return (null == mediaFileCfg || StringUtils.isEmpty(mediaFileCfg.getFileUrl())) ? null : mediaFileCfg; + } + + @Override + public MesMediaFileCfg getMediaFileCfg(String organizeCode, String idStr) { + Long id = null; + try { id = Long.valueOf(idStr);} catch (NumberFormatException e) {} + return getMediaFileCfg(organizeCode, id); + } + + @Override + public String getMediaFileUrl(String organizeCode, Long id) { + MesMediaFileCfg mediaFileCfg = getMediaFileCfg(organizeCode, id); + return (null == mediaFileCfg || StringUtils.isEmpty(mediaFileCfg.getFileUrl())) ? null : mediaFileCfg.getFileUrl(); + } + + @Override + public String getMediaFileUrl(String organizeCode, String idStr) { + MesMediaFileCfg mediaFileCfg = getMediaFileCfg(organizeCode, idStr); + return (null == mediaFileCfg || StringUtils.isEmpty(mediaFileCfg.getFileUrl())) ? null : mediaFileCfg.getFileUrl(); + } + + @Override + public List getMediaFileCfgList(String organizeCode, List idList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(idList)) return null; + if (idList.size() != 1) idList = idList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + if (idList.size() == 1) DdlPreparedPack.getNumEqualPack(idList.get(0), MesPcnExtConstWords.ID, packBean); + else DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean); + return mediaFileCfgRepository.findByHqlWhere(packBean); + } + + @Override + public Map getMediaFileCfgMap(String organizeCode, List idList) { + if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(idList)) return null; + List mediaFileCfgList = getMediaFileCfgList(organizeCode, idList); + if (CollectionUtils.isEmpty(mediaFileCfgList)) return null; + return mediaFileCfgList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getFileUrl()))).collect(Collectors.toMap(MesMediaFileCfg::getId, MesMediaFileCfg::getFileUrl)); + } +} From 4a3e42f31f26652454dffc8c73200eeca27f4304 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 18 Dec 2024 18:41:09 +0800 Subject: [PATCH 11/14] =?UTF-8?q?44399=20=E5=B7=A5=E4=BD=8D=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E4=BD=8D=E5=9B=BE=E7=9A=84file=5FID=E5=8F=96?= =?UTF-8?q?=20mes=5Fmedia=5Ffile=5Fcfg=E8=A1=A8=E7=9A=84ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesAssemblyExtService.java | 23 ++++++++-------------- .../station/MesProductionNoSortModuleService.java | 16 +++------------ .../MesFunctionProductionStatisticsService.java | 12 +++-------- 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java index 87fb10b..0225acd 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesAssemblyExtService.java @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesMediaFileCfgService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesAssemblyExtService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; @@ -11,7 +12,10 @@ 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.*; -import cn.estsh.i3plus.pojo.mes.repository.*; +import cn.estsh.i3plus.pojo.mes.repository.MesAssemblyNosortCfgRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyUniqueRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderAssemblyRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -47,7 +51,7 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { private IMesProductionProcessContextStepService productionProcessContextStepService; @Autowired - private MesFileRepository fileRepository; + private IMesMediaFileCfgService mediaFileCfgService; //【排序线】获取生产工单装配件绑定记录 @Override @@ -69,7 +73,7 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0))).collect(Collectors.toList()); //获取排序FILE文件URL - Map fileMap = getFileMap(prodRuleContext.getOrganizeCode(), filterSortFileIdList(unBindList)); + Map fileMap = mediaFileCfgService.getMediaFileCfgMap(prodRuleContext.getOrganizeCode(), filterSortFileIdList(unBindList)); List productionAssemblySortContextList = new ArrayList<>(); @@ -177,7 +181,7 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { if (CollectionUtils.isEmpty(assemblyNosortCfgList)) return null; //获取非排序FILE文件URL - Map fileMap = getFileMap(prodRuleContext.getOrganizeCode(), filterNosortFileIdList(assemblyNosortCfgList)); + Map fileMap = mediaFileCfgService.getMediaFileCfgMap(prodRuleContext.getOrganizeCode(), filterNosortFileIdList(assemblyNosortCfgList)); List productionAssemblyNosortContextList = new ArrayList<>(); @@ -271,17 +275,6 @@ public class MesAssemblyExtService implements IMesAssemblyExtService { return imageFileIdList; } - //获取FILE文件URL - private Map getFileMap(String organizeCode, List fileIdList) { - if (StringUtils.isEmpty(organizeCode) || CollectionUtils.isEmpty(fileIdList)) return null; - fileIdList = fileIdList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); - DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); - if (fileIdList.size() == 1) DdlPreparedPack.getNumEqualPack(fileIdList.get(0), MesPcnExtConstWords.ID, packBean); - DdlPreparedPack.getInPackList(fileIdList, MesPcnExtConstWords.ID, packBean); - List fileDbList = fileRepository.findByHqlWhere(packBean); - return CollectionUtils.isEmpty(fileIdList) ? null : fileDbList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getFileUrl()))).collect(Collectors.toMap(MesFile::getId, MesFile::getFileUrl)); - } - //根据生产工单装配件清单ID分组 private Map> groupProductionAssembly(List productionAssemblyList) { return CollectionUtils.isEmpty(productionAssemblyList) ? null : diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java index c6011f2..5dcca12 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java @@ -1,35 +1,29 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesMediaFileCfgService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; 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.api.busi.IMesWorkOrderExtService; -import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function.MesFunctionProductionStatisticsService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; 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.BaseModuleService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; import cn.estsh.i3plus.mes.pcn.util.StationKvBeanUtil; -import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; -import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.MesFile; import cn.estsh.i3plus.pojo.mes.bean.MesStateMachineStatus; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; -import cn.estsh.i3plus.pojo.mes.repository.MesFileRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import com.alibaba.fastjson.JSONObject; -import com.google.common.base.Objects; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -39,7 +33,6 @@ import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.StringJoiner; /** * @Description : 展示组件:非排序生产 @@ -65,7 +58,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { private IMesWorkOrderExtService workOrderExtService; @Autowired - private MesFileRepository mesFileRepository; + private IMesMediaFileCfgService mediaFileCfgService; @Override public void init(StationRequestBean reqBean) { @@ -165,10 +158,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { //判断是否配置的是展示文件 String url = null; if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && !StringUtils.isEmpty(MesExtEnumUtil.WORK_FILE_TYPE.valueOfDescription(workCell.getIsShowMsg()))) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - DdlPreparedPack.getNumEqualPack(Long.parseLong(workCell.getFileId()), MesPcnExtConstWords.ID, packBean); - MesFile mesFile = mesFileRepository.getByProperty(packBean); - url = (null != mesFile && !StringUtils.isEmpty(mesFile.getFileUrl())) ? mesFile.getFileUrl() : null; + url = mediaFileCfgService.getMediaFileUrl(reqBean.getOrganizeCode(), workCell.getFileId()); if (!StringUtils.isEmpty(url)) { JSONObject reqJson = new JSONObject(); if (workCell.getIsShowMsg().compareTo(MesExtEnumUtil.WORK_FILE_TYPE.WORK_CELL_PICTURE.getValue()) == 0) resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.IMAGE.getValue()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java index a7a9ced..ea94a17 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesMediaFileCfgService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; @@ -7,17 +8,13 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; -import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; -import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.MesFile; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; -import cn.estsh.i3plus.pojo.mes.repository.MesFileRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -35,7 +32,7 @@ public class MesFunctionProductionStatisticsService extends BaseSwsService imple private IMesProductionCustomContextStepService productionCustomContextStepService; @Autowired - private MesFileRepository mesFileRepository; + private IMesMediaFileCfgService mediaFileCfgService; @Autowired private IMesProductionProcessContextStepService productionProcessContextStepService; @@ -68,10 +65,7 @@ public class MesFunctionProductionStatisticsService extends BaseSwsService imple //判断是否配置的是展示文件 String url = null; if (!StringUtils.isEmpty(workCell.getIsShowMsg()) && !StringUtils.isEmpty(MesExtEnumUtil.WORK_FILE_TYPE.valueOfDescription(workCell.getIsShowMsg()))) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - DdlPreparedPack.getNumEqualPack(Long.parseLong(workCell.getFileId()), MesPcnExtConstWords.ID, packBean); - MesFile mesFile = mesFileRepository.getByProperty(packBean); - url = (null != mesFile && !StringUtils.isEmpty(mesFile.getFileUrl())) ? mesFile.getFileUrl() : null; + url = mediaFileCfgService.getMediaFileUrl(reqBean.getOrganizeCode(), workCell.getFileId()); } //如果不存在文件, 且当前工位配置需要统计加工数的情况下才进行重置加工数 From c3324d473657f156c51c5b8affc5af963d77332f Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Thu, 19 Dec 2024 13:46:02 +0800 Subject: [PATCH 12/14] =?UTF-8?q?fix=20bug=2044247=20=20=E8=A3=85=E7=AE=B1?= =?UTF-8?q?=E9=98=B2=E9=94=99=E5=88=86=E5=A4=96=E5=8D=8F=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E8=87=AA=E5=88=B6=E4=BB=B6=EF=BC=8C=E8=87=AA=E5=88=B6=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E5=8F=AF=E4=BB=A5=E4=B8=8D?= =?UTF-8?q?=E7=94=A8=E7=BB=B4=E6=8A=A4=E6=89=AB=E6=8F=8F=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/busi/IMesProduceSnExtService.java | 2 + .../busi/MesBoxingErrorProofingService.java | 122 ++++++++++++++++++++- .../serviceimpl/busi/MesProduceSnExtService.java | 9 ++ 3 files changed, 130 insertions(+), 3 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java index 9d89691..12caff7 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProduceSnExtService.java @@ -11,6 +11,8 @@ import java.util.List; import java.util.Map; public interface IMesProduceSnExtService { + @ApiOperation(value = "装箱防错获取正常的条码") + MesProduceSn getProduceSnForBox(String produceSn ,String PartNo,String organizeCode); @ApiOperation(value = "根据零件条码查询零件条码信息") List getProduceSnList(String organizeCode, List productSnList); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java index 3f9f064..0a37f2e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java @@ -123,7 +123,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer if (StringUtils.isEmpty(packingDefine.getSplitChar())) { MesPcnException.throwMesBusiException("箱类别代号【%s】分隔符不能为空,请检查数据!", packingDefine.getPackCode()); } - String[] split = mesPackageDetail.getPackageNo().split("\\\\" + packingDefine.getSplitChar()); + String[] split = mesPackageDetail.getPackageNo().split("\\" + packingDefine.getSplitChar()); //获取序列号 checkSerial(packingDefine, split); //工厂校验 @@ -149,7 +149,7 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer MesPcnException.throwMesBusiException("箱条码已封箱,不允许扫描零件条码,请检查数据!"); } //校验条码规则 - MesPart mesPart = getMesPart(mesPackageDetail, mesPackage, packingDefine); + MesPart mesPart = getMesPartNew(mesPackageDetail, mesPackage, packingDefine); //包装规格明细 MesPackageDetail saveMesPackageDetail = getPackageDetail(mesPackageDetail, mesPart); if (mesPackageDetail.getIsMemoryBoolean()) { @@ -228,7 +228,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer //校验是否重复扫描 List mesPackageDetails = getMesPackageDetailList(mesPackageDetail); //校验条码是否符合规则 - MesPart mesPart = getMesPart(mesPackageDetail, mesPackageDb, null); + //获取包装定义 + MesPackingDefine packingDefine = getMesPackingDefine(mesPackageDetail); + MesPart mesPart = getMesPartNew(mesPackageDetail, mesPackageDb, packingDefine); boolean exist = false; for (MesPackageDetail packageDetail : mesPackageDetails) { //替换条码是否已经存在 @@ -284,6 +286,15 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer return getPart(mesPackageDetail.getOrganizeCode(), partNo); } + private MesPart getMesPartNew(MesPackageDetail mesPackageDetail, MesPackage mesPackage, MesPackingDefine packingDefine) { + //校验是否重复扫描 + checkSerialNumber(mesPackageDetail); + //校验条码信息 + String partNo = checkSnNew(mesPackageDetail, packingDefine, mesPackage); + //物料信息 + return getPart(mesPackageDetail.getOrganizeCode(), partNo); + } + private void checkSerialNumber(MesPackageDetail mesPackageDetail) { DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(mesPackageDetail.getOrganizeCode()); // DdlPreparedPack.getStringEqualPack(mesPackageDetail.getPackageNo(), "packageNo", ddlPackBean); @@ -303,6 +314,17 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer return defineDetails; } + private List getMesPackingDefineDetailsNew(String organizeCode, String packCode,String partNo) { + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(packCode, "packCode", ddlPackBean); + DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean); + List defineDetails = mesPackingDefineDetailsRDao.findByHqlWhere(ddlPackBean); + if (CollectionUtils.isEmpty(defineDetails)) { + MesPcnException.throwMesBusiException("箱类别代号【%s】包装定义明细未维护,请检查数据!", packCode); + } + return defineDetails; + } + private void unboxing(MesPackage mesPackage, String userName, MesPackage mesPackageDb) { //更新包装表 mesPackageDb.setQty(0d); @@ -449,6 +471,100 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer return partNo; } + /** + * 2024/12/19 10:50 by castle fix bug 44247 + * 装箱防错逻辑优化: + * 1.箱条码会包含零件号(客户零件号),取箱条码中的零件号,作为扫描条码的零件号 + * 2.自制件 & 外协件 + * + * 2.1 自制件 + * + * 2.2.1 首先查询包装明细中包含此零件 且 规则为空 --- 确定为自制件 + * + * 2.2.2 根据零件号和扫描的条码,查询条码表是否存在,存在即自制件,不需要校验规则 (需要校验条码状态 qcStatus=10合格 15 可疑转正常 snStatus = 10 或 20) + * + * 2.2 外协件 + * + * 根据零件号 查询包装明细的规则,校验规则是否符合扫描的箱条码 + * @param mesPackageDetail + * @param packingDefine + * @param mesPackage + * @return + */ + private String checkSnNew(MesPackageDetail mesPackageDetail, MesPackingDefine packingDefine,MesPackage mesPackage ) { + String partNo = mesPackage.getPartNo(); + //1.查询包装明细是否包含此零件 + List defineDetails = getMesPackingDefineDetailsNew(mesPackageDetail.getOrganizeCode(), mesPackage.getPackageSn(), partNo); + if (defineDetails.isEmpty()) { + MesPcnException.throwMesBusiException("箱类别代号【%s】零件号【%s】未维护,请检查数据!", mesPackage.getPackageSn(), partNo); + } + MesPackingDefineDetails mesPackingDefineDetails = defineDetails.get(0); + if (StringUtils.isEmpty(mesPackingDefineDetails.getPackageBarcodeRule())){ + //是自制件 + MesProduceSn produceSn = mesProduceSnExtService.getProduceSnForBox(mesPackageDetail.getSerialNumber(), partNo, mesPackageDetail.getOrganizeCode()); + if (produceSn == null){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】在条码表不存在,请检查数据!", mesPackage.getPackageSn(), partNo); + } + //QC 检查 + if (produceSn.getQcStatus() == MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,QC可疑状态,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + if (produceSn.getQcStatus() == MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,QC为报废状态,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + //SN 条码状态 + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.UNKNOW.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为未知,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.PROCESSING.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为加工中,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY_BACK.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为已拆解,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为已装配,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.CHECKED.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为已校验,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.SHIPPED.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为已发运,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + if (produceSn.getSnStatus() == MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY_DISASSEMBLY.getValue()){ + MesPcnException.throwMesBusiException("扫描条码【%s】零件号【%s】,条码状态为已总成拆解,不能包装此零件!", mesPackage.getPackageSn(), partNo); + } + }else{ + //外协件 + String packageBarcodeRule = mesPackingDefineDetails.getPackageBarcodeRule().replace("*", ""); + boolean checkResult = mesPackageDetail.getSerialNumber().contains(packageBarcodeRule); + if (!checkResult){ + MesPcnException.throwMesBusiException("零件条码【%s】未匹配到符合条码规则的数据,请检查数据!", mesPackageDetail.getSerialNumber()); + } + } + + //工艺校验 + if(!Objects.isNull(packingDefine) && !Objects.isNull(packingDefine.getCheckCraftFlag()) && CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == packingDefine.getCheckCraftFlag()){ + //查询加工记录 + List productionRecordList = mesProductionRecordService.findProductionRecordList(mesPackageDetail.getOrganizeCode(), mesPackageDetail.getSerialNumber()); + if(CollectionUtils.isEmpty(productionRecordList)){ + MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺失败,加工记录信息不存在,请检查数据!", mesPackageDetail.getSerialNumber()); + } + if(StringUtils.isEmpty(packingDefine.getCraft())){ + MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺为空,请检查数据!", mesPackageDetail.getSerialNumber()); + } + //校验条码是否经过该工艺 + Optional productionRecordOptional = productionRecordList.stream().filter(t -> !StringUtils.isEmpty(t.getCraftCode()) && packingDefine.getCraft().equals(t.getCraftCode())).findFirst(); + if(!productionRecordOptional.isPresent()){ + MesPcnException.throwMesBusiException("条码【%s】校验装箱防错对应工艺【%s】失败,请检查数据!", mesPackageDetail.getSerialNumber(),packingDefine.getCraft()); + } + } + + return partNo; + } + private String getPartNo(MesPackageDetail mesPackageDetail, MesPackage mesPackage, List defineDetails) { String packageBarcodeRule; String partNo = null; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java index 0708879..bac40b1 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java @@ -34,6 +34,15 @@ public class MesProduceSnExtService implements IMesProduceSnExtService { @Autowired private MesQueueOrderRepository queueOrderRepository; + @Override + public MesProduceSn getProduceSnForBox(String produceSn, String partNo,String organizeCode) { + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(produceSn,"productSn",ddlPackBean); + DdlPreparedPack.getStringEqualPack(partNo,"partNo",ddlPackBean); + List produceSnList = produceSnRepository.findByHqlWhere(ddlPackBean); + return produceSnList.isEmpty() ? null : produceSnList.get(0); + } + //根据零件条码查询零件条码信息 @Override public List getProduceSnList(String organizeCode, List productSnList) { From 379aad9ba467efa6fd9ff860b750ac0c4189168e Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 19 Dec 2024 14:13:20 +0800 Subject: [PATCH 13/14] =?UTF-8?q?bom=20=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=20=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../i3plus/ext/mes/pcn/api/busi/IMesConfigService.java | 3 +++ .../apiservice/serviceimpl/busi/MesConfigService.java | 8 ++++++++ .../apiservice/serviceimpl/busi/MesWorkOrderService.java | 16 +++++++++++----- .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 9 +++++++++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesConfigService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesConfigService.java index e79c9b5..0477984 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesConfigService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesConfigService.java @@ -39,4 +39,7 @@ public interface IMesConfigService { @ApiOperation(value = "获取配置信息") List findMesConfigList(String organizeCode, String cfgCode); + @ApiOperation(value = "获取配置信息") + MesConfig getCfgValueByCode(String organizeCode, String cfgCode); + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesConfigService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesConfigService.java index 3e73b20..ee73a26 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesConfigService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesConfigService.java @@ -113,5 +113,13 @@ public class MesConfigService implements IMesConfigService { return configList; } + @Override + public MesConfig getCfgValueByCode(String organizeCode,String cfgCode) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(cfgCode)) return null; + return configRepository.getByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.CFG_CODE}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), cfgCode}); + } + } 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 9a0b4ce..ce6457d 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 @@ -359,12 +359,18 @@ public class MesWorkOrderService implements IMesWorkOrderService { } public List findMesBomByPartNoAndBomVersion(String partNo, String organizeCode, String bomVersion) { + + //MES汇报查询BOM是否携带结束查询条件 + MesConfig config = configService.getCfgValueByCode(organizeCode, MesPcnExtConstWords.MES_REPORT_FIND_BOM_WITH_EFFENDTIME); + Boolean isWithEffEndTime = (null != config && !StringUtils.isEmpty(config.getCfgValue()) && config.getCfgValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? true : false; + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean); - DdlPreparedPack.getStringEqualPack(bomVersion, "bomVersion", ddlPackBean); - DdlPreparedPack.getStringSmallerPack(TimeTool.getNowTime(true), "effStartTime", ddlPackBean); - DdlPreparedPack.getStringBiggerPack(TimeTool.getNowTime(true), "effEndTime", ddlPackBean); - DdlPreparedPack.getOrderBy("effStartTime", CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), ddlPackBean); + DdlPreparedPack.getStringEqualPack(partNo, MesPcnExtConstWords.PART_NO, ddlPackBean); + DdlPreparedPack.getStringEqualPack(bomVersion, MesPcnExtConstWords.BOM_VERSION, ddlPackBean); + DdlPreparedPack.getStringSmallerPack(TimeTool.getNowTime(true), MesPcnExtConstWords.EFF_START_TIME, ddlPackBean); + if (isWithEffEndTime) DdlPreparedPack.getStringBiggerPack(TimeTool.getNowTime(true), MesPcnExtConstWords.EFF_END_TIME, ddlPackBean); + DdlPreparedPack.getOrderBy(MesPcnExtConstWords.EFF_START_TIME, CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), ddlPackBean); + List mesBoms = mesBomRDao.findByHqlWhere(ddlPackBean); if (org.springframework.util.CollectionUtils.isEmpty(mesBoms)) { LOGGER.info("物料{}生产版本{}对应bom信息不存在", partNo, bomVersion ); 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 575d766..d986680 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 @@ -298,6 +298,15 @@ public class MesPcnExtConstWords { public static final String REPORT_STATUS = "reportStatus"; //汇报状态 public static final String REPORT_STATUS_NAME = "reportStatusName"; + //BOM版本 + public static final String BOM_VERSION = "bomVersion"; + //生效时间 + public static final String EFF_START_TIME = "effStartTime"; + //失效时间 + public static final String EFF_END_TIME = "effEndTime"; + //MES汇报查询BOM是否携带结束查询条件 + public static final String MES_REPORT_FIND_BOM_WITH_EFFENDTIME = "MES_REPORT_FIND_BOM_WITH_EFFENDTIME"; + //BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties) From 523991461e4dffb0daf1a51704e25e4c0252a63f Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Fri, 20 Dec 2024 11:33:23 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8A=A5=E5=B7=A5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesWorkOrderService.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 ce6457d..432135a 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 @@ -241,6 +241,19 @@ public class MesWorkOrderService implements IMesWorkOrderService { MesProductOffLine newMesProductOffLine; for (MesProductionRecord mesProductionRecord : mesProductionRecordList) { for (MesBom mesBom : mesBoms) { + + DdlPackBean productPackBean = DdlPackBean.getDdlPackBean(mesProductionRecord.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(mesBom.getItemPartNo(),"itemPartNo", productPackBean); + DdlPreparedPack.getStringEqualPack(mesWorkOrderDb.getPartNo(),"reportPartNo", productPackBean); + DdlPreparedPack.getStringEqualPack(mesProductionRecord.getProductSn(),"reportSn", productPackBean); + int count = mesProductOffLineRDao.findByHqlWhereCount(productPackBean); + if (count > 0) { + String msg = String.format("子零件【%s】产成零件【%s】条码【%s】对应报工信息已存在", + mesBom.getItemPartNo(),mesWorkOrderDb.getPartNo(), mesProductionRecord.getProductSn()); + LOGGER.info(msg); + continue; + } + newMesProductOffLine = new MesProductOffLine(); newMesProductOffLine.setReportPartNo(mesWorkOrderDb.getPartNo()); newMesProductOffLine.setReportPartNameRdd(mesWorkOrderDb.getPartName()); @@ -578,6 +591,23 @@ public class MesWorkOrderService implements IMesWorkOrderService { return bom; })); if (MesExtEnumUtil.NOSORT_REPORT_TYPE.REPORT.getValue() == productionRecord.getReportType()) { + + DdlPackBean productPackBean = DdlPackBean.getDdlPackBean(productionRecord.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(oldMesWorkOrder.getPartNo(),"reportPartNo", productPackBean); + DdlPreparedPack.getStringEqualPack(productionRecord.getProductSn(),"reportSn", productPackBean); + int count = mesProductOffLineRDao.findByHqlWhereCount(productPackBean); + if (count > 0) { + String msg = String.format("产成零件【%s】条码【%s】对应报工信息已存在", + oldMesWorkOrder.getPartNo(), productionRecord.getProductSn()); + LOGGER.error(msg); + LOGGER.info("条码【{}】重复报工更新成已报工", productionRecord.getProductSn()); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getNumEqualPack(productionRecord.getId(), "id", packBean); + productionRecordRao.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "workOrderNo", "reportStatus","description"}, + new Object[]{userName, TimeTool.getNowTime(true), oldMesWorkOrder.getWorkOrderNo(), MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_20.getValue(), "重复报工更新成已报工"}, packBean); + return; + } + for (Map.Entry> entry : map.entrySet()) { mesProductOffLineList.add(getMesProductOffLine(productionRecord, userName, oldMesWorkOrder, mesProductVersion, entry.getValue().get(0), productionRecord.getProductSn(), false,false,map.size())); } @@ -823,6 +853,10 @@ public class MesWorkOrderService implements IMesWorkOrderService { DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getStringEqualPack(productionRecord.getPartNo(), "partNo", ddlPackBean); + // 获取5分钟之前的时间 + String startTime = TimeTool.timeCalc(new Date(), Calendar.MINUTE, -2, "yyyy-MM-dd HH:mm:ss"); + + DdlPreparedPack.getStringSmallerNotEqualPack(startTime, "createDatetime", ddlPackBean); DdlPreparedPack.getStringEqualPack(productionRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean); if (!StringUtils.isEmpty(productionRecord.getWorkOrderNo())) { DdlPreparedPack.getStringEqualPack(productionRecord.getWorkOrderNo(), "workOrderNo", ddlPackBean);