diff --git a/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/entity/AftersalesAbnormalRecordZeroDetailEntity.java b/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/entity/AftersalesAbnormalRecordZeroDetailEntity.java index 4dcf02a88..8213d3465 100644 --- a/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/entity/AftersalesAbnormalRecordZeroDetailEntity.java +++ b/blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/entity/AftersalesAbnormalRecordZeroDetailEntity.java @@ -30,7 +30,7 @@ public class AftersalesAbnormalRecordZeroDetailEntity extends TenantEntity { private String reserve5 ; @ApiModelProperty(name = "异常记录id",notes = "") - private Long AbnormalRecordId; + private Long abnormalRecordId; @ApiModelProperty(name = "异常记录id",notes = "") private Long packageId; diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index d8fc7911e..0d31d17d9 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -21,6 +21,7 @@ import com.logpm.distribution.dto.FindParamterDTO; import com.logpm.distribution.dto.OrderPackageDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.ZeroPackageSupplyVO; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; import org.springblade.core.tool.api.R; @@ -223,4 +224,7 @@ public interface IDistributionParcelListClient { @GetMapping(API_PREFIX + "/addZeroQuantity") void addZeroQuantity(@RequestParam Long packageId, @RequestParam int num); + + @PostMapping(API_PREFIX + "/findListByStockArticleIds") + List findListByStockArticleIds(@RequestBody List orderIdList); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelNumberClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelNumberClient.java index 70b64c983..7c2c076e2 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelNumberClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelNumberClient.java @@ -60,4 +60,6 @@ public interface IDistributionParcelNumberClient { @PostMapping(API_PREFIX + "/updateList") void updateList(@RequestBody List updateParceNumberList); + @GetMapping(API_PREFIX+"/findListByStockArticleId") + List findListByStockArticleId(@RequestParam Long orderId); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/ZeroPackageSupplyVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/ZeroPackageSupplyVO.java new file mode 100644 index 000000000..e1a2c3ca8 --- /dev/null +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/ZeroPackageSupplyVO.java @@ -0,0 +1,16 @@ +package com.logpm.distribution.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ZeroPackageSupplyVO implements Serializable { + + private Long stockArticleId; + private Long packageId; + private Long goodsId; + private String goodsName;//品类名称 + private Integer stockNum;//品类在库件数 + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ZeroPackageDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ZeroPackageDTO.java index 4acac8b3e..d1c2916bd 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ZeroPackageDTO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ZeroPackageDTO.java @@ -7,6 +7,7 @@ import java.io.Serializable; @Data public class ZeroPackageDTO implements Serializable { + private Long id; private Long packageId; private Long goodsId; private String goodsName;//品类名称 diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineScanZeroDetailClient.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineScanZeroDetailClient.java new file mode 100644 index 000000000..5e04afbc6 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineScanZeroDetailClient.java @@ -0,0 +1,26 @@ +package com.logpm.trunkline.feign; + +import com.logpm.trunkline.entity.TrunklineScanZeroDetailEntity; +import org.springblade.common.constant.ModuleNameConstant; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_TRUNKLINE_NAME +) +public interface ITrunklineScanZeroDetailClient { + + String API_PREFIX = "trunklineScanZeroDetail/client"; + + @GetMapping(API_PREFIX+"/findListByCarsLoadScanId") + List findListByCarsLoadScanId(@RequestParam Long carsLoadScanId); + + @PostMapping(API_PREFIX+"/updateBetch") + void updateBetch(@RequestBody List updateScanZeroDetailEntityList); + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignPackageVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignPackageVO.java index a75bf8f19..eb27db6f5 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignPackageVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignPackageVO.java @@ -3,6 +3,8 @@ package com.logpm.trunkline.vo; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; @Data public class SignPackageVO implements Serializable { @@ -12,5 +14,9 @@ public class SignPackageVO implements Serializable { private Integer num; private Integer unloadNum; private String scanStatus; + private String orderCode; + private String waybillNo; + + private List scanZeroDetailList = new ArrayList<>(); } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/UnloadPackageVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/UnloadPackageVO.java index 2805c25a6..52e15fb7c 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/UnloadPackageVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/UnloadPackageVO.java @@ -17,6 +17,8 @@ public class UnloadPackageVO implements Serializable { private String trayCode; private String scanStatus; private String unloadNodeName; + private String orderCode; + private String waybillNo; private List scanZeroDetailList = new ArrayList<>(); diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleListVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleListVO.java new file mode 100644 index 000000000..bce4c47fe --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleListVO.java @@ -0,0 +1,40 @@ +package com.logpm.trunkline.vo; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Data +public class ZeroSuppleListVO implements Serializable { + + + private Long orderId; + private String waybillNo; + private String orderCode; + private Integer stockNum;//在库数量 + private Date createTime;//开单时间 + private String destination;//到站 + private String destinationWarehouseName;//目的仓 + private String shipper;//发货单位 + private String shipperName;//发货人 + private String consignee;//收货单位 + private String consigneeName;//收货人 + private String goodsName;//货物名称 + private Integer totalNum;//运单总件数 + private BigDecimal weight;//运单总重量 + private BigDecimal volume;//运单总体积 + private String customerTrain;//客户车次号 + private String remark;//备注 + private String loadSignCode;//签收单号 + private Long signOrderId;//签收单id + private BigDecimal totalFreight;//总运费 + private BigDecimal price;//总运费 + + private List zeroPackageSupplyVOS = new ArrayList<>(); + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleVO.java index 5302f0a09..03538c686 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleVO.java @@ -1,8 +1,11 @@ package com.logpm.trunkline.vo; +import com.logpm.trunkline.dto.ZeroPackageDTO; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; @Data public class ZeroSuppleVO implements Serializable { @@ -14,5 +17,6 @@ public class ZeroSuppleVO implements Serializable { private Long finalNodeId;//目的仓id private Long signOrderId;//签收单id + private List zeroPackageList = new ArrayList<>(); } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesAbnormalRecordController.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesAbnormalRecordController.java index 93c42a23d..d8e729bee 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesAbnormalRecordController.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesAbnormalRecordController.java @@ -19,8 +19,6 @@ package com.logpm.aftersales.controller; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.aftersales.dto.AbnormalRecordDTO; import com.logpm.aftersales.service.IAftersalesAbnormalRecordService; -import com.logpm.basicdata.entity.BasicdataWarehouseEntity; -import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -84,9 +82,34 @@ public class AftersalesAbnormalRecordController extends BladeController { return R.fail(405,"异常id为空"); } + return aftersalesAbnormalRecordService.dealAbnormal(abnormalRecordDTO); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } - return aftersalesAbnormalRecordService.dealAbnormal(abnormalRecordDTO); + @ResponseBody + @PostMapping("/findZeroDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "处理异常", notes = "传入loadCarsDTO") + public R findZeroDetail(@RequestBody AbnormalRecordDTO abnormalRecordDTO) { + String method = "############findZeroDetail: "; + log.info(method + "请求参数{}", abnormalRecordDTO); + Long abnormalRecordId = abnormalRecordDTO.getAbnormalRecordId(); + + try{ + + if(Objects.isNull(abnormalRecordId)){ + log.warn(method+"异常id为空 abnormalRecordId={}",abnormalRecordId); + return R.fail(405,"异常id为空"); + } + + return aftersalesAbnormalRecordService.findZeroDetail(abnormalRecordDTO); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); @@ -95,4 +118,6 @@ public class AftersalesAbnormalRecordController extends BladeController { return R.fail(500,"系统异常"); } } + + } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AbnormalRecordDTO.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AbnormalRecordDTO.java index e16d56068..4e675f06d 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AbnormalRecordDTO.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AbnormalRecordDTO.java @@ -1,9 +1,12 @@ package com.logpm.aftersales.dto; import com.logpm.aftersales.entity.AftersalesAbnormalRecordEntity; +import com.logpm.trunkline.dto.ZeroPackageDTO; import lombok.Data; +import java.util.ArrayList; import java.util.Date; +import java.util.List; @Data public class AbnormalRecordDTO extends AftersalesAbnormalRecordEntity { @@ -27,4 +30,6 @@ public class AbnormalRecordDTO extends AftersalesAbnormalRecordEntity { private Date dealDateStart; private Date dealDateEnd; + private List zeroPackageDTOS = new ArrayList<>(); + } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java index b19900864..334532381 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java @@ -12,4 +12,6 @@ public interface IAftersalesAbnormalRecordService extends BaseService { + + List findListByAbnormalRecordId(Long abnormalRecordId); + } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java index 10b8e70ea..7665d89e4 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java @@ -1,24 +1,30 @@ package com.logpm.aftersales.service.impl; +import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.aftersales.dto.AbnormalRecordDTO; import com.logpm.aftersales.entity.AftersalesAbnormalRecordEntity; +import com.logpm.aftersales.entity.AftersalesAbnormalRecordZeroDetailEntity; import com.logpm.aftersales.mapper.AftersalesAbnormalRecordMapper; import com.logpm.aftersales.service.IAftersalesAbnormalRecordService; +import com.logpm.aftersales.service.IAftersalesAbnormalRecordZeroDetailService; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionParcelNumberEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.feign.IDistributionParcelListClient; +import com.logpm.distribution.feign.IDistributionParcelNumberClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; +import com.logpm.distribution.vo.DistributionParcelListVO; import com.logpm.trunkline.dto.AddWaybillTrackDTO; +import com.logpm.trunkline.dto.ZeroPackageDTO; import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; -import com.logpm.trunkline.feign.ITrunklineCarsLoadScanClient; -import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; -import com.logpm.trunkline.feign.ITrunklineWaybillPackageClient; -import com.logpm.trunkline.feign.ITrunklineWaybillTrackClient; +import com.logpm.trunkline.entity.TrunklineScanZeroDetailEntity; +import com.logpm.trunkline.feign.*; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; import lombok.AllArgsConstructor; @@ -30,10 +36,8 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; @Slf4j @@ -49,6 +53,8 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl page = new Page<>(); @@ -145,149 +155,225 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl zeroPackageDTOS = abnormalRecordDTO.getZeroPackageDTOS(); Integer num = abnormalRecordEntity.getNum(); - Long associationId = abnormalRecordEntity.getAssociationId(); - TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanClient.findEntityById(associationId); + Long carsLoadScanId = abnormalRecordEntity.getAssociationId(); + TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanClient.findEntityById(carsLoadScanId); Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); String orderCode = carsLoadScanEntity.getOrderCode(); + List recordZeroDetailEntities = recordZeroDetailService.findListByAbnormalRecordId(abnormalRecordId); + //把zeroPackageDTOS转化成以goodsId作为key的Map + Map recordZeroDetailEntitiesMapByGoodsId = recordZeroDetailEntities.stream().collect(Collectors.toMap(AftersalesAbnormalRecordZeroDetailEntity::getGoodsId, Function.identity())); + List scanZeroDetailEntityList = scanZeroDetailClient.findListByCarsLoadScanId(carsLoadScanId); + DistributionStockArticleEntity stockArticleEntity = stockArticleClient.findZeroByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); if(!Objects.isNull(stockArticleEntity)){ Long stockId = stockArticleEntity.getId(); if(dealType.equals(5)){ //回退原仓库 + recordZeroDetailEntities.forEach(detailEntity -> { + parcelListClient.addZeroQuantity(detailEntity.getPackageId(),detailEntity.getAbnormalNum()); + detailEntity.setReturnNum(detailEntity.getAbnormalNum()); + }); stockArticleClient.addHandQuantity(stockId,num); + recordZeroDetailService.updateBatchById(recordZeroDetailEntities); abnormalRecordEntity.setRemark("差异件数退回原仓"); }else if(dealType.equals(6)){ //入库本仓 Integer enterNum = abnormalRecordDTO.getNum(); + //把scanZeroDetailEntityList转化成以packageId为key的map + Map scanZeroDetailEntityMap = scanZeroDetailEntityList.stream().collect(Collectors.toMap(TrunklineScanZeroDetailEntity::getPackageId, Function.identity())); + if(enterNum > 0){ Date now = new Date(); int diff = num - enterNum; Long warehouseId = abnormalRecordEntity.getWarehouseId(); BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); + //把zeroPackageDTOS转化成以packageId作为key的Map + Map zeroPackageDTOSMapByPackageId = zeroPackageDTOS.stream().collect(Collectors.toMap(ZeroPackageDTO::getPackageId, Function.identity())); if(diff == 0){ - //全部入库到本仓 - DistributionStockArticleEntity currentStockArticleEntity = stockArticleClient.findZeroByOrderCodeAndWarehouseId(orderCode, warehouseId); - if(Objects.isNull(currentStockArticleEntity)){ - currentStockArticleEntity = new DistributionStockArticleEntity(); - Integer totalNumber = stockArticleEntity.getTotalNumber(); - BeanUtil.copy(stockArticleEntity,currentStockArticleEntity); - currentStockArticleEntity.setId(null); - currentStockArticleEntity.setHandQuantity(enterNum); - currentStockArticleEntity.setWarehouseId(warehouseId); - currentStockArticleEntity.setWarehouse(warehouseEntity.getName()); - currentStockArticleEntity.setWarehouseEntryTime(now); - currentStockArticleEntity.setCompleteSet(1); - currentStockArticleEntity.setOrderReceiveStatus("20"); - if(totalNumber.equals(enterNum)){ - currentStockArticleEntity.setCompleteSet(2); - currentStockArticleEntity.setOrderReceiveStatus("30"); - } - currentStockArticleEntity.setStockupStatus("10"); - currentStockArticleEntity.setReservationStatus("10"); - currentStockArticleEntity.setOrderStatus("20"); - currentStockArticleEntity.setGroundingStatus("10"); - currentStockArticleEntity.setFreezeStatus("10"); - currentStockArticleEntity.setWarehouseEntryTimeEnd(now); - currentStockArticleEntity.setSortingQuantity(0); - currentStockArticleEntity.setDeliveryQuantity(0); - currentStockArticleEntity.setTransferQuantity(0); - currentStockArticleEntity.setSigninQuantity(0); - currentStockArticleEntity.setAllocation(null); - currentStockArticleEntity.setTrays(null); - currentStockArticleEntity.setIncomingNum(enterNum); - Long orderId = stockArticleClient.addData(currentStockArticleEntity); - if(!Objects.isNull(orderId)){ - List addParcelListEntityList = new ArrayList<>(); - List parcelListEntityList = parcelListClient.findEntityListByOrderCode(orderCode, warehouseId); - parcelListEntityList.forEach(parcelListEntity -> { - DistributionParcelListEntity currentParcelListEntity = new DistributionParcelListEntity(); - BeanUtil.copy(parcelListEntity,currentParcelListEntity); - Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId(); - currentParcelListEntity.setId(null); - currentParcelListEntity.setGoodsAllocation(null); - currentParcelListEntity.setStockArticleId(orderId); - currentParcelListEntity.setPallet(null); - currentParcelListEntity.setWarehouseId(warehouseId); - currentParcelListEntity.setWarehouse(warehouseEntity.getName()); - currentParcelListEntity.setIsTransfer(1); - if(acceptWarehouseId.equals(warehouseId)){ - currentParcelListEntity.setIsTransfer(0); - } - addParcelListEntityList.add(currentParcelListEntity); - }); - parcelListClient.addZeroParcelList(addParcelListEntityList); - } - }else{ - - stockArticleClient.addHandQuantityAndIncomingNum(currentStockArticleEntity.getId(),enterNum); - - } abnormalRecordEntity.setRemark("差异"+enterNum+"件数入库本仓"); - }else{ //回退原仓库 + recordZeroDetailEntities.forEach(detailEntity -> { + Long packageId = detailEntity.getPackageId(); + Integer abnormalNum = detailEntity.getAbnormalNum(); + ZeroPackageDTO zeroPackageDTO = zeroPackageDTOSMapByPackageId.get(packageId); + Integer enterPackageNum = zeroPackageDTO.getEnterNum(); + parcelListClient.addZeroQuantity(packageId,abnormalNum - enterPackageNum); + detailEntity.setReturnNum(abnormalNum - enterPackageNum); + }); + stockArticleClient.addHandQuantity(stockId,diff); + recordZeroDetailService.updateBatchById(recordZeroDetailEntities); + abnormalRecordEntity.setRemark("差异"+enterNum+"件数入库本仓,原仓返回"+diff+"件"); + } - //全部入库到本仓 - DistributionStockArticleEntity currentStockArticleEntity = stockArticleClient.findZeroByOrderCodeAndWarehouseId(orderCode, warehouseId); - if(Objects.isNull(currentStockArticleEntity)){ - currentStockArticleEntity = new DistributionStockArticleEntity(); - Integer totalNumber = stockArticleEntity.getTotalNumber(); - BeanUtil.copy(stockArticleEntity,currentStockArticleEntity); - currentStockArticleEntity.setId(null); - currentStockArticleEntity.setHandQuantity(enterNum); - currentStockArticleEntity.setWarehouseId(warehouseId); - currentStockArticleEntity.setWarehouse(warehouseEntity.getName()); - currentStockArticleEntity.setWarehouseEntryTime(now); - currentStockArticleEntity.setCompleteSet(1); - currentStockArticleEntity.setOrderReceiveStatus("20"); - if(totalNumber.equals(enterNum)){ - currentStockArticleEntity.setCompleteSet(2); - currentStockArticleEntity.setOrderReceiveStatus("30"); + DistributionStockArticleEntity currentStockArticleEntity = stockArticleClient.findZeroByOrderCodeAndWarehouseId(orderCode, warehouseId); + if(Objects.isNull(currentStockArticleEntity)){ + currentStockArticleEntity = new DistributionStockArticleEntity(); + Integer totalNumber = stockArticleEntity.getTotalNumber(); + BeanUtil.copy(stockArticleEntity,currentStockArticleEntity); + currentStockArticleEntity.setId(null); + currentStockArticleEntity.setHandQuantity(enterNum); + currentStockArticleEntity.setWarehouseId(warehouseId); + currentStockArticleEntity.setWarehouse(warehouseEntity.getName()); + currentStockArticleEntity.setWarehouseEntryTime(now); + currentStockArticleEntity.setCompleteSet(1); + currentStockArticleEntity.setOrderReceiveStatus("20"); + if(totalNumber.equals(enterNum)){ + currentStockArticleEntity.setCompleteSet(2); + currentStockArticleEntity.setOrderReceiveStatus("30"); + } + currentStockArticleEntity.setStockupStatus("10"); + currentStockArticleEntity.setReservationStatus("10"); + currentStockArticleEntity.setOrderStatus("20"); + currentStockArticleEntity.setGroundingStatus("10"); + currentStockArticleEntity.setFreezeStatus("10"); + currentStockArticleEntity.setWarehouseEntryTimeEnd(now); + currentStockArticleEntity.setSortingQuantity(0); + currentStockArticleEntity.setDeliveryQuantity(0); + currentStockArticleEntity.setTransferQuantity(0); + currentStockArticleEntity.setSigninQuantity(0); + currentStockArticleEntity.setAllocation(null); + currentStockArticleEntity.setTrays(null); + currentStockArticleEntity.setIncomingNum(enterNum); + Long orderId = stockArticleClient.addData(currentStockArticleEntity); + if(!Objects.isNull(orderId)){ + List updateScanZeroDetailEntityList = new ArrayList<>(); + List addParcelNumberEntityList = new ArrayList<>(); + List updateRecordZeroDetailList = new ArrayList<>(); + List parcelListEntityList = parcelListClient.findEntityVOListByOrderCode(orderCode, fromWarehouseId); + parcelListEntityList.forEach(parcelListEntity -> { + Long packageId = parcelListEntity.getId(); + Integer zeroPackageTotalNum = parcelListEntity.getZeroPackageTotalNum(); + ZeroPackageDTO zeroPackageDTO = zeroPackageDTOSMapByPackageId.get(packageId); + Long goodsId = zeroPackageDTO.getGoodsId(); + Integer packageEnterNum = zeroPackageDTO.getEnterNum(); + //保存包件信息 + DistributionParcelListEntity currentParcelListEntity = new DistributionParcelListEntity(); + BeanUtil.copy(parcelListEntity,currentParcelListEntity); + Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId(); + currentParcelListEntity.setId(null); + currentParcelListEntity.setQuantity(packageEnterNum); + currentParcelListEntity.setGoodsAllocation(null); + currentParcelListEntity.setStockArticleId(orderId); + currentParcelListEntity.setPallet(null); + currentParcelListEntity.setWarehouseId(warehouseId); + currentParcelListEntity.setWarehouse(warehouseEntity.getName()); + currentParcelListEntity.setIsTransfer(1); + if(acceptWarehouseId.equals(warehouseId)){ + currentParcelListEntity.setIsTransfer(0); + } + Long parceListId = parcelListClient.addReturnId(currentParcelListEntity); + if(!Objects.isNull(parceListId)){ + //保存零担包件数量信息 + DistributionParcelNumberEntity currentParcelNumberEntity = new DistributionParcelNumberEntity(); + currentParcelNumberEntity.setStockArticleId(orderId); + currentParcelNumberEntity.setParcelListId(parceListId); + currentParcelNumberEntity.setQuantity(zeroPackageTotalNum); + currentParcelNumberEntity.setHandQuantity(packageEnterNum); + currentParcelNumberEntity.setOutboundQuantity(0); + currentParcelNumberEntity.setDeliveryQuantity(0); + currentParcelNumberEntity.setSigninQuantity(0); + addParcelNumberEntityList.add(currentParcelNumberEntity); + } + + //更新异常列表零担品类数量信息 + AftersalesAbnormalRecordZeroDetailEntity aftersalesAbnormalRecordZeroDetailEntity = recordZeroDetailEntitiesMapByGoodsId.get(goodsId); + AftersalesAbnormalRecordZeroDetailEntity updateRecordZeroDetail = new AftersalesAbnormalRecordZeroDetailEntity(); + updateRecordZeroDetail.setId(aftersalesAbnormalRecordZeroDetailEntity.getId()); + updateRecordZeroDetail.setIncomingNum(packageEnterNum); + updateRecordZeroDetailList.add(updateRecordZeroDetail); + + //更新装车明细零担信息 + TrunklineScanZeroDetailEntity scanZeroDetailEntity = scanZeroDetailEntityMap.get(packageId); + TrunklineScanZeroDetailEntity updateScanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); + updateScanZeroDetailEntity.setId(scanZeroDetailEntity.getId()); + updateScanZeroDetailEntity.setUnloadNum(scanZeroDetailEntity.getUnloadNum()+packageEnterNum); + updateScanZeroDetailEntityList.add(updateScanZeroDetailEntity); + }); + if(CollUtil.isNotEmpty(updateRecordZeroDetailList)){ + recordZeroDetailService.updateBatchById(updateRecordZeroDetailList); } - currentStockArticleEntity.setStockupStatus("10"); - currentStockArticleEntity.setReservationStatus("10"); - currentStockArticleEntity.setOrderStatus("20"); - currentStockArticleEntity.setGroundingStatus("10"); - currentStockArticleEntity.setFreezeStatus("10"); - currentStockArticleEntity.setWarehouseEntryTimeEnd(now); - currentStockArticleEntity.setSortingQuantity(0); - currentStockArticleEntity.setDeliveryQuantity(0); - currentStockArticleEntity.setTransferQuantity(0); - currentStockArticleEntity.setSigninQuantity(0); - currentStockArticleEntity.setAllocation(null); - currentStockArticleEntity.setTrays(null); - currentStockArticleEntity.setIncomingNum(enterNum); - Long orderId = stockArticleClient.addData(currentStockArticleEntity); - if(!Objects.isNull(orderId)){ - List addParcelListEntityList = new ArrayList<>(); - List parcelListEntityList = parcelListClient.findEntityListByOrderCode(orderCode, warehouseId); - parcelListEntityList.forEach(parcelListEntity -> { - DistributionParcelListEntity currentParcelListEntity = new DistributionParcelListEntity(); - BeanUtil.copy(parcelListEntity,currentParcelListEntity); - Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId(); - currentParcelListEntity.setId(null); - currentParcelListEntity.setGoodsAllocation(null); - currentParcelListEntity.setStockArticleId(orderId); - currentParcelListEntity.setPallet(null); - currentParcelListEntity.setWarehouseId(warehouseId); - currentParcelListEntity.setWarehouse(warehouseEntity.getName()); - currentParcelListEntity.setIsTransfer(1); - if(acceptWarehouseId.equals(warehouseId)){ - currentParcelListEntity.setIsTransfer(0); - } - addParcelListEntityList.add(currentParcelListEntity); - }); - parcelListClient.addZeroParcelList(addParcelListEntityList); + if(CollUtil.isNotEmpty(updateScanZeroDetailEntityList)){ + scanZeroDetailClient.updateBetch(updateScanZeroDetailEntityList); } - }else{ + if(CollUtil.isNotEmpty(addParcelNumberEntityList)){ + parcelNumberClient.addBatch(addParcelNumberEntityList); + } + } + }else{ + Long orderId = currentStockArticleEntity.getId(); + + List parcelListEntityList = parcelListClient.findListByStockArticleId(orderId); + //把parcelListEntityList转化成以firsts为key的map + Map parcelListEntityMapByFirsts = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getFirsts, Function.identity())); + + List parcelNumberEntityList =parcelNumberClient.findListByStockArticleId(orderId); + //把parcelNumberEntityList转化成以parceListId为key的Map + Map parcelNumberEntityMapByParcelListId = parcelNumberEntityList.stream().collect(Collectors.toMap(DistributionParcelNumberEntity::getParcelListId, Function.identity())); + + //把scanZeroDetailEntityList转化成以goodsId为key的Map + Map scanZeroDetailEntityMapByGoodsId = scanZeroDetailEntityList.stream().collect(Collectors.toMap(TrunklineScanZeroDetailEntity::getGoodsId, Function.identity())); + + List updateScanZeroDetailEntityList = new ArrayList<>(); + List updateAbnormalRecordZeroDetailEntityList = new ArrayList<>(); + List updateParcelListEntityList = new ArrayList<>(); + List updateParcelNumberEntityList = new ArrayList<>(); + + zeroPackageDTOS.forEach(zeroPackageDTO -> { + Integer packageNum = zeroPackageDTO.getEnterNum(); + String goodsName = zeroPackageDTO.getGoodsName(); + Long goodsId = zeroPackageDTO.getGoodsId(); + //更新装车明细零担信息 + TrunklineScanZeroDetailEntity scanZeroDetailEntity = scanZeroDetailEntityMapByGoodsId.get(goodsId); + TrunklineScanZeroDetailEntity updateScanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); + updateScanZeroDetailEntity.setId(scanZeroDetailEntity.getId()); + updateScanZeroDetailEntity.setUnloadNum(scanZeroDetailEntity.getUnloadNum()+packageNum); + updateScanZeroDetailEntityList.add(updateScanZeroDetailEntity); + + //更新异常列表零担品类数量 + AftersalesAbnormalRecordZeroDetailEntity aftersalesAbnormalRecordZeroDetailEntity = recordZeroDetailEntitiesMapByGoodsId.get(goodsId); + AftersalesAbnormalRecordZeroDetailEntity updateRecordZeroDetail = new AftersalesAbnormalRecordZeroDetailEntity(); + updateRecordZeroDetail.setId(aftersalesAbnormalRecordZeroDetailEntity.getId()); + updateRecordZeroDetail.setIncomingNum(aftersalesAbnormalRecordZeroDetailEntity.getIncomingNum()+packageNum); + updateAbnormalRecordZeroDetailEntityList.add(updateRecordZeroDetail); + + //更新;零担包件信息 + DistributionParcelListEntity parcelList = parcelListEntityMapByFirsts.get(goodsName); + Long parcelListId = parcelList.getId(); + DistributionParcelListEntity updateParceListEntity = new DistributionParcelListEntity(); + updateParceListEntity.setId(parcelListId); + updateParceListEntity.setQuantity(parcelList.getQuantity()+packageNum); + updateParcelListEntityList.add(updateParceListEntity); + + //更新零担品类数量信息 + DistributionParcelNumberEntity parcelNumberEntity = parcelNumberEntityMapByParcelListId.get(parcelListId); + DistributionParcelNumberEntity updateParceNumberEntity = new DistributionParcelNumberEntity(); + updateParceNumberEntity.setId(parcelNumberEntity.getId()); + updateParceNumberEntity.setHandQuantity(parcelNumberEntity.getHandQuantity()+packageNum); + updateParcelNumberEntityList.add(updateParceNumberEntity); + }); + + if(CollUtil.isNotEmpty(updateScanZeroDetailEntityList)){ + scanZeroDetailClient.updateBetch(updateScanZeroDetailEntityList); + } + if(CollUtil.isNotEmpty(updateAbnormalRecordZeroDetailEntityList)){ + recordZeroDetailService.updateBatchById(updateAbnormalRecordZeroDetailEntityList); + } + if(CollUtil.isNotEmpty(updateParcelListEntityList)){ + parcelListClient.updateList(updateParcelListEntityList); + } + if(CollUtil.isNotEmpty(updateParcelNumberEntityList)){ + parcelNumberClient.updateList(updateParcelNumberEntityList); + } - stockArticleClient.addHandQuantityAndIncomingNum(currentStockArticleEntity.getId(),enterNum); + stockArticleClient.addHandQuantityAndIncomingNum(currentStockArticleEntity.getId(),enterNum); - } - abnormalRecordEntity.setRemark("差异"+enterNum+"件数入库本仓,原仓返回"+diff+"件"); } + + carsLoadScanEntity.setScanStatus("2"); carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getUnloadNum()+enterNum); trunklineCarsLoadScanClient.updateEntity(carsLoadScanEntity); @@ -353,4 +439,13 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("abnormal_record_id",abnormalRecordId); + List list = recordZeroDetailService.list(queryWrapper); + return R.data(list); + } } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordZeroDetailServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordZeroDetailServiceImpl.java index e78854b95..d603b5419 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordZeroDetailServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordZeroDetailServiceImpl.java @@ -1,16 +1,25 @@ package com.logpm.aftersales.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.aftersales.entity.AftersalesAbnormalRecordZeroDetailEntity; import com.logpm.aftersales.mapper.AftersalesAbnormalRecordZeroDetailMapper; import com.logpm.aftersales.service.IAftersalesAbnormalRecordZeroDetailService; import lombok.AllArgsConstructor; -import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + @Service @AllArgsConstructor @Slf4j public class AftersalesAbnormalRecordZeroDetailServiceImpl extends BaseServiceImpl implements IAftersalesAbnormalRecordZeroDetailService { + @Override + public List findListByAbnormalRecordId(Long abnormalRecordId) { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("abnormal_record_id",abnormalRecordId); + return baseMapper.selectList(queryWrapper); + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 27bc19be8..5cc5c5a15 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -34,6 +34,7 @@ import com.logpm.distribution.service.IDistributionParcelListService; import com.logpm.distribution.service.IDistributionParcelNumberService; import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.ZeroPackageSupplyVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.BladePage; @@ -529,4 +530,9 @@ public class DistributionParcelListClient implements IDistributionParcelListClie //对应的parceNumber也要加上在库数量 distributionParcelNumberService.addZeroQuantity(packageId,num); } + + @Override + public List findListByStockArticleIds(List orderIdList) { + return distributionParcelListService.findListByStockArticleIds(orderIdList); + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelNumberClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelNumberClient.java index d46248cc3..f58e8e9ba 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelNumberClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelNumberClient.java @@ -70,4 +70,11 @@ public class DistributionParcelNumberClient implements IDistributionParcelNumber distributionParcelNumberService.updateBatchById(updateParceNumberList); } + @Override + public List findListByStockArticleId(Long orderId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("stock_article_id", orderId); + return distributionParcelNumberService.list(queryWrapper); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java index bd019cb23..856639143 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java @@ -303,4 +303,7 @@ public interface DistributionParcelListMapper extends BaseMapper findEntityVOListByOrderCode(@Param("orderCode") String orderCode,@Param("fromWarehouseId") Long fromWarehouseId); void addZeroPackageQuantity(@Param("packageId") Long packageId, @Param("num") int num); + + List findListByStockArticleIds(@Param("orderIdList") List orderIdList); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml index b9c4ea74c..8afeef52c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml @@ -1888,7 +1888,7 @@ select ldpl.*, lwwd.num zeroPackageTotalNum from logpm_distribution_parcel_list ldpl - left join logpm_warehouse_waybill_detail lwwd on lwwd.id = ldpl.advanceId + left join logpm_warehouse_waybill_detail lwwd on lwwd.id = ldpl.advance_id where ldpl.order_code = #{orderCode} and ldpl.warehouse_id = #{fromWarehouseId} @@ -1900,4 +1900,19 @@ where id = #{packageId} + + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index b2c9a4afb..e9a2e4a25 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -21,10 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.distribution.dto.app.StockupDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.excel.DistributionParcelListExcel; -import com.logpm.distribution.vo.DistributionParcelListBaseVO; -import com.logpm.distribution.vo.DistributionParcelListVO; -import com.logpm.distribution.vo.DistributionParcelListZeroVO; -import com.logpm.distribution.vo.PackageStockupVO; +import com.logpm.distribution.vo.*; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; @@ -261,4 +258,6 @@ public interface IDistributionParcelListService extends BaseService findEntityVOListByOrderCode(String orderCode, Long fromWarehouseId); void addZeroPackageQuantity(Long packageId, int num); + + List findListByStockArticleIds(List orderIdList); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index 6e029ddef..053ef44a7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -1364,6 +1364,11 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl findListByStockArticleIds(List orderIdList) { + return baseMapper.findListByStockArticleIds(orderIdList); + } + private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node) { JSONObject trunklinePackageTrackLog = new JSONObject(); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/CarsLoadApiController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/CarsLoadApiController.java index d0eac3c71..8843461e0 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/CarsLoadApiController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/CarsLoadApiController.java @@ -931,6 +931,8 @@ public class CarsLoadApiController { Long signOrderId = loadCarsDTO.getSignOrderId(); Long carsLoadScanId = loadCarsDTO.getCarsLoadScanId(); Integer enterNum = loadCarsDTO.getEnterNum(); + List zeroPackageList = loadCarsDTO.getZeroPackageList(); + try{ @@ -951,7 +953,12 @@ public class CarsLoadApiController { return R.fail(405,"签收零担id为空"); } - return carsLoadService.signZeroOrder(signOrderId,carsLoadScanId,enterNum,"PDA录入签收"); + if(CollUtil.isEmpty(zeroPackageList)){ + log.warn(method+"品类信息为空 zeroPackageList={}",zeroPackageList); + return R.fail(405,"品类信息为空"); + } + + return carsLoadService.signZeroOrder(signOrderId,carsLoadScanId,enterNum,"PDA录入签收",zeroPackageList); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/TripartiteTransferApiController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/TripartiteTransferApiController.java index 5195eb533..9e9e6b808 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/TripartiteTransferApiController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/TripartiteTransferApiController.java @@ -1,11 +1,13 @@ package com.logpm.trunkline.api; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.trunkline.dto.BatchUnloadDTO; import com.logpm.trunkline.dto.LoadCarsDTO; +import com.logpm.trunkline.dto.ZeroPackageDTO; import com.logpm.trunkline.service.ITrunklineCarsLoadService; import com.logpm.trunkline.vo.TripartiteTransferVO; import io.swagger.annotations.Api; @@ -17,6 +19,7 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Objects; @Slf4j @@ -135,6 +138,7 @@ public class TripartiteTransferApiController { String trayCode = loadCarsDTO.getTrayCode(); String orderCode = loadCarsDTO.getOrderCode(); Long carsLoadScanId = loadCarsDTO.getCarsLoadScanId(); + List zeroPackageList = loadCarsDTO.getZeroPackageList(); try{ @@ -157,8 +161,12 @@ public class TripartiteTransferApiController { log.warn(method+"订单号为空 orderCode={}",orderCode); return R.fail(405,"订单号为空"); } + if(CollUtil.isEmpty(zeroPackageList)){ + log.warn(method+"品类信息为空 zeroPackageList={}",zeroPackageList); + return R.fail(405,"品类信息为空"); + } - return carsLoadService.transferUnloadZero(carsLoadScanId,loadId,waybillNo,enterNum,myCurrentWarehouse.getId(),1,trayCode,orderCode,"零担正常卸车"); + return carsLoadService.transferUnloadZero(carsLoadScanId,loadId,waybillNo,enterNum,myCurrentWarehouse.getId(),1,trayCode,orderCode,"零担正常卸车",zeroPackageList); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); 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 aa6ab07af..57158a086 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 @@ -1,5 +1,6 @@ package com.logpm.trunkline.controller; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; @@ -1407,6 +1408,7 @@ public class CarsLoadController { String orderCode = zeroSuppleVO.getOrderCode(); Integer enterNum = zeroSuppleVO.getEnterNum(); Long finalNodeId = zeroSuppleVO.getFinalNodeId(); + List zeroPackageList = zeroSuppleVO.getZeroPackageList(); if(StringUtil.isBlank(waybillNo)){ log.warn(method+"运单号为空 waybillNo={}",waybillNo); @@ -1427,6 +1429,12 @@ public class CarsLoadController { log.warn(method+"目的仓id为空 finalNodeId={}",finalNodeId); return R.fail(405,"目的仓id为空"); } + + if(CollUtil.isNotEmpty(zeroPackageList)){ + log.warn(method+"品类信息为空 zeroPackageList={}",zeroPackageList); + return R.fail(405,"品类信息为空"); + } + } return carsLoadService.addZeroSupple(loadCarsDTO); @@ -1976,6 +1984,7 @@ public class CarsLoadController { Long signOrderId = loadCarsDTO.getSignOrderId(); Long carsLoadScanId = loadCarsDTO.getCarsLoadScanId(); Integer enterNum = loadCarsDTO.getEnterNum(); + List zeroPackageList = loadCarsDTO.getZeroPackageList(); try{ @@ -1996,7 +2005,12 @@ public class CarsLoadController { return R.fail(405,"签收零担id为空"); } - return carsLoadService.signZeroOrder(signOrderId,carsLoadScanId,enterNum,"PC录入签收"); + if(CollUtil.isEmpty(zeroPackageList)){ + log.warn(method+"品类信息为空 zeroPackageList={}",zeroPackageList); + return R.fail(405,"品类信息为空"); + } + + return carsLoadService.signZeroOrder(signOrderId,carsLoadScanId,enterNum,"PC录入签收",zeroPackageList); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineScanZeroDetailClient.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineScanZeroDetailClient.java new file mode 100644 index 000000000..d1c4da8f8 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineScanZeroDetailClient.java @@ -0,0 +1,32 @@ +package com.logpm.trunkline.feign; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.trunkline.entity.TrunklineScanZeroDetailEntity; +import com.logpm.trunkline.service.ITrunklineScanZeroDetailService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; + +@Slf4j +@ApiIgnore() +@RestController +@AllArgsConstructor +public class TrunklineScanZeroDetailClient implements ITrunklineScanZeroDetailClient{ + + private final ITrunklineScanZeroDetailService trunklineScanZeroDetailService; + + @Override + public List findListByCarsLoadScanId(Long carsLoadScanId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("scan_id",carsLoadScanId); + return trunklineScanZeroDetailService.list(queryWrapper); + } + + @Override + public void updateBetch(List updateScanZeroDetailEntityList) { + trunklineScanZeroDetailService.updateBatchById(updateScanZeroDetailEntityList); + } +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.java index 92a13f4bb..0348ad393 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.java @@ -9,6 +9,7 @@ import com.logpm.trunkline.entity.TrunklineCarsLoadEntity; import com.logpm.trunkline.vo.CarsLoadAllOrderVO; import com.logpm.trunkline.vo.TripartiteTransferVO; import com.logpm.trunkline.vo.TrunklineCarsLoadVO; +import com.logpm.trunkline.vo.ZeroSuppleListVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -38,8 +39,8 @@ public interface TrunklineCarsLoadMapper extends BaseMapper findUseOrderListNoPage(@Param("param") LoadCarsDTO loadCarsDTO); - IPage findZeroListByWarehouseId(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); - IPage findSignOrderZeroListByWarehouseId(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); + IPage findZeroListByWarehouseId(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); + IPage findSignOrderZeroListByWarehouseId(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); IPage useZeroList(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml index c2accde79..d8dbcb732 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml @@ -552,10 +552,10 @@ - + select ldsa.id orderId, + ldsa.waybill_number waybillNo, ldsa.order_code orderCode, - ldsa.hand_quantity handQuantity, lww.create_time createTime, lww.destination destination, lww.destination_warehouse_name destinationWarehouseName, @@ -570,7 +570,6 @@ ldsa.hand_quantity stockNum, lww.customer_train customerTrain, IFNULL(lww.total_freight,0) totalFreight, - lww.total_count, lww.remark remark, ROUND(lww.total_freight/lww.total_count,2) price, ltlso.load_sign_code loadSignCode, @@ -694,10 +693,10 @@ - + select ldsa.id orderId, + ldsa.waybill_number waybillNo, ldsa.order_code orderCode, - ldsa.hand_quantity handQuantity, lww.create_time createTime, lww.destination destination, lww.destination_warehouse_name destinationWarehouseName, @@ -712,7 +711,6 @@ ldsa.hand_quantity stockNum, lww.customer_train customerTrain, IFNULL(lww.total_freight,0) totalFreight, - lww.total_count, lww.remark remark, ROUND(lww.total_freight/lww.total_count,2) price, ltlso.load_sign_code loadSignCode, 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 7557ffb12..163aa887b 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 @@ -175,4 +175,10 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper findAllIdListByLoadIdAndNoScanStatus(@Param("loadId") Long loadId, @Param("scanStatus") String scanStatus); List findTransferLoadScanWaybillList(@Param("loadId") Long loadId, @Param("nodeId") Long nodeId); + + List findUnloadPackageListByLoadIdAndFinalNodeId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); + + List findUnloadZeroListByLoadIdAndFinalNodeId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); + + List findSignPackageListBySignOrderId(@Param("signOrderId") Long signOrderId); } 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 0455bf279..126d13cc3 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 @@ -932,4 +932,48 @@ and scan_status != #{scanStatus} + + + + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java index 752d79d9a..7e5ebe138 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java @@ -66,4 +66,8 @@ public interface TrunklineCarsOrderMapper extends BaseMapper findMallOrderList(@Param("carsOrderIdList") List carsOrderIdList); void deleteNoRealNumByLoadIdAndWarehouseId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId); + + List findSignOrderListBySignOrderId(@Param("signOrderId") Long signOrderId); + + List findSignZeroOrderListBySignOrderId(@Param("signOrderId") Long signOrderId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml index d6f4ccaff..f2956c837 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml @@ -356,4 +356,26 @@ and real_num = 0 + + + + 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 8f158ce25..db41b721a 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 @@ -171,4 +171,10 @@ public interface ITrunklineCarsLoadScanService extends BaseService findAllIdListByLoadIdAndNoScanStatus(Long loadId, String scanStatus); List findTransferLoadScanWaybillList(Long loadId, Long nodeId); + + List findUnloadPackageListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId); + + List findUnloadZeroListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId); + + List findSignPackageListBySignOrderId(Long signOrderId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java index 9cf630809..39e196a4d 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java @@ -139,7 +139,7 @@ public interface ITrunklineCarsLoadService extends BaseService zeroPackageList); R transferUnloadTray(Long loadId, String trayCode, Long warehouseId); @@ -159,7 +159,7 @@ public interface ITrunklineCarsLoadService extends BaseService zeroPackageList); R findSignOrderList(LoadCarsDTO loadCarsDTO); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java index 6927abe7e..790f5ff54 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java @@ -64,4 +64,7 @@ public interface ITrunklineCarsOrderService extends BaseService findSignOrderListBySignOrderId(Long signOrderId); + + List findSignZeroOrderListBySignOrderId(Long signOrderId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java index ce14ec96c..f711e6a1a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java @@ -439,4 +439,19 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl findUnloadPackageListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId) { + return baseMapper.findUnloadPackageListByLoadIdAndFinalNodeId(loadId,warehouseId); + } + + @Override + public List findUnloadZeroListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId) { + return baseMapper.findUnloadZeroListByLoadIdAndFinalNodeId(loadId,warehouseId); + } + + @Override + public List findSignPackageListBySignOrderId(Long signOrderId) { + return baseMapper.findSignPackageListBySignOrderId(signOrderId); + } + } 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 6561afc0b..3fd097816 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 @@ -29,6 +29,7 @@ import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.distribution.feign.IDistributionParcelNumberClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.distribution.vo.DistributionParcelListVO; +import com.logpm.distribution.vo.ZeroPackageSupplyVO; import com.logpm.factorydata.enums.BrandEnums; import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.util.FactoryDataMessageSender; @@ -1313,8 +1314,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl entity, (entity1, entity2) -> entity1)); // 处理可能的键冲突 - - List updateParceList = new ArrayList<>(); List updateParceNumberList = new ArrayList<>(); @@ -1673,8 +1672,24 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl pageList = distributionStockArticleClient.findZeroListByWarehouseId(warehouseId,pageNum,pageSize); - IPage pageList = baseMapper.findSignOrderZeroListByWarehouseId(page, loadCarsDTO); + IPage pageList = baseMapper.findSignOrderZeroListByWarehouseId(page, loadCarsDTO); + List records = pageList.getRecords(); + //把records中所有元素的orderId放入一个集合 + List orderIdList = records.stream().map(ZeroSuppleListVO::getOrderId).collect(Collectors.toList()); + List packageList = distributionParcelListClient.findListByStockArticleIds(orderIdList); + //把packageList中所有元素通过stockArticleId进行分组 + Map> map = packageList.stream().collect(Collectors.groupingBy(ZeroPackageSupplyVO::getStockArticleId)); + records.forEach(zeroSuppleListVO -> { + Long orderId = zeroSuppleListVO.getOrderId(); + List jsonObjectList = new ArrayList<>(); + List zeroPackageSupplyVOS = map.get(orderId); + zeroPackageSupplyVOS.forEach(zeroPackageSupplyVO -> { + jsonObjectList.add(JSONObject.parseObject(JSONObject.toJSONString(zeroPackageSupplyVO))); + }); + zeroSuppleListVO.setZeroPackageSupplyVOS(jsonObjectList); + }); + + pageList.setRecords(records); return R.data(pageList); } @@ -3768,8 +3783,24 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl pageList = distributionStockArticleClient.findZeroListByWarehouseId(warehouseId,pageNum,pageSize); - IPage pageList = baseMapper.findZeroListByWarehouseId(page, loadCarsDTO); + IPage pageList = baseMapper.findZeroListByWarehouseId(page, loadCarsDTO); + List records = pageList.getRecords(); + //把records中所有元素的orderId放入一个集合 + List orderIdList = records.stream().map(ZeroSuppleListVO::getOrderId).collect(Collectors.toList()); + List packageList = distributionParcelListClient.findListByStockArticleIds(orderIdList); + //把packageList中所有元素通过stockArticleId进行分组 + Map> map = packageList.stream().collect(Collectors.groupingBy(ZeroPackageSupplyVO::getStockArticleId)); + records.forEach(zeroSuppleListVO -> { + Long orderId = zeroSuppleListVO.getOrderId(); + List jsonObjectList = new ArrayList<>(); + List zeroPackageSupplyVOS = map.get(orderId); + zeroPackageSupplyVOS.forEach(zeroPackageSupplyVO -> { + jsonObjectList.add(JSONObject.parseObject(JSONObject.toJSONString(zeroPackageSupplyVO))); + }); + zeroSuppleListVO.setZeroPackageSupplyVOS(jsonObjectList); + }); + + pageList.setRecords(records); return R.data(pageList); } @@ -3821,6 +3852,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroPackageList = zeroSuppleVO.getZeroPackageList(); WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); if (Objects.isNull(warehouseWaybillEntity)) { @@ -3864,6 +3896,23 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl scanZeroDetailEntityList = new ArrayList<>(); + + zeroPackageList.forEach(zeroPackageDTO -> { + Long packageId = zeroPackageDTO.getPackageId(); + Integer packageNum = zeroPackageDTO.getEnterNum(); + TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); + scanZeroDetailEntity.setScanId(scanLoadId); + scanZeroDetailEntity.setPackageId(zeroPackageDTO.getPackageId()); + scanZeroDetailEntity.setGoodsId(zeroPackageDTO.getGoodsId()); + scanZeroDetailEntity.setGoodsName(zeroPackageDTO.getGoodsName()); + scanZeroDetailEntity.setLoadingNum(packageNum); + scanZeroDetailEntity.setUnloadNum(0); + scanZeroDetailEntityList.add(scanZeroDetailEntity); + distributionParcelListClient.addZeroQuantity(packageId,-packageNum); + }); + scanZeroDetailService.saveBatch(scanZeroDetailEntityList); zeroStockArticleEntity.setHandQuantity(zeroStockArticleEntity.getHandQuantity() - enterNum); @@ -3876,14 +3925,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl 0 ){ -// signOrderEntity.setSignStatus("10"); -// } -// trunklineLoadSignOrderService.updateById(signOrderEntity); } } //更新数量 @@ -4130,6 +4171,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroPackageList) { log.info("#############transferUnloadZero: 三方中转卸车零担"); TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); @@ -4422,6 +4464,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl updateScanZeroDetailList = new ArrayList<>(); + zeroPackageList.forEach(zeroPackageDTO -> { + TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); + scanZeroDetailEntity.setId(zeroPackageDTO.getId()); + scanZeroDetailEntity.setUnloadNum(zeroPackageDTO.getEnterNum()); + updateScanZeroDetailList.add(scanZeroDetailEntity); + }); + scanZeroDetailService.updateBatchById(updateScanZeroDetailList); + trunklineCarsUnloadLogService.savaUnloadLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode, scanCode, enterNum, 2, 1, isAbnormal, trayId, trayCode, trayName, fromWarehouseId, loadScanId, remark); @@ -4466,7 +4517,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId); + List zeroPackageList = new ArrayList<>(); + zeroDetailVOList.forEach(zeroDetailVO -> { + ZeroPackageDTO zeroPackageDTO = new ZeroPackageDTO(); + zeroPackageDTO.setId(zeroDetailVO.getId()); + zeroPackageDTO.setPackageId(zeroDetailVO.getPackageId()); + zeroPackageDTO.setGoodsId(zeroDetailVO.getGoodsId()); + zeroPackageDTO.setGoodsName(zeroDetailVO.getGoodsName()); + zeroPackageDTO.setEnterNum(zeroDetailVO.getLoadingNum()); + zeroPackageList.add(zeroPackageDTO); + }); + transferUnloadZero(carsLoadScanId,loadId, waybillNo, num, warehouseId, 0, trayCode, orderCode, "三方中装托盘零担正常卸车",zeroPackageList); } } @@ -5031,7 +5093,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId); + List zeroPackageList = new ArrayList<>(); + zeroDetailVOList.forEach(zeroDetailVO -> { + ZeroPackageDTO zeroPackageDTO = new ZeroPackageDTO(); + zeroPackageDTO.setId(zeroDetailVO.getId()); + zeroPackageDTO.setPackageId(zeroDetailVO.getPackageId()); + zeroPackageDTO.setGoodsId(zeroDetailVO.getGoodsId()); + zeroPackageDTO.setGoodsName(zeroDetailVO.getGoodsName()); + zeroPackageDTO.setEnterNum(zeroDetailVO.getLoadingNum()); + zeroPackageList.add(zeroPackageDTO); + }); + transferUnloadZero(carsLoadScanId,loadId, waybillNo, enterNum, warehouseId, 1, trayCode, orderCode, "批量卸车零担正常卸车",zeroPackageList); } @@ -5339,20 +5412,52 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl signScanOrderList = trunklineCarsOrderService.findSignOrderList(loadId, fromWarehouseId,signOrderId); + List signScanOrderList = trunklineCarsOrderService.findSignOrderListBySignOrderId(signOrderId); + List signPackageList = trunklineCarsLoadScanService.findSignPackageListBySignOrderId(signOrderId); + for (SignScanOrderVO signScanOrderVO : signScanOrderList) { - String waybillNo = signScanOrderVO.getWaybillNo(); - String orderCode = signScanOrderVO.getOrderCode(); - List signPackageList = trunklineCarsLoadScanService.findSignPackageList(loadId, fromWarehouseId, orderCode, waybillNo); - signScanOrderVO.setSignPackageList(signPackageList); - } + String waybillNo = StringUtil.isBlank(signScanOrderVO.getWaybillNo())?"null":signScanOrderVO.getWaybillNo(); + String orderCode = StringUtil.isBlank(signScanOrderVO.getOrderCode())?"null":signScanOrderVO.getOrderCode(); + List ls = new ArrayList<>(); + signPackageList.forEach(e -> { + String waybillNo1 = StringUtil.isBlank(e.getWaybillNo())?"null":e.getWaybillNo(); + String orderCode1 = StringUtil.isBlank(e.getOrderCode())?"null":e.getOrderCode(); + if(waybillNo.equals(waybillNo1) && orderCode.equals(orderCode1)){ + ls.add(e); + } + }); + signScanOrderVO.setSignPackageList(ls); + } + + List signScanZeroOrderList = trunklineCarsOrderService.findSignZeroOrderListBySignOrderId(signOrderId); + List signZeroPackageList = trunklineCarsLoadScanService.findSignPackageListBySignOrderId(signOrderId); + // 创建一个包含所有carsLoadScanId的新列表 + List carsLoadScanIds = signZeroPackageList.stream() + .map(SignPackageVO::getCarsLoadScanId) + .collect(Collectors.toList()); + List scanZeroDetailList = scanZeroDetailService.findListByCarsLoadScanIds(carsLoadScanIds); + //把scanZeroDetailList中所有元素通过id进行分组 + Map> scanZeroDetailMap = scanZeroDetailList.stream() + .collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getScanId)); + + signZeroPackageList.forEach(signPackageVO -> { + Long carsLoadScanId = signPackageVO.getCarsLoadScanId(); + List list = scanZeroDetailMap.get(carsLoadScanId); + signPackageVO.setScanZeroDetailList(list); + }); - List signScanZeroOrderList = trunklineCarsOrderService.findSignZeroOrderList(loadId, fromWarehouseId,signOrderId); for (SignScanOrderVO signScanOrderVO : signScanZeroOrderList) { - String waybillNo = signScanOrderVO.getWaybillNo(); - String orderCode = signScanOrderVO.getOrderCode(); - List signPackageList = trunklineCarsLoadScanService.findSignPackageList(loadId, fromWarehouseId, orderCode, waybillNo); - signScanOrderVO.setSignPackageList(signPackageList); + String waybillNo = StringUtil.isBlank(signScanOrderVO.getWaybillNo())?"null":signScanOrderVO.getWaybillNo(); + String orderCode = StringUtil.isBlank(signScanOrderVO.getOrderCode())?"null":signScanOrderVO.getOrderCode(); + List ls = new ArrayList<>(); + signZeroPackageList.forEach(e -> { + String waybillNo1 = StringUtil.isBlank(e.getWaybillNo())?"null":e.getWaybillNo(); + String orderCode1 = StringUtil.isBlank(e.getOrderCode())?"null":e.getOrderCode(); + if(waybillNo.equals(waybillNo1) && orderCode.equals(orderCode1)){ + ls.add(e); + } + }); + signScanOrderVO.setSignPackageList(ls); } //查询异常列表 @@ -5706,7 +5811,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroPackageList) { Date date = new Date(); TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService.getById(signOrderId); if (Objects.isNull(signOrderEntity)) { @@ -5768,6 +5873,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl updateScanZeroDetailList = new ArrayList<>(); + zeroPackageList.forEach(zeroPackage -> { + TrunklineScanZeroDetailEntity updateEntity = new TrunklineScanZeroDetailEntity(); + updateEntity.setId(zeroPackage.getId()); + updateEntity.setUnloadNum(zeroPackage.getEnterNum()); + updateScanZeroDetailList.add(updateEntity); + }); + + if(CollUtil.isNotEmpty(updateScanZeroDetailList)){ + scanZeroDetailService.updateBatchById(updateScanZeroDetailList); + } + //生成签收记录 trunklineCarsSignLogService.addEntity(carsLoadScanEntity, remark); @@ -5835,7 +5952,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl signOrderIds = new ArrayList<>(); List updateCarsLoadScanList = new ArrayList<>(); List updateParcelList = new ArrayList<>(); - + List updateZerpPackageList = new ArrayList<>(); Date date = new Date(); if (!list.isEmpty()) { @@ -5864,7 +5981,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl parcelList = parcelListMap.get(scanCode); if (!Objects.isNull(parcelList)) { @@ -5874,6 +5993,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId); + zeroDetailVOList.forEach(p -> { + TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); + scanZeroDetailEntity.setId(p.getId()); + scanZeroDetailEntity.setUnloadNum(p.getLoadingNum()); + updateZerpPackageList.add(scanZeroDetailEntity); + }); + } updateCarsLoadScanList.add(entity); loadIds.add(entity.getLoadId()); @@ -5908,6 +6037,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderCodeNumMap = orderCodeNumList.stream().collect(Collectors.toMap(OrderCodeNumVO::getOrderCode, Function.identity())); + List unloadList = trunklineCarsLoadScanService.findUnloadPackageListByLoadIdAndFinalNodeId(loadId,warehouseId); + for (UnloadScanOrderVO unloadScanOrderVO : unloadScanOrderList) { - String waybillNo = unloadScanOrderVO.getWaybillNo(); - String orderCode = unloadScanOrderVO.getOrderCode(); + String waybillNo = StringUtil.isBlank(unloadScanOrderVO.getWaybillNo())?"null":unloadScanOrderVO.getWaybillNo(); + String orderCode = StringUtil.isBlank(unloadScanOrderVO.getOrderCode())?"null":unloadScanOrderVO.getOrderCode(); unloadScanOrderVO.setTotalNumber(orderCodeNumMap.get(orderCode).getTotalNum()); - List unloadPackageList = trunklineCarsLoadScanService.findUnloadPackageList(loadId, warehouseId, waybillNo, orderCode); + List unloadPackageList = new ArrayList<>(); + unloadList.forEach(unloadPackageVO -> { + String orderCode1 = StringUtil.isBlank(unloadPackageVO.getOrderCode())?"null":unloadPackageVO.getOrderCode(); + String waybillNo1 = StringUtil.isBlank(unloadPackageVO.getWaybillNo())?"null":unloadPackageVO.getWaybillNo(); + if(waybillNo.equals(waybillNo1) && orderCode.equals(orderCode1)){ + unloadPackageList.add(unloadPackageVO); + } + }); unloadScanOrderVO.setUnloadPackageList(unloadPackageList); } } @@ -9470,11 +9612,34 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroList = trunklineCarsLoadScanService.findUnloadZeroList(loadId, warehouseId); + + List unloadPackageList = trunklineCarsLoadScanService.findUnloadZeroListByLoadIdAndFinalNodeId(loadId, warehouseId); + List carsLoadScanIds = unloadPackageList.stream() + .map(UnloadPackageVO::getCarsLoadScanId) + .collect(Collectors.toList()); + List scanZeroDetailList = scanZeroDetailService.findListByCarsLoadScanIds(carsLoadScanIds); + //把scanZeroDetailList中所有元素通过id进行分组 + Map> scanZeroDetailMap = scanZeroDetailList.stream() + .collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getScanId)); + + unloadPackageList.forEach(unloadPackageVO -> { + Long carsLoadScanId = unloadPackageVO.getCarsLoadScanId(); + List list = scanZeroDetailMap.get(carsLoadScanId); + unloadPackageVO.setScanZeroDetailList(list); + }); + for (UnloadZeroVO unloadZeroVO : zeroList) { - String waybillNo = unloadZeroVO.getWaybillNo(); - String orderCode = unloadZeroVO.getOrderCode(); - List unloadPackageList = trunklineCarsLoadScanService.findUnloadZeroList(loadId, warehouseId, waybillNo, orderCode); - unloadZeroVO.setUnloadPackageList(unloadPackageList); + String waybillNo = StringUtil.isBlank(unloadZeroVO.getWaybillNo())?"null":unloadZeroVO.getWaybillNo(); + String orderCode = StringUtil.isBlank(unloadZeroVO.getOrderCode())?"null":unloadZeroVO.getOrderCode(); + List unloadLs = new ArrayList<>(); + unloadPackageList.forEach(unloadPackageVO -> { + String orderCode1 = StringUtil.isBlank(unloadPackageVO.getOrderCode())?"null":unloadPackageVO.getOrderCode(); + String waybillNo1 = StringUtil.isBlank(unloadPackageVO.getWaybillNo())?"null":unloadPackageVO.getWaybillNo(); + if(waybillNo.equals(waybillNo1) && orderCode.equals(orderCode1)){ + unloadLs.add(unloadPackageVO); + } + }); + unloadZeroVO.setUnloadPackageList(unloadLs); } //查询异常列表 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java index e0b3a3e39..53d89f456 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java @@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.List; @Slf4j @@ -153,4 +154,14 @@ public class TrunklineCarsOrderEntityServiceImpl extends BaseServiceImpl findSignOrderListBySignOrderId(Long signOrderId) { + return baseMapper.findSignOrderListBySignOrderId(signOrderId); + } + + @Override + public List findSignZeroOrderListBySignOrderId(Long signOrderId) { + return baseMapper.findSignZeroOrderListBySignOrderId(signOrderId); + } + }