From 6f45f6332130fc406527bf56f8810cc994434452 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 20 Aug 2024 23:32:12 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E4=BB=93=E5=BA=93=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E4=BB=BB=E5=8A=A1=E6=98=8E=E7=BB=86=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/trunkline/vo/ZeroNumVO.java | 13 + .../mapper/TrunklineCarsLoadScanMapper.java | 2 + .../mapper/TrunklineCarsLoadScanMapper.xml | 10 + .../ITrunklineCarsLoadScanService.java | 2 + .../ITrunklineWaybillOrderService.java | 1 + .../TrunklineCarsLoadScanServiceImpl.java | 6 + .../impl/TrunklineCarsLoadServiceImpl.java | 260 ++++++++++++++---- .../TrunklineWaybillOrderServiceImpl.java | 9 + .../controller/TaskQuestController.java | 22 +- .../excel/QuestContrastPackageExcelVO.java | 6 +- .../service/impl/TaskQuestServiceImpl.java | 7 +- 11 files changed, 281 insertions(+), 57 deletions(-) create mode 100644 blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java new file mode 100644 index 000000000..ba6282ad9 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java @@ -0,0 +1,13 @@ +package com.logpm.trunkline.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ZeroNumVO implements Serializable { + + private String waybillNo; + private Integer num; + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java index 5d2f1c1e5..98db9c039 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java @@ -169,4 +169,6 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper findAbnormalZeroScanList(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); + + List findZeroStartNum(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml index 74363958b..3bce8c213 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml @@ -903,4 +903,14 @@ and scan_status = '1' + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java index 7976a2e59..51913e4ef 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java @@ -164,4 +164,6 @@ public interface ITrunklineCarsLoadScanService extends BaseService findAbnormalZeroScanList(Long loadId, Long warehouseId); + + List findZeroStartNum(Long loadId, Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java index dbe111831..2c32d61b2 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java @@ -25,4 +25,5 @@ public interface ITrunklineWaybillOrderService extends BaseService findZeroStartNum(Long loadId, Long warehouseId) { + return baseMapper.findZeroStartNum(loadId,warehouseId); + } + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index 30ff00353..8612ae4a3 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -369,6 +369,51 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); + if(CollUtil.isNotEmpty(zeroNumVOList)){ + zeroNumVOList.forEach(zeroNumVO -> { + String waybillNo = zeroNumVO.getWaybillNo(); + Integer num = zeroNumVO.getNum(); + WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); + Integer totalCount = waybill.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); + TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); + if(!Objects.isNull(waybillOrderEntity)){ + Integer handleNumber = waybillOrderEntity.getHandleNumber(); + if(Objects.isNull(handleNumber)){ + handleNumber = 0; + } + int i = handleNumber + num; + if(waybillStatusInt < 30){ + if(totalCount == i){ + waybill.setWaybillStatus("40"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + }else{ + waybill.setWaybillStatus("30"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + }else if(waybillStatusInt == 30){ + if(totalCount == i){ + waybill.setWaybillStatus("40"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + }else{ + waybillOrderEntity.setHandleNumber(i); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + } + + } + }); + } + //更新关联订单数据的发车数量 trunklineCarsOrderService.updateStartNumByLoadIdAndWarehouseId(loadId, warehouseId); //删除没有装车的计划数据 @@ -756,6 +801,41 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); + if(CollUtil.isNotEmpty(zeroNumVOList)){ + zeroNumVOList.forEach(zeroNumVO -> { + String waybillNo = zeroNumVO.getWaybillNo(); + Integer num = zeroNumVO.getNum(); + WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); + Integer totalCount = waybill.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); + TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); + if(!Objects.isNull(waybillOrderEntity)){ + Integer handleNumber = waybillOrderEntity.getHandleNumber(); + if(waybillStatusInt == 40 || waybillStatusInt == 30){ + if(Objects.isNull(handleNumber)){ + handleNumber = 0; + } + int i = handleNumber - num; + if(i==0){ + waybill.setWaybillStatus("20"); + waybillOrderEntity.setHandleNumber(totalCount); + }else{ + waybill.setWaybillStatus("30"); + waybillOrderEntity.setHandleNumber(i); + } + + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + + } + + }); + } + //更新关联订单数据的发车数量 trunklineCarsOrderService.updateStartNumToPlanNumByLoadIdAndWarehouseId(loadId, warehouseId); @@ -1004,6 +1084,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); - queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) - .eq("order_code",stockArticleEntity.getWaybillNumber()); - TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); - if(!Objects.isNull(one)){ - WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(stockArticleEntity.getWaybillNumber()); - Integer totalCount = waybillEntity.getTotalCount(); - Integer waybillStatusInt = Integer.parseInt(waybillEntity.getWaybillStatus()); - if(waybillStatusInt <= 30){ - Integer handleNumber = one.getHandleNumber(); - int total = handleNumber + unloadNum; - if(total < totalCount){ - waybillEntity.setWaybillStatus("50"); - one.setHandleNumber(total); - }else{ - waybillEntity.setWaybillStatus("60"); - one.setHandleNumber(totalCount); - } - warehouseWaybillClient.updateEntity(waybillEntity); - trunklineWaybillOrderService.updateById(one); - } - } - } +// if(isTransfer == 0){ +// //查询零担发车件数 +// List zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); +// if(CollUtil.isNotEmpty(zeroNumVOList)){ +// zeroNumVOList.forEach(zeroNumVO -> { +// String waybillNo = zeroNumVO.getWaybillNo(); +// Integer num = zeroNumVO.getNum(); +// WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); +// Integer totalCount = waybill.getTotalCount(); +// Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); +// TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); +// if(!Objects.isNull(waybillOrderEntity)){ +// Integer handleNumber = waybillOrderEntity.getHandleNumber(); +// if(waybillStatusInt <= 40){ +// if(Objects.isNull(handleNumber)){ +// handleNumber = 0; +// } +// int i = handleNumber - num; +// if(i==0){ +// waybill.setWaybillStatus("20"); +// waybillOrderEntity.setHandleNumber(totalCount); +// }else{ +// waybill.setWaybillStatus("30"); +// waybillOrderEntity.setHandleNumber(i); +// } +// +// warehouseWaybillClient.updateEntity(waybill); +// trunklineWaybillOrderService.updateById(waybillOrderEntity); +// } +// +// } +// +// }); +// } +// } } } else { Integer hQuantity = newStockArticleEntity.getHandQuantity() + unloadNum; @@ -1232,38 +1324,77 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); - queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) - .eq("order_code",stockArticleEntity.getWaybillNumber()); - TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); - if(!Objects.isNull(one)){ - Integer totalCount = warehouseWaybillEntity.getTotalCount(); - Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); - if(waybillStatusInt <= 30){ - Integer handleNumber = one.getHandleNumber(); - int total = handleNumber + unloadNum; - if(total < totalCount){ - warehouseWaybillEntity.setWaybillStatus("50"); - one.setHandleNumber(total); - }else{ - warehouseWaybillEntity.setWaybillStatus("60"); - one.setHandleNumber(totalCount); - } - warehouseWaybillClient.updateEntity(warehouseWaybillEntity); - trunklineWaybillOrderService.updateById(one); - } - } - } +// String waybillNumber = newStockArticleEntity.getWaybillNumber(); +// WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNumber); +// Long destinationWarehouseId = warehouseWaybillEntity.getDestinationWarehouseId(); +// if(warehouseId.equals(destinationWarehouseId)){ +// QueryWrapper queryWrapper1 = new QueryWrapper<>(); +// queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) +// .eq("order_code",stockArticleEntity.getWaybillNumber()); +// TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); +// if(!Objects.isNull(one)){ +// Integer totalCount = warehouseWaybillEntity.getTotalCount(); +// Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); +// if(waybillStatusInt <= 30){ +// Integer handleNumber = one.getHandleNumber(); +// int total = handleNumber + unloadNum; +// if(total < totalCount){ +// warehouseWaybillEntity.setWaybillStatus("50"); +// one.setHandleNumber(total); +// }else{ +// warehouseWaybillEntity.setWaybillStatus("60"); +// one.setHandleNumber(totalCount); +// } +// warehouseWaybillClient.updateEntity(warehouseWaybillEntity); +// trunklineWaybillOrderService.updateById(one); +// } +// } +// } } } } } }); + + + WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(orderCode); + String waybillNo = warehouseWaybillEntity.getWaybillNo(); + Long waybillId = warehouseWaybillEntity.getId(); + int unloadNum = orderCodeList.stream().mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); + Long destinationWarehouseId = warehouseWaybillEntity.getDestinationWarehouseId(); + if(warehouseId.equals(destinationWarehouseId)){ + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("waybill_no",orderCode) + .eq("order_code",orderCode); + TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); + if(!Objects.isNull(one)){ + Integer handleNumber = one.getHandleNumber(); + Integer totalCount = warehouseWaybillEntity.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); + int total = handleNumber + unloadNum; + if(waybillStatusInt < 50){ + if(total != totalCount){ + warehouseWaybillEntity.setWaybillStatus("50"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + }else{ + warehouseWaybillEntity.setWaybillStatus("60"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + } + }else if(waybillStatusInt == 50){ + if(total == totalCount){ + warehouseWaybillEntity.setWaybillStatus("60"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + } + } + } + } }); } @@ -6667,7 +6798,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("waybill_id",waybillId) + .eq("order_code",waybillNo); + TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); + if(!Objects.isNull(one)){ + Integer totalCount = waybillEntity.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybillEntity.getWaybillStatus()); + if(waybillStatusInt <= 40){ + Integer handleNumber = one.getHandleNumber(); + int total = handleNumber - num; + if(total == 0){ + waybillEntity.setWaybillStatus("20"); + one.setHandleNumber(total); + }else{ + waybillEntity.setWaybillStatus("30"); + one.setHandleNumber(totalCount); + } + warehouseWaybillClient.updateEntity(waybillEntity); + trunklineWaybillOrderService.updateById(one); + } + } + } } }); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java index b777f9353..7099684c5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.logpm.trunkline.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.mapper.TrunklineWaybillOrderMapper; @@ -54,4 +55,12 @@ public class TrunklineWaybillOrderServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no",waybillNo) + .eq("order_code",orderCode); + return baseMapper.selectOne(queryWrapper); + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java index abafc1f87..7404df82e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java @@ -50,13 +50,18 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.cache.UserCache; +import org.springblade.system.entity.User; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; /** * 盘点任务 控制器 @@ -228,8 +233,23 @@ public class TaskQuestController extends BladeController { @ApiOperation(value = "导出已盘数据明细维度", notes = "传入questDetailDTO") public void exportPanDataWithPackage(QuestDetailDTO questDetailDTO, HttpServletResponse response){ String questNum = questDetailDTO.getQuestNum(); + List ls = new ArrayList(); List list = taskQuestService.exportPanDataWithPackage(questDetailDTO); - ExcelUtil.export(response, "盘点任务【"+questNum+"】数据" + DateUtil.time(), "盘点明细数据表", list, QuestContrastPackageExcelVO.class); + //把list中所有元素通过inventoryUser进行分组 + Map> groupedByInventoryUser = list.stream() + .collect(Collectors.groupingBy(QuestContrastPackageExcelVO::getInventoryUser)); + groupedByInventoryUser.keySet().forEach(inventoryUser -> { + List questContrastPackageExcelVOS = groupedByInventoryUser.get(inventoryUser); + User user = UserCache.getUser(inventoryUser); + if(!Objects.isNull(user)){ + questContrastPackageExcelVOS.forEach(questContrastPackageExcelVO -> { + questContrastPackageExcelVO.setInventoryUserStr(user.getName()); + }); + } + + ls.addAll(questContrastPackageExcelVOS); + }); + ExcelUtil.export(response, "盘点任务【"+questNum+"】数据" + DateUtil.time(), "盘点明细数据表", ls, QuestContrastPackageExcelVO.class); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java index 6f8436874..1e130b94e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java @@ -1,5 +1,6 @@ package com.logpm.warehouse.excel; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import lombok.Data; @@ -98,8 +99,11 @@ public class QuestContrastPackageExcelVO implements Serializable { @ExcelProperty(value = "盘点时间") private Date inventoryTime; + @ExcelIgnore + private Long inventoryUser; + @ColumnWidth(20) @ExcelProperty(value = "盘点人") - private String inventoryUser; + private String inventoryUserStr; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java index 09b917b9d..938ac89a2 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java @@ -1009,9 +1009,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl> listR = userSearchClient.listByUser(String.valueOf(i.getUpdateUser())); if (ObjectUtils.isNotNull(listR.getData())) { @@ -1021,7 +1021,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl