From 655f495f7b203b51b9fd20bb8cbafa8b8bea9305 Mon Sep 17 00:00:00 2001 From: jun Date: Wed, 31 Jul 2024 10:47:41 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B8=85=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesProduceSnPrintService.java | 15 +++++++++++++-- .../i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java index 972668e..ad94bab 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java @@ -118,6 +118,8 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { @Override public MesProduceSnPrintModel doPrint(MesProduceSnPrintModel mesProduceSnPrintModel) { String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + //获取产线信息 + String workCenterCode = getWorkCenterCode(organizeCode); //物料信息 MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); @@ -132,7 +134,7 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { DdlPreparedPack.getStringEqualPack(snRule, "ruleCode", mesRulePackBean); List ruleList = mesNumberRuleRDao.findByHqlWhere(mesRulePackBean); if (ruleList.isEmpty()) { - MesPcnException.throwMesBusiException("零件号【】打印规则查询不到!", mesPart.getPartNo()); + MesPcnException.throwMesBusiException("零件号【%s】打印规则查询不到!", mesPart.getPartNo()); } MesNumberRule numberRule = ruleList.get(0); String methodNameExt = numberRule.getMethodNameExt(); @@ -166,6 +168,7 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { MesProduceSnPrintModel resultModel = templateStrategy.execute(genSerialNoModel, mesProduceSnPrintModel, numberRule,null,null,false); resultModel.getMesProduceSnList().forEach(mesProduceSn -> { + mesProduceSn.setWorkCenterCode(workCenterCode); mesProduceSn.setFid(UUID.randomUUID().toString()); //保存条码 mesProduceSnRDao.insert(mesProduceSn); @@ -186,7 +189,7 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { DdlPreparedPack.getStringEqualPack(mesProduceSnPrintModel.getProductSn(), "barcode", snLogPackBean); List snLogList = mesPrintedSnRao.findByHqlWhere(snLogPackBean); if (snLogList.isEmpty()) { - MesPcnException.throwMesBusiException("条码【】查询不到打印记录!", mesProduceSnPrintModel.getProductSn()); + MesPcnException.throwMesBusiException("条码【%s】查询不到打印记录!", mesProduceSnPrintModel.getProductSn()); } MesPrintedSnLog mesPrintedSnLog = snLogList.get(0); MesProduceSnPrintDataModel model = new MesProduceSnPrintDataModel(); @@ -198,6 +201,14 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { return mesProduceSnPrintModel; } + private String getWorkCenterCode(String organizeCode) { + List mesConfigList = configService.findMesConfigByCfgCode(MesPcnExtConstWords.PRINT_WORK_CENTER_COED, organizeCode); + if(CollectionUtils.isEmpty(mesConfigList)){ + MesPcnException.throwMesBusiException("条码打印产线参数【%s】未维护",MesPcnExtConstWords.PRINT_WORK_CENTER_COED); + } + return mesConfigList.iterator().next().getCfgValue(); + } + private String getTemplate(MesProduceSnPrintModel mesProduceSnPrintModel, MesPart mesPart) { Date date = new Date(); StringBuilder template = new StringBuilder(); 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 ddb2446..3832e63 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 @@ -379,5 +379,8 @@ public class MesPcnExtConstWords { public static final String SEND_DATA = "SEND_DATA"; public static final String SEND_ITEM_DATA = "SEND_ITEM_DATA"; + //条码打印产线 + public static final String PRINT_WORK_CENTER_COED = "PRINT_WORK_CENTER_COED"; + }