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 36521c5..27fe116 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 @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station; 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.pojo.context.MesCellEquipContext; +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.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseModuleService; @@ -27,6 +28,7 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.StringJoiner; import java.util.stream.Collectors; /** @@ -56,6 +58,8 @@ public class MesProductionNoSortModuleService extends BaseModuleService { // 获取班次信息 List prodShiftDataContext = mesProductionDispatchContextStepService.getProdShiftDataContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + MesProdShiftContext mesProdShiftKvBean = mesProductionDispatchContextStepService.getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + if (CollectionUtils.isEmpty(prodShiftDataContext)) { this.sendMessage(reqBean, new StationResultBean().writeDbLog(), "请先开班", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); throw ImppExceptionBuilder.newInstance().setSystemID(CommonEnumUtil.SOFT_TYPE.MES_PCN.getCode()).setErrorCode("NO_SHOW_MSG").build(); @@ -68,7 +72,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService { List shiftCountContext = new ArrayList<>(); if (mesWorkCell.getIsShowMsg() != null && Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(),mesWorkCell.getIsShowMsg())) { List productionStatisticsContext = mesProductionDispatchContextStepService.getProductionStatisticsContext(reqBean); - + if (CollectionUtils.isEmpty(productionStatisticsContext)) { + StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工次数", "0")); + } StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext); this.sendMessage(reqBean, shiftCountBean); } @@ -83,20 +89,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { resultBean.setDataType(MesPcnEnumUtil.STATION_DATA_TYPE.CUSTOM.getValue()); resultBean.setCustomPageName(MesPcnExtConstWords.CUSTOM_PAGE_NAME_DEFAULT); resultBean.setSpecialDisplayData(getStepColIndent(reqBean)); -/* - List stationKvBeans3 = new ArrayList<>(); - StationKvBean stationKvBean7 = new StationKvBean(); - stationKvBean7.setKey("shiftCode"); - stationKvBean7.setName("班次"); - stationKvBean7.setValue("白班"); - stationKvBeans3.add(stationKvBean7); - - StationKvBean stationKvBean8 = new StationKvBean(); - stationKvBean8.setKey("shiftGroup"); - stationKvBean8.setName("班组"); - stationKvBean8.setValue("注塑2班"); - stationKvBeans3.add(stationKvBean8);*/ resultBean.setResultObj(prodShiftDataContext); resultBean.setResultList(moduleContentContext); @@ -111,6 +104,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { resultBean.setDataAttrList(packDataAttrList()); resultBean.setSpecialDisplayData(getStepColIndent(reqBean)); + resultBean.setResultList(productionStatisticsContext); return resultBean; } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionDispatchContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionDispatchContextStepService.java index 684cdd8..229a71f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionDispatchContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionDispatchContextStepService.java @@ -439,17 +439,17 @@ public class MesProductionDispatchContextStepService extends BaseStepService imp public Boolean addProductionStatisticsContext(StationRequestBean reqBean, int count) { MesProdShiftContext mesProdShiftKvBean = getMesProdShiftKvBean(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode()); + String key = new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(); List stationKvBeans = getProductionStatisticsContext(reqBean); if (CollectionUtils.isEmpty(stationKvBeans)) { - String key = mesProdShiftKvBean.getShiftGroup() + "_" + mesProdShiftKvBean.getShiftCode(); String name = "加工次数"; String value = count + ""; List generateStationKvBeans = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(key, name, value)); saveProductionStatisticsContext(reqBean, generateStationKvBeans); } else { stationKvBeans.stream().forEach(stationKvBean -> { - if (Objects.equal(stationKvBean.getKey(), mesProdShiftKvBean.getShiftGroup() + "_" + mesProdShiftKvBean.getShiftCode())) { + if (Objects.equal(stationKvBean.getKey(), key)) { stationKvBean.setValue(stationKvBean == null ? count + "" : (Integer.valueOf(stationKvBean.getValue()) + count) + ""); } });