From 4273eba96c58134cb095632a0f17cb3a96689efb Mon Sep 17 00:00:00 2001 From: administrator Date: Sun, 30 Jun 2024 17:53:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A1=A5=E5=BD=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/IMesWorkCellScanMonitorLogService.java | 17 +++++ .../schedulejob/MesWorkCellOperationLogJob.java | 52 +++++++++++++++ .../busi/MesWorkCellScanMonitorLogServiceImpl.java | 75 ++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkCellScanMonitorLogService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkCellScanMonitorLogService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkCellScanMonitorLogService.java new file mode 100644 index 0000000..5fdd860 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkCellScanMonitorLogService.java @@ -0,0 +1,17 @@ +package cn.estsh.i3plus.ext.mes.pcn.api.busi; + +/** + * @Description : 补录工位操作日志 + * @Reference : + * @Author : Castle + * @CreateDate : 2024/6/30 16:44 + * @Modify: + **/ +public interface IMesWorkCellScanMonitorLogService { + /** + * 每次补录的条数 + * @param pageSize + * @param organizeCode + */ + void doRecordCellOperationLog(String organizeCode,Integer pageSize); +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java new file mode 100644 index 0000000..69293d8 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java @@ -0,0 +1,52 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.schedulejob; + + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkCellScanMonitorLogService; +import cn.estsh.impp.framework.boot.init.ApplicationProperties; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +/** + * @Description : 生产开模统计job + * @Reference : + * @Author : Castle + * @CreateDate 2024/6/26 18:22 + * @Modify: + **/ +@Slf4j +@DisallowConcurrentExecution +@Component +@ApiOperation("工位操作日志字段补录job") +public class MesWorkCellOperationLogJob extends BaseMesScheduleJob { + + @Autowired + private IMesWorkCellScanMonitorLogService logService; + + public MesWorkCellOperationLogJob() { + super(MesWorkCellOperationLogJob.class, "工位操作日志字段补录job"); + } + + @Override + public void executeMesJob(JobExecutionContext context, ApplicationProperties applicationProperties) { + /** + * 入参 + * { + * "organizeCode":"CK01", + * "pageSize":50 + * } + */ + String jobParam = this.getJobParam(); + JSONObject params = JSONUtil.parseObj(jobParam); + + String organizeCode = params.get("organizeCode").toString(); + Integer pageSize = Integer.parseInt(params.get("pageSize").toString()); + logService.doRecordCellOperationLog(organizeCode,pageSize); + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java new file mode 100644 index 0000000..d29e0ca --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java @@ -0,0 +1,75 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkCellScanMonitorLogService; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog; +import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellScanMonitorLogRepository; +import com.netflix.discovery.converters.Auto; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description : + * @Reference : + * @Author : Castle + * @CreateDate : 2024/6/30 16:57 + * @Modify: + **/ +@Service +public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMonitorLogService { + @Autowired + private MesWorkCellScanMonitorLogRepository monitorLogRao; + + @Autowired + private MesProductionRecordRepository productionRecordRao; + + /** + * 根据 MesWorkCellScanMonitorLog 表中 mouldRecordId 开模id 有数据 才去补录 + * 补录数据 是根据MesProductionRecord 中的 开模id相匹配去做 + * @param pageSize + * @param organizeCode + */ + @Override + public void doRecordCellOperationLog(String organizeCode,Integer pageSize) { + //查询serviceFlag是未处理状态,mouldRecordId不为空的记录,每次查询pageSize 默认50条 + DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),"serviceFlag",logPackBean); + DdlPreparedPack.getIsNotNull("mouldRecordId",logPackBean); + List monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize); + + if (!monitorLogs.isEmpty()) { + for (MesWorkCellScanMonitorLog monitorLog : monitorLogs) { + Long mouldRecordId = monitorLog.getMouldRecordId(); + DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getNumEqualPack(mouldRecordId,"mouldRecordId",logPackBean); + List recordList = productionRecordRao.findByHqlWhere(recordPackBean); + //需要补录如下字段 + if (!recordList.isEmpty()) { + String workOrderNoStr = recordList.stream().map(MesProductionRecord::getWorkOrderNo).collect(Collectors.joining(",")); + String serialNoStr = recordList.stream().map(MesProductionRecord::getSerialNumber).collect(Collectors.joining(",")); + String productSnStr = recordList.stream().map(MesProductionRecord::getProductSn).collect(Collectors.joining(",")); + String custSnStr = recordList.stream().map(MesProductionRecord::getCustSn).collect(Collectors.joining(",")); + String partNoStr = recordList.stream().map(MesProductionRecord::getPartNo).collect(Collectors.joining(",")); + String partNameStr = recordList.stream().map(MesProductionRecord::getPartName).collect(Collectors.joining(",")); + monitorLog.setWorkOrderNo(workOrderNoStr); + monitorLog.setSerialNumber(serialNoStr); + monitorLog.setProductSn(productSnStr); + monitorLog.setCustSn(custSnStr); + monitorLog.setPartNo(partNoStr); + monitorLog.setPartName(partNameStr); + ConvertBean.saveOrUpdate(monitorLog,"JOB"); + } + } + monitorLogRao.saveAll(monitorLogs); + } + + } +} From a443453c9cf24a8c2ef55abae86c137069eacf2a Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 4 Jul 2024 08:55:39 +0800 Subject: [PATCH 2/3] assemnly skip code --- .../IMesProductionProcessContextStepService.java | 4 +- .../step/MesAssemblyMatchNosortStepService.java | 43 +++++++++++++++++++--- .../step/MesProductSnScanNosortStepService.java | 10 +---- .../step/MesProductSnScanSortStepService.java | 2 + .../MesProductionProcessContextStepService.java | 15 +++++--- .../MesProductionAssemblyNosortContext.java | 7 ++++ .../context/MesProductionAssemblySortContext.java | 2 + .../pojo/context/MesProductionProcessContext.java | 20 +++++++++- .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 9 ++++- 9 files changed, 86 insertions(+), 26 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java index 691d430..9ab1c27 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesProductionProcessContextStepService.java @@ -36,8 +36,8 @@ public interface IMesProductionProcessContextStepService { @ApiOperation(value = "获取工序工艺信息") MesProductionProcessContext processContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext); - @ApiOperation(value = "获取finishCode码") - MesProductionProcessContext finishCodeContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext); + @ApiOperation(value = "获取生产过程控制全局密码") + MesProductionProcessContext productionPwdContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext); @ApiOperation(value = "验证组织模型有效性") MesProductionProcessContext checkBaseData(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext); 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 9dbb32c..174dbf4 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 @@ -103,8 +103,11 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { //删除上下文扫/读信息:装配件条码 productionDispatchContextStepService.deleteScanAssemblySnContext(reqBean); + //验证当前是否属于装配件跳过码 + Boolean isSkip = checkIsSkip(productionProcessContext, equipVariableCollectContextList); + //处理待验证的装配件条码 [扫描模式匹配成功返回true, 否则返回flase, 非扫描模式需要验证是否全部匹配完成] - Boolean result = doHandleMatchAssembly(reqBean, resultBean, stepResult, prodRuleContextList, equipVariableCollectContextList); + Boolean result = doHandleMatchAssembly(reqBean, resultBean, stepResult, prodRuleContextList, equipVariableCollectContextList, isSkip); //验证是否存在待绑定数据 hasUnBindAssembly = hasUnBindAssembly(prodRuleContextList); @@ -122,17 +125,25 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { if (!hasUnBindAssembly) return execDynamicsCompleteAndSendMsgReturn(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匹配成功!当前上下文中的加工规则对应的装配件扫描项均匹配完毕!", assemblySn)); + MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("%s当前上下文中的加工规则对应的装配件扫描项均匹配完毕!", isSkip ? stepResult.getMsg() : String.format("上下文中的装配件条码%s匹配成功!", assemblySn))); //单次匹配成功 if (result) return execDynamicsCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), - stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, String.format("上下文中的装配件条码%s匹配成功!", assemblySn)); + stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, isSkip ? stepResult.getMsg() : String.format("上下文中的装配件条码%s匹配成功!", assemblySn)); return execNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog().scanInfo(assemblySn), stepResult.nextTriggerEvent(MesPcnExtConstWords.NEXT_TRIGGER_EVENT_ASSEMBLY), String.format("上下文中的装配件条码%s匹配失败!%s", assemblySn, StringUtils.isEmpty(stepResult.getMsg()) ? MesPcnExtConstWords.EMPTY : stepResult.getMsg())); } + //验证当前是否属于装配件跳过码 + private Boolean checkIsSkip(MesProductionProcessContext productionProcessContext, List equipVariableCollectContextList) { + if (equipVariableCollectContextList.size() > 1) return false; + if (equipVariableCollectContextList.get(0).getMessageSource().compareTo(MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN.getValue()) != 0) return false; + if (!equipVariableCollectContextList.get(0).getEquipVariableValue().equals(productionProcessContext.getAssemblySkipCode())) return false; + return true; + } + //判断是否存在装配件清单 private Boolean checkIsNeedScanAssembly(List prodRuleContextList) { Optional optional = prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getAssemblyDataJson()))).findFirst(); @@ -154,7 +165,9 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { } //处理待验证的装配件条码 [扫描模式匹配成功返回true, 否则返回flase, 非扫描模式需要验证是否全部匹配完成] - private Boolean doHandleMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List prodRuleContextList, List equipVariableCollectContextList) { + private Boolean doHandleMatchAssembly(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List prodRuleContextList, List equipVariableCollectContextList, Boolean isSkip) { + + Boolean flag = false; //遍历产品加工规则 for (MesProdRuleContext prodRuleContext : prodRuleContextList) { @@ -165,8 +178,8 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { //获取非排序装配件清单 List productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext(); - Boolean flag = false; //遍历装配件清单 + LOOP: for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) { //已装配 @@ -178,6 +191,23 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { //已被消费 if (null == equipVariableCollectContext || equipVariableCollectContext.getIsConsume().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) continue; + //装配件跳过, 必须顺序扫描才生效 + if (isSkip && !StringUtils.isEmpty(prodRuleContext.getIsCheckBindSeq()) && prodRuleContext.getIsCheckBindSeq().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) { + + //匹配成功 + equipVariableCollectContext.isConsume(); + + flag = true; + + //装配件清单该数据标记跳过 + productionAssemblyNosortContext.assemblySkip(); + + stepResult.msg(String.format("装配件跳过码验证成功,已跳过当前装配项!")); + + break LOOP; + + } + //匹配规则 List filterList = (List) numberRuleMatchDispatchService.matchNumberRule(reqBean.getOrganizeCode(), equipVariableCollectContext.getEquipVariableValue(), Stream.of(productionAssemblyNosortContext).collect(Collectors.toList())); @@ -205,6 +235,7 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { //匹配成功 equipVariableCollectContext.isConsume(); + flag = true; //装配件清单该数据标记已装配 (如果是自制件赋值productSnId) @@ -225,7 +256,7 @@ public class MesAssemblyMatchNosortStepService extends BaseStepService { } - return false; + return flag; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java index 7f7695d..10a7b99 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanNosortStepService.java @@ -91,7 +91,7 @@ public class MesProductSnScanNosortStepService extends BaseStepService { List productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean); //验证扫描信息是否属于工艺强过码 - Boolean isCraftJumpCode = checkScanInfoMatchCraftJumpCode(reqBean, scanInfo); + Boolean isCraftJumpCode = (!StringUtils.isEmpty(scanInfo) && scanInfo.equals(productionProcessContext.getCraftJumpCode())) ? true : false; //不属于工艺强过码,并且存在扫描信息,剔除此前已标记工艺防错结果错误的数据 if (!isCraftJumpCode && !StringUtils.isEmpty(scanInfo) && !CollectionUtils.isEmpty(productionPsInContextList)) productionPsInContextList = updateProductionPsInContextList(reqBean, productionPsInContextList); @@ -201,14 +201,6 @@ public class MesProductSnScanNosortStepService extends BaseStepService { return productionPsInContextList; } - //验证扫描信息是否属于工艺强过码 - private Boolean checkScanInfoMatchCraftJumpCode(StationRequestBean reqBean, String scanInfo) { - if (StringUtils.isEmpty(scanInfo)) return false; - String craftJumpCode = fsmCommonService.doHandleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.CRAFT_JUMP_CODE); - if (StringUtils.isEmpty(craftJumpCode)) craftJumpCode = MesPcnExtConstWords.CRAFT_JUMP_CODE; - return scanInfo.equals(craftJumpCode) ? true : false; - } - //验证前期扫描数量是否已超过匹配腔数 private void checkIsAboveNeedQty(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, Integer scanedQty, Integer needQty, List equipVariableCollectContextList, List productionPsInContextList, List productionPartContextList, MesCellEquipContext cellEquipContext) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanSortStepService.java index 60c82b2..511c1d2 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnScanSortStepService.java @@ -104,6 +104,8 @@ public class MesProductSnScanSortStepService extends BaseStepService { //删除上下文扫/读信息:主条码 if (!CollectionUtils.isEmpty(equipVariableCollectContextList)) productionDispatchContextStepService.deleteScanProductSnContext(reqBean); + //TODO 下面逻辑可能有问题 目前未处理 + //验证是否匹配工艺强过码 if (equipVariableCollectContextList.size() != 1 || checkScanInfoMatchCraftJumpCode(reqBean, equipVariableCollectContextList.get(0).getEquipVariableValue())) { String productSnStr = equipVariableCollectContextList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java index 5aa1437..b2895ff 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java @@ -87,8 +87,8 @@ public class MesProductionProcessContextStepService extends BaseStepService impl //生产过程上下文对象赋值工序工艺信息 if (StringUtils.isEmpty(productionProcessContext.getProcessCode()) || !productionProcessContext.getProcessCode().equals(reqBean.getProcessCode())) processContext(reqBean, productionProcessContext); - //生产过程上下文对象赋值工序工艺信息 - if (StringUtils.isEmpty(productionProcessContext.getFinishCode())) finishCodeContext(reqBean, productionProcessContext); + //生产过程上下文对象赋值生产过程控制全局密码 + if (StringUtils.isEmpty(productionProcessContext.getFinishCode()) || StringUtils.isEmpty(productionProcessContext.getCraftJumpCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblySkipCode())) productionPwdContext(reqBean, productionProcessContext); //验证组织模型有效性 return checkBaseData(reqBean, productionProcessContext); @@ -118,11 +118,14 @@ public class MesProductionProcessContextStepService extends BaseStepService impl } - //获取finishCode码 + //获取生产过程控制全局密码 @Override - public MesProductionProcessContext finishCodeContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext) { - List configList = configService.doCachedConfigList(MesPcnExtConstWords.CAVITY_FINISH_CODE, reqBean.getOrganizeCode()); - return productionProcessContext.finishCode((!CollectionUtils.isEmpty(configList) && !StringUtils.isEmpty(configList.get(0).getCfgValue())) ? configList.get(0).getCfgValue() : MesPcnExtConstWords.CAVITY_FINISH_CODE); + public MesProductionProcessContext productionPwdContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext) { + List configList = configService.doCachedConfigList(MesPcnExtConstWords.PRODUCTION_PWD_CFG, reqBean.getOrganizeCode()); + Map> cfgKeyMap = CollectionUtils.isEmpty(configList) ? null : configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgKey()))).collect(Collectors.groupingBy(MesConfig::getCfgKey)); + return productionProcessContext.finishCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CAVITY_FINISH_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CAVITY_FINISH_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CAVITY_FINISH_CODE). + craftJumpCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CRAFT_JUMP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CRAFT_JUMP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CRAFT_JUMP_CODE). + assemblySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_SKIP_CODE); } //验证组织模型有效性 diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java index df18e27..ca00672 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblyNosortContext.java @@ -46,6 +46,7 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon this.partNo = prodRuleContext.getOutPartNo(); if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue(); + this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); if (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); if (!StringUtils.isEmpty(assemblySn)) { @@ -61,6 +62,12 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon return this; } + public MesProductionAssemblyNosortContext assemblySkip() { + this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue(); + this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + return this; + } + public MesProductionAssemblyNosortContext assemblySn(String assemblySn) { this.assemblySn = assemblySn; return this; diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java index e3a448b..2b86f78 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionAssemblySortContext.java @@ -1,6 +1,7 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.context; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly; import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderAssembly; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; @@ -106,6 +107,7 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte if (null != workOrderAssembly) BeanUtils.copyProperties(workOrderAssembly, this); if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this); if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO; + if (StringUtils.isEmpty(this.isSkip)) this.isSkip = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && (MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_50.getValue() == this.matchType || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_60.getValue() == this.matchType)) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue(); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java index 1dc9405..76e92cf 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java @@ -38,6 +38,12 @@ public class MesProductionProcessContext implements Serializable { @ApiParam("finishCode码") private String finishCode; + @ApiParam("工艺强过码") + private String craftJumpCode; + + @ApiParam("装配件跳过码") + private String assemblySkipCode; + @ApiParam("生产线信息([Json]MesWorkCenter)") private String workCenterJson; @@ -107,7 +113,7 @@ public class MesProductionProcessContext implements Serializable { return this; } - //---------------------- finishCode码赋值 --------------------------------------- + //---------------------- 生产过程控制全局密码 --------------------------------------- //上下文赋值finishCode码 public MesProductionProcessContext finishCode(String finishCode) { @@ -115,6 +121,18 @@ public class MesProductionProcessContext implements Serializable { return this.isNeedCache(); } + //上下文赋值工艺强过码 + public MesProductionProcessContext craftJumpCode(String craftJumpCode) { + this.craftJumpCode = craftJumpCode; + return this.isNeedCache(); + } + + //上下文赋值装配件跳过码 + public MesProductionProcessContext assemblySkipCode(String assemblySkipCode) { + this.assemblySkipCode = assemblySkipCode; + return this.isNeedCache(); + } + //---------------------- 生产线对象 --------------------------------------- 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 55ab152..6ebd9ee 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 @@ -165,8 +165,14 @@ public class MesPcnExtConstWords { //写设备日志KEY public static final String WRITE_DB_LOG_EXT_ACTOR = "writeDbLogExtActor"; + // 生产过程控制全局密码 + public static final String PRODUCTION_PWD_CFG = "PRODUCTION_PWD_CFG"; // 空腔码 public static final String CAVITY_FINISH_CODE = "CAVITY_FINISH_CODE"; + // 工艺强过码(前后防错/顺序防错) + public static final String CRAFT_JUMP_CODE = "CRAFT_JUMP_CODE"; + // 装配件跳过码 + public static final String ASSEMBLY_SKIP_CODE = "ASSEMBLY_SKIP_CODE"; // 设备代码[工步参数] public static final String EQUIPMENT_CODE_UC = "EQUIPMENT_CODE"; // 模具号读一模多腔配置[工步参数] @@ -182,8 +188,7 @@ public class MesPcnExtConstWords { // 排序需要扫描主条码配置[工步参数] public static final String SORT_NEED_SCAN_PS = "SORT_NEED_SCAN_PS"; - // 工艺强过码(前后防错/顺序防错)[工位参数] - public static final String CRAFT_JUMP_CODE = "CRAFT_JUMP_CODE"; + // 未知腔数[工位参数] public static final String CAVITY_UNKNOWN_CFG = "CAVITY_UNKNOWN_CFG"; // 支持混腔扫描[工位参数] From c283acfd7ce4753707487babc27a74f88d6d1a15 Mon Sep 17 00:00:00 2001 From: administrator Date: Thu, 4 Jul 2024 09:15:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A1=A5=E5=BD=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java | 1 - .../serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java index 69293d8..a7bedd8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/schedulejob/MesWorkCellOperationLogJob.java @@ -7,7 +7,6 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; import org.quartz.DisallowConcurrentExecution; import org.quartz.JobExecutionContext; import org.springframework.beans.factory.annotation.Autowired; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java index d29e0ca..efa7865 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkCellScanMonitorLogServiceImpl.java @@ -43,13 +43,14 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon DdlPackBean logPackBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),"serviceFlag",logPackBean); DdlPreparedPack.getIsNotNull("mouldRecordId",logPackBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"createDatetime"}, logPackBean); List monitorLogs = monitorLogRao.findByHqlTopWhere(logPackBean, pageSize); if (!monitorLogs.isEmpty()) { for (MesWorkCellScanMonitorLog monitorLog : monitorLogs) { Long mouldRecordId = monitorLog.getMouldRecordId(); DdlPackBean recordPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumEqualPack(mouldRecordId,"mouldRecordId",logPackBean); + DdlPreparedPack.getNumEqualPack(mouldRecordId,"mouldRecordId",recordPackBean); List recordList = productionRecordRao.findByHqlWhere(recordPackBean); //需要补录如下字段 if (!recordList.isEmpty()) { @@ -65,10 +66,11 @@ public class MesWorkCellScanMonitorLogServiceImpl implements IMesWorkCellScanMon monitorLog.setCustSn(custSnStr); monitorLog.setPartNo(partNoStr); monitorLog.setPartName(partNameStr); - ConvertBean.saveOrUpdate(monitorLog,"JOB"); + monitorLog.setServiceFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } + ConvertBean.saveOrUpdate(monitorLog,"JOB"); + monitorLogRao.update(monitorLog); } - monitorLogRao.saveAll(monitorLogs); } }