From 5307e783249e27a02cc148219f11897a42e62386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E7=AC=91=E7=9D=80=E9=9D=A2=E5=AF=B9=E6=98=8E?= =?UTF-8?q?=E5=A4=A9?= <752558143@qq.com> Date: Sun, 14 Jul 2024 15:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=B7=A5=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/busi/IMesWorkOrderExtService.java | 3 ++ .../serviceimpl/busi/MesWorkOrderExtService.java | 8 ++++++ .../station/MesProductionNoSortModuleService.java | 32 +++++++++++++++------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkOrderExtService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkOrderExtService.java index f8d2e4e..f1e34f2 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkOrderExtService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesWorkOrderExtService.java @@ -20,4 +20,7 @@ public interface IMesWorkOrderExtService { MesWorkOrder insert(MesWorkOrder item); void update(MesWorkOrder item); + + @ApiOperation(value = "根据生产工单ID查询生产工单信息") + List getWorkOrderListByShiftCode(String organizeCode, String workCenterCode, String shiftCode); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderExtService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderExtService.java index 140dc56..705e9a7 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderExtService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesWorkOrderExtService.java @@ -74,4 +74,12 @@ public class MesWorkOrderExtService implements IMesWorkOrderExtService { public void update(MesWorkOrder item) { workOrderRepository.update(item); } + + @Override + public List getWorkOrderListByShiftCode(String organizeCode, String workCenterCode, String shiftCode) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); + DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + DdlPreparedPack.getStringEqualPack(shiftCode, MesPcnExtConstWords.SHIFT_CODE, packBean); + return workOrderRepository.findByHqlWhere(packBean); + } } 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 c713094..089d2c4 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 @@ -4,6 +4,7 @@ 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.pojo.context.MesProdShiftContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext; @@ -15,10 +16,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.MesFile; -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.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; @@ -40,6 +38,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.StringJoiner; +import java.util.function.BinaryOperator; /** * @Description : 展示组件:非排序生产 @@ -62,6 +61,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService { private IMesProdShiftRecordService mesProdShiftRecordService; @Autowired + private IMesWorkOrderExtService workOrderExtService; + + @Autowired private MesFileRepository mesFileRepository; @Override @@ -93,7 +95,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { productionStatisticsContext = StationKvBeanUtil.addStationKvBeanList(new ArrayList<>(), new StationKvBean(new StringJoiner(MesPcnExtConstWords.AND).add(mesProdShiftKvBean.getShiftGroup()).add(mesProdShiftKvBean.getShiftCode()).toString(), "加工数", "0"), new StationKvBean("color", "颜色", MesExtEnumUtil.COLOR.BLACK.getValue())); } - StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell); + StationResultBean shiftCountBean = getStationResultBean(reqBean, productionStatisticsContext,mesWorkCell, mesProdShiftKvBean); this.sendMessage(reqBean, shiftCountBean); //验证工位是否锁定 @@ -143,7 +145,7 @@ public class MesProductionNoSortModuleService extends BaseModuleService { return attrBeanList; } - private StationResultBean getStationResultBean(StationRequestBean reqBean, List productionStatisticsContext, MesWorkCell mesWorkCell) { + private StationResultBean getStationResultBean(StationRequestBean reqBean, List productionStatisticsContext, MesWorkCell mesWorkCell, MesProdShiftContext mesProdShiftKvBean) { StationResultBean resultBean = new StationResultBean(); resultBean.setBusiType(MesPcnEnumUtil.STATION_BUSI_TYPE.MODULE_CUSTOM_CONTENT.getValue()); String dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); @@ -164,11 +166,21 @@ public class MesProductionNoSortModuleService extends BaseModuleService { } if (Objects.equal(MesExtEnumUtil.WORK_FILE_TYPE.HISTOGRAM.getValue(), mesWorkCell.getIsShowMsg())) { dataType = MesPcnEnumUtil.STATION_DATA_TYPE.ECHART.getValue(); + List workOrderList = workOrderExtService.getWorkOrderListByShiftCode(reqBean.getOrganizeCode(), mesWorkCell.getWorkCenterCode(), mesProdShiftKvBean.getShiftCode()); + if (CollectionUtils.isEmpty(workOrderList)) { + StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), + new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", 0 + ""), + new StationKvBean(MesPcnExtConstWords.COMPLATED_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 + "")); + } if (!CollectionUtils.isEmpty(productionPartContextList)) { - productionPartContextList.forEach(o -> StationKvBeanUtil.addStationKvBeanList(orderQtyKvBeans, new ArrayList<>(), - new StationKvBean(MesPcnExtConstWords.WORK_ORDER_NO, "工单号", o.getWorkOrderNo() + ""), - new StationKvBean(MesPcnExtConstWords.QTY, "工单计划数", o.getQty() + ""), - new StationKvBean(MesPcnExtConstWords.COMPLATED_QTY, "工单完成数", o.getCompleteQty() + ""))); + } resultBean.setResultList(orderQtyKvBeans);