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 8890000..678df66 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 @@ -415,6 +415,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } if (Objects.isNull(srcLocateNo)) { srcLocateNo = configService.getCfgValue(org, "LGORT"); + + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); + + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + if (version != null) { + srcLocateNo = version.getShipInventoryPoint(); + } } if (model.getOptType() != 2) { //移库 @@ -480,7 +488,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //移库 if (model.getOptType() != 2) { - MesMove move = createMove(model, configService.getCfgValue(org, "LGORT"), configService.getCfgValue(org, "UMLGO"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + String srcLocateNo = configService.getCfgValue(org, "LGORT"); + + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); + + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + if (version != null) { + srcLocateNo = version.getShipInventoryPoint(); + } + + MesMove move = createMove(model, srcLocateNo, configService.getCfgValue(org, "UMLGO"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); moveRepository.save(move); } @@ -734,10 +752,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService * @return */ private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode) { + if (StringUtils.isEmpty(model.getUserInfo())) model.setUserInfo("系统"); GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); serialNoModel.setPartNo(model.getPart().getPartNo()); -// ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, AuthUtil.getSessionUser().getUserName(), org, 1); - ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, "系统", org, 1); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getUserInfo(), org, 1); String zrsum = ""; if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { zrsum = (rb.getResultList().get(0)).toString(); @@ -758,8 +776,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue()); move.setProductSn(model.getSn()); move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); -// ConvertBean.serviceModelInitialize(move, AuthUtil.getSessionUser().getUserName()); - ConvertBean.serviceModelInitialize(move, "系统"); + ConvertBean.serviceModelInitialize(move, model.getUserInfo()); return move; } @@ -935,7 +952,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService private List checkPartInspectionDetail(MesPartInspection partInspection, String org) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); - DdlPreparedPack.getNumEqualPack(partInspection.getId(), "pid", packBean); + DdlPreparedPack.getNumEqualPack(partInspection.getId(), MesPcnExtConstWords.PID, packBean); List detailList = partInspectionDetailRepository.findByHqlWhere(packBean); return detailList; @@ -945,7 +962,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService public void saveSusPartInspection(MesPartInspectionInputModel model, String org) { MesPartInspection partInspection = new MesPartInspection(); - BeanUtils.copyProperties(model, partInspection); + BeanUtils.copyProperties(model, partInspection, MesPcnExtConstWords.ID); partInspection.setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()); partInspection.setOrganizeCode(org); @@ -959,8 +976,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection.setDefectTypeCode(defectType.getDefectTypeCode()); partInspection.setDefectTypeId(defectType.getId()); - - partInspectionRepository.save(partInspection); + ConvertBean.serviceModelInitialize(partInspection, model.getUserInfo()); + partInspection = partInspectionRepository.insert(partInspection); log.info("生成的缺陷记录id ={}", partInspection); MesPartInspectionDetail detail = new MesPartInspectionDetail(); @@ -974,7 +991,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeName(defectType.getDefectTypeName()); detail.setId(null); detail.setOrganizeCode(org); - ConvertBean.serviceModelInitialize(detail, "系统"); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); partInspectionDetailRepository.insert(detail); // String source = configService.getCfgValue(org, "LGORT"); @@ -996,7 +1013,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } } MesMove move = createMove(model, source, configService.getCfgValue(org, "UMLGO"), org, model.getWorkCenterCode()); - moveRepository.save(move); + moveRepository.insert(move); } @ApiOperation(value = "客退品查询") 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 cd930d3..6ab03b2 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 @@ -397,8 +397,17 @@ public class MesNcProcessingService implements IMesNcProcessingService { partInspectionRepository.save(model.getPartInspection()); + String target = configService.getCfgValue(org, "LGORT"); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean); + + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + if (version != null) { + target = version.getShipInventoryPoint(); + } + //移库 转正常、放行:8000移至2000 - MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java index e064a1b..9eb8964 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnExtService.java @@ -10,7 +10,6 @@ import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.PagerHelper; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; -import cn.estsh.i3plus.pojo.mes.bean.MesProdShiftRecord; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; import cn.estsh.i3plus.pojo.mes.bean.MesQueueOrder; import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; @@ -160,10 +159,12 @@ public class MesProduceSnExtService implements IMesProduceSnExtService { @Override public void saveProduceSnList(StationRequestBean reqBean, Integer snStatus, List idList) { - + idList = CollectionUtils.isEmpty(idList) ? idList : idList.stream().filter(o -> !StringUtils.isEmpty(o)).distinct().collect(Collectors.toList()); + if (CollectionUtils.isEmpty(idList)) return; DdlPackBean packBean = new DdlPackBean(); DdlPreparedPack.getStringEqualPack(reqBean.getOrganizeCode(), MesPcnExtConstWords.ORGANIZE_CODE, packBean); - DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean); + if (idList.size() == 1) DdlPreparedPack.getNumEqualPack(idList.get(0), MesPcnExtConstWords.ID, packBean); + else DdlPreparedPack.getInPackList(idList, MesPcnExtConstWords.ID, packBean); produceSnRepository.updateByProperties( new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE, MesPcnExtConstWords.SN_STATUS}, new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), snStatus}, diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesRawPartChargingServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesRawPartChargingServiceImpl.java index e23434c..53f0bd9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesRawPartChargingServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesRawPartChargingServiceImpl.java @@ -128,10 +128,14 @@ public class MesRawPartChargingServiceImpl implements IMesRawPartChargingService if (!CollectionUtils.isEmpty(mesRawPartCharging)) { MesPcnException.throwMesBusiException("料筒条码【%s】与原料条码【%s】已绑定", mesRawPartChargingModel.getPackageSn(), mesRawPartCharging.iterator().next().getSn()); } - //保存生产控制加料 - MesRawPartCharging charging = insertRawPartCharging(mesRawPartChargingModel); - //保存日志 - saveLog(mesRawPartChargingModel, charging, MesExtEnumUtil.CHARGING_LOG_STATUS.FEEDING); + //保存生产控制加料 43302 加料防错扫码流程优化 + String[] split = mesRawPartChargingModel.getSn().split(","); + for (String sn : split) { + mesRawPartChargingModel.setSn(sn); + MesRawPartCharging charging = insertRawPartCharging(mesRawPartChargingModel); + //保存日志 + saveLog(mesRawPartChargingModel, charging, MesExtEnumUtil.CHARGING_LOG_STATUS.FEEDING); + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java index 9ba63e6..d669b57 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/MesProductionNoSortModuleService.java @@ -162,14 +162,14 @@ public class MesProductionNoSortModuleService extends BaseModuleService { if (CollectionUtils.isEmpty(workOrderList)) { StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", MesPcnExtConstWords.ZERO_STR), - new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR)); + new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", MesPcnExtConstWords.ZERO_STR)); } else { Double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); Double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty.toString()), - new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty.toString())); + new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty.toString())); } if (!CollectionUtils.isEmpty(productionPartContextList)) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java index 80ea88f..2460337 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/station/function/MesFunctionProductionStatisticsService.java @@ -104,14 +104,14 @@ public class MesFunctionProductionStatisticsService extends BaseSwsService imple if (CollectionUtils.isEmpty(workOrderList)) { StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""), - new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", 0 + "")); + new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", 0 + "")); } else { double qty = workOrderList.stream().map(MesWorkOrder::getQty).reduce((a, b) -> a + b).get(); double complateQty = workOrderList.stream().map(MesWorkOrder::getCompleteQty).reduce((a, b) -> a + b).get(); StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", qty + ""), - new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", complateQty + "")); + new StationKvBean(MesPcnExtConstWords.COMPLETE_QTY, "工单完成数", complateQty + "")); } resultBean.setResultList(orderQtyKvBeans); } else if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.PROD_VIDEO.getValue(), mesWorkCell.getIsShowMsg())) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java index af34618..d49cf0c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java @@ -157,6 +157,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { model.setPart(mesPartSap); model.setPartInspectionDetailList(Arrays.asList(mesPartInspectionDetail)); if (Objects.equal(MesExtEnumUtil.EQUIP_VARIABLE_CFG_CATEGORY.PRODUCT_SCRAP.getValue(), result)) { + //TODO 有问题 需要修改条码质量状态 ncProcessingService.saveNc(model, reqBean.getOrganizeCode(), true); } else { MesPartInspectionInputModel inspectModel = new MesPartInspectionInputModel(); @@ -169,6 +170,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { inspectModel.setPartInspection(partInspection); inspectModel.setShiftCode(mesProduceSn.getShiftCode()); inspectModel.setProductVersion(productVersion); + inspectModel.setUserInfo(reqBean.getUserInfo()); inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode()); } 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 index b9016de..cbfc373 100644 --- 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 @@ -9,7 +9,6 @@ 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; @@ -126,8 +125,6 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService { 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()))); @@ -135,17 +132,16 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService { 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<>(); + Map propertyMap = new HashMap<>(); + //修改完成数量 if (calcCompleteQty.compareTo(MesPcnExtConstWords.ZERO) > 0) { - workOrder.setCompleteQty(MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); - propertyNameList.add(MesPcnExtConstWords.COMPLATED_QTY); + propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, MathOperation.add(workOrder.getCompleteQty(), calcCompleteQty)); } //修改未完成数量 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); + propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, MathOperation.sub(workOrder.getUnCompleteQty(), new Double(calcCompleteQty))); } /** @@ -155,43 +151,46 @@ public class MesWorkOrderSaveNosortStepService extends BaseStepService { * 上下文中 已经按照工单分组了,因为有一模多腔问题 */ - 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); + if (Integer.valueOf(prodResult).compareTo(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()) == 0 && !CollectionUtils.isEmpty(productionPsOutContextList)){ + propertyMap.put(MesPcnExtConstWords.SUSPICIOUS_PART_QTY, MathOperation.add(workOrder.getSuspiciousPartQty(), new Double(productionPsOutContextList.size()))); } //报废数量 - 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 (Integer.valueOf(prodResult).compareTo(MesExtEnumUtil.PRODUCE_QC_STATUS.SCRAP.getValue()) == 0 && !CollectionUtils.isEmpty(productionPsOutContextList)){ + propertyMap.put(MesPcnExtConstWords.SCRAP_PART_QTY, MathOperation.add(workOrder.getScrapPartQty(), new Double(productionPsOutContextList.size()))); } } 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); + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); } 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); + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); } - //如果数量都没有修改,不操作数据库 - 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)); + if (CollectionUtils.isEmpty(propertyMap)) continue; + + propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date())); + propertyMap.put(MesPcnExtConstWords.MODIFY_USER, reqBean.getUserInfo()); + + String[] propertyName = new String[propertyMap.size()]; + Object[] propertyValue = new Object[propertyMap.size()]; + Integer index = 0; + for (Map.Entry innerEntry : propertyMap.entrySet()) { + if (null == innerEntry) continue; + propertyName[index] = innerEntry.getKey(); + propertyValue[index] = innerEntry.getValue(); + index ++; } + + workOrderRepository.updateByProperties(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{workOrder.getId(), reqBean.getOrganizeCode()}, propertyName, propertyValue); + + 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(propertyMap)); } } } + 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 index 66736b5..06989fd 100644 --- 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 @@ -107,7 +107,7 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService { 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, MesPcnExtConstWords.OFFLINE_TIME}, + new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLETE_QTY, MesPcnExtConstWords.UN_COMPLETE_QTY, MesPcnExtConstWords.OFFLINE_TIME}, 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), TimeTool.getNowTime(true)}); } 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 655fe72..060318b 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 @@ -94,9 +94,9 @@ public class MesPcnExtConstWords { // 模具号 public static final String MOULD_NO = "mouldNo"; // 工单完成数 - public static final String COMPLATED_QTY = "complateQty"; + public static final String COMPLETE_QTY = "completeQty"; // 工单未完成数 - public static final String UN_COMPLATED_QTY = "unCompleteQty"; + public static final String UN_COMPLETE_QTY = "unCompleteQty"; // 工单可疑品数 public static final String SUSPICIOUS_PART_QTY = "suspiciousPartQty"; // 工单报废品数