Browse Source

1.零担按品类逻辑代码优化

dist.1.2.0^2
zhenghaoyu 7 months ago
parent
commit
68a903a5ef
  1. 2
      blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/entity/AftersalesAbnormalRecordZeroDetailEntity.java
  2. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  3. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelNumberClient.java
  4. 16
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/ZeroPackageSupplyVO.java
  5. 1
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/ZeroPackageDTO.java
  6. 26
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineScanZeroDetailClient.java
  7. 6
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignPackageVO.java
  8. 2
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/UnloadPackageVO.java
  9. 40
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleListVO.java
  10. 4
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroSuppleVO.java
  11. 31
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesAbnormalRecordController.java
  12. 5
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/dto/AbnormalRecordDTO.java
  13. 2
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java
  14. 5
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordZeroDetailService.java
  15. 245
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java
  16. 11
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordZeroDetailServiceImpl.java
  17. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  18. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelNumberClient.java
  19. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  20. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  21. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  22. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  23. 9
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/CarsLoadApiController.java
  24. 10
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/api/TripartiteTransferApiController.java
  25. 16
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java
  26. 32
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineScanZeroDetailClient.java
  27. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.java
  28. 14
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml
  29. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java
  30. 44
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml
  31. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java
  32. 22
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml
  33. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java
  34. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java
  35. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java
  36. 15
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java
  37. 241
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  38. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsOrderEntityServiceImpl.java

2
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;

4
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<ZeroPackageSupplyVO> findListByStockArticleIds(@RequestBody List<Long> orderIdList);
}

2
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<DistributionParcelNumberEntity> updateParceNumberList);
@GetMapping(API_PREFIX+"/findListByStockArticleId")
List<DistributionParcelNumberEntity> findListByStockArticleId(@RequestParam Long orderId);
}

16
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;//品类在库件数
}

1
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;//品类名称

26
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<TrunklineScanZeroDetailEntity> findListByCarsLoadScanId(@RequestParam Long carsLoadScanId);
@PostMapping(API_PREFIX+"/updateBetch")
void updateBetch(@RequestBody List<TrunklineScanZeroDetailEntity> updateScanZeroDetailEntityList);
}

6
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<TrunklineScanZeroDetailVO> scanZeroDetailList = new ArrayList<>();
}

2
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<TrunklineScanZeroDetailVO> scanZeroDetailList = new ArrayList<>();

40
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<JSONObject> zeroPackageSupplyVOS = new ArrayList<>();
}

4
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<ZeroPackageDTO> zeroPackageList = new ArrayList<>();
}

31
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,"系统异常");
}
}
}

5
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<ZeroPackageDTO> zeroPackageDTOS = new ArrayList<>();
}

2
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordService.java

@ -12,4 +12,6 @@ public interface IAftersalesAbnormalRecordService extends BaseService<Aftersales
R dealAbnormal(AbnormalRecordDTO abnormalRecordDTO);
JSONObject findListByCarsNoAndUpWarehouseId(String carsNo, Long warehouseId);
R findZeroDetail(AbnormalRecordDTO abnormalRecordDTO);
}

5
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/IAftersalesAbnormalRecordZeroDetailService.java

@ -3,5 +3,10 @@ package com.logpm.aftersales.service;
import com.logpm.aftersales.entity.AftersalesAbnormalRecordZeroDetailEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
public interface IAftersalesAbnormalRecordZeroDetailService extends BaseService<AftersalesAbnormalRecordZeroDetailEntity> {
List<AftersalesAbnormalRecordZeroDetailEntity> findListByAbnormalRecordId(Long abnormalRecordId);
}

245
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<Aftersa
private final IDistributionParcelListClient parcelListClient;
private final IDistributionParcelNumberClient parcelNumberClient;
private final IWarehouseWaybillClient warehouseWaybillClient;
private final ITrunklineWaybillTrackClient trunklineWaybillTrackClient;
@ -57,6 +63,10 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
private final ITrunklineWaybillPackageClient trunklineWaybillPackageClient;
private final IAftersalesAbnormalRecordZeroDetailService recordZeroDetailService;
private final ITrunklineScanZeroDetailClient scanZeroDetailClient;
@Override
public R findPageList(AbnormalRecordDTO abnormalRecordDTO) {
IPage<Object> page = new Page<>();
@ -145,91 +155,60 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
//零担卸车数量异常
Long waybillId = null;
Integer dealType = abnormalRecordDTO.getDealType();
List<ZeroPackageDTO> 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<AftersalesAbnormalRecordZeroDetailEntity> recordZeroDetailEntities = recordZeroDetailService.findListByAbnormalRecordId(abnormalRecordId);
//把zeroPackageDTOS转化成以goodsId作为key的Map
Map<Long, AftersalesAbnormalRecordZeroDetailEntity> recordZeroDetailEntitiesMapByGoodsId = recordZeroDetailEntities.stream().collect(Collectors.toMap(AftersalesAbnormalRecordZeroDetailEntity::getGoodsId, Function.identity()));
List<TrunklineScanZeroDetailEntity> 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<Long, TrunklineScanZeroDetailEntity> 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<Long, ZeroPackageDTO> 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<DistributionParcelListEntity> addParcelListEntityList = new ArrayList<>();
List<DistributionParcelListEntity> 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();
@ -261,13 +240,22 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
currentStockArticleEntity.setIncomingNum(enterNum);
Long orderId = stockArticleClient.addData(currentStockArticleEntity);
if(!Objects.isNull(orderId)){
List<DistributionParcelListEntity> addParcelListEntityList = new ArrayList<>();
List<DistributionParcelListEntity> parcelListEntityList = parcelListClient.findEntityListByOrderCode(orderCode, warehouseId);
List<TrunklineScanZeroDetailEntity> updateScanZeroDetailEntityList = new ArrayList<>();
List<DistributionParcelNumberEntity> addParcelNumberEntityList = new ArrayList<>();
List<AftersalesAbnormalRecordZeroDetailEntity> updateRecordZeroDetailList = new ArrayList<>();
List<DistributionParcelListVO> 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);
@ -277,17 +265,115 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
if(acceptWarehouseId.equals(warehouseId)){
currentParcelListEntity.setIsTransfer(0);
}
addParcelListEntityList.add(currentParcelListEntity);
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);
});
parcelListClient.addZeroParcelList(addParcelListEntityList);
if(CollUtil.isNotEmpty(updateRecordZeroDetailList)){
recordZeroDetailService.updateBatchById(updateRecordZeroDetailList);
}
if(CollUtil.isNotEmpty(updateScanZeroDetailEntityList)){
scanZeroDetailClient.updateBetch(updateScanZeroDetailEntityList);
}
if(CollUtil.isNotEmpty(addParcelNumberEntityList)){
parcelNumberClient.addBatch(addParcelNumberEntityList);
}
}
}else{
Long orderId = currentStockArticleEntity.getId();
List<DistributionParcelListEntity> parcelListEntityList = parcelListClient.findListByStockArticleId(orderId);
//把parcelListEntityList转化成以firsts为key的map
Map<String, DistributionParcelListEntity> parcelListEntityMapByFirsts = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getFirsts, Function.identity()));
List<DistributionParcelNumberEntity> parcelNumberEntityList =parcelNumberClient.findListByStockArticleId(orderId);
//把parcelNumberEntityList转化成以parceListId为key的Map
Map<Long, DistributionParcelNumberEntity> parcelNumberEntityMapByParcelListId = parcelNumberEntityList.stream().collect(Collectors.toMap(DistributionParcelNumberEntity::getParcelListId, Function.identity()));
//把scanZeroDetailEntityList转化成以goodsId为key的Map
Map<Long, TrunklineScanZeroDetailEntity> scanZeroDetailEntityMapByGoodsId = scanZeroDetailEntityList.stream().collect(Collectors.toMap(TrunklineScanZeroDetailEntity::getGoodsId, Function.identity()));
List<TrunklineScanZeroDetailEntity> updateScanZeroDetailEntityList = new ArrayList<>();
List<AftersalesAbnormalRecordZeroDetailEntity> updateAbnormalRecordZeroDetailEntityList = new ArrayList<>();
List<DistributionParcelListEntity> updateParcelListEntityList = new ArrayList<>();
List<DistributionParcelNumberEntity> 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);
}
abnormalRecordEntity.setRemark("差异"+enterNum+"件数入库本仓,原仓返回"+diff+"件");
}
carsLoadScanEntity.setScanStatus("2");
carsLoadScanEntity.setUnloadNum(carsLoadScanEntity.getUnloadNum()+enterNum);
trunklineCarsLoadScanClient.updateEntity(carsLoadScanEntity);
@ -353,4 +439,13 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl<Aftersa
public JSONObject findListByCarsNoAndUpWarehouseId(String carsNo, Long warehouseId) {
return baseMapper.findListByCarsNoAndUpWarehouseId(carsNo,warehouseId);
}
@Override
public R findZeroDetail(AbnormalRecordDTO abnormalRecordDTO) {
Long abnormalRecordId = abnormalRecordDTO.getAbnormalRecordId();
QueryWrapper<AftersalesAbnormalRecordZeroDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("abnormal_record_id",abnormalRecordId);
List<AftersalesAbnormalRecordZeroDetailEntity> list = recordZeroDetailService.list(queryWrapper);
return R.data(list);
}
}

11
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<AftersalesAbnormalRecordZeroDetailMapper, AftersalesAbnormalRecordZeroDetailEntity> implements IAftersalesAbnormalRecordZeroDetailService {
@Override
public List<AftersalesAbnormalRecordZeroDetailEntity> findListByAbnormalRecordId(Long abnormalRecordId) {
QueryWrapper<AftersalesAbnormalRecordZeroDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("abnormal_record_id",abnormalRecordId);
return baseMapper.selectList(queryWrapper);
}
}

6
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<ZeroPackageSupplyVO> findListByStockArticleIds(List<Long> orderIdList) {
return distributionParcelListService.findListByStockArticleIds(orderIdList);
}
}

7
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<DistributionParcelNumberEntity> findListByStockArticleId(Long orderId) {
QueryWrapper<DistributionParcelNumberEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("stock_article_id", orderId);
return distributionParcelNumberService.list(queryWrapper);
}
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java

@ -303,4 +303,7 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
List<DistributionParcelListVO> findEntityVOListByOrderCode(@Param("orderCode") String orderCode,@Param("fromWarehouseId") Long fromWarehouseId);
void addZeroPackageQuantity(@Param("packageId") Long packageId, @Param("num") int num);
List<ZeroPackageSupplyVO> findListByStockArticleIds(@Param("orderIdList") List<Long> orderIdList);
}

17
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}
</select>
@ -1900,4 +1900,19 @@
where id = #{packageId}
</update>
<select id="findListByStockArticleIds" resultType="com.logpm.distribution.vo.ZeroPackageSupplyVO">
select ldpl.stock_article_id stockArticleId,
ldpl.id packageId,
lwwd.product_id goodsId,
lwwd.product_name goodsName,
ldpl.quantity stockNum
from logpm_distribution_parcel_list ldpl
left join logpm_warehouse_waybill_detail lwwd on lwwd.id = ldpl.advance_id
where ldpl.stock_article_id in
<foreach collection="orderIdList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

7
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<Distribution
List<DistributionParcelListVO> findEntityVOListByOrderCode(String orderCode, Long fromWarehouseId);
void addZeroPackageQuantity(Long packageId, int num);
List<ZeroPackageSupplyVO> findListByStockArticleIds(List<Long> orderIdList);
}

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -1364,6 +1364,11 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
baseMapper.addZeroPackageQuantity(packageId,num);
}
@Override
public List<ZeroPackageSupplyVO> findListByStockArticleIds(List<Long> orderIdList) {
return baseMapper.findListByStockArticleIds(orderIdList);
}
private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node) {
JSONObject trunklinePackageTrackLog = new JSONObject();

9
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<ZeroPackageDTO> 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);

10
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<ZeroPackageDTO> 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);

16
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<ZeroPackageDTO> 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<ZeroPackageDTO> 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);

32
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<TrunklineScanZeroDetailEntity> findListByCarsLoadScanId(Long carsLoadScanId) {
QueryWrapper<TrunklineScanZeroDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("scan_id",carsLoadScanId);
return trunklineScanZeroDetailService.list(queryWrapper);
}
@Override
public void updateBetch(List<TrunklineScanZeroDetailEntity> updateScanZeroDetailEntityList) {
trunklineScanZeroDetailService.updateBatchById(updateScanZeroDetailEntityList);
}
}

5
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<TrunklineCarsLoadEnt
List<CarsLoadAllOrderVO> findUseOrderListNoPage(@Param("param") LoadCarsDTO loadCarsDTO);
IPage<JSONObject> findZeroListByWarehouseId(IPage<Object> page, @Param("param") LoadCarsDTO loadCarsDTO);
IPage<JSONObject> findSignOrderZeroListByWarehouseId(IPage<Object> page, @Param("param") LoadCarsDTO loadCarsDTO);
IPage<ZeroSuppleListVO> findZeroListByWarehouseId(IPage<Object> page, @Param("param") LoadCarsDTO loadCarsDTO);
IPage<ZeroSuppleListVO> findSignOrderZeroListByWarehouseId(IPage<Object> page, @Param("param") LoadCarsDTO loadCarsDTO);
IPage<JSONObject> useZeroList(IPage<Object> page, @Param("param") LoadCarsDTO loadCarsDTO);

14
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml

@ -552,10 +552,10 @@
</if>
</select>
<select id="findZeroListByWarehouseId" resultType="com.alibaba.fastjson.JSONObject">
select ldsa.waybill_number waybillNo,
<select id="findZeroListByWarehouseId" resultType="com.logpm.trunkline.vo.ZeroSuppleListVO">
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 @@
</update>
<select id="findSignOrderZeroListByWarehouseId" resultType="com.alibaba.fastjson.JSONObject">
select ldsa.waybill_number waybillNo,
<select id="findSignOrderZeroListByWarehouseId" resultType="com.logpm.trunkline.vo.ZeroSuppleListVO">
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,

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.java

@ -175,4 +175,10 @@ public interface TrunklineCarsLoadScanMapper extends BaseMapper<TrunklineCarsLoa
List<Long> findAllIdListByLoadIdAndNoScanStatus(@Param("loadId") Long loadId, @Param("scanStatus") String scanStatus);
List<LoadScanWaybillVO> findTransferLoadScanWaybillList(@Param("loadId") Long loadId, @Param("nodeId") Long nodeId);
List<UnloadPackageVO> findUnloadPackageListByLoadIdAndFinalNodeId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId);
List<UnloadPackageVO> findUnloadZeroListByLoadIdAndFinalNodeId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId);
List<SignPackageVO> findSignPackageListBySignOrderId(@Param("signOrderId") Long signOrderId);
}

44
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml

@ -932,4 +932,48 @@
and scan_status != #{scanStatus}
</select>
<select id="findUnloadPackageListByLoadIdAndFinalNodeId" resultType="com.logpm.trunkline.vo.UnloadPackageVO">
select id carsLoadScanId,
scan_code orderPackageCode,
num num,
unload_num unloadNum,
tray_code trayCode,
tray_name trayName,
scan_status scanStatus,
unload_node_name unloadNodeName,
order_code orderCode,
waybill_no waybillNo
from logpm_trunkline_cars_load_scan
where load_id = #{loadId}
and final_node_id = #{warehouseId}
</select>
<select id="findUnloadZeroListByLoadIdAndFinalNodeId" resultType="com.logpm.trunkline.vo.UnloadPackageVO">
select id carsLoadScanId,
scan_code orderPackageCode,
num num,
unload_num unloadNum,
tray_code trayCode,
tray_name trayName,
scan_status scanStatus,
unload_node_name unloadNodeName,
order_code orderCode,
waybill_no waybillNo
from logpm_trunkline_cars_load_scan
where load_id = #{loadId}
and final_node_id = #{warehouseId}
</select>
<select id="findSignPackageListBySignOrderId" resultType="">
select id carsLoadScanId,
scan_code orderPackageCode,
num num,
unload_num unloadNum,
scan_status scanStatus,
order_code orderCode,
waybill_no waybillNo
from logpm_trunkline_cars_load_scan
where sign_order_id = #{signOrderId}
</select>
</mapper>

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.java

@ -66,4 +66,8 @@ public interface TrunklineCarsOrderMapper extends BaseMapper<TrunklineCarsOrderE
List<TrunklineCarsOrderVO> findMallOrderList(@Param("carsOrderIdList") List<Long> carsOrderIdList);
void deleteNoRealNumByLoadIdAndWarehouseId(@Param("loadId") Long loadId, @Param("warehouseId") Long warehouseId);
List<SignScanOrderVO> findSignOrderListBySignOrderId(@Param("signOrderId") Long signOrderId);
List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(@Param("signOrderId") Long signOrderId);
}

22
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsOrderMapper.xml

@ -356,4 +356,26 @@
and real_num = 0
</delete>
<select id="findSignOrderListBySignOrderId" resultType="com.logpm.trunkline.vo.SignScanOrderVO">
select ltco.waybill_no waybillNo,
ltco.order_code orderCode,
ltco.real_num loadingNum,
ltco.sign_num signNum
from logpm_trunkline_cars_order ltco
where ltco.sign_order_id = #{signOrderId}
and ltco.type = 1
and ltco.is_customer = '1'
</select>
<select id="findSignZeroOrderListBySignOrderId" resultType="com.logpm.trunkline.vo.SignScanOrderVO">
select ltco.waybill_no waybillNo,
ltco.order_code orderCode,
ltco.real_num loadingNum,
ltco.sign_num signNum
from logpm_trunkline_cars_order ltco
where ltco.sign_order_id = #{signOrderId}
and ltco.type = 2
and ltco.is_customer = '1'
</select>
</mapper>

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java

@ -171,4 +171,10 @@ public interface ITrunklineCarsLoadScanService extends BaseService<TrunklineCars
List<Long> findAllIdListByLoadIdAndNoScanStatus(Long loadId, String scanStatus);
List<LoadScanWaybillVO> findTransferLoadScanWaybillList(Long loadId, Long nodeId);
List<UnloadPackageVO> findUnloadPackageListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId);
List<UnloadPackageVO> findUnloadZeroListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId);
List<SignPackageVO> findSignPackageListBySignOrderId(Long signOrderId);
}

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java

@ -139,7 +139,7 @@ public interface ITrunklineCarsLoadService extends BaseService<TrunklineCarsLoad
R transferUnloadPackage(Long loadId, String orderPackageCode, Long warehouseId, Integer unbindTray, String remark);
R transferUnloadZero(Long carsLoadScanId,Long loadId, String waybillNo, Integer enterNum, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark);
R transferUnloadZero(Long carsLoadScanId,Long loadId, String waybillNo, Integer enterNum, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark,List<ZeroPackageDTO> zeroPackageList);
R transferUnloadTray(Long loadId, String trayCode, Long warehouseId);
@ -159,7 +159,7 @@ public interface ITrunklineCarsLoadService extends BaseService<TrunklineCarsLoad
R signScanPackageCode(Long signOrderId,String orderPackageCode,String remark,Long warehouseId);
R signZeroOrder(Long signOrderId,Long carsLoadScanId,Integer enterNum, String remark);
R signZeroOrder(Long signOrderId,Long carsLoadScanId,Integer enterNum, String remark,List<ZeroPackageDTO> zeroPackageList);
R findSignOrderList(LoadCarsDTO loadCarsDTO);

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsOrderService.java

@ -64,4 +64,7 @@ public interface ITrunklineCarsOrderService extends BaseService<TrunklineCarsOrd
void deleteNoRealNumByLoadIdAndWarehouseId(Long loadId, Long warehouseId);
List<SignScanOrderVO> findSignOrderListBySignOrderId(Long signOrderId);
List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(Long signOrderId);
}

15
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadScanServiceImpl.java

@ -439,4 +439,19 @@ public class TrunklineCarsLoadScanServiceImpl extends BaseServiceImpl<TrunklineC
return baseMapper.findTransferLoadScanWaybillList(loadId,nodeId);
}
@Override
public List<UnloadPackageVO> findUnloadPackageListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId) {
return baseMapper.findUnloadPackageListByLoadIdAndFinalNodeId(loadId,warehouseId);
}
@Override
public List<UnloadPackageVO> findUnloadZeroListByLoadIdAndFinalNodeId(Long loadId, Long warehouseId) {
return baseMapper.findUnloadZeroListByLoadIdAndFinalNodeId(loadId,warehouseId);
}
@Override
public List<SignPackageVO> findSignPackageListBySignOrderId(Long signOrderId) {
return baseMapper.findSignPackageListBySignOrderId(signOrderId);
}
}

241
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<TrunklineCarsL
entity -> entity,
(entity1, entity2) -> entity1)); // 处理可能的键冲突
List<DistributionParcelListEntity> updateParceList = new ArrayList<>();
List<DistributionParcelNumberEntity> updateParceNumberList = new ArrayList<>();
@ -1673,8 +1672,24 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
page.setSize(loadCarsDTO.getPageSize());
//查询当前仓零担在库列表
// IPage<JSONObject> pageList = distributionStockArticleClient.findZeroListByWarehouseId(warehouseId,pageNum,pageSize);
IPage<JSONObject> pageList = baseMapper.findSignOrderZeroListByWarehouseId(page, loadCarsDTO);
IPage<ZeroSuppleListVO> pageList = baseMapper.findSignOrderZeroListByWarehouseId(page, loadCarsDTO);
List<ZeroSuppleListVO> records = pageList.getRecords();
//把records中所有元素的orderId放入一个集合
List<Long> orderIdList = records.stream().map(ZeroSuppleListVO::getOrderId).collect(Collectors.toList());
List<ZeroPackageSupplyVO> packageList = distributionParcelListClient.findListByStockArticleIds(orderIdList);
//把packageList中所有元素通过stockArticleId进行分组
Map<Long, List<ZeroPackageSupplyVO>> map = packageList.stream().collect(Collectors.groupingBy(ZeroPackageSupplyVO::getStockArticleId));
records.forEach(zeroSuppleListVO -> {
Long orderId = zeroSuppleListVO.getOrderId();
List<JSONObject> jsonObjectList = new ArrayList<>();
List<ZeroPackageSupplyVO> 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<TrunklineCarsL
page.setSize(loadCarsDTO.getPageSize());
//查询当前仓零担在库列表
// IPage<JSONObject> pageList = distributionStockArticleClient.findZeroListByWarehouseId(warehouseId,pageNum,pageSize);
IPage<JSONObject> pageList = baseMapper.findZeroListByWarehouseId(page, loadCarsDTO);
IPage<ZeroSuppleListVO> pageList = baseMapper.findZeroListByWarehouseId(page, loadCarsDTO);
List<ZeroSuppleListVO> records = pageList.getRecords();
//把records中所有元素的orderId放入一个集合
List<Long> orderIdList = records.stream().map(ZeroSuppleListVO::getOrderId).collect(Collectors.toList());
List<ZeroPackageSupplyVO> packageList = distributionParcelListClient.findListByStockArticleIds(orderIdList);
//把packageList中所有元素通过stockArticleId进行分组
Map<Long, List<ZeroPackageSupplyVO>> map = packageList.stream().collect(Collectors.groupingBy(ZeroPackageSupplyVO::getStockArticleId));
records.forEach(zeroSuppleListVO -> {
Long orderId = zeroSuppleListVO.getOrderId();
List<JSONObject> jsonObjectList = new ArrayList<>();
List<ZeroPackageSupplyVO> 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<TrunklineCarsL
Integer enterNum = zeroSuppleVO.getEnterNum();
Long finalNodeId = zeroSuppleVO.getFinalNodeId();
Long signOrderId = zeroSuppleVO.getSignOrderId();
List<ZeroPackageDTO> zeroPackageList = zeroSuppleVO.getZeroPackageList();
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if (Objects.isNull(warehouseWaybillEntity)) {
@ -3864,6 +3896,23 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setIsSupple(1);
carsLoadScanEntity.setSignOrderId(signOrderId);
trunklineCarsLoadScanService.save(carsLoadScanEntity);
Long scanLoadId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailEntity> 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<TrunklineCarsL
if(!Objects.isNull(signOrderId)){
updateSignOrderNumBySignOrderId(signOrderId);
// TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService.getById(signOrderId);
// signOrderEntity.setPlanNum(signOrderEntity.getPlanNum() + enterNum);
// signOrderEntity.setLoadingNum(signOrderEntity.getLoadingNum() + enterNum);
// Integer signNum = signOrderEntity.getSignNum();
// if(signNum > 0 ){
// signOrderEntity.setSignStatus("10");
// }
// trunklineLoadSignOrderService.updateById(signOrderEntity);
}
}
//更新数量
@ -4130,6 +4171,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.fail(405, "配载计划信息不存在");
}
String loadCode = carsLoadEntity.getCarsNo();
String carrierName = carsLoadEntity.getCarrierName();
// TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId);
// if(Objects.isNull(carsLoadLineEntity)){
@ -4140,7 +4182,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long trayId = null;
String trayName = null;
String trayCode = null;
String content = "包件在 "+warehouseName+" 扫码 卸车,车次号:"+loadCode+".";
String content = "包件在 "+warehouseName+" 扫码 卸车,车次号:"+loadCode+",由["+carrierName+"] 承运.";
//判断包件是否已入库
// DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
@ -4359,7 +4401,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
@Override
public R transferUnloadZero(Long carsLoadScanId,Long loadId, String waybillNo, Integer enterNum, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark) {
public R transferUnloadZero(Long carsLoadScanId,Long loadId, String waybillNo, Integer enterNum, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark,List<ZeroPackageDTO> zeroPackageList) {
log.info("#############transferUnloadZero: 三方中转卸车零担");
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
@ -4422,6 +4464,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setScanStatus("2");
trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
List<TrunklineScanZeroDetailEntity> 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<TrunklineCarsL
Integer num = carsLoadScanEntity.getNum();
String orderCode = carsLoadScanEntity.getOrderCode();
Long carsLoadScanId = carsLoadScanEntity.getId();
transferUnloadZero(carsLoadScanId,loadId, waybillNo, num, warehouseId, 0, trayCode, orderCode, "三方中装托盘零担正常卸车");
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId);
List<ZeroPackageDTO> 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<TrunklineCarsL
String trayCode = unloadZeroDTO.getTrayCode();
String orderCode = unloadZeroDTO.getOrderCode();
Long carsLoadScanId = unloadZeroDTO.getCarsLoadScanId();
transferUnloadZero(carsLoadScanId,loadId, waybillNo, enterNum, warehouseId, 1, trayCode, orderCode, "批量卸车零担正常卸车");
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId);
List<ZeroPackageDTO> 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<TrunklineCarsL
Long fromWarehouseId = signOrderVO.getWarehouseId();
//查询订单列表
List<SignScanOrderVO> signScanOrderList = trunklineCarsOrderService.findSignOrderList(loadId, fromWarehouseId,signOrderId);
List<SignScanOrderVO> signScanOrderList = trunklineCarsOrderService.findSignOrderListBySignOrderId(signOrderId);
List<SignPackageVO> signPackageList = trunklineCarsLoadScanService.findSignPackageListBySignOrderId(signOrderId);
for (SignScanOrderVO signScanOrderVO : signScanOrderList) {
String waybillNo = signScanOrderVO.getWaybillNo();
String orderCode = signScanOrderVO.getOrderCode();
List<SignPackageVO> 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<SignPackageVO> 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<SignScanOrderVO> signScanZeroOrderList = trunklineCarsOrderService.findSignZeroOrderListBySignOrderId(signOrderId);
List<SignPackageVO> signZeroPackageList = trunklineCarsLoadScanService.findSignPackageListBySignOrderId(signOrderId);
// 创建一个包含所有carsLoadScanId的新列表
List<Long> carsLoadScanIds = signZeroPackageList.stream()
.map(SignPackageVO::getCarsLoadScanId)
.collect(Collectors.toList());
List<TrunklineScanZeroDetailVO> scanZeroDetailList = scanZeroDetailService.findListByCarsLoadScanIds(carsLoadScanIds);
//把scanZeroDetailList中所有元素通过id进行分组
Map<Long, List<TrunklineScanZeroDetailVO>> scanZeroDetailMap = scanZeroDetailList.stream()
.collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getScanId));
signZeroPackageList.forEach(signPackageVO -> {
Long carsLoadScanId = signPackageVO.getCarsLoadScanId();
List<TrunklineScanZeroDetailVO> list = scanZeroDetailMap.get(carsLoadScanId);
signPackageVO.setScanZeroDetailList(list);
});
List<SignScanOrderVO> signScanZeroOrderList = trunklineCarsOrderService.findSignZeroOrderList(loadId, fromWarehouseId,signOrderId);
for (SignScanOrderVO signScanOrderVO : signScanZeroOrderList) {
String waybillNo = signScanOrderVO.getWaybillNo();
String orderCode = signScanOrderVO.getOrderCode();
List<SignPackageVO> 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<SignPackageVO> 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<TrunklineCarsL
}
@Override
public R signZeroOrder(Long signOrderId, Long carsLoadScanId, Integer enterNum, String remark) {
public R signZeroOrder(Long signOrderId, Long carsLoadScanId, Integer enterNum, String remark,List<ZeroPackageDTO> zeroPackageList) {
Date date = new Date();
TrunklineLoadSignOrderEntity signOrderEntity = trunklineLoadSignOrderService.getById(signOrderId);
if (Objects.isNull(signOrderEntity)) {
@ -5768,6 +5873,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
carsLoadScanEntity.setSignOrderId(signOrderId);
trunklineCarsLoadScanService.updateById(carsLoadScanEntity);
List<TrunklineScanZeroDetailEntity> 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<TrunklineCarsL
List<Long> signOrderIds = new ArrayList<>();
List<TrunklineCarsLoadScanEntity> updateCarsLoadScanList = new ArrayList<>();
List<DistributionParcelListEntity> updateParcelList = new ArrayList<>();
List<TrunklineScanZeroDetailEntity> updateZerpPackageList = new ArrayList<>();
Date date = new Date();
if (!list.isEmpty()) {
@ -5864,7 +5981,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
entity.setUnloadTime(date);
entity.setUnloadNodeId(warehouseId);
entity.setUnloadNodeName(warehouseName);
if (entity.getType().equals(1)) {
Integer type = entity.getType();
Long carsLoadScanId = t.getCarsLoadScanId();
if (type.equals(1)) {
String scanCode = entity.getScanCode();
List<DistributionParcelListEntity> parcelList = parcelListMap.get(scanCode);
if (!Objects.isNull(parcelList)) {
@ -5874,6 +5993,16 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
});
}
orderPackageCodes.add(entity.getScanCode());
}else if(type.equals(2)){
//零担
List<TrunklineScanZeroDetailVO> 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<TrunklineCarsL
trunklineCarsLoadScanService.updateBatchById(updateCarsLoadScanList);
if(CollUtil.isNotEmpty(updateZerpPackageList)){
scanZeroDetailService.updateBatchById(updateZerpPackageList);
}
//生成签收记录
trunklineCarsSignLogService.addList(updateCarsLoadScanList, "PC批量签收");
@ -9458,11 +9591,20 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
//把orderCodeNumList中所有元素转化成以orderCode为key的map
Map<String, OrderCodeNumVO> orderCodeNumMap = orderCodeNumList.stream().collect(Collectors.toMap(OrderCodeNumVO::getOrderCode, Function.identity()));
List<UnloadPackageVO> 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<UnloadPackageVO> unloadPackageList = trunklineCarsLoadScanService.findUnloadPackageList(loadId, warehouseId, waybillNo, orderCode);
List<UnloadPackageVO> 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<TrunklineCarsL
//查询已装车的零担
List<UnloadZeroVO> zeroList = trunklineCarsLoadScanService.findUnloadZeroList(loadId, warehouseId);
List<UnloadPackageVO> unloadPackageList = trunklineCarsLoadScanService.findUnloadZeroListByLoadIdAndFinalNodeId(loadId, warehouseId);
List<Long> carsLoadScanIds = unloadPackageList.stream()
.map(UnloadPackageVO::getCarsLoadScanId)
.collect(Collectors.toList());
List<TrunklineScanZeroDetailVO> scanZeroDetailList = scanZeroDetailService.findListByCarsLoadScanIds(carsLoadScanIds);
//把scanZeroDetailList中所有元素通过id进行分组
Map<Long, List<TrunklineScanZeroDetailVO>> scanZeroDetailMap = scanZeroDetailList.stream()
.collect(Collectors.groupingBy(TrunklineScanZeroDetailVO::getScanId));
unloadPackageList.forEach(unloadPackageVO -> {
Long carsLoadScanId = unloadPackageVO.getCarsLoadScanId();
List<TrunklineScanZeroDetailVO> list = scanZeroDetailMap.get(carsLoadScanId);
unloadPackageVO.setScanZeroDetailList(list);
});
for (UnloadZeroVO unloadZeroVO : zeroList) {
String waybillNo = unloadZeroVO.getWaybillNo();
String orderCode = unloadZeroVO.getOrderCode();
List<UnloadPackageVO> 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<UnloadPackageVO> 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);
}
//查询异常列表

11
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<Trunkli
baseMapper.deleteNoRealNumByLoadIdAndWarehouseId(loadId,warehouseId);
}
@Override
public List<SignScanOrderVO> findSignOrderListBySignOrderId(Long signOrderId) {
return baseMapper.findSignOrderListBySignOrderId(signOrderId);
}
@Override
public List<SignScanOrderVO> findSignZeroOrderListBySignOrderId(Long signOrderId) {
return baseMapper.findSignZeroOrderListBySignOrderId(signOrderId);
}
}

Loading…
Cancel
Save