diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillLogDTO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillLogDTO.java new file mode 100644 index 000000000..49264a292 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/dto/WaybillLogDTO.java @@ -0,0 +1,27 @@ +package com.logpm.trunkline.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class WaybillLogDTO implements Serializable { + + private Long warehouseId;//当前仓库id + private String warehouseName;//当前仓库名称 + private String waybillNo;//运单号 + private String trainNumber;//车次号 + private String carNumber;//车牌号 + private String loadingUser;//装车人 + private Date deliveryTime;//配送时间 + private String signUser;//签收人 + private Date signTime;//签收时间 + private String driverName;//司机名称 + private Integer num;//签收数量 + private Integer type;//1三方中转签收 2直发商家签收 3配送签收 + private String signOrderCode;//签收单号 + private Long userId; + private String nickName; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillOrderClient.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillOrderClient.java index d07fa1344..e6c74502a 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillOrderClient.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillOrderClient.java @@ -1,7 +1,6 @@ package com.logpm.trunkline.feign; import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; -import com.logpm.trunkline.vo.TrunklineBillladingVO; import org.springblade.common.constant.ModuleNameConstant; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -26,4 +25,10 @@ public interface ITrunklineWaybillOrderClient { @PostMapping(API_PREFIX+"/findListByWaybillIds") List findListByWaybillIds(@RequestBody List waybillIds); + + @GetMapping(API_PREFIX+"/findEntityByWaybillNoAndOrderCode") + TrunklineWaybillOrderEntity findEntityByWaybillNoAndOrderCode(@RequestParam String waybillNo, @RequestParam String orderCode); + + @GetMapping(API_PREFIX+"/updateEntity") + void updateEntity(@RequestBody TrunklineWaybillOrderEntity waybillOrderEntity); } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillTrackClient.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillTrackClient.java index cd27ce2ce..7a0a27b85 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillTrackClient.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/feign/ITrunklineWaybillTrackClient.java @@ -1,6 +1,7 @@ package com.logpm.trunkline.feign; import com.logpm.trunkline.dto.AddWaybillTrackDTO; +import com.logpm.trunkline.dto.WaybillLogDTO; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; @@ -17,4 +18,6 @@ public interface ITrunklineWaybillTrackClient { @PostMapping(API_PREFIX+"/addWaybillLog") R addWaybillLog(@RequestBody AddWaybillTrackDTO addWaybillTrackDTO); + @PostMapping(API_PREFIX+"/addSignWaybillLog") + void addSignWaybillLog(@RequestBody WaybillLogDTO waybillLogDTO); } 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 6c0931497..bc770b47e 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 @@ -15,7 +15,9 @@ import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.trunkline.dto.AddWaybillTrackDTO; import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.feign.ITrunklineCarsLoadScanClient; +import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; import com.logpm.trunkline.feign.ITrunklineWaybillTrackClient; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; @@ -51,6 +53,8 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl page = new Page<>(); @@ -291,6 +295,7 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl + + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillPackageMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillPackageMapper.java index 66dcec4e4..940761296 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillPackageMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineWaybillPackageMapper.java @@ -10,4 +10,8 @@ public interface TrunklineWaybillPackageMapper extends BaseMapper findUpdateWaybillList(IPage page, OpenOrderDTO openOrderDTO); void deleteByWaybillNo(String waybillNo); + + void addSignWaybillLog(WaybillLogDTO waybillLogDTO); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java index ba14f554c..99d577e45 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java @@ -87,76 +87,116 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("waybill_no",waybillEntity.getWaybillNo()) - .eq("is_deleted",0); - List packageEntityList = baseMapper.selectList(queryWrapper); - int size = packageEntityList.size(); - Integer noIncomingNum = 0; - Integer incomingNum = 0; - Integer transferNum = 0; - Integer unloadNum = 0; - Integer deliveryNum = 0; - Integer signNum = 0; - for (TrunklineWaybillPackageEntity waybillPackageEntity : packageEntityList) { - Integer packageStatus = waybillPackageEntity.getPackageStatus(); + String waybillNo = waybillEntity.getWaybillNo(); + Integer totalCount = waybillEntity.getTotalCount(); + //查询出当前运单关联包件状态最大的值 + Integer packageStatus = baseMapper.findMaxPackageStatus(waybillNo); + //查询该状态包件数量 + Integer num = baseMapper.findPackageStatusNum(waybillNo,packageStatus); + + WarehouseWaybillEntity updateEntity = new WarehouseWaybillEntity(); + updateEntity.setId(waybillEntity.getId()); + if(totalCount == num){ if(packageStatus == 0){ - noIncomingNum++; + updateEntity.setWaybillStatus("0"); }else if(packageStatus == 10){ - incomingNum++; + updateEntity.setWaybillStatus("20"); }else if(packageStatus == 20){ - transferNum++; + updateEntity.setWaybillStatus("40"); }else if(packageStatus == 30){ - unloadNum++; + updateEntity.setWaybillStatus("60"); }else if(packageStatus == 40){ - deliveryNum++; + updateEntity.setWaybillStatus("80"); }else if(packageStatus == 50){ - signNum++; - } - } - - if(signNum > 0){ - if(signNum == size){ - updateWaybillEntity.setWaybillStatus("100"); - }else{ - updateWaybillEntity.setWaybillStatus("90"); + updateEntity.setWaybillStatus("100"); } }else{ - if(deliveryNum > 0){ - if (deliveryNum == size){ - updateWaybillEntity.setWaybillStatus("80"); - }else { - updateWaybillEntity.setWaybillStatus("70"); - } - }else{ - if(unloadNum > 0){ - if (unloadNum == size){ - updateWaybillEntity.setWaybillStatus("60"); - }else { - updateWaybillEntity.setWaybillStatus("50"); - } - }else{ - if(transferNum > 0){ - if (transferNum == size){ - updateWaybillEntity.setWaybillStatus("40"); - }else { - updateWaybillEntity.setWaybillStatus("30"); - } - }else{ - if(incomingNum > 0){ - if (incomingNum == size){ - updateWaybillEntity.setWaybillStatus("20"); - }else { - updateWaybillEntity.setWaybillStatus("10"); - } - } - } - } + if(packageStatus == 0){ + updateEntity.setWaybillStatus("0"); + }else if(packageStatus == 10){ + updateEntity.setWaybillStatus("10"); + }else if(packageStatus == 20){ + updateEntity.setWaybillStatus("30"); + }else if(packageStatus == 30){ + updateEntity.setWaybillStatus("50"); + }else if(packageStatus == 40){ + updateEntity.setWaybillStatus("70"); + }else if(packageStatus == 50){ + updateEntity.setWaybillStatus("90"); } } - warehouseWaybillClient.updateEntity(updateWaybillEntity); + warehouseWaybillClient.updateEntity(updateEntity); + +// WarehouseWaybillEntity updateWaybillEntity = new WarehouseWaybillEntity(); +// updateWaybillEntity.setId(waybillEntity.getId()); +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("waybill_no",waybillEntity.getWaybillNo()) +// .eq("is_deleted",0); +// List packageEntityList = baseMapper.selectList(queryWrapper); +// int size = packageEntityList.size(); +// Integer noIncomingNum = 0; +// Integer incomingNum = 0; +// Integer transferNum = 0; +// Integer unloadNum = 0; +// Integer deliveryNum = 0; +// Integer signNum = 0; +// for (TrunklineWaybillPackageEntity waybillPackageEntity : packageEntityList) { +// Integer packageStatus = waybillPackageEntity.getPackageStatus(); +// if(packageStatus == 0){ +// noIncomingNum++; +// }else if(packageStatus == 10){ +// incomingNum++; +// }else if(packageStatus == 20){ +// transferNum++; +// }else if(packageStatus == 30){ +// unloadNum++; +// }else if(packageStatus == 40){ +// deliveryNum++; +// }else if(packageStatus == 50){ +// signNum++; +// } +// } +// +// if(signNum > 0){ +// if(signNum == size){ +// updateWaybillEntity.setWaybillStatus("100"); +// }else{ +// updateWaybillEntity.setWaybillStatus("90"); +// } +// }else{ +// if(deliveryNum > 0){ +// if (deliveryNum == size){ +// updateWaybillEntity.setWaybillStatus("80"); +// }else { +// updateWaybillEntity.setWaybillStatus("70"); +// } +// }else{ +// if(unloadNum > 0){ +// if (unloadNum == size){ +// updateWaybillEntity.setWaybillStatus("60"); +// }else { +// updateWaybillEntity.setWaybillStatus("50"); +// } +// }else{ +// if(transferNum > 0){ +// if (transferNum == size){ +// updateWaybillEntity.setWaybillStatus("40"); +// }else { +// updateWaybillEntity.setWaybillStatus("30"); +// } +// }else{ +// if(incomingNum > 0){ +// if (incomingNum == size){ +// updateWaybillEntity.setWaybillStatus("20"); +// }else { +// updateWaybillEntity.setWaybillStatus("10"); +// } +// } +// } +// } +// } +// } +// warehouseWaybillClient.updateEntity(updateWaybillEntity); } @Override @@ -193,7 +233,7 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl trunklineWaybillPackageEntities = baseMapper.selectList(queryWrapper); if(!trunklineWaybillPackageEntities.isEmpty()){ + List updateList = new ArrayList<>(); for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : trunklineWaybillPackageEntities) { - trunklineWaybillPackageEntity.setPackageStatus(packageStatus); + TrunklineWaybillPackageEntity updateEntity = new TrunklineWaybillPackageEntity(); + updateEntity.setId(trunklineWaybillPackageEntity.getId()); + updateEntity.setPackageStatus(packageStatus); + updateList.add(updateEntity); waybillIds.add(trunklineWaybillPackageEntity.getWaybillId()); } - updateBatchById(trunklineWaybillPackageEntities); + updateBatchById(updateList); for (Long waybillId : waybillIds) { WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java index 6fe75efd2..79a50ab94 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java @@ -2,21 +2,36 @@ package com.logpm.trunkline.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.trunkline.dto.OpenOrderDTO; +import com.logpm.trunkline.dto.WaybillLogDTO; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; import com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper; +import com.logpm.trunkline.service.IOpenOrderAsyncService; +import com.logpm.trunkline.service.ITrunklineWaybillOrderService; import com.logpm.trunkline.service.ITrunklineWaybillTrackService; import com.logpm.trunkline.vo.TrunklineWaybillTrackVO; +import com.logpm.warehouse.entity.WarehouseWaybillEntity; +import com.logpm.warehouse.feign.IWarehouseWaybillClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.utils.CommonUtil; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; +import java.util.Objects; @Slf4j @Service @AllArgsConstructor public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl implements ITrunklineWaybillTrackService { + + private final IWarehouseWaybillClient warehouseWaybillClient; + private final IOpenOrderAsyncService openOrderAsyncService; + private final ITrunklineWaybillOrderService waybillOrderService; + @Override public List findWaybillLog(Long waybillId, String trackType) { return baseMapper.findWaybillLog(waybillId,trackType); @@ -31,4 +46,137 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl