From 3c1f3a3c374116c3a2f11ad596d46c093427d3a6 Mon Sep 17 00:00:00 2001 From: liangzhou <594755172@qq.com> Date: Tue, 15 Apr 2025 13:20:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E5=88=86=E9=85=8D?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A3=85=E8=BD=BD=E6=9C=BA=E7=9A=84=E7=8B=AC=E7=AB=8B=E6=80=A7?= =?UTF-8?q?=E3=80=82=202.=20=E4=BF=AE=E6=94=B9=E6=95=B4=E7=90=86=E5=A4=A7?= =?UTF-8?q?=E7=9B=92=E5=AD=90=E9=83=A8=E5=88=86=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KateWorkQueryController.java | 47 ++++++++++--------- .../com/wms/controller/TaskController.java | 6 +-- .../WorkServiceImplements.java | 17 ++++++- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/wms/controller/KateWorkQueryController.java b/src/main/java/com/wms/controller/KateWorkQueryController.java index c30ccc0..8d79975 100644 --- a/src/main/java/com/wms/controller/KateWorkQueryController.java +++ b/src/main/java/com/wms/controller/KateWorkQueryController.java @@ -9,17 +9,14 @@ import com.wms.constants.enums.ResponseCode; import com.wms.entity.app.ResponseEntity; import com.wms.entity.app.dto.PageDto; import com.wms.entity.app.dto.StockOfGoodsDto; -import com.wms.entity.app.dto.extend.KanbanEntity; import com.wms.entity.app.request.*; import com.wms.entity.app.vo.*; import com.wms.entity.table.*; import com.wms.service.*; import com.wms.utils.HttpUtils; import com.wms.utils.StringUtils; -import com.wms.utils.excel.vo.ClcKanbanRequirementExcelVo; import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; -import org.joda.time.LocalDate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -842,19 +839,30 @@ public class KateWorkQueryController { } // 返回结果 Map bigBoxVoMap = new HashMap<>(); - // 查询到当前站台所有的大盒子 + // 找出本次工作的标签位 + List eConfigLastList = eLocationConfigLastService.list(new LambdaQueryWrapper() + .eq(ELocationConfigLast::getWorkStation, standId)); + // 整理出所有的小盒子号 + List smallBoxList = eConfigLastList.stream().map(ELocationConfigLast::getWorkCenter).distinct().toList(); + // 查询出对应小盒子的工站配置 List stationConfigs = workStationConfigService.list(new LambdaQueryWrapper() - .eq(WorkStationConfig::getWorkStation, standId)); + .in(WorkStationConfig::getSmallBox, smallBoxList)); + // 整理出每个大盒子的工单数 + Map bigBoxOrderQuantityMap = new HashMap<>(); for (WorkStationConfig currentBigBoxConfig : stationConfigs) { - // 当前配置的工单数/大盒子 - int orderQuantity = currentBigBoxConfig.getOrderQuantity(); + if (!bigBoxOrderQuantityMap.containsKey(currentBigBoxConfig.getBigBox())) { + // 添加大盒子-工单数 + bigBoxOrderQuantityMap.put(currentBigBoxConfig.getBigBox(), currentBigBoxConfig.getOrderQuantity()); + } + } + // 生成结果集 + for (String bigBox : bigBoxOrderQuantityMap.keySet()) { + int orderQuantity = bigBoxOrderQuantityMap.get(bigBox); // 查询这个大盒子对应的小盒子 - List smallBoxListOfAll = stationConfigs.stream().map(WorkStationConfig::getSmallBox).distinct().toList(); + List smallBoxListOfAll = stationConfigs.stream().filter(currentBigBoxConfig -> currentBigBoxConfig.getBigBox().equals(bigBox)).map(WorkStationConfig::getSmallBox).distinct().toList(); // 找出本次工作中的标签位 - List eConfigLastList = eLocationConfigLastService.list(new LambdaQueryWrapper() - .eq(ELocationConfigLast::getWorkStation, standId) - .in(ELocationConfigLast::getWorkCenter, smallBoxListOfAll)); - if (eConfigLastList.isEmpty()) { + List thisBigBoxEConfigLastList = eConfigLastList.stream().filter(currentEConfigLast -> smallBoxListOfAll.contains(currentEConfigLast.getWorkCenter())).toList(); + if (thisBigBoxEConfigLastList.isEmpty()) { continue; } // 设置返回结果 @@ -863,21 +871,16 @@ public class KateWorkQueryController { boxQuantity = 1; } else { // 根据这些小盒子号找到对应的工单 - List orderIds = eConfigLastList.stream().map(ELocationConfigLast::getWorkOrder).distinct().toList(); - boxQuantity = boxQuantity + (orderIds.size() / orderQuantity); + List orderIds = thisBigBoxEConfigLastList.stream().map(ELocationConfigLast::getWorkOrder).distinct().toList(); + boxQuantity = (orderIds.size() + orderQuantity - 1) / orderQuantity; } // 键 - String key = currentBigBoxConfig.getWorkStation() + "_" + currentBigBoxConfig.getBigBox(); - if (bigBoxVoMap.containsKey(key)) { - BigBoxVo bigBoxVo = bigBoxVoMap.get(key); - bigBoxVo.setBoxQuantity(bigBoxVo.getBoxQuantity() + boxQuantity); - bigBoxVoMap.replace(key, bigBoxVo); - } else { + if (!bigBoxVoMap.containsKey(bigBox)) { BigBoxVo bigBoxVo = new BigBoxVo(); bigBoxVo.setStandId(standId); - bigBoxVo.setBigBoxNo(currentBigBoxConfig.getBigBox()); + bigBoxVo.setBigBoxNo(bigBox); bigBoxVo.setBoxQuantity(boxQuantity); - bigBoxVoMap.put(key, bigBoxVo); + bigBoxVoMap.put(bigBox, bigBoxVo); } } diff --git a/src/main/java/com/wms/controller/TaskController.java b/src/main/java/com/wms/controller/TaskController.java index d920429..685d270 100644 --- a/src/main/java/com/wms/controller/TaskController.java +++ b/src/main/java/com/wms/controller/TaskController.java @@ -2595,8 +2595,7 @@ public class TaskController { } // 判断大盒子号是否正确 List stationConfigs = workStationConfigService.list(new LambdaQueryWrapper() - .eq(WorkStationConfig::getBigBox, sortBoxRequest.getBigBoxNo()) - .eq(WorkStationConfig::getWorkStation, standId)); + .eq(WorkStationConfig::getBigBox, sortBoxRequest.getBigBoxNo())); if (stationConfigs == null || stationConfigs.isEmpty()) { logger.error("请输入正确的大盒子号。"); response.setCode(ResponseCode.ERROR.getCode()); @@ -2695,8 +2694,7 @@ public class TaskController { } // 判断大盒子号是否正确 List stationConfigs = workStationConfigService.list(new LambdaQueryWrapper() - .eq(WorkStationConfig::getBigBox, sortBoxRequest.getBigBoxNo()) - .eq(WorkStationConfig::getWorkStation, standId)); + .eq(WorkStationConfig::getBigBox, sortBoxRequest.getBigBoxNo())); if (stationConfigs == null || stationConfigs.isEmpty()) { logger.error("请输入正确的大盒子号。"); response.setCode(ResponseCode.ERROR.getCode()); diff --git a/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java b/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java index ee57431..44c7625 100644 --- a/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java +++ b/src/main/java/com/wms/service/business/serviceImplements/WorkServiceImplements.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.wms.constants.enums.*; import com.wms.entity.app.dto.KateOrdersDto; -import com.wms.entity.app.dto.WorkCenterAndOrderDto; import com.wms.entity.app.dto.extend.StockDetailInfo; import com.wms.entity.table.*; import com.wms.service.*; @@ -861,6 +860,7 @@ public class WorkServiceImplements implements IWorkService { // .eq(WorkFlow::getWorkStation, workStation) // .eq(WorkFlow::getMachineType, 1) // .ne(WorkFlow::getWorkStatus, -1)); + int currentWorkType = -1; if (!StringUtils.isEmpty(workPriority) && workPriority.equals("1")) { // 当前工作优先级为先平地机后装载机 // 查询当前站台是否还有装载机的任务没做完 @@ -909,8 +909,10 @@ public class WorkServiceImplements implements IWorkService { return; } needDistributeWorks.addAll(mwlWorks); + currentWorkType = 1;// 装载机 } else { needDistributeWorks.addAll(oldWorkFlows); + currentWorkType = 2;// 平地机 } } else { // 默认优先级为先装载机后平地机 @@ -956,8 +958,10 @@ public class WorkServiceImplements implements IWorkService { return; } needDistributeWorks.addAll(mgWorks); + currentWorkType = 2;// 平地机 } else { needDistributeWorks.addAll(oldWorkFlows); + currentWorkType = 1;// 装载机 } } // 最终需要存储的数据 @@ -986,7 +990,16 @@ public class WorkServiceImplements implements IWorkService { // 然后获取大盒子-订单的map Map> workFlowsByBigBoxMap = new HashMap<>(); // 获取工站配置 - List workStationConfigs = workStationConfigService.list(); + LambdaQueryWrapper wsConfigQueryWrapper = new LambdaQueryWrapper<>(); + if (currentWorkType == 1) { + // 当前是装载机工作,装载机要区分站台 + wsConfigQueryWrapper.eq(WorkStationConfig::getWorkStation, workStation) + .eq(WorkStationConfig::getModel, "MWL"); + } else { + // 当前是平地机工作 + wsConfigQueryWrapper.ne(WorkStationConfig::getModel, "MWL"); + } + List workStationConfigs = workStationConfigService.list(wsConfigQueryWrapper); // 根据小盒子号生成map Map smallBoxToBigBoxConfigMap = workStationConfigs.stream().collect(Collectors.toMap(WorkStationConfig::getSmallBox, WorkStationConfig::getBigBox)); for (WorkFlow workFlow : needDistributeWorks) {