From c62e4e7c1699b2374c044f939cb08c520c067c18 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854> Date: Mon, 15 May 2023 18:03:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A1=E5=88=92=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96-=E5=B7=A5=E5=BA=8F=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E8=A7=84=E5=88=99=20=E4=BC=98=E5=8C=96=205.1?= =?UTF-8?q?5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/message/ZySpeechMessageList.vue | 16 +------ .../impl/IZyProductPlanAutoServiceImpl.java | 43 +++++++++++++------ .../jeecg/modules/team/entity/Station.java | 4 ++ 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/message/ZySpeechMessageList.vue b/ant-design-vue-jeecg/src/views/message/ZySpeechMessageList.vue index 409b8730..a2ab4071 100644 --- a/ant-design-vue-jeecg/src/views/message/ZySpeechMessageList.vue +++ b/ant-design-vue-jeecg/src/views/message/ZySpeechMessageList.vue @@ -84,24 +84,12 @@ class="j-table-force-nowrap" @change="handleTableChange"> - - - - - - - - - - + 播放 + 删除 - - - - diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java index 396caa23..5f8b56f2 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java @@ -11,6 +11,7 @@ import org.jeecg.modules.device.entity.ZyDevice; import org.jeecg.modules.device.service.IZyDeviceService; import org.jeecg.modules.operationtool.entity.ZyOperationtool; import org.jeecg.modules.operationtool.service.IZyOperationtoolService; +import org.jeecg.modules.person.vo.station; import org.jeecg.modules.productplan.entity.ZyPlanProcess; import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories; import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric; @@ -351,7 +352,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl planProcessList, List stationList, final String planId) { + public boolean diff(List planProcessList, List stationList, final ZyProductPlan zyProductPlan) { List updateList = new LinkedList<>(); if (ObjectUtils.isEmpty(stationList) || ObjectUtils.isEmpty(planProcessList)) return false; @@ -382,17 +383,19 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl zyProcessMachineIds = machineList.stream().map(ZyProcessMachine::getMachineId).collect(Collectors.toList()); List zyProcessCodes = machineList.stream().map(ZyProcessMachine::getCode).collect(Collectors.toList()); - ZyPlanProcess diffMachine = this.diffMachine(obj, zyProcessMachineIds, zyProcessCodes, stationList); + //匹配设备时,已更新station.tasksCount值,在这时查询最新的数据 + List stationListNew = iStationService.list(new LambdaQueryWrapper().eq(Station::getDepartId, zyProductPlan.getWorkshopId())); + ZyPlanProcess diffMachine = this.diffMachine(obj, zyProcessMachineIds, zyProcessCodes, stationListNew); if (ObjectUtils.isEmpty(diffMachine)) { //设备匹配失败,删除该生产计划相半数据,直接结束 - this.doException(planId, obj, "工序设备匹配"); + this.doException(zyProductPlan.getId(), obj, "工序设备匹配"); return false; } /*else { // 设备匹配成功,则匹配工具 //TODO 暂时注释掉 工序工具匹配 ZyPlanProcess diffTool = this.diffTool(diffMachine, toolList, stationList); if (ObjectUtils.isEmpty(diffTool)) { //设备匹配失败,删除该生产计划相半数据,直接结束 - this.doException(planId, obj, "工序工具匹配"); + this.doException(zyProductPlan.getId(), obj, "工序工具匹配"); return false; } else { // 匹配工人 updateList.add(diffTool); @@ -477,7 +480,10 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl zyProcessMachineIds, List zyProcessCodes, List stationList) { + if (!ObjectUtils.isEmpty(zyProcessCodes) && !ObjectUtils.isEmpty(zyProcessMachineIds)) { +// Set matchStationList = new LinkedHashSet<>(stationList.size()); + Map> matchObj = new LinkedHashMap<>(); for (int j = 0; j < stationList.size(); j++) { Station station = stationList.get(j); //工位设备ids @@ -493,18 +499,29 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl collect = machineList.stream().map(ZyDevice::getId).collect(Collectors.toList()); - zyPlanProcess.setMachineIds(ids); - zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(collect)); - zyPlanProcess.setStationId(station.getId()); - zyPlanProcess.setStationName(station.getStationName()); - zyPlanProcess.setStationNum(station.getStationNum()); - return zyPlanProcess; + matchObj.put(station.getId(), machineList); } } } } + + if (!ObjectUtils.isEmpty(matchObj)) { + Set keySet = matchObj.keySet(); + List stationList2 = iStationService.list(new LambdaQueryWrapper().in(Station::getId, keySet)); + Station minTaskCountStation = stationList2.stream().min(Comparator.comparing(Station::getTasksCount)).get(); + List machineList2 = matchObj.get(minTaskCountStation.getId()); + String ids = machineList2.stream().map(ZyDevice::getId).collect(Collectors.joining(",")); + List collect = machineList2.stream().map(ZyDevice::getId).collect(Collectors.toList()); + zyPlanProcess.setMachineIds(ids); + zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(collect)); + zyPlanProcess.setStationId(minTaskCountStation.getId()); + zyPlanProcess.setStationName(minTaskCountStation.getStationName()); + zyPlanProcess.setStationNum(minTaskCountStation.getStationNum()); + minTaskCountStation.setTasksCount(minTaskCountStation.getTasksCount() + 1); + iStationService.updateById(minTaskCountStation); + return zyPlanProcess; + } + } return null; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/entity/Station.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/entity/Station.java index 000267e1..a41937c3 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/entity/Station.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/entity/Station.java @@ -78,6 +78,10 @@ public class Station { @Excel(name = "工位序号", width = 15) @ApiModelProperty(value = "工位序号") private Integer stationNum; + + @Excel(name = "已分配任务量", width = 15) + @ApiModelProperty(value = "已分配任务量") + private Integer tasksCount; /** * 备注 */