From f441b07b4b90f38f5bab580b6ca53ca49bfeb5db Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 26 Sep 2024 16:39:53 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=96=87=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=9F=E4=BA=A7=E7=BA=BF=E7=B1=BB=E5=9E=8B=20?= =?UTF-8?q?=E4=B8=8D=E9=AA=8C=E8=AF=81=E5=B7=A5=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/context/MesProductionProcessContextStepService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/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 efd5334..4b0dcbc 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 @@ -482,7 +482,7 @@ public class MesProductionProcessContextStepService extends BaseStepService impl @Override public Integer getCenterType(StationRequestBean reqBean) { if (!StringUtils.isEmpty(reqBean.getCenterType())) return reqBean.getCenterType(); - MesProductionProcessContext productionProcessContext = getProductionProcessContext(reqBean); + MesProductionProcessContext productionProcessContext = getProductionProcessContext(reqBean, false); //获取生产过程上下文对象有异常信息 抛出异常 if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, new StationResultBean().writeDbLog(), productionProcessContext.getMessage()); dispatchProductionProcessContext(reqBean, productionProcessContext); From 176b41870916d6134e2673d78af3cfec0509848c Mon Sep 17 00:00:00 2001 From: gsz Date: Thu, 26 Sep 2024 17:33:35 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E8=BF=94=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/base/MesReworkTaskServiceImpl.java | 29 +++++++++++++++++++--- .../busi/MesInputDefectRecordService.java | 8 +++--- .../serviceimpl/busi/MesNcProcessingService.java | 6 ++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java index 2c3ca4e..8f44d6c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java @@ -136,6 +136,8 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { @Autowired private IMesWorkOrderExtService workOrderExtService; + @Autowired + private MesWorkOrderRepository workOrderRepository; @Override public ListPager queryReworkTask(MesReworkTask mesReworkTask, Pager pager) { String organizeCode = !StringUtils.isEmpty(mesReworkTask.getOrganizeCode())?mesReworkTask.getOrganizeCode():AuthUtil.getOrganizeCode(); @@ -300,6 +302,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { mesReworkTask.setReworkedQty(mesReworkTask.getQty()); } else if (MesExtEnumUtil.NC_TYPE.SCRAP.getValue() == requestModel.getType()) { //更新条码状态为报废 + requestModel.setSn(mesReworkTask.getSn()); updateMesProduceSn(requestModel); //更新返工数量 mesReworkTask.setScrapQty(mesReworkTask.getQty()); @@ -363,7 +366,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { new Object[]{userName, TimeTool.getNowTime(true),sn.getProductSn(),sn.getDescription()},packBean); //更新返工记录 packBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getStringEqualPack(requestModel.getSn(),"sn",packBean); + DdlPreparedPack.getStringEqualPack(sn.getProductSn(),"sn",packBean); DdlPreparedPack.getStringEqualPack(sn.getPartNo(),"partNo",packBean); mesReworkTaskRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime","sn","description"}, new Object[]{userName, TimeTool.getNowTime(true),sn.getProductSn(),sn.getDescription()},packBean); @@ -772,7 +775,10 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { MesProduceSn produceSnDb = mesProduceSnRepository.getByProperty(oldSnPackBean); if (produceSnDb == null) { - MesPcnException.throwFlowException(String.format("条码【%s】信息不存在", productSn)); + produceSnDb = (MesProduceSn) workOrderExtService.getWorkOrderSort(organizeCode, productSn, false); + if (produceSnDb == null) { + MesPcnException.throwFlowException(String.format("条码【%s】信息不存在", productSn)); + } } return produceSnDb; } @@ -863,8 +869,25 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); ConvertBean.serviceModelUpdate(produceSn,requestModel.getUserName()); mesProduceSnRepository.update(produceSn); + //排序产线 更新工单的 qcStatus + MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(requestModel.getOrganizeCode(), produceSn.getWorkCenterCode()); + if (!StringUtil.isEmpty(centerDb)){ + if(centerDb.getCenterType() == MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue()){ + MesWorkOrder workOrder = getWorkOrder(requestModel.getOrganizeCode(),produceSn.getWorkOrderNo()); + if (!StringUtil.isEmpty(workOrder)){ + workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); + ConvertBean.serviceModelUpdate(workOrder, requestModel.getUserName()); + workOrderRepository.update(workOrder); + } + } + } + } + public MesWorkOrder getWorkOrder(String organizeCode, String workOrderNo) { + if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workOrderNo)) return null; + return workOrderRepository.getByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_ORDER_NO}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workOrderNo}); } - private MesMove doCreateMove(String oldSn, String sn, String organizeCode, String userName) { MesMove move = new MesMove(); move.setOrganizeCode(organizeCode); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 1df69f9..b182609 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -266,7 +266,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); workOrderRepository.update(workOrder); } } @@ -322,7 +322,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); workOrderRepository.update(workOrder); } } @@ -391,7 +391,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); workOrderRepository.update(workOrder); } } @@ -449,7 +449,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); workOrderRepository.update(workOrder); } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java index 2edbb69..98c2e70 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java @@ -373,7 +373,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { MesWorkOrder workOrder = getWorkOrder(org,sn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS_TO_QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserName()); workOrderRepository.update(workOrder); } } @@ -459,7 +459,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { MesWorkOrder workOrder = getWorkOrder(org,sn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserName()); workOrderRepository.update(workOrder); } } @@ -500,7 +500,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { MesWorkOrder workOrder = getWorkOrder(org,sn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(sn, model.getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserName()); workOrderRepository.update(workOrder); } } From bdceeb26f50c09928415072e503ab7374a2024b4 Mon Sep 17 00:00:00 2001 From: yxw Date: Thu, 26 Sep 2024 17:39:44 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../station/MesProductionSortModuleService.java | 89 ++++++++++++++++++---- .../ext/mes/pcn/pojo/model/MesQueueOrderModel.java | 74 ++++++++++++++++++ .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 + 3 files changed, 150 insertions(+), 15 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesQueueOrderModel.java diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java index 6a9a38e..d84ee20 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java @@ -4,36 +4,39 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderExtService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesQueueOrderModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseModuleService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; +import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil; import cn.estsh.i3plus.mes.pcn.util.StationKvBeanUtil; +import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; -import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord; -import cn.estsh.i3plus.pojo.mes.bean.MesStateMachineStatus; -import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; +import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.*; +import cn.estsh.i3plus.pojo.mes.model.AttrBean; import cn.estsh.i3plus.pojo.mes.model.StationKvBean; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; -import cn.estsh.i3plus.pojo.mes.repository.MesFileRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesQueueOrderRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import cn.estsh.impp.framework.boot.util.SpringContextsUtil; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** - * @Description : 展示组件:非排序生产 + * @Description : 展示组件:排序生产 * @Author :wangjie **/ @Slf4j @@ -53,10 +56,7 @@ public class MesProductionSortModuleService extends BaseModuleService { private IMesProdShiftRecordService mesProdShiftRecordService; @Autowired - private IMesWorkOrderExtService workOrderExtService; - - @Autowired - private MesFileRepository mesFileRepository; + private MesQueueOrderRepository queueOrderRepository; @Override public void init(StationRequestBean reqBean) { @@ -80,10 +80,9 @@ public class MesProductionSortModuleService extends BaseModuleService { StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext); this.sendMessage(reqBean, resultBean); - //TODO 右侧排序表格数据 - - - + // 获取当前工位最新修改的完成状态的队列单据数据 并根据其零件生产组代码按生产序号倒序前50条 + resultBean = getStationResultBean(queryQueueOrderTopFiftyProduceSeq(getNewQueueOrder(reqBean))); + this.sendMessage(reqBean, resultBean); //验证工位是否锁定 reqBean.getDataMap().put(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_INIT_MODULE.getCode(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr()); @@ -94,6 +93,66 @@ public class MesProductionSortModuleService extends BaseModuleService { } + private StationResultBean getStationResultBean(List mesQueueOrderModelList) { + return new StationResultBean().busiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()) + .customPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_WORK_CELL) + .dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()) + .dataAttrList(dataAttrList()).resultList(mesQueueOrderModelList); + } + + //队列工单清单列表标题 + public List dataAttrList() { + List attrBeanList = new ArrayList<>(); + PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PRODUCT_SEQ, "工单序号"); + PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.CAR_MODEL_CODE, "车型配置"); + PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.CUST_ORDER_NO, "客户订单号"); + PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件号"); + return attrBeanList; + } + + private List queryQueueOrderTopFiftyProduceSeq(MesQueueOrder queueOrder) { + + if (queueOrder == null) return new ArrayList<>(); + + Pager pager = new Pager(); + pager.setStartRow(1); + pager.setCurrentPage(1); + pager.setPageSize(50); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(queueOrder.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(queueOrder.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + DdlPreparedPack.getStringEqualPack(queueOrder.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); + DdlPreparedPack.getStringEqualPack(queueOrder.getPartProdGroupCode(), MesPcnExtConstWords.PART_PROD_GROUP_CODE, packBean); + packBean.setOrderByStr(" order by produceSeq desc "); + List queueOrderList = queueOrderRepository.findByHqlWherePage(packBean, pager); + + List queueOrderModels = new ArrayList<>(); + if (!CollectionUtils.isEmpty(queueOrderList)) { + + boolean isComplete = false; + for (MesQueueOrder mesQueueOrder : queueOrderList) { + MesQueueOrderModel queueOrderModel = new MesQueueOrderModel(); + BeanUtils.copyProperties(mesQueueOrder, queueOrderModel); + String color = MesExtEnumUtil.COLOR.GREEN.getValue(); + if (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.FINISH.getValue()) isComplete = true; + else if (!isComplete) color = MesExtEnumUtil.COLOR.WHITE.getValue(); + else if (isComplete && (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.CREATE.getValue())) color = MesExtEnumUtil.COLOR.YELLOW.getValue(); + queueOrderModel.setColor(color); + queueOrderModels.add(queueOrderModel); + } + } + + return queueOrderModels; + } + + private MesQueueOrder getNewQueueOrder(StationRequestBean reqBean) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(reqBean.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + DdlPreparedPack.getStringEqualPack(reqBean.getWorkCellCode(), MesPcnExtConstWords.WORK_CELL_CODE, packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.QUEUE_ORDER_STATUS.FINISH.getValue(), MesPcnExtConstWords.STATUS, packBean); + packBean.setOrderByStr(" order by modifyDatetime desc "); + return queueOrderRepository.getByProperty(packBean); + } + private List getShiftRecordStationKvBeans(StationRequestBean reqBean) { // 获取班次信息 redis List prodShiftDataContext = productionCustomContextStepService.getProdShiftDataContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesQueueOrderModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesQueueOrderModel.java new file mode 100644 index 0000000..d1e9111 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesQueueOrderModel.java @@ -0,0 +1,74 @@ +package cn.estsh.i3plus.ext.mes.pcn.pojo.model; + +import io.swagger.annotations.ApiParam; +import lombok.Data; + +import javax.persistence.Column; +import java.io.Serializable; + +/** + * + */ +@Data +public class MesQueueOrderModel implements Serializable { + + @ApiParam("区域代码") + private String areaCode; + + @Column(name = "WORK_CENTER_CODE") + @ApiParam("工作中心") + private String workCenterCode; + + @Column(name = "WORK_CELL_CODE") + @ApiParam("工位代码") + private String workCellCode; + + @ApiParam("生产工单号") + private String workOrderNo; + + @ApiParam("过程条码") + private String serialNumber; + + @ApiParam("产品条码") + private String productSn; + + @ApiParam("客户条码") + private String custSn; + + @ApiParam("物料号") + private String partNo; + + @ApiParam("物料名称") + private String partName; + + @ApiParam("状态") + private Integer status; + + @ApiParam("零件生产组代码") + private String partProdGroupCode; + + @ApiParam("零件生产组名称") + private String partProdGroupName; + + @ApiParam("生产序号") + private Long produceSeq; + + @ApiParam("工单序号") + private String workOrderSeq; + + @ApiParam("车型大类") + private String carModelCode; + + @ApiParam("客户订单号") + private String custOrderNo; + + @ApiParam("客户物料号") + private String custPartNo; + + @ApiParam(value = "工艺顺序号") + private Integer processSeq; + + @ApiParam(value = "颜色") + private String color; + +} 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 5ea08e4..b35e14e 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 @@ -575,4 +575,6 @@ public class MesPcnExtConstWords { // 产线名称 public static final String WORK_CENTER_NAME = "workCenterName"; + // 生产序号 + public static final String PRODUCT_SEQ = "productSeq"; } From d1b5e32076388ccc6e70196e9ac4fc0736358ac8 Mon Sep 17 00:00:00 2001 From: yxw Date: Thu, 26 Sep 2024 17:51:23 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E9=9D=9E=E6=8E=92=E5=BA=8F=E4=BA=A7?= =?UTF-8?q?=E5=87=BA=E9=9B=B6=E4=BB=B6=E6=9D=A1=E7=A0=81=20=E5=8E=BB?= =?UTF-8?q?=E6=8E=89cutWorkOrderNo=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/step/MesWorkOrderCutCheckStepService.java | 2 +- .../ext/mes/pcn/pojo/context/MesProductionPsOutContext.java | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutCheckStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutCheckStepService.java index a6d8857..107dad7 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutCheckStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutCheckStepService.java @@ -330,7 +330,7 @@ public class MesWorkOrderCutCheckStepService extends BaseStepService { if (!CollectionUtils.isEmpty(produceSnList)) produceSnList.stream().filter(o -> null != o).forEach(o -> { productionPsInContextList.add(new MesProductionPsInContext(workCell, o).cutCode(cutScheme.getCutCode())); - productionPsOutContextList.add(new MesProductionPsOutContext().copy(o).cutWorkOrderNo(cutWorkOrderNo)); + productionPsOutContextList.add(new MesProductionPsOutContext().copy(o)); }); } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionPsOutContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionPsOutContext.java index fccedb2..3abbfe3 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionPsOutContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionPsOutContext.java @@ -22,9 +22,6 @@ public class MesProductionPsOutContext extends MesProduceSn implements Serializa @ApiParam(name = "是否计算工单完成数量") private Integer isCalcCompleteQty = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(); - @ApiParam(name = "裁片工单号") - private String cutWorkOrderNo; - public MesProductionPsOutContext() {} public MesProductionPsOutContext copy(MesProduceSn produceSn, Integer foreignKey) { @@ -44,11 +41,6 @@ public class MesProductionPsOutContext extends MesProduceSn implements Serializa return this; } - public MesProductionPsOutContext cutWorkOrderNo(String cutWorkOrderNo) { - this.setCutWorkOrderNo(cutWorkOrderNo); - return this; - } - public MesProductionPsOutContext isCalcCompleteQty(Boolean isCalcCompleteQty) { if (isCalcCompleteQty) this.isCalcCompleteQty = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); return this; From df5757bec81956627e7e09f33b3f72a4b0a592c8 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Fri, 27 Sep 2024 11:18:09 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=8E=92=E5=BA=8F=20=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/MesAssemblyShowSortStepService.java | 14 +- .../step/MesFirstMouldNoReadStepService.java | 4 +- .../step/MesWorkOrderSaveNosortStepService.java | 197 +++++++++++++++++++++ .../step/MesWorkOrderSaveSortStepService.java | 120 +++++++++++++ .../step/MesWorkOrderSaveStepService.java | 182 +------------------ .../MesProductionProcessContextStepService.java | 2 - .../ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 6 + 7 files changed, 337 insertions(+), 188 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveNosortStepService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java index 4c32135..5d2580d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyShowSortStepService.java @@ -68,8 +68,8 @@ public class MesAssemblyShowSortStepService extends BaseStepService { //从上下文中取出生产线对象 MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); - //获取上下文加工规则数据信息集合 - List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + //加工规则数据信息集合 + List prodRuleContextList = new ArrayList<>(); //获取上下文产出零件数据信息集合 List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); @@ -80,22 +80,18 @@ public class MesAssemblyShowSortStepService extends BaseStepService { //获取上下文产出零件条码信息集合 List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); - //根据现有数据【产出零件数据】【进料零件条码信息】比对上下文中已经存在的加工规则数据信息集合, 没有加工规则的数据进行查询 - if (CollectionUtils.isEmpty(prodRuleContextList)) prodRuleContextList = new ArrayList<>(); - Integer initSize = prodRuleContextList.size(); - //封装排序加工规则 doHandleProdRuleData(reqBean, resultBean, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList, productionPsOutContextList); - if (prodRuleContextList.size() != initSize) { + if (!CollectionUtils.isEmpty(prodRuleContextList)) { //保存上下文产品加工规则信息集合 productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList); //保存上下文产出零件信息 if (!CollectionUtils.isEmpty(productionPartContextList)) productionDispatchContextStepService.dispatchProductionPartContext(reqBean, productionPartContextList); //保存进料主条码数据 if (!CollectionUtils.isEmpty(productionPsInContextList)) productionDispatchContextStepService.dispatchProductionPsInContext(reqBean, productionPsInContextList); - //保存进料主条码数据 - if (!CollectionUtils.isEmpty(productionPsOutContextList)) productionDispatchContextStepService.dispatchProductionPsInContext(reqBean, productionPsInContextList); + //保存产出条码数据 + if (!CollectionUtils.isEmpty(productionPsOutContextList)) productionDispatchContextStepService.dispatchProductionPsOutContext(reqBean, productionPsOutContextList); } //显示装配件信息 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 9965831..d3ad11a 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 @@ -181,7 +181,9 @@ public class MesFirstMouldNoReadStepService extends BaseStepService { //更新展示组件MODULE_CONTENT内容 doCacheMoudleContext(reqBean, productionPartContextList, true); - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).scanInfo(firstMouldNo), stepResult, String.format("当前已读取到设备[%s]头道模具号[%s]!", cellEquipContext.getEquipmentName(), firstMouldNo)); + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.READ.getValue()).scanInfo(firstMouldNo), stepResult, + String.format("当前已读取到设备[%s]头道模具号[%s]! 一模多腔信息[%s]!", cellEquipContext.getEquipmentName(), firstMouldNo, + productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartNo()))).map(MesProductionPartContext::getPartNo).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/MesWorkOrderSaveNosortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveNosortStepService.java new file mode 100644 index 0000000..b9016de --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveNosortStepService.java @@ -0,0 +1,197 @@ +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.api.busi.IMesWorkOrderExtService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.mes.pcn.util.StringUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.MathOperation; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; +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.MesWorkOrderRepository; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import com.alibaba.fastjson.JSONObject; +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 javax.persistence.EntityManager; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description : 保存加工单信息工步 【非排序】 + * @Reference : + * @Author : wangjie + * @CreateDate : 2024/6/11 18:50 + * @Modify: + **/ +@Slf4j +@Service("mesWorkOrderSaveNosortStepService") +public class MesWorkOrderSaveNosortStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + private IMesProductionDispatchContextStepService productionDispatchContextStepService; + + @Autowired + private IMesWorkOrderExtService workOrderExtService; + + @Autowired + private MesWorkOrderRepository workOrderRepository; + + @Autowired + private EntityManager entityManager; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //获取上下文产出零件数据信息集合 + List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + + //没有产出零件或者没有工单 + if (CollectionUtils.isEmpty(productionPartContextList) || StringUtils.isEmpty( + productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).findFirst().get().getWorkOrderNo())) return stepResult; + + //获取上下文产出零件数据信息集合 + List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); + + //保存生产工单数据 + doHandleWorkOrderData(reqBean, resultBean, productionPartContextList, productionPsOutContextList); + + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "保存加工单信息成功!"); + + } + + //保存生产工单数据 + private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List productionPartContextList, List productionPsOutContextList) { + + //产出零件信息根据生产工单分组 + Map> ppMap = productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.groupingBy(MesProductionPartContext::getWorkOrderNo)); + + //产出条码 根据生产工单分组 + Map> proMap = productionPsOutContextList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MesProductionPsOutContext::getWorkOrderNo)); + + String prodResult = productionDispatchContextStepService.getProductResultContext(reqBean); + + //遍历产出零件信息 + for(Map.Entry> entry : ppMap.entrySet()) { + + if (null == entry) continue; + //获取对应的加工规则 + List produceSnContextList = proMap.get(entry.getKey()); + //生产数量 + Integer calcCompleteQty = 0; + //遍历产出物料 + for (MesProductionPsOutContext productionPsOutContext : produceSnContextList) { + if (null == productionPsOutContext) continue; + //产出零件是否是 + if (productionPsOutContext.getIsCalcCompleteQty() == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) calcCompleteQty += 1; + } + + if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) == 0) continue; + + MesWorkOrder workOrder = workOrderExtService.getWorkOrder(reqBean.getOrganizeCode(), entry.getValue().get(0).getId()); + + if (null == workOrder) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息不存在!", entry.getKey())); + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- QURERY:{} --- calcCompleteQty:{} --- prodResult:{}", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder), calcCompleteQty, prodResult); + + entityManager.detach(workOrder); + + //工单状态分 排序工单 和非排序工单; 现在必须是非排序工单 + if (!MesExtEnumUtil.ORDER_STATUS.checkNosortAllowStatus(workOrder.getWorkOrderStatus())) + stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息工单状态[%s]!", entry.getKey(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()))); + //工单产线要和当前产线一致 + if (!workOrder.getWorkCenterCode().equals(reqBean.getWorkCenterCode())) + stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息所属生产线[%s]与当前生产线[%s]不一致!", entry.getKey(), workOrder.getWorkCenterCode(), reqBean.getWorkCenterCode())); + + List propertyNameList = new ArrayList<>(); + //修改完成数量 + if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0) { + workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); + propertyNameList.add(MesPcnExtConstWords.COMPLATED_QTY); + } + //修改未完成数量 + if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0 && workOrder.getUnCompleteQty().compareTo(new Double(0)) > 0 && + MathOperation.compareTo(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty)), new Double(0)) >= 0) { + workOrder.setUnCompleteQty(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty))); + propertyNameList.add(MesPcnExtConstWords.UN_COMPLATED_QTY); + } + + /** + * 可疑品、报废数量、上下线时间; + * sql改成修改固定字段 + * 在上下文中获取busi中获取prodResult上下文 是数字 (标志着条码质量状态,与条码质量状态枚举一致) + * 上下文中 已经按照工单分组了,因为有一模多腔问题 + */ + + + if (!StringUtils.isEmpty(prodResult)) { + //可疑品 + boolean isSuspicious = MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue() == Integer.parseInt(prodResult); + if (isSuspicious && !productionPsOutContextList.isEmpty()){ + int suspiciousQty = productionPsOutContextList.size(); + workOrder.setSuspiciousPartQty(MathOperation.add(workOrder.getSuspiciousPartQty(), new Double(suspiciousQty))); + propertyNameList.add(MesPcnExtConstWords.SUSPICIOUS_PART_QTY); + } + //报废数量 + boolean isScrap = MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue() == Integer.parseInt(prodResult); + if (isScrap && !productionPsOutContextList.isEmpty()){ + int scrapQty = productionPsOutContextList.size(); + workOrder.setScrapPartQty(MathOperation.add(workOrder.getScrapPartQty(), new Double(scrapQty))); + propertyNameList.add(MesPcnExtConstWords.SCRAP_PART_QTY); + } + } + + if (MathOperation.compareTo(workOrder.getCompleteQty(), workOrder.getQty()) >= 0 && workOrder.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()) != 0) { + workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + propertyNameList.add(MesPcnExtConstWords.WORK_ORDER_STATUS); + } else if (workOrder.getCompleteQty() > 0 && workOrder.getWorkOrderStatus() == MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) { + workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); + propertyNameList.add(MesPcnExtConstWords.WORK_ORDER_STATUS); + } + //如果数量都没有修改,不操作数据库 + if (!propertyNameList.isEmpty()) { + ConvertBean.serviceModelUpdate(workOrder, reqBean.getUserInfo()); + workOrder.setModifyDatetime((new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date())); + workOrderExtService.update(workOrder); + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder)); + + } + } + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java new file mode 100644 index 0000000..28b9bc0 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java @@ -0,0 +1,120 @@ +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.api.busi.IMesWorkOrderExtService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; +import cn.estsh.i3plus.mes.pcn.util.StringUtil; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; +import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell; +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.MesWorkOrderRepository; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +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 javax.persistence.EntityManager; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + * @Description : 保存加工单信息工步 【排序】 + * @Reference : + * @Author : wangjie + * @CreateDate : 2024/6/11 18:50 + * @Modify: + **/ +@Slf4j +@Service("mesWorkOrderSaveSortStepService") +public class MesWorkOrderSaveSortStepService extends BaseStepService { + + @Autowired + private IMesProductionProcessContextStepService productionProcessContextStepService; + + @Autowired + private IMesProductionDispatchContextStepService productionDispatchContextStepService; + + @Autowired + private IMesWorkOrderExtService workOrderExtService; + + @Autowired + private MesWorkOrderRepository workOrderRepository; + + @Autowired + private EntityManager entityManager; + + @Override + public StepResult execute(StationRequestBean reqBean) { + + StationResultBean resultBean = new StationResultBean(); + + StepResult stepResult = StepResult.getSuccessComplete(); + + //获取上下文信息 + MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); + + //配置错误 抛出异常 + if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); + + //存储生产过程上下文对象 + productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + + //获取上下文产出零件数据信息集合 + List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + + //没有产出零件或者没有工单 + if (CollectionUtils.isEmpty(productionPartContextList) || StringUtils.isEmpty( + productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).findFirst().get().getWorkOrderNo())) return stepResult; + + //从上下文中取出工位对象 + MesWorkCell workCell = productionProcessContext.getWorkCell(); + + //保存生产工单数据 + doHandleWorkOrderData(reqBean, resultBean, productionPartContextList, workCell); + + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "保存加工单信息成功!"); + + } + + private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List productionPartContextList, MesWorkCell workCell) { + + for (MesProductionPartContext productionPartContext : productionPartContextList) { + + if (null == productionPartContext || StringUtils.isEmpty(productionPartContext.getForeignKey())) continue; + + Boolean isEndWorkCell = (StringUtils.isEmpty(workCell.getIsEndWorkCell()) || workCell.getIsEndWorkCell().compareTo(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) == 0) ? false : true; + + if (!isEndWorkCell && productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) == 0) continue; + + if (!isEndWorkCell) { + workOrderRepository.updateByProperties( + new String[]{MesPcnExtConstWords.ID}, + new Object[]{productionPartContext.getId()}, + new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS}, + new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()}); + } else { + workOrderRepository.updateByProperties( + new String[]{MesPcnExtConstWords.ID}, + new Object[]{productionPartContext.getId()}, + new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLATED_QTY, MesPcnExtConstWords.UN_COMPLATED_QTY}, + new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0)}); + } + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:[{}:{}]", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), MesPcnExtConstWords.WORK_ORDER_STATUS, !isEndWorkCell ? MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue() : MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + + } + } + +} 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 49c4584..a1b0a4d 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 @@ -1,37 +1,15 @@ 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.api.busi.IMesWorkOrderExtService; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; -import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; -import cn.estsh.i3plus.mes.pcn.util.StringUtil; -import cn.estsh.i3plus.platform.common.convert.ConvertBean; -import cn.estsh.i3plus.platform.common.tool.MathOperation; -import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; -import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; -import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter; -import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder; +import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IStepService; 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.MesWorkOrderRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import com.alibaba.fastjson.JSONObject; +import cn.estsh.impp.framework.boot.util.SpringContextsUtil; 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 javax.persistence.EntityManager; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; /** * @Description : 保存加工单信息工步 @@ -47,163 +25,15 @@ public class MesWorkOrderSaveStepService extends BaseStepService { @Autowired private IMesProductionProcessContextStepService productionProcessContextStepService; - @Autowired - private IMesProductionDispatchContextStepService productionDispatchContextStepService; - - @Autowired - private IMesWorkOrderExtService workOrderExtService; - - @Autowired - private MesWorkOrderRepository workOrderRepository; - - @Autowired - private EntityManager entityManager; - @Override public StepResult execute(StationRequestBean reqBean) { - StationResultBean resultBean = new StationResultBean(); - - StepResult stepResult = StepResult.getSuccessComplete(); - - //获取上下文信息 - MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean); - - //配置错误 抛出异常 - if (!productionProcessContext.getSuccess()) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage()); - - //存储生产过程上下文对象 - productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); - - //获取上下文产品加工规则数据信息集合 - List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); - - if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在加工规则信息,请重置工序解决!"); - - //获取上下文产出零件数据信息集合 - List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); - - //没有产出零件或者没有工单 - if (CollectionUtils.isEmpty(productionPartContextList) || StringUtils.isEmpty( - productionPartContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).findFirst().get().getWorkOrderNo())) return stepResult; - - //获取上下文产出零件数据信息集合 - List productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean); - - //从上下文中取出生产线对象 - MesWorkCenter workCenter = productionProcessContext.getWorkCenter(); - - //保存生产工单数据 - doHandleWorkOrderData(reqBean, resultBean, productionPartContextList, prodRuleContextList, productionPsOutContextList, workCenter); - - return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "保存加工单信息成功!"); - - } - - //保存生产工单数据 - private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List productionPartContextList, List prodRuleContextList, List productionPsOutContextList, MesWorkCenter workCenter) { - - //产出零件信息根据生产工单分组 - Map> ppMap = productionPartContextList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MesProductionPartContext::getWorkOrderNo)); - - //产出条码 根据生产工单分组 - Map> proMap = productionPsOutContextList.stream().filter(Objects::nonNull).collect(Collectors.groupingBy(MesProductionPsOutContext::getWorkOrderNo)); - //产品加工规则 根据foreignKey分组 - Map prMap = prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toMap(MesProdRuleContext::getForeignKey, o -> o)); - - String prodResult = productionDispatchContextStepService.getProductResultContext(reqBean); - - //遍历产出零件信息 - for(Map.Entry> entry : ppMap.entrySet()) { - - if (null == entry) continue; - //获取对应的加工规则 - List produceSnContextList = proMap.get(entry.getKey()); - //生产数量 - Integer calcCompleteQty = 0; - //遍历产出物料 - for (MesProductionPsOutContext productionPsOutContext : produceSnContextList) { - if (null == productionPsOutContext) continue; - //产出零件是否是 - if (productionPsOutContext.getIsCalcCompleteQty() == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) calcCompleteQty += 1; - } - - if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) == 0) continue; - - MesWorkOrder workOrder = workOrderExtService.getWorkOrder(reqBean.getOrganizeCode(), entry.getValue().get(0).getId()); - - if (null == workOrder) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息不存在!", entry.getKey())); - - log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- QURERY:{} --- calcCompleteQty:{} --- prodResult:{}", - reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), - StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder), calcCompleteQty, prodResult); - - entityManager.detach(workOrder); - - //工单状态分 排序工单 和非排序工单; 现在必须是非排序工单 - if (!MesExtEnumUtil.ORDER_STATUS.checkAllowStatus(workCenter.getCenterType(), workOrder.getWorkOrderStatus())) - stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息工单状态[%s]!", entry.getKey(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()))); - //工单产线要和当前产线一致 - if (!workOrder.getWorkCenterCode().equals(reqBean.getWorkCenterCode())) - stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), String.format("请检查工单信息,加工单[%s]信息所属生产线[%s]与当前生产线[%s]不一致!", entry.getKey(), workOrder.getWorkCenterCode(), reqBean.getWorkCenterCode())); - - List propertyNameList = new ArrayList<>(); - //修改完成数量 - if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0) { - workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); - propertyNameList.add("completeQty"); - } - //修改未完成数量 - if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0 && workOrder.getUnCompleteQty().compareTo(new Double(0)) > 0 && - MathOperation.compareTo(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty)), new Double(0)) >= 0) { - workOrder.setUnCompleteQty(MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty))); - propertyNameList.add("unCompleteQty"); - } - - /** - * 可疑品、报废数量、上下线时间; - * sql改成修改固定字段 - * 在上下文中获取busi中获取prodResult上下文 是数字 (标志着条码质量状态,与条码质量状态枚举一致) - * 上下文中 已经按照工单分组了,因为有一模多腔问题 - */ - - - if (!StringUtils.isEmpty(prodResult)) { - //可疑品 - boolean isSuspicious = MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue() == Integer.parseInt(prodResult); - if (isSuspicious && !productionPsOutContextList.isEmpty()){ - int suspiciousQty = productionPsOutContextList.size(); - workOrder.setSuspiciousPartQty(MathOperation.add(workOrder.getSuspiciousPartQty(), new Double(suspiciousQty))); - propertyNameList.add("suspiciousPartQty"); - } - //报废数量 - boolean isScrap = MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue() == Integer.parseInt(prodResult); - if (isScrap && !productionPsOutContextList.isEmpty()){ - int scrapQty = productionPsOutContextList.size(); - workOrder.setScrapPartQty(MathOperation.add(workOrder.getScrapPartQty(), new Double(scrapQty))); - propertyNameList.add("scrapPartQty"); - } - } - - if (MathOperation.compareTo(workOrder.getCompleteQty(), workOrder.getQty()) >= 0 && workOrder.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()) != 0) { - workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); - propertyNameList.add("workOrderStatus"); - } else if (workOrder.getCompleteQty() > 0 && workOrder.getWorkOrderStatus() == MesExtEnumUtil.ORDER_STATUS.RELEASE.getValue()) { - workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); - propertyNameList.add("workOrderStatus"); - } - //如果数量都没有修改,不操作数据库 - if (!propertyNameList.isEmpty()) { - ConvertBean.serviceModelUpdate(workOrder, reqBean.getUserInfo()); - workOrder.setModifyDatetime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date())); - workOrderExtService.update(workOrder); + //排序线 保存加工单信息工步 + if (MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue() == productionProcessContextStepService.getCenterType(reqBean)) return ((IStepService) SpringContextsUtil.getBean("mesWorkOrderSaveSortStepService")).executeInState(reqBean); - log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}", - reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), - StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), workOrder.getWorkOrderNo(), JSONObject.toJSONString(workOrder)); + //非排序线 保存加工单信息工步 + return ((IStepService) SpringContextsUtil.getBean("mesWorkOrderSaveNosortStepService")).executeInState(reqBean); - } - } } } 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 4b0dcbc..7535c6d 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 @@ -499,7 +499,5 @@ public class MesProductionProcessContextStepService extends BaseStepService impl Map workCellMap = CollectionUtils.isEmpty(workCellList) ? null : workCellList.stream().filter(o -> null != o).collect(Collectors.toMap(MesWorkCell::getWorkCellCode, o -> o)); if (!CollectionUtils.isEmpty(workCellList)) dispatchFsmBusiData(reqBean.getOrganizeCode(), getContextKey(reqBean), MesPcnExtConstWords.WORK_CELL_MAP_CONTEXT, JSONObject.toJSONString(workCellMap)); return workCellMap; - - } } 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 b35e14e..16fc74b 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 @@ -95,6 +95,12 @@ public class MesPcnExtConstWords { public static final String MOULD_NO = "mouldNo"; // 工单完成数 public static final String COMPLATED_QTY = "complateQty"; + // 工单未完成数 + public static final String UN_COMPLATED_QTY = "unCompleteQty"; + // 工单可疑品数 + public static final String SUSPICIOUS_PART_QTY = "suspiciousPartQty"; + // 工单报废品数 + public static final String SCRAP_PART_QTY = "scrapPartQty"; // 班次代码 public static final String SHIFT_CODE = "shiftCode"; // 班次名称 From f2a453f549bdd5a32c4fa3a639249314a05bc8d6 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Fri, 27 Sep 2024 12:40:02 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesInputDefectRecordService.java | 10 +++++++++ .../serviceimpl/busi/MesNcProcessingService.java | 26 +++++++++++++++++----- pom.xml | 4 +++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 9413beb..f8f340e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -237,6 +237,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (StringUtils.isEmpty(model.getPartInspection())) { partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue(), org); + if (model.getOptType() != null && model.getOptType() == 2) { + partInspection .setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } partInspectionRepository.save(partInspection); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { @@ -253,6 +256,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getPartInspection().getInspectionStatus() == MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()) { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + + if (model.getOptType() != null && model.getOptType() == 2) { + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 @@ -368,6 +375,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + if (model.getOptType() != null && model.getOptType() == 2) { + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 List resultDetailList = queryResultDetailList(model, org); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java index aa04ec6..1ea2a41 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java @@ -116,6 +116,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { DdlPreparedPack.getNumEqualPack(partInspection.getQty(), "qty", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue(), "ncStatus", packBean); + DdlPreparedPack.getNumEqualPack(partInspection.getRefundFlag(), "refundFlag", packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); pager = PagerHelper.getPager(pager, partInspectionRepository.findByHqlWhereCount(packBean)); @@ -360,11 +361,15 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue()); ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); - partInspectionRepository.save(model.getPartInspection()); String sourceValue = configService.getCfgValue(org, "UMLGO"); + if (model.getOptType() == 2) { sourceValue = refundSource; + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } + + partInspectionRepository.save(model.getPartInspection()); + //移库 转正常、放行:8000移至2000 MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); ConvertBean.serviceModelInitialize(move,model.getUserName()); @@ -417,12 +422,15 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue()); model.getPartInspection().setReworkTaskId(reworkTask.getId()); ConvertBean.serviceModelUpdate(model.getPartInspection(),model.getUserName()); - partInspectionRepository.save(model.getPartInspection()); - String sourceValue = configService.getCfgValue(org, "UMLGO"); + if (model.getOptType() == 2) { sourceValue = refundSource; + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } + partInspectionRepository.save(model.getPartInspection()); + + MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); ConvertBean.serviceModelInitialize(move,model.getUserName()); @@ -448,6 +456,11 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); + + if (model.getOptType() == 2) { + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + partInspectionRepository.save(model.getPartInspection()); if (isOrder) { String sourceValue = source; @@ -486,12 +499,15 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()); ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); - partInspectionRepository.save(model.getPartInspection()); - String sourceValue = configService.getCfgValue(org, "UMLGO"); + if (model.getOptType() == 2) { sourceValue = refundSource; + + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } + partInspectionRepository.save(model.getPartInspection()); + //移库 转正常、放行:8000移至2000 MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); ConvertBean.serviceModelInitialize(move,model.getUserName()); diff --git a/pom.xml b/pom.xml index 300c220..0dc8741 100644 --- a/pom.xml +++ b/pom.xml @@ -29,9 +29,11 @@ INFO true UTF-8 - + 1.0.0.4-patch + 1.0.0-yfai 1.0.0.1-patch 1.0.0-yfai From 947fa99b483c0e4ff7b60a3742112286112c4ffa Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Fri, 27 Sep 2024 13:29:04 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E6=89=AB=E6=8F=8F=20?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=20?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E5=88=A4=E7=A9=BA=E8=A1=A5?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/base/IMesEquipmentExtService.java | 6 ++++++ .../serviceimpl/base/MesEquipmentExtService.java | 21 ++++++++++++++++++--- .../MesWorkCellScanMonitorLogExtService.java | 11 +++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesEquipmentExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesEquipmentExtService.java index 8551207..7892143 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesEquipmentExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesEquipmentExtService.java @@ -11,6 +11,12 @@ public interface IMesEquipmentExtService { @ApiOperation(value = "根据生产线代码,工位代码查询工位设备集合") List getCellEquipmentList(String organizeCode, String workCenterCode, String workCellCode); + @ApiOperation(value = "根据生产线代码,工位代码查询工位设备集合") + List getWcEquipmentList(String organizeCode, String workCenterCode, String workCellCode); + + @ApiOperation(value = "根据生产线代码,工位代码查询工位设备") + MesWcEquipment getWcEquipment(String organizeCode, String workCenterCode, String workCellCode); + @ApiOperation(value = "根据设备变量配置类型查询设备数据变量接口逻辑集合") List getEquipmentVariableCfgList(String organizeCode, String variableCfgType); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentExtService.java index 5b7a78f..50782a2 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesEquipmentExtService.java @@ -16,6 +16,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -44,9 +45,7 @@ public class MesEquipmentExtService implements IMesEquipmentExtService { @Override public List getCellEquipmentList(String organizeCode, String workCenterCode, String workCellCode) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return null; - List wcEquipmentDbList = wcEquipmentRepository.findByProperty( - new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE}, - new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workCellCode}); + List wcEquipmentDbList = getWcEquipmentList(organizeCode, workCenterCode, workCellCode); if (CollectionUtils.isEmpty(wcEquipmentDbList)) return null; List cellEquipmentContextList = null; for (MesWcEquipment wcEquipmentDb : wcEquipmentDbList) { @@ -65,6 +64,22 @@ public class MesEquipmentExtService implements IMesEquipmentExtService { } @Override + public List getWcEquipmentList(String organizeCode, String workCenterCode, String workCellCode) { + return wcEquipmentRepository.findByProperty( + new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE}, + new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workCellCode}); + } + + @Override + public MesWcEquipment getWcEquipment(String organizeCode, String workCenterCode, String workCellCode) { + List wcEquipmentDbList = getWcEquipmentList(organizeCode, workCenterCode, workCellCode); + if (CollectionUtils.isEmpty(wcEquipmentDbList)) return null; + if (wcEquipmentDbList.size() == 1) return wcEquipmentDbList.get(0); + List wcEquipmentDbListSort = wcEquipmentDbList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getSeq()))).sorted(Comparator.comparing(MesWcEquipment::getSeq)).collect(Collectors.toList()); + return !CollectionUtils.isEmpty(wcEquipmentDbListSort) ? wcEquipmentDbListSort.get(0) : wcEquipmentDbList.get(0); + } + + @Override public List getEquipmentVariableCfgList(String organizeCode, String variableCfgType) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(variableCfgType)) return null; return equipmentVariableCfgRepository.findByProperty( 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 250bf53..26e90d1 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 @@ -1,5 +1,6 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.equiplog; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsOutContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesScanMonitorContext; @@ -11,6 +12,7 @@ import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.mes.bean.MesWcEquipment; import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellScanMonitorLog; import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellScanMonitorLogRepository; @@ -37,6 +39,9 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic private IMesProductionProcessContextStepService productionProcessContextStepService; @Autowired + private IMesEquipmentExtService equipmentExtService; + + @Autowired private MesWorkCellScanMonitorLogRepository workCellScanMonitorLogRepository; private final static Map> cellMsg2RepeatMap = new ConcurrentHashMap(); @@ -60,6 +65,12 @@ public class MesWorkCellScanMonitorLogExtService implements ISwsWriteDbLogServic workCellScanMonitorLog.setOrgWorkCode(new StringJoiner(MesPcnExtConstWords.E_UNDERLINE).add(workCellScanMonitorLog.getOrganizeCode()).add(workCellScanMonitorLog.getWorkCenterCode()).toString()); + if (StringUtils.isEmpty(workCellScanMonitorLog.getEquipmentCode())) { + MesWcEquipment wcEquipment = equipmentExtService.getWcEquipment(resultBean.getOrganizeCode(), resultBean.getWorkCenterCode(), resultBean.getWorkCellCode()); + workCellScanMonitorLog.setEquipmentCode(null != wcEquipment ? wcEquipment.getEquipmentCode() : null); + workCellScanMonitorLog.setEquipmentName(null != wcEquipment ? wcEquipment.getEquipmentName() : null); + } + ConvertBean.serviceModelInitialize(workCellScanMonitorLog, resultBean.getUserInfo()); workCellScanMonitorLog.setCreateDatetime(resultBean.getCreateDatetime()); From 0f3a1cb96455f4ae8458926849cd00147ee9b2fb Mon Sep 17 00:00:00 2001 From: yxw Date: Fri, 27 Sep 2024 13:30:17 +0800 Subject: [PATCH 08/10] =?UTF-8?q?1=E3=80=81MesProductionPartContext=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0cutQty=EF=BC=88=E8=A3=81=E7=89=87=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E9=87=8F=EF=BC=89=202=E3=80=81=E8=A3=81?= =?UTF-8?q?=E7=89=87=E5=B7=A5=E5=8D=95=E7=BB=91=E5=AE=9A=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java index 5444a01..e71c53c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutProductSnSaveStepService.java @@ -146,7 +146,7 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService { produceSn.setCustSn(produceSn.getCustSn()); produceSn.setSerialNumber(doGenerateSerialNo(reqBean, resultBean, MesPcnExtConstWords.DEFAULT_SERIAL_NUMBER_RULE, part)); - produceSn.setQty(mesProductionPartContext.getQty()); + produceSn.setQty(mesProductionPartContext.getCutQty()); produceSn.setWorkOrderNo(mesProductionPartContext.getWorkOrderNo()); produceSn.setCustCode(mesProductionPartContext.getCustCode()); From c8576f6f92164d435e77064d6ec3c35b661cdf80 Mon Sep 17 00:00:00 2001 From: yxw Date: Fri, 27 Sep 2024 13:30:37 +0800 Subject: [PATCH 09/10] =?UTF-8?q?1=E3=80=81MesProductionPartContext=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0cutQty=EF=BC=88=E8=A3=81=E7=89=87=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E9=87=8F=EF=BC=89=202=E3=80=81=E8=A3=81?= =?UTF-8?q?=E7=89=87=E5=B7=A5=E5=8D=95=E7=BB=91=E5=AE=9A=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java index dc4d3da..1a12755 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java @@ -86,7 +86,7 @@ public class MesWorkOrderCutWorkOrderSaveStepService extends BaseStepService { for (MesProductionPartContext mesProductionPartContext : productionPartContextList) { MesWorkOrder workOrder = workOrderExtService.getWorkOrder(reqBean.getOrganizeCode(), mesProductionPartContext.getWorkOrderNo()); - workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), mesProductionPartContext.getQty())); + workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), mesProductionPartContext.getCutQty())); if (MathOperation.compareTo(workOrder.getCompleteQty(), workOrder.getQty()) >= 0 && workOrder.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()) != 0) workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); else From bd4d547f4bc57323d339a9ce6affb784c0e1071b Mon Sep 17 00:00:00 2001 From: yxw Date: Fri, 27 Sep 2024 14:14:53 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=A3=81=E7=89=87?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=BB=93=E6=9E=9C=E5=B7=A5=E6=AD=A5-?= =?UTF-8?q?=E8=A3=81=E7=89=87=E5=B7=A5=E5=8D=95=E5=8F=B7=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/station/MesProductionSortModuleService.java | 2 +- .../serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java | 7 ++----- .../cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java index d84ee20..f742ed8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionSortModuleService.java @@ -103,7 +103,7 @@ public class MesProductionSortModuleService extends BaseModuleService { //队列工单清单列表标题 public List dataAttrList() { List attrBeanList = new ArrayList<>(); - PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PRODUCT_SEQ, "工单序号"); + PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PRODUCE_SEQ, "工单序号"); PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.CAR_MODEL_CODE, "车型配置"); PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.CUST_ORDER_NO, "客户订单号"); PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件号"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java index 1a12755..30a8fc9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderCutWorkOrderSaveStepService.java @@ -68,14 +68,11 @@ public class MesWorkOrderCutWorkOrderSaveStepService extends BaseStepService { //存储生产过程上下文对象 productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); - //获取上下文生产扫/读信息:加工单 - List equipVariableCollectContextList = productionDispatchContextStepService.getScanWorkOrderNoContext(reqBean); - - String cutWorkOrderNo = equipVariableCollectContextList.get(0).getEquipVariableValue(); - //获取上下文产出零件数据信息集合 List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + String cutWorkOrderNo = productionPartContextList.get(0).getCutWorkOrderNo(); + //从上下文中取出工位对象 MesWorkCell workCell = productionProcessContext.getWorkCell(); 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 16fc74b..6079e35 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 @@ -581,6 +581,4 @@ public class MesPcnExtConstWords { // 产线名称 public static final String WORK_CENTER_NAME = "workCenterName"; - // 生产序号 - public static final String PRODUCT_SEQ = "productSeq"; }