From 29759184b68881b5c3de7cdd74de0eedb33034ec Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Mon, 29 Jul 2024 15:50:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?mes=E6=8A=A5=E8=A1=A8=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=88=86=E8=A1=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ext/mes/pcn/api/busi/IMesConfigService.java | 6 +++++ .../serviceimpl/busi/MesConfigService.java | 27 ++++++++++++++++++++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 7 +++++- 3 files changed, 39 insertions(+), 1 deletion(-) 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 a9315a3..04e620c 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 @@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation; * @Author: simon.song */ public interface IMesConfigService { + @ApiOperation(value = "获取配置表模板代码") String getCfgValue(String org, String key); @@ -18,5 +19,10 @@ public interface IMesConfigService { @ApiOperation(value = "获取配置表模板代码") MesConfig getMesConfig(String org, String key); + @ApiOperation(value = "根据分隔符验证是否存在元素的配置") + Boolean checkCfgValueIsContainItem(String orginzeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item); + + @ApiOperation(value = "验证分表配置") + Boolean checkShardingTablesObjectCfg(String orginzeCode, String cfgKey, String item); } 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 8ac5ace..411c4ba 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 @@ -1,13 +1,21 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService; +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.MesConfig; import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; 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.Arrays; +import java.util.List; /** * @Description: @@ -55,4 +63,23 @@ public class MesConfigService implements IMesConfigService { } return config; } + + @Override + public Boolean checkCfgValueIsContainItem(String orginzeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(orginzeCode); + DdlPreparedPack.getStringEqualPack(cfgCode, MesPcnExtConstWords.CFG_CODE, packBean); + DdlPreparedPack.getStringEqualPack(cfgKey, MesPcnExtConstWords.CFG_KEY, packBean); + DdlPreparedPack.getStringEqualPack(cfgType, MesPcnExtConstWords.CFG_TYPE, packBean); + MesConfig config = configRepository.getByProperty(packBean); + if (null == config || StringUtils.isEmpty(config.getCfgValue())) return false; + List cfgValueList = Arrays.asList(config.getCfgValue().split(splitStr)); + return (!CollectionUtils.isEmpty(cfgValueList) && cfgValueList.contains(item)) ? true : false; + } + + @Override + public Boolean checkShardingTablesObjectCfg(String orginzeCode, String cfgKey, String item) { + return checkCfgValueIsContainItem(orginzeCode, MesPcnExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES_PCN.name(), MesPcnExtConstWords.SEMICOLON, item); + } + + } 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 98eff65..ddb2446 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 @@ -33,6 +33,10 @@ public class MesPcnExtConstWords { public static final String SUPPLIER_CODE_NO_SORT_GZ = "SUPPLIER_CODE_NO_SORT_GZ"; // 系统配置代码 public static final String CFG_CODE = "cfgCode"; + // 系统配置键 + public static final String CFG_KEY = "cfgKey"; + // 系统配置类型 + public static final String CFG_TYPE = "cfgType"; // 用户ID public static final String USER_ID = "userId"; // 区域代码 @@ -284,7 +288,8 @@ public class MesPcnExtConstWords { //_ public static final String E_UNDERLINE = "_"; - + // 分表配置 + public static final String MES_SHARDING_TABLES_OBJECT_CFG = "MES_SHARDING_TABLES_OBJECT_CFG"; //过程条码默认生成规则 public static final String DEFAULT_SERIAL_NUMBER_RULE = "DEFAULT_SERIAL_NUMBER_RULE"; From 3c024dcb893710bd879809a9de8a34f14f9a22d4 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Mon, 29 Jul 2024 16:06:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?mes=E6=8A=A5=E8=A1=A8=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=88=86=E8=A1=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesConfigService.java | 4 ++-- .../ext/mes/pcn/apiservice/serviceimpl/busi/MesConfigService.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 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 04e620c..2053fc5 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 @@ -20,9 +20,9 @@ public interface IMesConfigService { MesConfig getMesConfig(String org, String key); @ApiOperation(value = "根据分隔符验证是否存在元素的配置") - Boolean checkCfgValueIsContainItem(String orginzeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item); + Boolean checkCfgValueIsContainItem(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item); @ApiOperation(value = "验证分表配置") - Boolean checkShardingTablesObjectCfg(String orginzeCode, String cfgKey, String item); + Boolean checkShardingTablesObjectCfg(String organizeCode, String cfgKey, String item); } 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 411c4ba..5234a31 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 @@ -65,8 +65,8 @@ public class MesConfigService implements IMesConfigService { } @Override - public Boolean checkCfgValueIsContainItem(String orginzeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item) { - DdlPackBean packBean = DdlPackBean.getDdlPackBean(orginzeCode); + public Boolean checkCfgValueIsContainItem(String organizeCode, String cfgCode, String cfgKey, String cfgType, String splitStr, String item) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getStringEqualPack(cfgCode, MesPcnExtConstWords.CFG_CODE, packBean); DdlPreparedPack.getStringEqualPack(cfgKey, MesPcnExtConstWords.CFG_KEY, packBean); DdlPreparedPack.getStringEqualPack(cfgType, MesPcnExtConstWords.CFG_TYPE, packBean); @@ -77,8 +77,8 @@ public class MesConfigService implements IMesConfigService { } @Override - public Boolean checkShardingTablesObjectCfg(String orginzeCode, String cfgKey, String item) { - return checkCfgValueIsContainItem(orginzeCode, MesPcnExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES_PCN.name(), MesPcnExtConstWords.SEMICOLON, item); + public Boolean checkShardingTablesObjectCfg(String organizeCode, String cfgKey, String item) { + return checkCfgValueIsContainItem(organizeCode, MesPcnExtConstWords.MES_SHARDING_TABLES_OBJECT_CFG, cfgKey, CommonEnumUtil.SOFT_TYPE.MES_PCN.name(), MesPcnExtConstWords.SEMICOLON, item); } From 201371239744903b01389d6fae78719b74177ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E7=AC=91=E7=9D=80=E9=9D=A2=E5=AF=B9=E6=98=8E?= =?UTF-8?q?=E5=A4=A9?= <752558143@qq.com> Date: Mon, 29 Jul 2024 17:21:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8A=A5=E5=B7=A5=E9=97=AE=E9=A2=98?= =?UTF-8?q?=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 | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) 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 5ed14da..bab1738 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 @@ -675,18 +675,26 @@ public class MesWorkOrderService implements IMesWorkOrderService { MesShift currentShift = shifts.stream().filter(mesShift -> Objects.equals(mesShift.getShiftCode(), shiftCode)).findFirst().orElse(null); - String beginTime =productionRecord.getLotNo() + " " + currentShift.getStartTime(); - Date beginDate = transfer(beginTime); - - /*MesWorkOrder found = null; - for (MesWorkOrder oldMesWorkOrder : oldMesWorkOrders) { - if (beginDate.getTime() >= transfer(oldMesWorkOrder.getPlanStartTime()).getTime() && beginDate.getTime() < transfer(oldMesWorkOrder.getPlanEndTime()).getTime()) { - found = oldMesWorkOrder; - break; + + String orderDate = productionRecord.getLotNo(); + if (currentShift.getStartTime().compareTo(currentShift.getEndTime()) > 0){ + // 如果比0点大,需要找日期前一天的班次的工单号,如果是0点前,date =lotNO 如果是0点后,则找lot的前一天 + int hours = transfer(productionRecord.getCompleteDateTime()).getHours(); + if (hours < 12) { + orderDate = getDate(productionRecord.getLotNo(), 1); + } else { + orderDate = getDate(productionRecord.getLotNo(), 0); + } + } + + List list = new ArrayList<>(); + for (MesWorkOrder oldMesWorkOrder : oldMesWorkOrders) { + if (Objects.equals(oldMesWorkOrder.getShiftCode(), productionRecord.getShiftCode()) && Objects.equals(oldMesWorkOrder.getProduceTime(), orderDate)) { + list.add(oldMesWorkOrder); + } } - }*/ + workOrders = list; - workOrders = oldMesWorkOrders.stream().filter(workOrder -> beginDate.getTime() >= transfer(workOrder.getPlanStartTime()).getTime() && beginDate.getTime() <= transfer(workOrder.getPlanEndTime()).getTime()).collect(Collectors.toList()); MesWorkOrder bestWorkOrder = getBestWorkOrder(productionRecord, workOrders, mesWorkCenter); @@ -798,7 +806,7 @@ public class MesWorkOrderService implements IMesWorkOrderService { List centerList = Arrays.asList(workCenterCodes.split(",")); DdlPreparedPack.getNotInPack(centerList, "workCenterCode", ddlPackBean); } - /*String workCenterCodes ="C06CK01B"; + /*String workCenterCodes ="B19CK01A"; if (!StringUtils.isEmpty(workCenterCodes)) { List centerList = Arrays.asList(workCenterCodes.split(",")); DdlPreparedPack.getInPack(centerList, "workCenterCode", ddlPackBean);