From 9be95291673f3469de8c4a44feb1dd39b56c81ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E9=BE=99?= Date: Mon, 31 Mar 2025 18:38:23 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=86=E5=8D=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionSplitOrderTaskController.java | 3 +- .../IDistributionSplitOrderTaskService.java | 3 +- ...DistributionSplitOrderTaskServiceImpl.java | 139 +++++++++++++----- .../vo/DistributionSplitOrderAllTaskVO.java | 11 ++ .../vo/DistributionSplitOrderTaskVO.java | 11 ++ 5 files changed, 126 insertions(+), 41 deletions(-) create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java index eabf84f66..92d184845 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java @@ -6,6 +6,7 @@ import com.logpm.distribution.dto.splitOrder.*; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; @@ -30,7 +31,7 @@ public class DistributionSplitOrderTaskController { } @GetMapping("/all-task-list") - public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { + public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { return distributionSplitOrderTaskService.allTaskList(query, distributionSplitAllTaskSearchDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java index 7de3e8547..07710ab16 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java @@ -6,6 +6,7 @@ import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -32,7 +33,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO); + R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO); /** * 创建任务 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java index 22175185e..6cee439d7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java @@ -1,11 +1,13 @@ package com.logpm.distribution.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.SerializationUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.logpm.distribution.bean.Resp; import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; @@ -21,6 +23,7 @@ import com.logpm.distribution.service.IDistributionSplitOrderDetailService; import com.logpm.distribution.service.IDistributionSplitOrderLogService; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; import com.logpm.distribution.service.IDistributionStockArticleService; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -37,15 +40,15 @@ import org.springblade.core.redis.lock.LockType; import org.springblade.core.redis.lock.RedisLockClient; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.system.entity.User; +import org.springblade.system.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import java.util.stream.Stream; @Service @AllArgsConstructor @@ -58,6 +61,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() - .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) - .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) - .eq(DistributionParcelListEntity::getIsTransfer, 0) - ); - long packageAllCount = distributionParcelListService.count( - Wrappers.lambdaQuery() - .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) - ); + long packageAllowCount = getSplitOrderAllowCount(stockArticleId); + long packageAllCount = getSplitOrderAllCount(stockArticleId); + if (packageAllowCount == 0 || packageAllCount == 1) { return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单"); } + boolean exists = exists( + Wrappers.lambdaQuery() + .eq(DistributionSplitOrderTaskEntity::getStockArticleId, stockArticleId) + .eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue()) + ); + if (exists) { + return R.fail("订单"+ distributionStockArticle.getOrderCode() +"正在拆单中,不允许重复拆单"); + } + taskLock(stockArticleId, () -> { String allTaskNo = getAllTaskNo(); DistributionSplitOrderAllTaskEntity allTask = new DistributionSplitOrderAllTaskEntity(); @@ -254,12 +257,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl existsList = distributionSplitOrderDetailService.list(Wrappers.lambdaQuery() .in(DistributionSplitOrderDetailEntity::getOrderPackageCode, packageCodes) ); - int addNumber = packageCodes.size(); if (!existsList.isEmpty()) { if (existsList.stream().anyMatch(detail -> !detail.getSplitOrderTaskId().equals(taskId) && detail.getState().equals(OrderPackageSplitStateConstant.finish.getValue()))) { return R.fail("提交包件包含其他拆单任务的包件"); @@ -318,7 +321,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl cancelTask(Long taskId) { DistributionSplitOrderTaskEntity task = getById(taskId); @@ -735,12 +739,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaUpdate() + .eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, task.getId()) + .set(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.cancel.getValue()) + .set(DistributionSplitOrderDetailEntity::getCancelUser, AuthUtil.getUser().getUserId()) + .set(DistributionSplitOrderDetailEntity::getCancelUsername, AuthUtil.getUser().getUserName()) + ); + + distributionSplitOrderLogService.record(task, "撤消拆单任务", AuthUtil.getUser().getUserName()); + + } + + @Transactional @Override public R cancelAllTask(Long allTaskId) { DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(allTaskId); if (!allTask.getState().equals(OrderSplitAllTaskStateConstant.finish.getValue())) { - return R.fail("拆单总任务已完成,无法操作"); + return R.fail("拆单总任务未完成,无法操作"); } if (!list(Wrappers.lambdaQuery() @@ -766,8 +783,19 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl list = list( + Wrappers.lambdaQuery() + .eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId) + ); + + long finishCount = list.stream().filter(task -> task.getState().equals(OrderSplitStateConstant.finish.getValue())).count(); + if (finishCount > 0) { + return R.fail("拆单任务中存在已完成拆单任务,无法操作"); + } + allTask.setState(OrderSplitAllTaskStateConstant.cancel.getValue()); distributionSplitOrderAllTaskService.updateById(allTask); + list.forEach(this::cancelTask); return R.success("success"); } @@ -780,11 +808,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() + boolean existsInProgress = exists(Wrappers.lambdaQuery() .eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId) .eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue()) ); - if (existsInProgress != null) { + if (existsInProgress) { return R.fail("拆单总任务中存在未完成拆单任务,无法操作"); } @@ -836,8 +864,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { + public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { IPage page = Condition.getPage(query); + IPage pageResult = Condition.getPage(query); LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); @@ -878,16 +907,29 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl list = distributionSplitOrderAllTaskService.list(page, queryWrapper); - page.setRecords(list); - return R.data(page); + String createUserIds = list.stream().map((d) -> d.getCreateUser() + "").collect(Collectors.joining(",")); + List users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), String.join(",", createUserIds)).getData(); + Map userMap = users.stream().collect(Collectors.toMap(User::getId, u -> u)); + List listVo = list.stream().map(d -> { + DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO(); + BeanUtil.copyProperties(d, vo); + vo.setCreateUserName(userMap.get(d.getCreateUser()).getName()); + return vo; + }).collect(Collectors.toList()); + + pageResult.setRecords(listVo); + pageResult.setPages(page.getPages()); + pageResult.setTotal(page.getTotal()); + + return R.data(pageResult); } @Override @@ -906,16 +948,35 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() + .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) + .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) + .eq(DistributionParcelListEntity::getIsTransfer, 0) + ); + } - @Override - public R checkOrderCode(String orderCode) { - - DistributionSplitOrderAllTaskEntity exists = distributionSplitOrderAllTaskService.getOne( - Wrappers.lambdaQuery() - .eq(DistributionSplitOrderAllTaskEntity::getOrderCode, orderCode) + public long getSplitOrderAllCount(Long stockArticleId) { + return distributionParcelListService.count( + Wrappers.lambdaQuery() + .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) ); + } - return R.success(exists == null ? "" : exists.getNo()); + @Override + public R checkOrderCode(String orderCode) { + DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getOne(Wrappers.lambdaQuery() + .eq(DistributionStockArticleEntity::getOrderCode, orderCode)); + long splitOrderAllCount = getSplitOrderAllCount(distributionStockArticle.getId()); + long splitOrderAllowCount = getSplitOrderAllowCount(distributionStockArticle.getId()); + if (splitOrderAllowCount == 0 || splitOrderAllCount == 1) { + return R.success("该订单无法拆单"); + } + return R.success(""); } @Override diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java new file mode 100644 index 000000000..88844757c --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java @@ -0,0 +1,11 @@ +package com.logpm.distribution.vo; + +import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class DistributionSplitOrderAllTaskVO extends DistributionSplitOrderAllTaskEntity { + private String createUserName; +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java new file mode 100644 index 000000000..35eb05339 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java @@ -0,0 +1,11 @@ +package com.logpm.distribution.vo; + +import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class DistributionSplitOrderTaskVO extends DistributionSplitOrderTaskEntity { + private String createUserName; +} From a594acaa7f9edc7e1aa2ede9ae3640d881662a2b Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 09:21:23 +0800 Subject: [PATCH 02/12] =?UTF-8?q?1.=E4=B8=89=E6=96=B9=E4=B8=AD=E8=BD=AC?= =?UTF-8?q?=E7=AD=BE=E6=94=B6=E5=B9=BF=E6=92=AD=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TrunklineCarsLoadServiceImpl.java | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) 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 9631e1f09..97232e3f6 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 @@ -57,7 +57,6 @@ import org.springblade.common.constant.*; import org.springblade.common.constant.broadcast.FanoutConstants; import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant; import org.springblade.common.enums.BizOperationEnums; -import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.exception.CustomerException; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; @@ -9768,22 +9767,22 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); - parcelListEntityList.forEach(parcelListEntity -> { - PackageData packageData = new PackageData(); - packageData.setWaybillNumber(parcelListEntity.getWaybillNumber()); - packageData.setBrand(parcelListEntity.getBrandName()); - packageData.setPackageCode(parcelListEntity.getOrderPackageCode()); - packageData.setMaterialCode(parcelListEntity.getMaterialCode()); - packageData.setMaterialName(parcelListEntity.getMaterialName()); - packageData.setNumber(1); - packageData.setOrderCode(parcelListEntity.getOrderCode()); - packageData.setPackageType(PackageTypeEnums.CMP); - packageDataList.add(packageData); - }); +// FindParamterDTO findParamterDTO = new FindParamterDTO(); +// findParamterDTO.setOrderPackageCodeList(scanCodes); +// findParamterDTO.setWarehouseId(warehouseId); +// List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); +// parcelListEntityList.forEach(parcelListEntity -> { +// PackageData packageData = new PackageData(); +// packageData.setWaybillNumber(parcelListEntity.getWaybillNumber()); +// packageData.setBrand(parcelListEntity.getBrandName()); +// packageData.setPackageCode(parcelListEntity.getOrderPackageCode()); +// packageData.setMaterialCode(parcelListEntity.getMaterialCode()); +// packageData.setMaterialName(parcelListEntity.getMaterialName()); +// packageData.setNumber(1); +// packageData.setOrderCode(parcelListEntity.getOrderCode()); +// packageData.setPackageType(PackageTypeEnums.CMP); +// packageDataList.add(packageData); +// }); }else{ @@ -9803,19 +9802,19 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId); - if(!Objects.isNull(tripartiteVONodeFanoutMsg)){ - rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg)); - } +// NodeFanoutMsg tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId); +// if(!Objects.isNull(tripartiteVONodeFanoutMsg)){ +// rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg)); +// } return R.success("签收成功"); } From a1e01a15be2f6d5aed242f85ff09642d538f22e4 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 10:18:34 +0800 Subject: [PATCH 03/12] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=8D=95?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=B7=E8=BF=87=E5=A4=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=E6=88=AA=E5=8F=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml | 1 - .../trunkline/service/impl/OpenOrderServiceImpl.java | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml index cde4b100b..d9e1d4e72 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml @@ -93,7 +93,6 @@ 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 9e3f587ec..0e820d8fd 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 @@ -213,5 +213,5 @@ public interface ITrunklineCarsLoadScanService extends BaseService 0){ DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); if(!Objects.isNull(parcelListEntity)){ From b56308b2dae1567803239f09f1512f9690d845dc Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 15:06:17 +0800 Subject: [PATCH 07/12] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distribution/feign/DistributionStockArticleClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index 1901109be..b9cd8d4f0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -93,12 +93,12 @@ public class DistributionStockArticleClient implements IDistributionStockArticle bladeRedis.setEx(key,"1",30L); DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); if(ObjectUtils.isNotEmpty(distributionStockArticle)){ - bladeRedis.setEx(key,distributionStockArticle.getId(),30L); + bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); return distributionStockArticle.getId(); }else{ boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); if(saveFlag){ - bladeRedis.setEx(key,distributionStockArticleEntity.getId(),30L); + bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); return distributionStockArticleEntity.getId(); }else{ return 0L; From aa42d12b7bfd2496ee39064bc4b99a1096c8d7d5 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 15:30:52 +0800 Subject: [PATCH 08/12] =?UTF-8?q?1.=E5=8D=B8=E8=BD=A6=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=EF=BC=8C=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CarsLoadController.java | 4 +++- .../impl/CarsLoadAsyncServiceImpl.java | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java index 05bfa2752..978d521a9 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java @@ -1093,12 +1093,14 @@ public class CarsLoadController { // return R.fail(405,"未知的发车类型"); // } - carsLoadService.unloadByLoadId(loadCarsDTO); + try{ //同步一次系统无编码数据 carsLoadService.syncNoSystemData(loadId, myCurrentWarehouse.getId(), myCurrentWarehouse.getName()); + carsLoadService.unloadByLoadId(loadCarsDTO); + carsLoadService.sendStationArrivedEnter(loadCarsDTO); }catch (Exception e){ diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java index 02b2cc3cd..5d1d81720 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java @@ -18,6 +18,7 @@ import com.logpm.basic.entity.BasicCarModelEntity; import com.logpm.basic.feign.IBasicCarModelClient; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.distribution.dto.FindParamterDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.feign.IDistributionParcelListClient; @@ -548,6 +549,16 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService { List addList = new ArrayList<>(); List noUnloadList = trunklineCarsLoadScanService.findUnloadCheckAbnormalNoUnloadList(loadId, warehouseId); + //把noUnloadList中所有元素的scanCode放入一个List + List scanCodeList = noUnloadList.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList()); + FindParamterDTO findParamterDTO = new FindParamterDTO(); + findParamterDTO.setOrderPackageCodeList(scanCodeList); + findParamterDTO.setWarehouseId(warehouseId); + List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); + //把parcelListEntityList转化成以orderPackageCode作为key的Map + Map parcelMap = parcelListEntityList.stream() + .collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity())); + for (TrunklineCarsLoadScanEntity trunklineCarsLoadScanEntity : noUnloadList) { String loadCode = trunklineCarsLoadScanEntity.getLoadCode(); String waybillNo = trunklineCarsLoadScanEntity.getWaybillNo(); @@ -579,6 +590,14 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService { abnormalRecordEntity.setRemark("无卸车记录"); abnormalRecordEntity.setIsZero(0); abnormalRecordEntity.setNum(1); + DistributionParcelListEntity distributionParcel = parcelMap.get(scanCode); + if(!Objects.isNull(distributionParcel)){ + abnormalRecordEntity.setAbnormalStatus(1); + abnormalRecordEntity.setDealTime(new Date()); + abnormalRecordEntity.setDealUserId(userId); + abnormalRecordEntity.setDealUserName(nickName); + abnormalRecordEntity.setRemark("无卸车记录,已入库,系统判定自动完结"); + } addList.add(abnormalRecordEntity); // abnormalRecordClient.addAbnormalRecord(abnormalRecordEntity); } From 95df147b7780b067cf1d26a20036b30d47d5e652 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 15:43:47 +0800 Subject: [PATCH 09/12] =?UTF-8?q?1.=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TrunklineCarsLoadServiceImpl.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) 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 33b05a7bb..a96a20787 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 @@ -13541,6 +13541,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl scanCodeList = new ArrayList<>(scanCodeSet); + + FindParamterDTO findParamterDTO = new FindParamterDTO(); + findParamterDTO.setOrderPackageCodeList(scanCodeList); + findParamterDTO.setWarehouseId(warehouseId); + List parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO); + //把parcelListEntityList转化成以orderPackageCode作为key的Map + Map parcelMap = parcelListEntityList.stream() + .collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity())); + + List allAdvanceDetailList = new ArrayList<>(); int packageBatchSize = 500; @@ -13664,11 +13674,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl Date: Tue, 1 Apr 2025 16:00:37 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8B=86=E5=8D=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributionSplitOrderTaskController.java | 3 +- .../IDistributionSplitOrderTaskService.java | 3 +- ...DistributionSplitOrderTaskServiceImpl.java | 53 +++++++++++-------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java index 92d184845..08ea01f8e 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java @@ -7,6 +7,7 @@ import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; +import com.logpm.distribution.vo.DistributionSplitOrderTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; @@ -97,7 +98,7 @@ public class DistributionSplitOrderTaskController { } @GetMapping("/task-list") - public R> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { + public R> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { return distributionSplitOrderTaskService.taskList(query, distributionSplitTaskSearchDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java index 07710ab16..3362b6689 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java @@ -7,6 +7,7 @@ import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; +import com.logpm.distribution.vo.DistributionSplitOrderTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -25,7 +26,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO); + R> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO); /** * 拆单总任务 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java index e2e5a3896..673907ea5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java @@ -42,7 +42,9 @@ import org.springblade.core.redis.lock.LockType; import org.springblade.core.redis.lock.RedisLockClient; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.system.cache.UserCache; import org.springblade.system.entity.User; +import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -67,7 +69,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { + public R> taskList(Query query, DistributionSplitTaskSearchDTO distributionSplitTaskSearchDTO) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); if (distributionSplitTaskSearchDTO.getSplitOrderAllTaskId() != null) { queryWrapper.eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, distributionSplitTaskSearchDTO.getSplitOrderAllTaskId()); @@ -91,24 +93,28 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl page = Condition.getPage(query); IPage pageRes = Condition.getPage(query); List list = list(page, queryWrapper); + List listVo = new ArrayList<>(); + if (list != null && !list.isEmpty()) { + Map userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList())); + + listVo = list.stream().map(item -> { + DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO(); + BeanUtil.copyProperties(item, distributionSplitOrderTaskVO); + distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser())); + return distributionSplitOrderTaskVO; + }).collect(Collectors.toList()); + } - Map userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList())); - - pageRes.setRecords(list.stream().map(item -> { - DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO(); - BeanUtil.copyProperties(item, distributionSplitOrderTaskVO); - distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser())); - return distributionSplitOrderTaskVO; - }).collect(Collectors.toList())); + pageRes.setRecords(listVo); pageRes.setPages(page.getPages()); pageRes.setTotal(page.getTotal()); - return R.data(page); + return R.data(pageRes); } private Map getUserIdNameMap(List list) { String createUserIds = list.stream().map((d) -> d + "").collect(Collectors.joining(",")); - List users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), String.join(",", createUserIds)).getData(); + List users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), createUserIds).getData(); return users.stream().collect(Collectors.toMap(User::getId, User::getName)); } @@ -716,7 +722,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl cancelTask(Long taskId) { DistributionSplitOrderTaskEntity task = getById(taskId); - if (!task.getState().equals(OrderSplitStateConstant.InProgress.getValue())) { + if (!task.getState().equals(OrderSplitStateConstant.finish.getValue())) { return R.fail("任务未已完成,无法操作"); } DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(task.getSplitOrderAllTaskId()); @@ -903,16 +909,18 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl list = distributionSplitOrderAllTaskService.list(page, queryWrapper); - - Map userMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderAllTaskEntity::getCreateUser).collect(Collectors.toList())); - Map allTaskIdPackageNumber = getAllTaskIdPackageNumber(list.stream().map(DistributionSplitOrderAllTaskEntity::getId).collect(Collectors.toList())); - List listVo = list.stream().map(d -> { - DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO(); - BeanUtil.copyProperties(d, vo); - vo.setCreateUserName(userMap.get(d.getCreateUser())); - vo.setSplitPackageNumber(allTaskIdPackageNumber.get(d.getId())); - return vo; - }).collect(Collectors.toList()); + List listVo = new ArrayList<>(); + if (list != null && !list.isEmpty()) { + Map userMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderAllTaskEntity::getCreateUser).collect(Collectors.toList())); + Map allTaskIdPackageNumber = getAllTaskIdPackageNumber(list.stream().map(DistributionSplitOrderAllTaskEntity::getId).collect(Collectors.toList())); + listVo = list.stream().map(d -> { + DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO(); + BeanUtil.copyProperties(d, vo); + vo.setCreateUserName(userMap.get(d.getCreateUser())); + vo.setSplitPackageNumber(allTaskIdPackageNumber.get(d.getId())); + return vo; + }).collect(Collectors.toList()); + } pageResult.setRecords(listVo); pageResult.setPages(page.getPages()); @@ -949,6 +957,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl Date: Tue, 1 Apr 2025 16:05:30 +0800 Subject: [PATCH 11/12] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=8D=B8=E8=BD=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/DistributionStockArticleClient.java | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index b9cd8d4f0..ee527e818 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -81,30 +81,36 @@ public class DistributionStockArticleClient implements IDistributionStockArticle String key = orderCode + warehouseId; - Boolean exists = bladeRedis.exists(key); - if(exists){ - String idStr = bladeRedis.get(key); - if("1".equals(idStr)){ - return 1L; - }else{ - return Long.valueOf(idStr); - } - }else{ - bladeRedis.setEx(key,"1",30L); - DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); - if(ObjectUtils.isNotEmpty(distributionStockArticle)){ - bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); - return distributionStockArticle.getId(); + try{ + Boolean exists = bladeRedis.exists(key); + if(exists){ + String idStr = bladeRedis.get(key); + if("1".equals(idStr)){ + return 1L; + }else{ + return Long.valueOf(idStr); + } }else{ - boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); - if(saveFlag){ + bladeRedis.setEx(key,"1",30L); + DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); + if(ObjectUtils.isNotEmpty(distributionStockArticle)){ bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); - return distributionStockArticleEntity.getId(); + return distributionStockArticle.getId(); }else{ - return 0L; + boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); + if(saveFlag){ + bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); + return distributionStockArticleEntity.getId(); + }else{ + return 0L; + } } } + }catch (Exception e){ + log.error("#######addData: 保存订单失败",e); + return 0L; } + } @Override From 15e2635f64485428ca6738129617c9e265c94778 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 16:12:56 +0800 Subject: [PATCH 12/12] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=8D=B8=E8=BD=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distribution/feign/DistributionStockArticleClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index ee527e818..81607ec5f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -99,7 +99,7 @@ public class DistributionStockArticleClient implements IDistributionStockArticle }else{ boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); if(saveFlag){ - bladeRedis.setEx(key,distributionStockArticle.getId().toString(),30L); + bladeRedis.setEx(key,distributionStockArticleEntity.getId().toString(),30L); return distributionStockArticleEntity.getId(); }else{ return 0L;