diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/aspect/PcnRepositoryAspect.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/aspect/PcnRepositoryAspect.java index 32fca7f..5c8979b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/aspect/PcnRepositoryAspect.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/aspect/PcnRepositoryAspect.java @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.aspect; import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.pojo.base.bean.BaseBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; @@ -27,6 +28,7 @@ import java.util.List; @ConditionalOnExpression("'${pcn.aspect.repository:true}' == 'true'") @Aspect @Configuration +@Slf4j public class PcnRepositoryAspect { @Before("controllerPointcut()") 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 4d539e7..59f896d 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 @@ -79,7 +79,8 @@ public class MesProdShiftRecordServiceImpl implements IMesProdShiftRecordService DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", packBean); DdlPreparedPack.getStringEqualPack(item.getShiftGroup(), "shiftGroup", packBean); DdlPreparedPack.getStringEqualPack(item.getShiftCode(), "shiftCode", packBean); - DdlPreparedPack.getStringEqualPack(item.getStartTime(), "startTime", packBean); +// DdlPreparedPack.getStringEqualPack(item.getStartTime(), "startTime", packBean); + DdlPreparedPack.getIsNull("endTime", packBean); MesProdShiftRecord mesProdShiftRecord = mesProdShiftRecordRDao.getByProperty(packBean); if (StringUtil.isEmpty(mesProdShiftRecord)) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentLogExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentLogExtService.java index 59828e8..79e889b 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentLogExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesEquipmentLogExtService.java @@ -66,8 +66,7 @@ public class MesEquipmentLogExtService implements IMesEquipmentLogExtService { DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getNumEqualPack(equipId, MesPcnExtConstWords.EQUIP_ID, packBean); DdlPreparedPack.getNumEqualPack(equipVariableId, MesPcnExtConstWords.EQUIP_VARIABLE_ID, packBean); - - equipmentLogRepository.updateByProperties(new String[]{"equipVariableValue",MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus()}, packBean); + equipmentLogRepository.updateByProperties(new String[]{MesPcnExtConstWords.EQUIP_VARIABLE_STATUS, MesPcnExtConstWords.EQUIP_VARIABLE_STATUS}, new Object[]{value, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getEquipVariableStatus()}, packBean); } @Override public Boolean checkEquipQuality(Integer quality) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java index 90f9c7f..19a53dd 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/equiplog/MesWorkCellScanMonitorLogExtService.java @@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.List; +import java.util.StringJoiner; import java.util.stream.Collectors; @Slf4j @@ -65,6 +66,8 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic workCellScanMonitorLog.setDealStatus(MesExtEnumUtil.MES_LOG_DEAL_STATUS.UNDEAL.getValue()); + workCellScanMonitorLog.setOrgWorkCode(new StringJoiner(MesPcnExtConstWords.E_UNDERLINE).add(workCellScanMonitorLog.getOrganizeCode()).add(workCellScanMonitorLog.getWorkCenterCode()).toString()); + ConvertBean.serviceModelInitialize(workCellScanMonitorLog, resultBean.getUserInfo()); workCellScanMonitorLogRepository.insert(workCellScanMonitorLog); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/AionPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/AionPrintStrategy.java index e372027..36b0171 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/AionPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/AionPrintStrategy.java @@ -8,6 +8,7 @@ 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.base.IConfigService; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -71,7 +72,6 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService { } //获取工厂名称 String organizeName = mesConfig.getCfgValue(); - String format ="yyyy/MM/dd"; MesCustomerPart mesCustomerPart = getMesCustomerPart(mesProduceSnPrintModel); String custPartNo = mesCustomerPart == null ? "" : mesCustomerPart.getCustPartNo(); //物料信息 @@ -89,7 +89,7 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService { serialNo34 = stringFormat(serialNo34, 4, false, "0"); sn = snPrefix + serialNo34 + snSuffix; //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, custPartNo, organizeName); mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); @@ -134,7 +134,7 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService { mesProduceSnPrintDataModel.setNo(no); mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); mesProduceSnPrintDataModel.setCustPartNo(custPartNo); - mesProduceSnPrintDataModel.setProductDate(produceSn.getLotNo()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(), DateUtil.SHORT_FORMAT,"yyyy/MM/dd")); return mesProduceSnPrintDataModel; } private MesNumberRule getNumberRule(String organizeCode, MesPart part) { @@ -187,7 +187,7 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService { return dataBuffer.toString(); } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -200,7 +200,7 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqaaPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqaaPrintStrategy.java index 61d3b5b..eec752d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqaaPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqaaPrintStrategy.java @@ -8,6 +8,7 @@ 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.base.IConfigService; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -70,7 +71,6 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { } //获取工厂名称 String organizeName = mesConfig.getCfgValue(); - String format ="yyyy/MM/dd"; MesCustomerPart mesCustomerPart = getMesCustomerPart(mesProduceSnPrintModel); //物料信息 MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); @@ -87,7 +87,7 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { serialNo34 = stringFormat(serialNo34, 4, false, "0"); sn = snPrefix + serialNo34 + snSuffix; //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, mesCustomerPart.getCustPartNo(), organizeName); mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); @@ -120,7 +120,7 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { ConvertBean.serviceModelInitialize(snLog, mesProduceSnPrintModel.getUserName()); BeanUtil.copyProperties(printDataModel,snLog); mesProduceSnPrintModel.getMesPrintedSnLogList().add(snLog); - } + } return mesProduceSnPrintModel; } @@ -132,15 +132,15 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { mesProduceSnPrintDataModel.setNo(no); mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); mesProduceSnPrintDataModel.setCustPartNo(custPartNo); - mesProduceSnPrintDataModel.setProductDate(produceSn.getLotNo()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(),DateUtil.SHORT_FORMAT,"yyyy/MM/dd")); return mesProduceSnPrintDataModel; } private MesNumberRule getNumberRule(String organizeCode, MesPart part) { if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo()); MesNumberRule numberRule = numberRuleRepository.getByProperty( new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE}, - new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()}); - if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule()); + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProductMatchRule()}); + if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProductMatchRule()); return numberRule; } // 34进制字符集 @@ -185,7 +185,7 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { return dataBuffer.toString(); } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -198,7 +198,7 @@ public class GqaaPrintStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqxnyPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqxnyPrintStrategy.java index 96f19be..a14bfdc 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqxnyPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/GqxnyPrintStrategy.java @@ -64,7 +64,6 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule,StepResult stepResult, StationRequestBean reqBean,Boolean isStep) { //获取客户零件号 String custPartNo = getMesCustomerPart(mesProduceSnPrintModel).getCustPartNo(); - String format = "yyyy/MM/dd"; // 获取工厂名称 String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); MesConfig mesConfig = configService.getMesConfigByCfgCode(MesPcnExtConstWords.ORGANIZE_NAME, organizeCode); @@ -120,7 +119,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { // serialNo34 = stringFormat(serialNo34, 4, false, "0"); // sn = snPrefix + serialNo34 + snSuffix; //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, custPartNo, organizeName); printDataModel.setSupplierCode(supplierCode); @@ -147,7 +146,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { serialNo34 = stringFormat(serialNo34, 4, false, "0"); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, serialNo34, custPartNo, organizeName); - printDataModel.setBarcode(sn); + printDataModel.setSupplierCode(configService.getMesConfigByCfgCodeKeyOrg(MesPcnExtConstWords.SUPPLIER_CODE, MesExtEnumUtil.MES_PRINT_TEMPLATE.GQXNY.getValue(), organizeCode).getCfgValue()); mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); //保存打印记录 MesPrintedSnLog snLog = new MesPrintedSnLog(); @@ -217,7 +216,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { return sb.reverse().toString(); } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -230,7 +229,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); @@ -246,7 +245,7 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService { mesProduceSnPrintDataModel.setNo(no); mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); mesProduceSnPrintDataModel.setCustPartNo(custPartNo); - mesProduceSnPrintDataModel.setProductDate(produceSn.getLotNo()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(),DateUtil.SHORT_FORMAT,"yyyy/MM/dd")); return mesProduceSnPrintDataModel; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/NoSortBarCodeGzStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/NoSortBarCodeGzStrategy.java index 41a8e96..5364b9c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/NoSortBarCodeGzStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/NoSortBarCodeGzStrategy.java @@ -58,7 +58,6 @@ public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService { @Override public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule,StepResult stepResult, StationRequestBean reqBean,Boolean isStep) { // noSortBarCodeGz - String format = "yyyy/MM/dd"; //{partNo}{year}{month}{day}{serialNo} String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); @@ -79,7 +78,7 @@ public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService { Integer serialNoLength = numberRule.getSerialnoLength(); String serialNo = sn.substring(sn.length() - serialNoLength); //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, mesProduceSnPrintModel.getCustPartNo(), organizeName); mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); @@ -113,7 +112,7 @@ public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService { return mesProduceSnPrintModel; } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -126,7 +125,7 @@ public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); @@ -141,7 +140,7 @@ public class NoSortBarCodeGzStrategy implements IPrintTemplateStrategyService { mesProduceSnPrintDataModel.setNo(no); mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); mesProduceSnPrintDataModel.setCustPartNo(custPartNo); - mesProduceSnPrintDataModel.setProductDate(produceSn.getLotNo()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(),DateUtil.SHORT_FORMAT,"yyyy/MM/dd")); return mesProduceSnPrintDataModel; } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengNewPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengNewPrintStrategy.java index 82444c8..14f0c95 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengNewPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengNewPrintStrategy.java @@ -62,7 +62,6 @@ public class XiaoPengNewPrintStrategy implements IPrintTemplateStrategyService { @Override public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { - String format = "yyyy/MM/dd"; Date date = new Date(); String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); //gz-xiaopeng @@ -88,7 +87,7 @@ public class XiaoPengNewPrintStrategy implements IPrintTemplateStrategyService { Integer serialNoLength = numberRule.getSerialnoLength(); String serialNo = sn.substring(sn.length() - serialNoLength); //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); produceSn.setCustPartNo(custPartNo); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, custPartNo, organizeName); @@ -161,7 +160,7 @@ public class XiaoPengNewPrintStrategy implements IPrintTemplateStrategyService { return day; } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -174,7 +173,7 @@ public class XiaoPengNewPrintStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengPrintStrategy.java index f18118b..8f58aad 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengPrintStrategy.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/XiaoPengPrintStrategy.java @@ -62,7 +62,6 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService { @Override public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { - String format = "yyyy/MM/dd"; Date date = new Date(); String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); //gz-xiaopeng @@ -90,7 +89,7 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService { Integer serialNoLength = numberRule.getSerialnoLength(); String serialNo = sn.substring(sn.length() - serialNoLength); //保存条码信息 - MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty(), format); + MesProduceSn produceSn = generateMesProduceSn(mesPart, sn, mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); produceSn.setCustPartNo(custPartNo); //封装打印信息 MesProduceSnPrintDataModel printDataModel = getModel(produceSn, serialNo, custPartNo, organizeName); @@ -163,7 +162,7 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService { return day; } - private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty, String format) { + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { MesProduceSn mesProduceSn = new MesProduceSn(); mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); mesProduceSn.setProductSn(sn); @@ -176,7 +175,7 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService { mesProduceSn.setQty(qty); mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - mesProduceSn.setLotNo(TimeTool.getNowTime(format)); + mesProduceSn.setLotNo(TimeTool.getToday()); mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); @@ -191,7 +190,7 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService { mesProduceSnPrintDataModel.setNo(no); mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); mesProduceSnPrintDataModel.setCustPartNo(custPartNo); - mesProduceSnPrintDataModel.setProductDate(produceSn.getLotNo()); + mesProduceSnPrintDataModel.setProductDate(produceSn.getCreateDatetime()); return mesProduceSnPrintDataModel; } 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 d4be721..c6dcbf2 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 @@ -159,10 +159,14 @@ public class MesAssemblyReadStepService extends BaseStepService { List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.ASSEMBLY.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据 - if (CollectionUtils.isEmpty(equipVariableCollectContextList)) + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的装配件条码,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), - stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的装配件条码,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext))), + stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的装配件条码,持续监听中..", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } + //保存设备当前一轮工序待验证的装配件条码信息 productionDispatchContextStepService.saveScanAssemblySnContext(reqBean, equipVariableCollectContextList); @@ -171,7 +175,8 @@ public class MesAssemblyReadStepService extends BaseStepService { String scanInfo = equipVariableCollectContextList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); productionCustomContextStepService.doSendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]装配件条码的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).scanInfo(scanInfo), stepResult, String.format("当前已读取到设备[%s]装配件条码信息[%s]!", cellEquipContext.getEquipmentName(), scanInfo)); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesFirstMouldNoReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesFirstMouldNoReadStepService.java index 5ecc6f9..d8c2230 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesFirstMouldNoReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesFirstMouldNoReadStepService.java @@ -144,15 +144,20 @@ public class MesFirstMouldNoReadStepService extends BaseStepService { List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.FIRST_MOULD_NO.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据 - if (CollectionUtils.isEmpty(equipVariableCollectContextList)) + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的头道模具号,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), - stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的头道模具号,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext))), + stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的头道模具号,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } + //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 equipmentLogExtService.updateEquipmentLogList(reqBean.getOrganizeCode(), cellEquipContext.getEquipId(), equipLogDispatchContext.getResetEquipVariableIdList()); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]头道模具号的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //默认只需要配置一个点位 String firstMouldNo = equipVariableCollectContextList.get(0).getEquipVariableValue(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMaterialReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMaterialReadStepService.java index e64e45b..bfb5fe5 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMaterialReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMaterialReadStepService.java @@ -1,129 +1,129 @@ -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.mes.pcn.serviceimpl.fsm.BaseStepService; -import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; -import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; -import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; -import cn.estsh.i3plus.pojo.mes.bean.MesRawPackageDetail; -import cn.estsh.i3plus.pojo.mes.bean.MesRawPartCharging; -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.MesRawPackageDetailRepository; -import cn.estsh.i3plus.pojo.mes.repository.MesRawPartChargingRepository; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -/** - * @Description : 从料桶中获取原材料 - * @Author : zxw - **/ -@Slf4j -@Service("mesMaterialReadStepService") -public class MesMaterialReadStepService extends BaseStepService { - - @Autowired - private IMesProductionProcessContextStepService productionProcessContextStepService; - - @Autowired - private IMesProductionDispatchContextStepService productionDispatchContextStepService; - - - @Autowired - private MesRawPackageDetailRepository mesRawPackageDeatilRepository; - - @Autowired - private MesRawPartChargingRepository mesRawPartChargingRepository; - - @Override - public StepResult execute(StationRequestBean reqBean) { - - StationResultBean resultBean = new StationResultBean(); - - StepResult stepResult = StepResult.getSuccessComplete(); - - //获取工步参数 - Optional> stepParamMap = getStepParams(reqBean); - //获取上下文信息 - MesProductionProcessContext productionProcessContext = productionProcessContextStepService.doHandleCurCellEquipment(reqBean, stepParamMap); - - String equipmentCode = productionProcessContext.getCurCellEquip().getEquipmentCode(); - - // 根据设备id获取加料日志 - - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - DdlPreparedPack.getStringEqualPack(equipmentCode, "equipCode", packBean); - MesRawPackageDetail mesRawPackageDetail = mesRawPackageDeatilRepository.getByProperty(packBean); - if (mesRawPackageDetail == null) { - foundExThrow(reqBean, "原材料容器信息未配置"); - } - /** - * 查询原材料信息 - */ - List list = getListByParentDetailId(mesRawPackageDetail.getId()); - /** - * 查询料桶信息 todo - */ - /*MesRawPartCharging mesRawPartCharging = getRawPackByDetailId(mesRawPackageDetail.getId()); - if (mesRawPackageDetail == null) { - foundExThrow(reqBean, "料桶信息不存在"); - } - // - list.add(mesRawPartCharging);*/ - productionDispatchContextStepService.saveMesRawPartChargingDataContext(reqBean, list); - - return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "读取料桶原材料成功"); - - } - - /** - * 递归查询子料桶,直到查到最终的物料 - * @param id - * @return - */ - private List getListByParentDetailId(Long id){ - if (id == null) { - return null; - } - List list = new ArrayList<>(); - - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - DdlPreparedPack.getNumEqualPack(id, "parentPackageDetailId", packBean); - - List parentList = mesRawPartChargingRepository.findByHqlWhere(packBean); - if (CollectionUtils.isEmpty(parentList)) { - return null; - } - for (MesRawPartCharging mesRawPartCharging : parentList) { - List chilrenList = getListByParentDetailId(mesRawPartCharging.getPackageDetailId()); - if (CollectionUtils.isEmpty(chilrenList)) { - list.add(mesRawPartCharging); - } - } - return list; - } - - /** - * 递归查询子料桶,直到查到最终的物料 - * @param id - * @return - */ - private MesRawPartCharging getRawPackByDetailId(Long id){ - - DdlPackBean packBean = DdlPackBean.getDdlPackBean(); - DdlPreparedPack.getNumEqualPack(id, "packageDetailId", packBean); - - return mesRawPartChargingRepository.getByProperty(packBean); - } -} +//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.mes.pcn.serviceimpl.fsm.BaseStepService; +//import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +//import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +//import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +//import cn.estsh.i3plus.pojo.mes.bean.MesProdRouteOptParam; +//import cn.estsh.i3plus.pojo.mes.bean.MesRawPackageDetail; +//import cn.estsh.i3plus.pojo.mes.bean.MesRawPartCharging; +//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.MesRawPackageDetailRepository; +//import cn.estsh.i3plus.pojo.mes.repository.MesRawPartChargingRepository; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +//import org.springframework.util.CollectionUtils; +// +//import java.util.ArrayList; +//import java.util.List; +//import java.util.Map; +//import java.util.Optional; +// +///** +// * @Description : 从料桶中获取原材料 +// * @Author : zxw +// **/ +//@Slf4j +//@Service("mesMaterialReadStepService") +//public class MesMaterialReadStepService extends BaseStepService { +// +// @Autowired +// private IMesProductionProcessContextStepService productionProcessContextStepService; +// +// @Autowired +// private IMesProductionDispatchContextStepService productionDispatchContextStepService; +// +// +// @Autowired +// private MesRawPackageDetailRepository mesRawPackageDeatilRepository; +// +// @Autowired +// private MesRawPartChargingRepository mesRawPartChargingRepository; +// +// @Override +// public StepResult execute(StationRequestBean reqBean) { +// +// StationResultBean resultBean = new StationResultBean(); +// +// StepResult stepResult = StepResult.getSuccessComplete(); +// +// //获取工步参数 +// Optional> stepParamMap = getStepParams(reqBean); +// //获取上下文信息 +// MesProductionProcessContext productionProcessContext = productionProcessContextStepService.doHandleCurCellEquipment(reqBean, stepParamMap); +// +// String equipmentCode = productionProcessContext.getCurCellEquip().getEquipmentCode(); +// +// // 根据设备id获取加料日志 +// +// DdlPackBean packBean = DdlPackBean.getDdlPackBean(); +// DdlPreparedPack.getStringEqualPack(equipmentCode, "equipCode", packBean); +// MesRawPackageDetail mesRawPackageDetail = mesRawPackageDeatilRepository.getByProperty(packBean); +// if (mesRawPackageDetail == null) { +// foundExThrow(reqBean, "原材料容器信息未配置"); +// } +// /** +// * 查询原材料信息 +// */ +// List list = getListByParentDetailId(mesRawPackageDetail.getId()); +// /** +// * 查询料桶信息 todo +// */ +// /*MesRawPartCharging mesRawPartCharging = getRawPackByDetailId(mesRawPackageDetail.getId()); +// if (mesRawPackageDetail == null) { +// foundExThrow(reqBean, "料桶信息不存在"); +// } +// // +// list.add(mesRawPartCharging);*/ +// productionDispatchContextStepService.saveMesRawPartChargingDataContext(reqBean, list); +// +// return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "读取料桶原材料成功"); +// +// } +// +// /** +// * 递归查询子料桶,直到查到最终的物料 +// * @param id +// * @return +// */ +// private List getListByParentDetailId(Long id){ +// if (id == null) { +// return null; +// } +// List list = new ArrayList<>(); +// +// DdlPackBean packBean = DdlPackBean.getDdlPackBean(); +// DdlPreparedPack.getNumEqualPack(id, "parentPackageDetailId", packBean); +// +// List parentList = mesRawPartChargingRepository.findByHqlWhere(packBean); +// if (CollectionUtils.isEmpty(parentList)) { +// return null; +// } +// for (MesRawPartCharging mesRawPartCharging : parentList) { +// List chilrenList = getListByParentDetailId(mesRawPartCharging.getPackageDetailId()); +// if (CollectionUtils.isEmpty(chilrenList)) { +// list.add(mesRawPartCharging); +// } +// } +// return list; +// } +// +// /** +// * 递归查询子料桶,直到查到最终的物料 +// * @param id +// * @return +// */ +// private MesRawPartCharging getRawPackByDetailId(Long id){ +// +// DdlPackBean packBean = DdlPackBean.getDdlPackBean(); +// DdlPreparedPack.getNumEqualPack(id, "packageDetailId", packBean); +// +// return mesRawPartChargingRepository.getByProperty(packBean); +// } +//} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMouldNoReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMouldNoReadStepService.java index 2c95c85..a169ec5 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMouldNoReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesMouldNoReadStepService.java @@ -139,27 +139,33 @@ public class MesMouldNoReadStepService extends BaseStepService { String isReadMultiCavityCfg = (null != stepParamMap && stepParamMap.isPresent() && stepParamMap.get().containsKey(MesPcnExtConstWords.READ_MULTI_CAVITY_CFG)) ? stepParamMap.get().get(MesPcnExtConstWords.READ_MULTI_CAVITY_CFG).getParamValue() : null; //未采集到数据 - if (!equipLogDispatchContext.getIsCollectValue() && (equipLogDispatchContext.getNeedNewValue() || !StringUtils.isEmpty(isReadMultiCavityCfg))) + if (!equipLogDispatchContext.getIsCollectValue() && (equipLogDispatchContext.getNeedNewValue() || !StringUtils.isEmpty(isReadMultiCavityCfg))) { execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog().checkRepeatType(), stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]模具号,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - else if (!equipLogDispatchContext.getIsCollectValue()) + } else if (!equipLogDispatchContext.getIsCollectValue()) { return execDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, String.format("当前未读取到设备[%s]模具号,接口逻辑设置只读一次,当前读取模具号直接跳过!", cellEquipContext.getEquipmentName())); + } //读取的模具号进行规则匹配 List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.MOULD_NO.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据: 设置常变值 或者 当前没有头道模具号或生产工单信息 - if (CollectionUtils.isEmpty(equipVariableCollectContextList) && (equipLogDispatchContext.getNeedNewValue() || !StringUtils.isEmpty(isReadMultiCavityCfg))) + if (CollectionUtils.isEmpty(equipVariableCollectContextList) && (equipLogDispatchContext.getNeedNewValue() || !StringUtils.isEmpty(isReadMultiCavityCfg))) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的模具号,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), - stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的模具号,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext))), + stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的模具号,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); - else if (CollectionUtils.isEmpty(equipVariableCollectContextList)) //非常变值 没有有效的数据 也无需再读 + } else if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + //非常变值 没有有效的数据 也无需再读 return execDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, true, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT, String.format("当前未读取到设备[%s]有效的模具号,接口逻辑设置只读一次,当前读取模具号直接跳过!", cellEquipContext.getEquipmentName())); + } //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 equipmentLogExtService.updateEquipmentLogList(reqBean.getOrganizeCode(), cellEquipContext.getEquipId(), equipLogDispatchContext.getResetEquipVariableIdList()); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]模具号的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //默认只需要配置一个点位 String mouldNo = equipVariableCollectContextList.get(0).getEquipVariableValue(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultReadStepService.java index c7bcea1..86f3813 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultReadStepService.java @@ -127,7 +127,8 @@ public class MesProductResultReadStepService extends BaseStepService { //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 equipmentLogExtService.updateEquipmentLogList(reqBean.getOrganizeCode(), cellEquipContext.getEquipId(), equipLogDispatchContext.getResetEquipVariableIdList()); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]加工结果的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); return stepResult; @@ -180,7 +181,8 @@ public class MesProductResultReadStepService extends BaseStepService { String.format("%s!", MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.valueOfDescription(entry.getKey()))); } - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), String.format("读取设备[%s]加工结果的数据变量值匹配接口逻辑规则失败,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("读取设备[%s]加工结果的数据变量值匹配接口逻辑规则失败,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean, stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]加工结果,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintStepService.java index 199f9fe..de0e483 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintStepService.java @@ -6,7 +6,9 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; 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.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; @@ -109,6 +111,7 @@ public class MesProductSnPrintStepService extends BaseStepService { MesLabelTemplate labelTemplate = getLabelTemplate(prodLabelTemplate, organizeCode); mesProduceSnPrintModel.setMesLabelTemplate(labelTemplate); mesProduceSnPrintModel.setProductSn(sn.getProductSn()); + mesProduceSnPrintModel.setPartNo(sn.getPartNo()); mesProduceSnPrintModel.setOrganizeCode(organizeCode); List snList = new ArrayList<>(); snList.add(sn); @@ -138,10 +141,11 @@ public class MesProductSnPrintStepService extends BaseStepService { List snLogList = printModelList.stream().map(MesProduceSnPrintModel::getMesPrintedSnLogList).flatMap(List::stream).collect(Collectors.toList()); //更新打印状态 for (MesProductionPsOutContext outSn : productionPsOutContextList) { - Long id = outSn.getId(); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(outSn.getOrganizeCode()); - DdlPreparedPack.getNumberSmallerEqualPack(id,"id",ddlPackBean); - mesProduceSnRao.updateByProperties("printStatus",MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue(),ddlPackBean); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(outSn.getOrganizeCode()); + DdlPreparedPack.getNumEqualPack(outSn.getId(), MesPcnExtConstWords.ID, packBean); + mesProduceSnRao.updateByProperties( + new String[]{MesPcnExtConstWords.PRINT_STATUS, MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME}, + new Object[]{MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue(), reqBean.getUserInfo(), TimeTool.getNowTime(true)}, packBean); } //保存打印条码记录 snLogRao.saveAll(snLogList); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java index fbac4bf..7b8fa87 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnReadStepService.java @@ -141,15 +141,19 @@ public class MesProductSnReadStepService extends BaseStepService { List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SN.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据 - if (CollectionUtils.isEmpty(equipVariableCollectContextList)) + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的主条码,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), - stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的主条码,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext))), + stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的主条码,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 equipmentLogExtService.updateEquipmentLogList(reqBean.getOrganizeCode(), cellEquipContext.getEquipId(), equipLogDispatchContext.getResetEquipVariableIdList()); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("读取到设备[%s]主条码的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //读取主条码前置验证 checkReadProductSnValid(reqBean, resultBean, stepParamMap, stepResult, productionProcessContext, cellEquipContext, equipVariableCollectContextList); @@ -217,8 +221,7 @@ public class MesProductSnReadStepService extends BaseStepService { Integer ppSize = CollectionUtils.isEmpty(finishCodePpList) ? MesPcnExtConstWords.ZERO : finishCodePpList.size(); Integer psSize = CollectionUtils.isEmpty(finishCodeList) ? MesPcnExtConstWords.ZERO : finishCodeList.size(); - return ppSize.compareTo(psSize) <= 0 ? stepResult : - stepResult.isCompleted(false).msg(String.format("当前读取到设备[%s]主条码空腔数量[%s]小于产出零件对应的空腔数量[%s],持续监听中...", cellEquipContext.getEquipmentName(), psSize, ppSize)); + return ppSize.compareTo(psSize) <= 0 ? stepResult : stepResult.isCompleted(false).msg(String.format("当前读取到设备[%s]主条码空腔数量[%s]小于产出零件对应的空腔数量[%s],持续监听中...", cellEquipContext.getEquipmentName(), psSize, ppSize)); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoReadStepService.java index aaf6a48..e7fc7a4 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductionPartNoReadStepService.java @@ -143,15 +143,19 @@ public class MesProductionPartNoReadStepService extends BaseStepService { List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCTION_PART_NO.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据 - if (CollectionUtils.isEmpty(equipVariableCollectContextList)) + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的产出零件号,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的产出零件号,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } //根据设备ID,设备数据变量ID集合 修改设备ID分表采集数据的状态 equipmentLogExtService.updateEquipmentLogList(reqBean.getOrganizeCode(), cellEquipContext.getEquipId(), equipLogDispatchContext.getResetEquipVariableIdList()); - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]产出零件号的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //发送工步内容 String scanInfo = equipVariableCollectContextList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.joining(MesPcnExtConstWords.SEMICOLON)); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesReadySignalReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesReadySignalReadStepService.java index 8567904..225039f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesReadySignalReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesReadySignalReadStepService.java @@ -144,7 +144,8 @@ public class MesReadySignalReadStepService extends BaseStepService { MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); } - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), + String.format("读取到设备[%s]就绪信号的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //匹配成功发送工步内容 productionCustomContextStepService.doSendStepContextMessage(reqBean, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.READY_SIGNAL.getDescription(), MesExtEnumUtil.CELL_MESSAGE_SOURCE.READ); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderReadStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderReadStepService.java index c40cb48..3bffa2e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderReadStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderReadStepService.java @@ -145,12 +145,16 @@ public class MesWorkOrderReadStepService extends BaseStepService { List equipVariableCollectContextList = (List) equipVariableCfgRuleMatchService.matchEquipVariableCfgCollectContext(reqBean, productionProcessContext, MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.WORK_ORDER.getValue(), equipLogDispatchContext.getEquipVariableCfgCollectContextList()); //没有有效的数据 - if (CollectionUtils.isEmpty(equipVariableCollectContextList)) + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), + String.format("当前未读取到设备[%s]有效的加工单,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.EXP_TEXT); execThreadSleepAndSendTaskCompleteAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(), - stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的加工单,持续监听中...%s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext))), + stepResult.isCompleted(false).msg(String.format("当前未读取到设备[%s]有效的加工单,持续监听中...", cellEquipContext.getEquipmentName())), MesPcnEnumUtil.STATION_BUSI_TYPE.GUIDE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, stepParamMap, MesPcnExtConstWords.READ_FAILURE_SLEEP, MesPcnExtConstWords.READ_FAILURE_SLEEP_DEFAULT_TIME); + } - this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()), JSONObject.toJSONString(equipLogDispatchContext), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + this.sendMessage(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).checkRepeatType(false), + String.format("读取到设备[%s]加工单的详细JSON内容: %s", cellEquipContext.getEquipmentName(), JSONObject.toJSONString(equipLogDispatchContext)), MesPcnEnumUtil.STATION_BUSI_TYPE.RUNNING_INFO, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); //保存设备当前一轮工序的待验证的加工单信息 productionDispatchContextStepService.saveScanWorkOrderNoContext(reqBean, equipVariableCollectContextList); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveStepService.java index 4614416..b6c4da4 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveStepService.java @@ -144,6 +144,7 @@ public class MesWorkOrderSaveStepService extends BaseStepService { workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); propertyNameList.add("completeQty"); propertyValueList.add(workOrder.getCompleteQty()); + } //修改未完成数量 if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0 && workOrder.getUnCompleteQty().compareTo(new Double(0)) > 0 && @@ -184,6 +185,10 @@ public class MesWorkOrderSaveStepService extends BaseStepService { workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); propertyNameList.add("workOrderStatus"); propertyValueList.add(workOrder.getWorkOrderStatus()); + } else if (workOrder.getCompleteQty() > 0 && workOrder.getWorkOrderStatus() == MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) { + workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); + propertyNameList.add("workOrderStatus"); + propertyValueList.add(workOrder.getWorkOrderStatus()); } //如果数量都没有修改,不操作数据库 if (!propertyNameList.isEmpty()) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-72.properties b/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-72.properties index 8cfd2ce..896e07e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-72.properties +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/resources/application-72.properties @@ -252,27 +252,26 @@ slm.api.password=4C9479EBEFA6FA6E232EF25EFA49C4D2 slm.app.id=20190513 # \u811A\u672C\u5728\u7EBF\u8C03\u8BD5\u751F\u6210\u7684\u65E5\u5FD7\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84\uFF0Cclasspath:xx pcn.script.logger.path=pluginlogs -pcn.schedule.job=true +pcn.schedule.job=false server.tomcat.max-threads=300 server.tomcat.max-connections=300 plugin.mainPackage=cn.estsh.i3plus -#####\u5B9A\u65F6\u4EFB\u52A1 +impp.xxlJob.admin.enable=true impp.schedule.scheduleType=xxljob -xxl.job.admin.addresses=http://172.28.14.48:10010/xxl-job-admin +xxl.job.admin.addresses=http://10.195.88.71:10010/xxl-job-admin ### xxl-job, access token xxl.job.accessToken= ### xxl-job executor appname #xxl.job.executor.appname=${project.name} -xxl.job.executor.appname=pcn +xxl.job.executor.appname=i3mes-pcn ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null xxl.job.executor.address= ### xxl-job executor server-info -xxl.job.executor.ip=192.168.6.70 +xxl.job.executor.ip=10.195.88.71 #xxl.job.executor.ip= -#xxl.job.executor.port=9999 -xxl.job.executor.port=9999 +xxl.job.executor.port=12345 ### xxl-job executor log-path xxl.job.executor.logpath= ### xxl-job executor log-retention-days @@ -290,3 +289,4 @@ mqtt.keepalive=30 mqtt.clearSession=true pcn.mqtt.flag = true mqtt.topic.list=ABC,ABD,ADE +xxl.job.execute.methodName=executeImppJob,execute 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 c95ef52..a9fba24 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 @@ -79,6 +79,8 @@ public class MesPcnExtConstWords { public static final String VARIABLE_CFG_TYPE = "variableCfgType"; // 变量状态 public static final String EQUIP_VARIABLE_STATUS = "equipVariableStatus"; + // 变量值 + public static final String EQUIP_VARIABLE_VALUE = "equipVariableValue"; // 模具号 public static final String MOULD_NO = "mouldNo"; // 工单完成数 @@ -159,6 +161,8 @@ public class MesPcnExtConstWords { public static final String ERP_PART_NO = "erpPartNo"; // 编码规则代码 public static final String RULE_CODE = "ruleCode"; + // 打印状态 + public static final String PRINT_STATUS = "printStatus"; // 时间格式 public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; @@ -269,8 +273,10 @@ public class MesPcnExtConstWords { public static final String SQUARE_BRACKETS_R = "]"; // * public static final String ASTERISK = "*"; - + //- public static final String SEPARATOR = "-"; + //_ + public static final String E_UNDERLINE = "_";