Browse Source

Merge branch 'fix_bug_20231215' into dev

# Conflicts:
#	blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
single_db
pref_mail@163.com 1 year ago
parent
commit
260de883b2
  1. 30
      blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java
  2. 5
      blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java
  3. 4
      blade-ops/blade-xxljob-admin/src/main/java/com/xxl/job/admin/JobAdminApplication.java
  4. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java
  5. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupListVO.java
  6. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupVO.java
  7. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingVO.java
  8. 38
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/entity/OrderPackageStatusPushFailLogEntity.java
  9. 3
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseLog.java
  10. 19
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java
  11. 7
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java
  12. 20
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownGoodsClient.java
  13. 15
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/OrderPackageInfoVO.java
  14. 7
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java
  15. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java
  16. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java
  17. 62
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/bean/MyExcelUtil.java
  18. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java
  19. 18
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java
  20. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/BillLadingAppDTO.java
  21. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockConfigInfoVO.java
  22. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java
  23. 85
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockupPackageListDetailExcel.java
  24. 30
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml
  25. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml
  26. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  27. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  28. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  29. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  30. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java
  31. 76
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml
  32. 21
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml
  33. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockOrdercodeRecoService.java
  34. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java
  35. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java
  36. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DisStockOrdercodeRecoServiceImpl.java
  37. 20
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  38. 205
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  39. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  40. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  41. 108
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  42. 79
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  43. 30
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.java
  44. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.xml
  45. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java
  46. 147
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  47. 56
      blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java
  48. 51
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  49. 77
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  50. 243
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java
  51. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ReceiveInfoHandler.java
  52. 12
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  53. 71
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java
  54. 18
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml
  55. 3
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java
  56. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanDesServiceImpl.java
  57. 7
      blade-service/logpm-warehouse/pom.xml
  58. 107
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java
  59. 71
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java
  60. 15
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java
  61. 25
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java
  62. 16
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayTypeClient.java
  63. 19
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownGoodsClient.java
  64. 21
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java
  65. 56
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml
  66. 3
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.java
  67. 15
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml
  68. 15
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java
  69. 27
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml
  70. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IAsyncDataService.java
  71. 21
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java
  72. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java
  73. 15
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java
  74. 181
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java
  75. 27
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java
  76. 815
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  77. 12
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java
  78. 14
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

30
blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java

@ -0,0 +1,30 @@
package org.springblade.common.constant;
import java.util.ArrayList;
import java.util.List;
/**
* 老系统仓库
* 配置允许的仓库ID
*/
public class OldSystemDataPushConfig {
private static List<String> warehourseIds = new ArrayList<>();
static {
warehourseIds.add("30");
warehourseIds.add("38");
warehourseIds.add("124");
}
public static List<String> getWarehourseIdList(){
return warehourseIds;
}
}

5
blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java

@ -8,5 +8,10 @@ public class RedisKeyConstant {
*/
public static final String cache_oupai_key ="cache:oupai-key:";
/**
* 缓存老系统没有解析成功的数据
*/
public static final String CACHE_OLD_SYSTEM_ORDERPACKAGE_KEY ="cache:old-system-orderpackage-key:";
}

4
blade-ops/blade-xxljob-admin/src/main/java/com/xxl/job/admin/JobAdminApplication.java

@ -11,7 +11,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class JobAdminApplication {
public static void main(String[] args) {
BladeApplication.run(LauncherConstant.APPLICATION_XXLJOB_ADMIN_NAME, JobAdminApplication.class, args);
BladeApplication.run("blade-xxljob-pref", JobAdminApplication.class, args);
}
}

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java

@ -264,5 +264,11 @@ public class DistributionReservationEntity extends TenantEntity {
*/
@ApiModelProperty(value = "预留5")
private String reserve5;
/**
* 操作人
*/
@ApiModelProperty(value = "操作人")
@TableField(exist = false)
private String operator ;
}

5
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupListVO.java

@ -34,4 +34,9 @@ public class DistributionStockupListVO implements Serializable {
private Integer realNum;//件数
/**
* 商城名称
*/
private String mallName;
}

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockupVO.java

@ -59,7 +59,7 @@ public class DistributionStockupVO extends DistributionStockupEntity {
private String trainNumber;
//备货区名称
private String stockupArea;
//客户名称
private String consignee;
private String deliveryAddress;
private String deliveryPhone;

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingVO.java

@ -61,7 +61,9 @@ public class DistrilbutionBillLadingVO extends DistrilbutionBillLadingEntity {
private String assignStatusName;
private Integer treatNum; //待
private Integer signedFor ; //已签收
private Integer stopNum; //已
private Integer sumTotal; //总数
@ApiModelProperty(value = "提货状态")
private String conditionName;

38
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/entity/OrderPackageStatusPushFailLogEntity.java

@ -0,0 +1,38 @@
package com.logpm.factory.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("order_package_status_push_fail_log")
@ApiModel(value = "老系统推送失败的包件状态", description = "老系统推送失败的包件状态")
@EqualsAndHashCode(callSuper = true)
public class OrderPackageStatusPushFailLogEntity extends BaseEntity {
@ApiModelProperty(value = "包件码")
private String unitNo;
@ApiModelProperty(value = "仓库ID")
private String warehouseId;
@ApiModelProperty(value = "操作时间")
private String operationTime;
@ApiModelProperty(value = "托盘ID")
private Integer trayId;
@ApiModelProperty(value = "包件数据状态1=到货,2=分拣,3=装车,4=卸车,5=出库,6=配送,7=签收,8=滞留,9=备货")
private String orderPackageStatus;
@ApiModelProperty(value = "数据状态 0 待解析 1 解析成功 2 超过执行查询次数")
private Integer dataStatus;
}

3
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseLog.java

@ -14,6 +14,9 @@ public class WarehouseLog extends BaseEntity {
private String args;
/**
* 1 开单数据推送 2 托盘空置
*/
private Integer type;
private String brand;//品牌

19
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayGoodsClient.java

@ -20,6 +20,7 @@ package com.logpm.warehouse.feign;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
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;
@ -82,4 +83,22 @@ public interface IWarehouseTrayGoodsClient {
@PostMapping(GETTRAYLIST)
List<WarehouseTrayGoodsEntity> getTrayList(@RequestBody WarehouseTrayGoodsEntity warehouseTrayGoodsEntity);
@GetMapping(GETTRAYLIST+"/getTrayNameByOrderPackageCode")
String getTrayNameByOrderPackageCode(@RequestParam String orderCode,@RequestParam Integer type);
/**
* 查询无数据托盘信息
* @param marketId
* @param cargoNumber
* @return
*/
@GetMapping(GETTRAYLIST+"/getTrayInfoByInventory")
String getTrayInfoByInventory(@RequestParam Long marketId,@RequestParam String cargoNumber);
@GetMapping(API_PREFIX+"/findTrayCodeByOrderPackageCode")
WarehouseTrayGoodsEntity findTrayCodeByOrderPackageCode(@RequestParam String unitNo);
@GetMapping(API_PREFIX+"/delTrayGoodsById")
void delTrayGoodsById(@RequestParam Long trayGoodsId, @RequestParam Long warehouseId);
}

7
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java

@ -20,6 +20,7 @@ package com.logpm.warehouse.feign;
import com.alibaba.fastjson.JSONObject;
import com.logpm.warehouse.vo.TrayTypeDataVO;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -57,6 +58,9 @@ public interface IWarehouseTrayTypeClient {
@PostMapping(API_PREFIX+"/orderScanOrderPackageCode")
boolean orderScanOrderPackageCode(@RequestBody Map<String, Object> map);
@PostMapping(API_PREFIX+"/orderScanOrderPackageCodeReturnR")
R orderScanOrderPackageCodeReturnR(@RequestBody Map<String, Object> map);
@PostMapping(API_PREFIX+"/enterZeroOrderByTrayCode")
boolean enterZeroOrderByTrayCode(@RequestBody Map<String, Object> map);
@ -67,4 +71,7 @@ public interface IWarehouseTrayTypeClient {
void deleteZeroOrderByTrayCode(@RequestParam String orderCode, @RequestParam String palletCode, @RequestParam Long wid);
@GetMapping(API_PREFIX+"/changeTrayWarehouseInfo")
void changeTrayWarehouseInfo(@RequestParam String trayCode, @RequestParam Long warehouseId);
@GetMapping(API_PREFIX+"/trayToNull")
void trayToNull(@RequestParam String trayCode);
}

20
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseUpdownGoodsClient.java

@ -85,4 +85,24 @@ public interface IWarehouseUpdownGoodsClient {
@PostMapping(LOCATIONSTOCKLISTINFORMATION)
List<WarehouseUpdownGoodsEntity> getLocationStockListInformation(@RequestBody WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity);
/**
* 查询包件库位信息
* @param orderPackageCode
* @return
*/
@GetMapping(LOCATIONSTOCKLISTINFORMATION+"/getAllocationNameByOrderPackageCode")
String getAllocationNameByOrderPackageCode(@RequestParam String orderPackageCode,@RequestParam Integer type);
/**
* 查询无数据库存品库位信息
* @param marketId
* @param cargoNumber
* @return
*/
@GetMapping(LOCATIONSTOCKLISTINFORMATION+"/getAllocationNameByInventory")
String getAllocationNameByInventory(@RequestParam Long marketId,@RequestParam String cargoNumber);
@GetMapping(API_PREFIX+"/findEntityByOrderPackageCode")
WarehouseUpdownGoodsEntity findEntityByOrderPackageCode(@RequestParam String unitNo);
}

15
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/OrderPackageInfoVO.java

@ -0,0 +1,15 @@
package com.logpm.warehouse.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class OrderPackageInfoVO implements Serializable {
private String waybillNo;
private String orderCode;
private String orderPackageCode;
private Integer num;
}

7
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java

@ -4,6 +4,9 @@ import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class WarehouseTrayTypeVO extends WarehouseTrayTypeEntity {
@ -12,4 +15,8 @@ public class WarehouseTrayTypeVO extends WarehouseTrayTypeEntity {
private String trayName;
private List<OrderPackageInfoVO> packageList = new ArrayList<>();
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java

@ -192,7 +192,7 @@ public class DistributionBillLadingAppController extends BladeController {
@GetMapping("/getReceivedImage")
@ApiOperation(value = "查询自提单签收图片")
public R getReceivedImage(@RequestBody BillLadingAppDTO billLadingAppDTO) {
public R getReceivedImage(BillLadingAppDTO billLadingAppDTO) {
log.debug("=====查询自提单签收图片:{}",billLadingAppDTO);
if (ObjectUtils.isNull(billLadingAppDTO.getBillLadingId())) {
return R.fail(3002, "自提id不能为空 !");

17
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java

@ -1156,7 +1156,11 @@ public class DistributionStockupAppController extends BladeController {
else {
// 2打印处理的扫码
// 查询当前库位上最早入库的指定物料库存品
byId = disStockOrdercodeRecoService.selectStockOrdercodeRecoListByCode(stockupDTO.getCargoNumber(),stockupDTO.getAllocationId());
byId = disStockOrdercodeRecoService.selectStockOrdercodeRecoListByCode(stockupDTO.getCargoNumber(),stockupDTO.getAllocationId(),stockupDTO.getMallName());
// 需要判断当前这个找到的备货批次和计划的批次是否一直,如果不一致 就需要新增一个预约备货记录 扣减当前的数量
// updateStockOrdercodeRecoS(reservationId,byId);
if (Func.isEmpty(byId)){
return Resp.scanFail("当前库位无此物料库存品","当前库位无此物料库存品");
}
@ -1337,11 +1341,14 @@ public class DistributionStockupAppController extends BladeController {
return Resp.scanFail("当前货位没有该包件信息!!", "当前货位没有该包件信息!!");
}
}
//校验 修改库存品数据
R r1 = distributionStockupService.handlingPackages(stockupDTO);
if(r1.getCode() != 200){
Resp.scanFail(r1.getMsg(),r1.getMsg());
//有数数据校验 修改库存品数据
if (byId.getSourceType().equals("1")){
R r1 = distributionStockupService.handlingPackages(stockupDTO);
if(r1.getCode() != 200){
Resp.scanFail(r1.getMsg(),r1.getMsg());
}
}
Integer i = distributionStockupService.selectPackagePrint(stockupDTO);
switch (i) {
case 1:

62
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/bean/MyExcelUtil.java

@ -0,0 +1,62 @@
package com.logpm.distribution.bean;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.alibaba.excel.write.handler.WriteHandler;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel;
import org.apache.commons.codec.Charsets;
import org.springblade.core.excel.util.ExcelUtil;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class MyExcelUtil extends ExcelUtil {
public static <T> void export(HttpServletResponse response, List<DistributionStockupPackageListDetailExcel> stockupList,String fileName) {
try {
response.setContentType("application/vnd.ms-excel");
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(),DistributionStockupPackageListDetailExcel.class).build();
//将清单进行分组,首先区分是否是库存品,其次进行区分订制品和零担
Map<Integer, List<DistributionStockupPackageListDetailExcel>> isInventoryMap = stockupList.stream().collect(Collectors.groupingBy(DistributionStockupPackageListDetailExcel::getIsInventory));
isInventoryMap.forEach((k,v)->{
if (k.equals(0)){
//进行是否零担的区分
Map<String, List<DistributionStockupPackageListDetailExcel>> isZeroMap = v.stream().collect(Collectors.groupingBy(DistributionStockupPackageListDetailExcel::getIsZero));
isZeroMap.forEach((m,n)->{
if (m.equals("0")){
//订制品
WriteSheet writeSheet = EasyExcel.writerSheet(1,"订制品备货清单").head(DistributionStockupPackageListDetailExcel.class).build();
excelWriter.write(n, writeSheet);
}else {
//零担
WriteSheet writeSheet = EasyExcel.writerSheet(2,"零担备货清单").head(DistributionStockupPackageListDetailExcel.class).build();
excelWriter.write(n, writeSheet);
}
});
}else {
//库存品
WriteSheet writeSheet = EasyExcel.writerSheet(3,"库存品备货清单").head(DistributionStockupPackageListDetailExcel.class).build();
excelWriter.write(v, writeSheet);
}
});
excelWriter.finish();
} catch (Exception e) {
throw new RuntimeException("请稍后再试....");
}
}
}

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java

@ -40,9 +40,10 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.entity.User;
import org.springblade.system.feign.IUserClient;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -66,7 +67,7 @@ public class DistributionReservationController extends BladeController {
private final IDistributionReservationService reservationService;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IUserClient userClient;
/**
* 预约列表 详情
@ -103,6 +104,11 @@ public class DistributionReservationController extends BladeController {
lambda.notIn(DistributionReservationEntity::getId,ids);
}
IPage<DistributionReservationEntity> pages = reservationService.page(Condition.getPage(query),lambda );
pages.getRecords().forEach(i ->{
R<User> userR = userClient.userInfoById(i.getCreateUser());
i.setOperator(userR.getData().getName());
});
return R.data(DistributionReservationWrapper.build().pageVO(pages));
}

18
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java

@ -20,10 +20,12 @@ 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.distribution.bean.MyExcelUtil;
import com.logpm.distribution.entity.DistributionStockupEntity;
import com.logpm.distribution.excel.DistributionCityExcel;
import com.logpm.distribution.excel.DistributionMarketExcel;
import com.logpm.distribution.excel.DistributionSelfExcel;
import com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel;
import com.logpm.distribution.service.IDistributionStockupService;
import com.logpm.distribution.service.IDistrilbutionBillLadingService;
import com.logpm.distribution.vo.DistributionStockupVO;
@ -197,6 +199,22 @@ public class DistributionStockupController extends BladeController {
}
}
@GetMapping("/export-StockUpDetail")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出备货数据", notes = "传入paramMap")
public void exportStockUpDetail(@ApiIgnore @RequestParam String stockUpIds, HttpServletResponse response) {
if (Func.isEmpty(stockUpIds)){
log.info("缺少备货任务ID:{}",stockUpIds);
return;
}
List<Long> list = Func.toLongList(stockUpIds);
//查询计划包件的EXCEL列表数据
List<DistributionStockupPackageListDetailExcel> listExcel = distributionStockupService.exportStockUptDetail(list);
MyExcelUtil.export(response,listExcel,"备货清单");
}
/**
* 备货信息表 查询备货人员信息
*/

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/BillLadingAppDTO.java

@ -16,6 +16,7 @@ public class BillLadingAppDTO implements Serializable {
private String pickUpTimeStart;//提货时间开始
private String pickUpTimeEnd;//提货时间结束
private String conditions;//提货时间结束
private Integer orderStatus;//订单状态
@ -24,6 +25,7 @@ public class BillLadingAppDTO implements Serializable {
private Integer scanStatus;//扫码类型
private String orderSelfNumbering;//订单自编码
private String remark;//备注
private Long warehouseId;//仓库ID
private List<DistrilbutionAppBillLadingZeroVO> list; //零担数据集合

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockConfigInfoVO.java

@ -12,6 +12,11 @@ public class StockConfigInfoVO {
*/
private String customer;
/**
* 以备数量
*/
private Integer realityNum;
/**
* 地址
*/

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/StockupDTO.java

@ -14,6 +14,11 @@ public class StockupDTO implements Serializable {
private Integer status;//0未完成 1已完成
/**
* 客户名城
*/
private String customName;
@ApiModelProperty("当前页")
private Integer current;
@ApiModelProperty("每页的数量")
@ -66,4 +71,7 @@ public class StockupDTO implements Serializable {
private Integer packageNum;//包条数量
private String isZero;//零担标识 0否 1是
// 商场名
private String mallName;
}

85
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockupPackageListDetailExcel.java

@ -0,0 +1,85 @@
package com.logpm.distribution.excel;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
@Data
@HeadRowHeight(20)
@ContentRowHeight(18)
public class DistributionStockupPackageListDetailExcel {
/**
* 订单自编号
*/
@ColumnWidth(20)
@ExcelProperty("备货单号")
private String stockupCode;
/**
* 客户
*/
@ColumnWidth(20)
@ExcelProperty("客户")
private String consignee;
/**
* 订单自编号
*/
@ColumnWidth(20)
@ExcelProperty("品牌")
private String brand;
/**
* 订单自编号
*/
@ColumnWidth(50)
@ExcelProperty("订单自编号")
private String orderCode;
@ColumnWidth(20)
@ExcelProperty("产品名称")
private String productName;
@ColumnWidth(20)
@ExcelProperty("物料编码")
private String cargoNumber;
@ColumnWidth(20)
@ExcelProperty("备注")
private String remarks;
@ColumnWidth(20)
@ExcelProperty("计划件数")
private Integer reservationNum;
@ColumnWidth(200)
@ExcelProperty("托盘名称")
private String trayNames;
@ColumnWidth(50)
@ExcelProperty("库位名称")
private String allocationNames;
@ExcelIgnore
private Integer isInventory;
@ExcelIgnore
private Long id;
@ExcelIgnore
private String isZero;
/**
* 包件码
*/
@ExcelIgnore
private String orderPackageCode;
}

30
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml

@ -89,22 +89,20 @@
lds.loadedin_number inventoryNub,
lds.reservation_id reservationId,
lds.received_quantity receivedQuantity,
ldss.assign_status assignStatus,
ldss.stockup_area stockupArea,
ldss.stockup_date stockupDate,
ldss.outbound_date outboundDate,
ldss.forklift_name forkliftName,
ldss.stockup_status stockupStatus,
CASE
WHEN ldss.stockup_status ='10' THEN '待分配'
WHEN ldss.stockup_status ='20' THEN '待备货'
WHEN ldss.stockup_status ='30' THEN '备货中'
WHEN ldss.stockup_status ='40' THEN '已完成'
END stockupStatusName,
(SELECT
ldss.forklift_name
FROM
logpm_distribution_stockup_info AS ldsi
LEFT JOIN logpm_distribution_stockup AS ldss ON ldsi.stockup_id = ldss.id
WHERE
ldsi.reservation_id = lds.reservation_id
) AS forkliftName,
CASE
WHEN ldss.assign_status ='10' THEN '未指派'
WHEN ldss.assign_status ='20' THEN '已指派'
END assignStatusName,
WHEN ldr.stockup_status ='10' THEN '待指派'
WHEN ldr.stockup_status ='20' THEN '待备货'
WHEN ldr.stockup_status ='30' THEN '备货中'
WHEN ldr.stockup_status ='40' THEN '备货完成'
END stockupStatusName,
CASE
WHEN ldr.is_urgent ='1' THEN '否'
else '是'
@ -120,8 +118,6 @@
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id
JOIN logpm_distribution_stockup_info AS ldsi ON ldr.id = ldsi.reservation_id
JOIN logpm_distribution_stockup AS ldss ON ldsi.stockup_id = ldss.id
<where>
lds.is_deleted = 0 and lds.delivery_id = #{id} and ldr.reservation_status != 40
</where>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionLoadscanMapper.xml

@ -233,7 +233,7 @@
SELECT COUNT(ldl.loaded_nub) FROM logpm_distribution_loadscan AS ldl Where ldl.delivery_id = #{deliveryListId} and ldl.is_abnormal_loading = 2
</select>
<select id="selectOrderLoadingNum" resultType="java.lang.Integer">
SELECT sum(loaded_nub) FROM logpm_distribution_loadscan WHERE order_id = #{orderId} and is_deleted = 0 and scan_status != 1
SELECT IF(sum( loaded_nub ) is null,0,sum( loaded_nub )) FROM logpm_distribution_loadscan WHERE order_id = #{orderId} and is_deleted = 0 and scan_status != 1
</select>
<select id="selectOrderSignNum" resultType="java.lang.Integer">
SELECT SUM(received_quantity) FROM logpm_distribution_loadscan WHERE scan_status != 1 AND signfor_state =2 And order_id =#{orderId}

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

@ -128,4 +128,10 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
void updateOrderPackageCodeById(@Param("packageId") Long packageId, @Param("orderPackageStatus") String orderPackageStatus);
/**
* 批量修改包件装车状态
* @param packageIds
* @return
*/
Integer updatePackageListByIds(@Param("packageIds") List<Long> packageIds);
}

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

@ -145,6 +145,11 @@
<if test="param.warehouse !='' and param.warehouse != null">
and lww.name like concat('%',#{param.warehouse},'%')
</if>
<if test="param.orderPackageGroundingStatus !='' and param.orderPackageGroundingStatus != null">
and ldpl.order_package_grounding_status = #{param.orderPackageGroundingStatus}
</if>
<if test="param.warehouseIdList != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(param.warehouseIdList)">
and ldpl.warehouse_id in
<foreach collection="param.warehouseIdList" item="item" open="(" close=")" separator=",">
@ -191,7 +196,7 @@
and lwtg.tray_code = #{param.pallet}
</if>
<if test="param.goodsAllocation !='' and param.goodsAllocation != null">
and lwtg.position_code = #{param.goodsAllocation}
and lwug.position_code = #{param.goodsAllocation}
</if>
<if test="param.conditions !='' and param.conditions != null">
and ldpl.conditions = #{param.conditions}
@ -878,6 +883,12 @@
set order_package_status = #{orderPackageStatus}
where id = #{packageId}
</update>
<update id="updatePackageListByIds">
UPDATE logpm_distribution_parcel_list SET order_package_loading_status = 20 WHERE id IN
<foreach collection="packageIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
</mapper>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -1337,7 +1337,7 @@
LEFT JOIN logpm_distribution_reservation_stocklist AS ldrs ON ldr.id = ldrs.reservation_id
LEFT JOIN logpm_distribution_stock_list AS ldsl ON ldrs.stocklist_id = ldsl.id
WHERE
ldr.id = #{reservationId} AND ldsl.cargo_number = #{cargoNumber}
ldr.id = #{reservationId} AND ldsl.cargo_number = #{cargoNumber} AND ldrs.stock_list_status in ('1','3')
</select>
<select id="selectStockListByReservationIdAndCargoNumber"
resultType="com.logpm.distribution.entity.DistributionReservationStocklistEntity">

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -439,7 +439,7 @@
concat('%',#{param.orderCodeNumLike},'%')
</if>
<if test=" param.waybillNumList != null ">
and ldsa.waybill_number in
and ldpl.waybill_number in
<foreach collection="param.waybillNumList" open="(" item="a" close=")" separator=",">
#{a}
</foreach>
@ -477,7 +477,7 @@
<if test=" param.orderCode != null and param.orderCode != '' ">and ldsa.order_code like
concat('%',#{param.orderCode},'%')
</if>
<if test=" param.waybillNumber != null and param.waybillNumber != '' ">and ldsa.waybill_number like
<if test=" param.waybillNumber != null and param.waybillNumber != '' ">and ldpl.waybill_number like
concat('%',#{param.waybillNumber},'%')
</if>
<if test=" param.mallName != null and param.mallName != '' ">and ldsa.mall_name like
@ -784,6 +784,15 @@
<if test="paramMap.warehouseId != null and paramMap.warehouseId != ''">
and ldsa.warehouse_id = #{paramMap.warehouseId}
</if>
<if test="paramMap.waybillNumber != null and paramMap.waybillNumber != ''"> and ldpl.waybill_number = #{paramMap.waybillNumber} </if>
<if test="paramMap.orderCode != null and paramMap.orderCode != ''"> and ldsa.order_code = #{paramMap.orderCode} </if>
<if test="paramMap.mallName != null and paramMap.mallName != ''"> and ldsa.mall_name = #{paramMap.mallName} </if>
<if test="paramMap.typeService != null and paramMap.typeService != ''"> and ldsa.type_service = #{paramMap.typeService} </if>
<if test="paramMap.consigneeUnit != null and paramMap.consigneeUnit != ''"> and ldsa.consignee_unit = #{paramMap.consigneeUnit} </if>
<if test="paramMap.trainNumber != null and paramMap.trainNumber != ''"> and ldsa.train_number = #{paramMap.trainNumber} </if>
<if test="paramMap.acceptWarehouseName != null and paramMap.acceptWarehouseName != ''"> and ldsa.accept_warehouse_name = #{paramMap.acceptWarehouseName} </if>
<if test="paramMap.tenantId != null and paramMap.tenantId != ''">
and ldsa.tenant_id = #{paramMap.tenantId}
</if>

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java

@ -24,6 +24,7 @@ import com.logpm.distribution.entity.DistributionStockupEntity;
import com.logpm.distribution.excel.DistributionCityExcel;
import com.logpm.distribution.excel.DistributionMarketExcel;
import com.logpm.distribution.excel.DistributionSelfExcel;
import com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.StockupZeroVO;
import org.apache.ibatis.annotations.Mapper;
@ -234,4 +235,18 @@ public interface DistributionStockupMapper extends BaseMapper<DistributionStocku
List<DistributionCityExcel> exportCity(@Param("paramMap") Map<String, Object> paramMap, @Param("idArr") List<String> idArr);
List<DistributionSelfExcel> exportSelf(@Param("paramMap") Map<String, Object> paramMap, @Param("idArr") List<String> idArr);
/**
* 查询备货任务的订单详情
* @param list
* @return
*/
List<DistributionStockupPackageListDetailExcel> exportStockUptOrderDetail(@Param("ids") List<Long> ids);
/**
* 导出备货库存品明细
* @param list
* @return
*/
List<DistributionStockupPackageListDetailExcel> exportStockUptInventoryDetail(@Param("ids")List<Long> list);
}

76
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml

@ -33,6 +33,7 @@
<result column="fix_time" property="fixTime"/>
<result column="assign_time" property="assignTime"/>
</resultMap>
<delete id="deleteStockUpById">
DELETE
FROM logpm_distribution_stockup
@ -333,11 +334,11 @@
lds.type_service typeService,lds.outbound_date outboundDate,lds.stockup_code stockupCode,
COALESCE(GROUP_CONCAT(DISTINCT lwug.position_code SEPARATOR ','), '')stockipAllocation,
COALESCE(GROUP_CONCAT(DISTINCT lwtg.tray_code SEPARATOR ','), '') pallet,
COALESCE(GROUP_CONCAT(DISTINCT ldr.consignee SEPARATOR ','), '') consignee
COALESCE(group_concat(DISTINCT ldsa.mall_name separator ','), '') as consignee
from logpm_distribution_stockup lds
LEFT JOIN logpm_distribution_stockup_info ldsi on ldsi.stockup_id = lds.id
LEFT JOIN logpm_distribution_reservation ldr on ldsi.reservation_id = ldr.id
LEFT JOIN logpm_distrilbution_bill_stock ldbs on ldbs.bill_lading_id = ldsi.reservation_id
LEFT JOIN logpm_distribution_stock_article ldsa on ldsa.id = ldbs.stock_article_id and ldbs.order_status in (1,2)
LEFT JOIN logpm_distribution_parcel_list ldpl on ldpl.stock_article_id = ldbs.stock_article_id
LEFT JOIN logpm_warehouse_tray_goods lwtg on lwtg.association_id = ldpl.id
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldpl.id
@ -397,16 +398,9 @@
</select>
<select id="selectHomeStockupPage" resultType="com.logpm.distribution.vo.DistributionStockupListVO">
select t.* from (
select DISTINCT lds.id , lds.type_service typeService,lds.stockup_status stockupStatus,lds.stockup_area
stockupArea,
<!--(
select GROUP_CONCAT(DISTINCT IFNULL(ldsa.consignee_person,'') SEPARATOR ',')
from logpm_distribution_stockup ds
LEFT JOIN logpm_distribution_stockup_info ldsi on ds.id = ldsi.stockup_id
LEFT JOIN logpm_distribution_reservation_stockarticle ldrs on ldrs.reservation_id = ldsi.reservation_id and ldrs.stock_article_status in (1,3)
LEFT JOIN logpm_distribution_stock_article ldsa on ldsa.id = ldrs.stock_article_id
where ds.id = lds.id
) customer,-->
(
select GROUP_CONCAT(DISTINCT IFNULL(ldr.consignee,'') SEPARATOR ',')
from logpm_distribution_stockup ds
@ -473,6 +467,7 @@
and lds.forklift_id = #{param.userId}
</where>
UNION
select DISTINCT lds.id ,lds.type_service typeService,lds.stockup_status stockupStatus,lds.stockup_area
stockupArea,
(
@ -524,11 +519,18 @@
and lds.assign_status = 20
and lds.forklift_id = #{param.userId}
</where>
) t
<where>
<if test="param.customName !=null and param.customName !=''">
t.customer like concat('%', #{param.customName},'%')
</if>
</where>
</select>
<select id="selectStockupClientInfo" resultType="com.logpm.distribution.vo.DistributionStockupListVO">
select DISTINCT ldr.consignee customer,
lds.stockup_status stockupStatus,
lds.type_service typeService,
ldr.mall_name mallName,
(
select COUNT(ldrs.id)
from logpm_distribution_reservation dr
@ -1155,5 +1157,59 @@
</where>
GROUP BY lds.id;
</select>
<select id="exportStockUptOrderDetail"
resultType="com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel">
SELECT
lds.stockup_code stockupCode,
ldr.consignee consignee,
ldsa.brand brand,
ldsa.order_code orderCode,
ldrs.reservation_num reservationNum,
lds.remarks remarks,
ldrs.is_zero isZero,
0 AS isInventory,
GROUP_CONCAT(DISTINCT ldpl.material_name) AS productName,
GROUP_CONCAT(DISTINCT ldpl.order_package_code) AS orderPackageCode
FROM
logpm_distribution_stockup AS lds
LEFT JOIN logpm_distribution_stockup_info AS ldsi ON lds.id = ldsi.stockup_id
LEFT JOIN logpm_distribution_reservation AS ldr ON ldsi.reservation_id = ldr.id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON ldrs.reservation_id = ldr.id
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldrs.stock_article_id = ldsa.id
LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldrp.stock_article_id = ldrs.stock_article_id AND ldrp.reservation_id = ldr.id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
WHERE
lds.id IN
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
GROUP BY ldrs.id
</select>
<select id="exportStockUptInventoryDetail"
resultType="com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel">
SELECT
lds.stockup_code AS stockupCode,
ldr.consignee AS consignee,
ldsl.order_code AS orderCode,
ldsl.description_goods AS productName,
ldsl.brand_name AS brand,
lds.remarks AS remarks,
ldrs.reservation_num AS reservationNum,
ldsl.id AS id,
ldsl.cargo_number AS cargoNumber,
1 AS isInventory
FROM
logpm_distribution_stockup AS lds
LEFT JOIN logpm_distribution_stockup_info AS ldsi ON lds.id = ldsi.stockup_id
LEFT JOIN logpm_distribution_reservation AS ldr ON ldsi.reservation_id = ldr.id
LEFT JOIN logpm_distribution_reservation_stocklist AS ldrs ON ldr.id=ldrs.reservation_id
LEFT JOIN logpm_distribution_stock_list AS ldsl ON ldsl.id=ldrs.stocklist_id
WHERE
lds.id IN
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>

21
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml

@ -235,11 +235,12 @@
lad.stock_article_id stockArticleId
from logpm_distrilbution_bill_lading lad
<where>
lad.is_deleted = 0 and lad.conditions = 10
<!-- and lad.warehouse_id = #{param.warehouseId} -->
lad.is_deleted = 0
and lad.warehouse_id = #{param.warehouseId}
<if test="param.pickUpTimeStart != null and param.pickUpTimeStart!='' ">and lad.pick_up_time between
#{param.pickUpTimeStart} and #{param.pickUpTimeEnd}
</if>
<if test="param.conditions != null and param.conditions != ''" >and lad.conditions =#{ param.conditions }</if>
</where>
@ -369,7 +370,7 @@
select DISTINCT (select count(conditions)
from logpm_distrilbution_bill_lading
<where>
conditions IN (10) and is_deleted = '0'
conditions IN (10,20) and is_deleted = '0' and warehouse_id = #{param.warehouseId}
<if test="param.startDate != null">and pick_up_time between #{param.startDate} and #{param.entDate}</if>
<if test="param.startDate == null">and DATE(pick_up_time) = CURDATE()</if>
</where>
@ -377,16 +378,18 @@
(select count(conditions)
from logpm_distrilbution_bill_lading
<where>
conditions IN (20) and is_deleted = '0'
conditions IN (30) and is_deleted = '0' and warehouse_id = #{param.warehouseId}
<if test="param.startDate != null">and pick_up_time between #{param.startDate} and #{param.entDate}</if>
<if test="param.startDate == null">and DATE(pick_up_time) = CURDATE()</if>
</where>
) stopNum
from logpm_distrilbution_bill_lading
) stopNum, COUNT(ldbls.id) signedFor,COUNT(ldbp.id) sumTotal
from logpm_distrilbution_bill_lading ldbl
LEFT JOIN logpm_distrilbution_bill_package ldbp on ldbp.bill_lading_id = ldbl.id
LEFT JOIN logpm_distribution_bill_lading_scan ldbls on ldbls.parcel_list_id = ldbp.parce_list_id
<where>
is_deleted = '0'
<if test="param.startDate != null">and pick_up_time between #{param.startDate} and #{param.entDate}</if>
<if test="param.startDate == null">and DATE(pick_up_time) = CURDATE()</if>
ldbl.is_deleted = '0' and ldbl.warehouse_id = #{param.warehouseId}
<if test="param.startDate != null">and ldbl.pick_up_time between #{param.startDate} and #{param.entDate}</if>
<if test="param.startDate == null">and DATE(ldbl.pick_up_time) = CURDATE()</if>
</where>
</select>

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDisStockOrdercodeRecoService.java

@ -57,6 +57,6 @@ public interface IDisStockOrdercodeRecoService extends BaseService<DisStockOrder
* @param allocationId
* @return
*/
DistributionStockListEntity selectStockOrdercodeRecoListByCode(String cargoNumber,Long allocationId);
DistributionStockListEntity selectStockOrdercodeRecoListByCode(String cargoNumber,Long allocationId,String mallName);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java

@ -207,7 +207,7 @@ public interface IDistributionAsyncService {
/**
* 维护订单预约装车状态
* @param parcelListEntity
* @param packageId
*/
void checkReservationStatusAndLoadingStatusByPackage(Long packageId);
@ -258,4 +258,10 @@ public interface IDistributionAsyncService {
* @param orderPackageId
*/
void checkRetentionZeroPackageReservationAndDeliveryInfo(Long reservationId, Long deliveryId, Long orderPackageId, Long orderId);
/**
* 批量修改包件装车状态
* @param updatePackageList
*/
void updatepackageListLoadingStatus(List<DistributionParcelListEntity> updatePackageList,Long warehouseId);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java

@ -25,6 +25,7 @@ import com.logpm.distribution.entity.DistributionStockupEntity;
import com.logpm.distribution.excel.DistributionCityExcel;
import com.logpm.distribution.excel.DistributionMarketExcel;
import com.logpm.distribution.excel.DistributionSelfExcel;
import com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel;
import com.logpm.distribution.vo.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -274,4 +275,11 @@ public interface IDistributionStockupService extends BaseService<DistributionSto
* @param stockupDTO
*/
R handlingPackages(StockupDTO stockupDTO);
/**
* 查询备货详情
* @param list
* @return
*/
List<DistributionStockupPackageListDetailExcel> exportStockUptDetail(List<Long> list);
}

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

@ -77,7 +77,7 @@ public class DisStockOrdercodeRecoServiceImpl extends BaseServiceImpl<DisStockOr
}
@Override
public DistributionStockListEntity selectStockOrdercodeRecoListByCode(String cargoNumber,Long allocationId) {
public DistributionStockListEntity selectStockOrdercodeRecoListByCode(String cargoNumber,Long allocationId,String mallName) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
return null;
@ -89,12 +89,15 @@ public class DisStockOrdercodeRecoServiceImpl extends BaseServiceImpl<DisStockOr
warehouseUpdownGoodsEntity.setWarehouseId(myCurrentWarehouse.getId());
warehouseUpdownGoodsEntity.setAssociationType("4");
warehouseUpdownGoodsEntity.setAssociationValue(cargoNumber);
warehouseUpdownGoodsEntity.setMarketName(mallName);
List<WarehouseUpdownGoodsEntity> locationStockListInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity);
if (Func.isNotEmpty(locationStockListInformation)){
List<String> IncomingBatchs = locationStockListInformation.stream().map(WarehouseUpdownGoodsEntity::getIncomingBatch).collect(Collectors.toList());
List<DistributionStockListEntity> distributionStockListEntity = distributionStockListMapper.selectList(Wrappers.<DistributionStockListEntity>query().lambda()
.eq(DistributionStockListEntity::getCargoNumber, cargoNumber)
.eq(DistributionStockListEntity::getMarketName,mallName)
.in(DistributionStockListEntity::getIncomingBatch, IncomingBatchs)
.orderByAsc(DistributionStockListEntity::getCreateTime)
);
if (Func.isNotEmpty(distributionStockListEntity)){

20
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -905,12 +905,9 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
@Override
public void checkOrderLoadingStatus(Long packageId) {
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(packageId);
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
distributionParcelListService.updateById(parcelListEntity);
if (Func.isNotEmpty(parcelListEntity)) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId());
public void checkOrderLoadingStatus(Long orderId) {
if (Func.isNotEmpty(orderId)) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(orderId);
Integer orderLoadingNum = distributionLoadscanMapper.selectOrderLoadingNum(stockArticleEntity.getId());
if (Func.isNotEmpty(orderLoadingNum) && orderLoadingNum > 0) {
if (stockArticleEntity.getTotalNumber() == orderLoadingNum) {
@ -1342,6 +1339,17 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
maintenanceDeliveryPackageNum(deliveryId);
}
@Override
public void updatepackageListLoadingStatus(List<DistributionParcelListEntity> updatePackageList,Long warehouseId) {
List<Long> packageIds = updatePackageList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList());
Integer i = distributionParcelListMapper.updatePackageListByIds(packageIds);
String collect = updatePackageList.stream().map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(","));
warehouseUpdownTypeClient.downPackageOrDelTray(collect,warehouseId);
// 进行批量下架
}
/**
* 维护配送数量和状态
*

205
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -74,6 +74,7 @@ import org.springblade.common.constant.orderpackage.OrderPackageReservationStatu
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
import org.springblade.common.constant.reservation.*;
import org.springblade.common.constant.signing.SignforStatusConstant;
import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.exception.CustomerException;
@ -85,6 +86,7 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -157,6 +159,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
private final IDistributionParcelNumberService distributionParcelNumberService;
private final IWarehouseTrayGoodsClient warehouseTrayGoodsClient;
private final IWarehouseWaybillClient warehouseWaybillClient;
private final BladeRedis bladeRedis;
// 自提mapper
private final DistrilbutionBillLadingMapper distrilbutionBillLadingMapper;
@ -1402,6 +1405,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// ----------------------------2023-09-06 PDA一键装车调整----------------------------------------
//1、查询该客户下是否还存在需要装车的包件和库存品
StringBuilder orderPackages = new StringBuilder();
//查询配送任务配车司机信息
DistributionDeliveryListEntity distributionDeliveryListEntity = this.getById(distrilbutionloadingscanDTO.getDeliveryId());
@ -1437,7 +1441,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
boolean inventoryStockUpFlag = stockListDetailEntityList.stream().anyMatch(l -> Func.isEmpty(l.getStockPackageCode()));
if (inventoryStockUpFlag) {
log.error("##################库存品未备货");
return Resp.scanFail("操作失败", "存在库存品未备货");
return Resp.scanFail("存在库存品未备货", "存在库存品未备货");
// return R.fail("该客户存在库存品暂未备货 一键装车失败!!!");
}
Map<String, List<DistributionReservationStockarticleEntity>> allStockArticle = reservationStockarticleEntityList.stream().filter(f -> Func.isNotEmpty(f.getIsZero())).collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getIsZero));
@ -1447,6 +1451,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
case "0":
//订制品
// v.forEach(ord -> {
List<DistributionParcelListEntity> updatePackageList = new ArrayList<>();
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageByReservationAndStockArticle(distrilbutionloadingscanDTO.getReservationId(), reservationStockarticleEntity.getStockArticleId());
for (DistributionParcelListEntity parcelListEntity : parcelListEntities) {
DistributionLoadscanEntity packageLoadingScan = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()).eq(DistributionLoadscanEntity::getOrderId, reservationStockarticleEntity.getStockArticleId()).eq(DistributionLoadscanEntity::getPackageId, parcelListEntity.getId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
@ -1503,12 +1508,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//扣减在库订单的在库数量
Integer k = distributionStockArticleMapper.deductionHandQuantity(loadscanEntity.getOrderId(), loadscanEntity.getLoadedNub());
warehouseUpdownTypeClient.downPackageOrDelTray(parcelListEntity.getOrderPackageCode(), myCurrentWarehouse.getId());
distributionAsyncService.checkOrderLoadingStatus(parcelListEntity.getId());
distributionAsyncService.checkOrderLoadingStatus(parcelListEntity.getStockArticleId());
updatePackageList.add(parcelListEntity);
//拼接包条码
orderPackages.append(parcelListEntity.getOrderPackageCode()).append(",");
}
//异步修改包件状态
// distributionAsyncService.changeMarketDeliveryListStatus(loadscanEntity.getOrderPackageCode(), loadscanEntity.getDeliveryId());
}
distributionAsyncService.updatepackageListLoadingStatus(updatePackageList,myCurrentWarehouse.getId());
// });
break;
case "1":
@ -1713,6 +1723,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
///包件下架
return Resp.scanSuccess("操作成功", "装车成功");
}
@ -2659,9 +2671,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
int trayNum = 0;
if (Func.isNotEmpty(distributionParcelListEntities)) {
List<String> packageCodeList = distributionParcelListEntities.stream().map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.toList());
List<WarehouseTrayGoodsEntity> collect = trayList.stream().distinct().collect(Collectors.toList());
for (WarehouseTrayGoodsEntity warehouseTrayGoodsEntity : collect) {
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(warehouseTrayGoodsEntity.getTrayId().toString(), warehouseTrayGoodsEntity.getTrayCode());
// List<WarehouseTrayGoodsEntity> collect = trayList.stream().distinct().collect(Collectors.toList());
List<Long> trayIds = trayList.stream().map(WarehouseTrayGoodsEntity::getTrayId).distinct().collect(Collectors.toList());
for (Long trayId : trayIds) {
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(trayId.toString(), "");
//判断该托盘上的货物都存在于计划之中
boolean isLoadingTrayFlag = trayIdList.stream().map(WarehouseTrayGoodsEntity::getAssociationValue).allMatch(t -> packageCodeList.contains(t));
if (isLoadingTrayFlag) {
@ -3990,24 +4003,87 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override
@Transactional
public R<?> updateMarketDeliveryList(DistributionDeliveryListDTO deliveryListDTO) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
return R.fail(403,"未授权!!!");
}
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryListDTO.getId());
//查询原来的预约信息,
List<DistributionReservationEntity> reservationDTOS = baseMapper.selectReservationByDeliveryListId(deliveryListDTO.getId());
List<DistributionReservationDTO> reservationInfos = deliveryListDTO.getReservationInfos();
List<Long> newReservationIds = reservationInfos.stream().map(DistributionReservationDTO::getId).collect(Collectors.toList());
List<DistributionReservationEntity> distributionReservationEntities = distributionReservationMapper.selectList(Wrappers.<DistributionReservationEntity>query().lambda().in(DistributionReservationEntity::getId, newReservationIds));
List<DistributionReservationEntity> needStockUpReservationList = distributionReservationEntities.stream().filter(r -> r.getStockupStatus().equals(ReservationStockupStatusConstant.weibeihuo.getValue())).collect(Collectors.toList());
DistributionStockupEntity stockupEntity = null;
if (Func.isNotEmpty(needStockUpReservationList)){
//需要进行备货的预约列表
stockupEntity = new DistributionStockupEntity();
stockupEntity.setAssignStatus(StockAssignStatusConstant.weizhipai.getValue());
stockupEntity.setStockupStatus(StockupStatusConstant.weibeihuo.getValue());
//这里就需要构建备货任务中间表
BladeUser user = AuthUtil.getUser();
stockupEntity.setTypeService(DistributionTypeConstant.shipie.getValue());
//编码生成规则 BH+仓库编码+年月日+序号00001
stockupEntity.setStockupCode(bianMa());
stockupEntity.setStockupStatus(StockupStatusConstant.weibeihuo.getValue());
stockupEntity.setStockupDate(new Date());
stockupEntity.setIsDeleted(0);
stockupEntity.setStatus(1);
stockupEntity.setCreateUser(user.getUserId());
stockupEntity.setCreateDept(Long.parseLong(user.getDeptId()));
stockupEntity.setCreateTime(new Date());
// stockupEntity.setOutboundDate(new Date());
stockupEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionStockupMapper.insert(stockupEntity);
for (DistributionReservationEntity distributionReservationEntity : needStockUpReservationList) {
DistributionStockupInfoEntity distributionStockupInfoEntity = new DistributionStockupInfoEntity();
distributionStockupInfoEntity.setReservationId(distributionReservationEntity.getId());
distributionStockupInfoEntity.setStockupId(stockupEntity.getId());
distributionStockupInfoEntity.setStockUpType(distributionReservationEntity.getDeliveryType());
distributionStockupInfoService.save(distributionStockupInfoEntity);
}
}
//这里暂时不考虑出现新增的情况
Map<Long, List<DistributionReservationEntity>> oldReservation = reservationDTOS.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getId));
Map<Long, List<DistributionReservationDTO>> newReservation = reservationInfos.stream().collect(Collectors.groupingBy(DistributionReservationDTO::getId));
Map<Long, List<DistributionReservationEntity>> newReservation = distributionReservationEntities.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getId));
//重新统计包件数量
AtomicInteger packageTotal = new AtomicInteger();
//重新统计库存品配送数量
AtomicInteger inventoryTotal = new AtomicInteger();
//客户数量
AtomicInteger clientTotal = new AtomicInteger();
newReservation.forEach((k, v) -> {
clientTotal.getAndIncrement();
if (!Func.isEmpty(oldReservation.get(k))) {
//统计配送包件总数量
packageTotal.getAndAdd(v.get(0).getReservationNum());
//统计配送库存品总数量
inventoryTotal.getAndAdd(v.get(0).getReservationStockListNum());
if (Func.isNotEmpty(oldReservation.get(k))){
//存在
//进行统计
oldReservation.remove(k);
packageTotal.getAndAdd(v.get(0).getReservationNum());
}else {
//新增
DistributionReservationEntity distributionReservationEntity = v.get(0);
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity();
// String trainNumberMa = trainNumberMa();
distributionSignforEntity.setTrainNumber(deliveryListEntity.getTrainNumber());
distributionSignforEntity.setReservationId(distributionReservationEntity.getId());
distributionSignforEntity.setDeliveryId(deliveryListEntity.getId());
distributionSignforEntity.setSigningStatus(SignforStatusConstant.daiqianshou.getValue());
distributionSignforEntity.setDriverSigning(SignforStatusConstant.daiqianshou.getValue());
distributionSignforService.save(distributionSignforEntity);
distributionReservationEntity.setReservationStatus(ReservationStatusConstant.daipeisong.getValue());
distributionReservationMapper.updateById(distributionReservationEntity);
}
});
oldReservation.forEach((m, n) -> {
//这里就是取消的预约单,进行状态回退
DistributionReservationEntity reservationEntity = n.get(0);
@ -4076,45 +4152,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
deliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
deliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length() - 1).toString());
}
//查询出原来配送信息的备货任务
// DistributionStockupVO deliveryStockupInfo = distributionStockupMapper.getDeliveryStockupInfo(deliveryListEntity.getId());
//这里查询出该备货任务的执行情况,如果该任务处于已完成的状态需要创建新的备货任务,其他的备货状态则是进行备货任务的修改
// DistributionStockupDTO stockupInfo = deliveryListDTO.getStockupInfo();
//前端进行校验这个备货任务是否发生改变,没有发生改变则不需要传递此参数
// if (!Func.isEmpty(stockupInfo)) {
// if (Func.isNotEmpty(stockupInfo.getForkliftName())) {
// deliveryStockupInfo.setAssignStatusName(StockAssignStatusConstant.weizhipai.getValue());
// deliveryStockupInfo.setStockupStatus(StockupStatusConstant.weibeihuo.getValue());
// deliveryStockupInfo.setForkliftName(stockupInfo.getForkliftName());
// deliveryStockupInfo.setForkliftId(stockupInfo.getForkliftId());
// //不存在备货人员,此时该任务的状态处于未指派、待分配的状态
// } else {
// deliveryStockupInfo.setAssignStatusName(StockAssignStatusConstant.yizhipai.getValue());
// }
// if (Func.isNotEmpty(stockupInfo.getGoodsAreaId())) {
// deliveryStockupInfo.setGoodsAreaId(stockupInfo.getGoodsAreaId());
// deliveryStockupInfo.setStockupArea(stockupInfo.getGoodsAreaName());
// }
//// ---------------------------2023-09-06 取消班组职能字段维护------------------------------------
//// if (Func.isNotEmpty(stockupInfo.getLoaderId())) {
//// deliveryStockupInfo.setLoaderId(stockupInfo.g 0etLoaderId());
//// deliveryStockupInfo.setLoaderName(stockupInfo.getLoaderName());
//// }
//// if (Func.isNotEmpty(stockupInfo.getLoadAndUnload())) {
//// deliveryStockupInfo.setTeamResponsibility(stockupInfo.getLoadAndUnload());
//// }
// if (Func.isNotEmpty(stockupInfo.getStockupDate())) {
// deliveryStockupInfo.setStockupDate(stockupInfo.getStockupDate());
// }
// if (Func.isNotEmpty(stockupInfo.getRemarks())) {
// deliveryStockupInfo.setRemarks(stockupInfo.getRemarks());
// }
//// if (Func.isNotEmpty(stockupInfo.getRemarks())) {
//// deliveryStockupInfo.setRemarks(stockupInfo.getRemarks());
//// }
// deliveryStockupInfo.setOutboundDate(stockupInfo.getOutboundDate());
// distributionStockupMapper.updateById(deliveryStockupInfo);
// }
if (Func.isNotEmpty(deliveryListDTO.getRemarks())) {
deliveryListEntity.setRemarks(deliveryListDTO.getRemarks());
}
@ -4130,6 +4167,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(deliveryListDTO.getFee())) {
deliveryListEntity.setTaskTime(deliveryListDTO.getTaskTime());
}
deliveryListEntity.setDeliveryNumber(packageTotal.get());
deliveryListEntity.setInventoryNub(inventoryTotal.get());
// if (Func.isNotEmpty(stockupInfo.getUnloaderName()) && Func.isNotEmpty(stockupInfo.getUnloaderId())) {
// deliveryListEntity.setUnloadingTeamId(stockupInfo.getUnloaderId());
// deliveryListEntity.setUnloadingTeamName(stockupInfo.getUnloaderName());
@ -5158,7 +5197,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//扣减订单在库数量
distributionStockArticleMapper.deductionHandQuantity(loadscanEntity.getOrderId(), loadscanEntity.getLoadedNub());
//异步维护此异常装车包件的订单状态
distributionAsyncService.checkOrderLoadingStatus(parcelListEntity.getId());
distributionAsyncService.checkOrderLoadingStatus(parcelListEntity.getStockArticleId());
DistributionSignforEntity signforEntity = distributionSignforService.getOne(Wrappers.<DistributionSignforEntity>query().lambda().eq(DistributionSignforEntity::getReservationId, reservationEntity.getId()).eq(DistributionSignforEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()));
if (Func.isNotEmpty(signforEntity)) {
//标识该客户存在异常装车包件,为了后续的异常装车审核
@ -6418,4 +6457,72 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
private String bianMa() {
// String code ="BH";
StringBuilder sb = new StringBuilder();
sb.append("BH");
BladeUser user = AuthUtil.getUser();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String format1 = format.format(new Date());
BasicdataWarehouseEntity warehouseByDepartment = warehouseClient.getWarehouseByDepartment(user.getDeptId());
if (ObjectUtil.isNotEmpty(warehouseByDepartment)) {
sb.append(warehouseByDepartment.getWarehouseCode());
sb.append(format1);
String s = "BH" + warehouseByDepartment.getWarehouseCode();
String s1 = jiShuan(s);
sb.append(s1);
} else {
sb.append("00000");
sb.append(format1);
String s = "BH" + "00000";
String s1 = jiShuan(s);
sb.append(s1);
}
return sb.toString();
}
private String jiShuan(String s) {
String n = "00001";
if (Func.notNull(bladeRedis.get(s))) {
Object o1 = bladeRedis.get(s);
int anInt = Integer.parseInt(String.valueOf(o1));
if (anInt < 10) {
if (anInt + 1 == 10) {
n = String.format("000%d", anInt + 1);
} else {
n = String.format("0000%d", anInt + 1);
}
} else if (anInt < 100) {
if (anInt + 1 == 100) {
n = String.format("00%d", anInt + 1);
} else {
n = String.format("000%d", anInt + 1);
}
} else if (anInt < 1000) {
if (anInt + 1 == 1000) {
n = String.format("0%d", anInt + 1);
} else {
n = String.format("00%d", anInt + 1);
}
} else if (anInt < 10000) {
if (anInt + 1 == 10000) {
n = String.format("%d", anInt + 1);
} else {
n = String.format("0%d", anInt + 1);
}
} else {
n = String.valueOf(anInt + 1);
}
bladeRedis.set(s, n);
return n;
} else {
bladeRedis.set(s, n);
return n;
}
}
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -1769,6 +1769,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
DistributionReservationStocklistEntity reservationStocklistEntity = new DistributionReservationStocklistEntity();
DistributionStockListDTO distributionStockListDTO = d.get(0);
if (Func.isEmpty(oleInventoryList.get(c))) {
mallName.add(distributionStockListDTO.getMarketName());
mallId.add(distributionStockListDTO.getMarketId());
//新增库存品
reservationStocklistEntity.setStocklistId(distributionStockListDTO.getId());
reservationStocklistEntity.setReservationId(id);

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -54,6 +54,7 @@ import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant;
import org.springblade.common.constant.Inventory.InventorySigningStatusConstant;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant;
import org.springblade.common.constant.loading.LoadScanSigningStatusConstant;
import org.springblade.common.constant.loading.LoadingIsInsertConstant;
import org.springblade.common.constant.loading.LoadingStatusConstant;
@ -2112,6 +2113,13 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionReservationMapper.updateById(reservationEntity);
//维护配送任务
distributionAsyncService.checkDeliverySignStatusByReservation(distributionSignforEntity.getDeliveryId());
distributionDeliveryListEntity.setDeliveryListLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
if (distributionSignfor.getIsClerk()){
distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue());
}else {
distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue());
}
distributionDeliveryListMapper.updateById(distributionDeliveryListEntity);
LambdaUpdateWrapper<DistributionSignforEntity> set = new UpdateWrapper<DistributionSignforEntity>().lambda()
.eq(DistributionSignforEntity::getId, distributionSignforEntity.getId())
.set(StringUtils.isNotBlank(distributionSignfor.getDeliverySignPictures()), DistributionSignforEntity::getDeliverySignPictures, distributionSignfor.getDeliverySignPictures())
@ -2648,6 +2656,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscanAbnormalService.updateById(distributionLoadscanAbnormalEntity);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() + distributionLoadscanAbnormalEntity.getLoadingQuantity());
distributionReservationMapper.updateById(reservationEntity);
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getReservationId, distributionLoadscanAbnormalEntity.getReservationId())
.eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanAbnormalEntity.getDeliveryListId())
.eq(DistributionLoadscanEntity::getPackageId, distributionLoadscanAbnormalEntity.getPackageId())
.eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanAbnormalEntity.getPackageCode())
);
loadscanEntity.setIsAbnormalLoading(1);
distributionLoadscanService.updateById(loadscanEntity);
}
//单个审核
} else {

108
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java

@ -40,6 +40,7 @@ import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionCityExcel;
import com.logpm.distribution.excel.DistributionMarketExcel;
import com.logpm.distribution.excel.DistributionSelfExcel;
import com.logpm.distribution.excel.DistributionStockupPackageListDetailExcel;
import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.*;
@ -54,6 +55,8 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.CodeDesEnum;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant;
import org.springblade.common.constant.pda.PdaAudioLingoStatus;
import org.springblade.common.constant.stocklist.StockLockingStatusConstant;
@ -199,6 +202,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
@Autowired
private DistributionStockListInfoMapper distributionStockListInfoMapper;
@Override
public IPage<DistributionStockupVO> selectDistributionStockupPage(IPage<DistributionStockupVO> page, DistributionStockupVO distributionStockup) {
return page.setRecords(baseMapper.selectDistributionStockupPage(page, distributionStockup));
@ -286,8 +290,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
distributionStockupEntity.setTenantId(AuthUtil.getTenantId());
if (distributionStockupEntity.getTypeService().equals("3")) {
//自
return baseMapper.pageOweList(page, distributionStockupEntity);
} else {
//商 市
return baseMapper.pageList(page, distributionStockupEntity);
}
@ -1198,11 +1204,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
map.put("name", allocationInforById.getQrCode());
distributionStockupStockListVO.getAllocationList().add(map);
}
}else {
log.info("##################库存品信息:{}",list);
return null;
}
// 查询货位信息
}
@ -2904,7 +2906,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
log.info("#############缺少库位ID:{}",stockupDTO.getAllocationId());
return null;
}
//根据物料查询出多个库存品信息
List<DistributionStockListEntity> distributionStockListEntities = distributionStockListMapper.selectList(Wrappers.<DistributionStockListEntity>query().lambda()
.eq(DistributionStockListEntity::getCargoNumber, stockupDTO.getCargoNumber())
@ -2962,12 +2963,28 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
stockConfigInfoVO.setAddress(reservationEntity.getDeliveryAddress()); //地址
List<StockConfigOrderPackageListVO> ls = new ArrayList<>();
//过滤出同物料库存品的ID信息
List<Long> stockListIds = distributionStockListEntities.stream().map(DistributionStockListEntity::getId).collect(Collectors.toList());
//查询该物料的库存品信息
List<DistributionReservationStocklistEntity> reservationStocklistEntityList = distributionReservationStocklistService.list(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
.eq(DistributionReservationStocklistEntity::getReservationId, stockupDTO.getReservationId())
.in(DistributionReservationStocklistEntity::getStocklistId, stockListIds)
.notIn(DistributionReservationStocklistEntity::getStockListStatus, 2)
);
stockConfigInfoVO.setRealityNum(0);
if (Func.isNotEmpty(reservationStocklistEntityList)){
int realityNum = reservationStocklistEntityList.stream().mapToInt(DistributionReservationStocklistEntity::getRealityNum).sum();
stockConfigInfoVO.setRealityNum(realityNum); //地址
}
LambdaQueryWrapper<DistributionStockEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DistributionStockEntity::getReservationId, stockupDTO.getReservationId());
lambdaQueryWrapper.eq(DistributionStockEntity::getAllocationId, stockupDTO.getAllocationId());
lambdaQueryWrapper.eq(DistributionStockEntity::getType, 2);
lambdaQueryWrapper.eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId());
lambdaQueryWrapper.in(DistributionStockEntity::getStockListId, stockListIds);
List<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper);
for (DistributionStockEntity distributionStockEntity : distributionStockEntities) {
StockConfigOrderPackageListVO stockConfigOrderPackageListVO = new StockConfigOrderPackageListVO();
@ -3116,4 +3133,85 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
}
return R.success("成功!!");
}
@Override
public List<DistributionStockupPackageListDetailExcel> exportStockUptDetail(List<Long> list) {
List<DistributionStockupPackageListDetailExcel> detail = new ArrayList<>();
List<DistributionStockupPackageListDetailExcel> stockupPackageListDetailExcels = baseMapper.exportStockUptOrderDetail(list);
if (Func.isNotEmpty(stockupPackageListDetailExcels)){
for (DistributionStockupPackageListDetailExcel stockupPackageListDetailExcel : stockupPackageListDetailExcels) {
if (stockupPackageListDetailExcel.getIsZero().equals(IsOrNoConstant.no.getValue())){
//订制品订单 查询托盘和库位
String trayName = warehouseTrayGoodsClient.getTrayNameByOrderPackageCode(stockupPackageListDetailExcel.getOrderPackageCode(),3);
if (Func.isNotBlank(trayName)){
stockupPackageListDetailExcel.setTrayNames(trayName);
}
String allocationName = warehouseUpdownGoodsClient.getAllocationNameByOrderPackageCode(stockupPackageListDetailExcel.getOrderPackageCode(),3);
if (Func.isNotBlank(allocationName)){
stockupPackageListDetailExcel.setAllocationNames(allocationName);
}
}else {
//零担
String trayName = warehouseTrayGoodsClient.getTrayNameByOrderPackageCode(stockupPackageListDetailExcel.getOrderCode(),1);
if (Func.isNotBlank(trayName)){
stockupPackageListDetailExcel.setTrayNames(trayName);
}
String allocationName = warehouseUpdownGoodsClient.getAllocationNameByOrderPackageCode(stockupPackageListDetailExcel.getOrderCode(),1);
if (Func.isNotBlank(allocationName)){
stockupPackageListDetailExcel.setAllocationNames(allocationName);
}
}
}
detail.addAll(stockupPackageListDetailExcels);
}
//库存品
List<DistributionStockupPackageListDetailExcel> stockupInventoryListDetailExcels = baseMapper.exportStockUptInventoryDetail(list);
boolean flag = stockupInventoryListDetailExcels.stream().allMatch(r -> Func.isNotEmpty(r.getId()));
if (flag){
if (Func.isNotEmpty(stockupInventoryListDetailExcels)){
for (DistributionStockupPackageListDetailExcel stockupInventoryListDetailExcel : stockupInventoryListDetailExcels) {
//查询库存品托盘信息
DistributionStockListEntity distributionStockLisEntity = distributionStockListMapper.selectById(stockupInventoryListDetailExcel.getId());
if (distributionStockLisEntity.getSourceType().equals("1")){
//转
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getOrderCode, distributionStockLisEntity.getIncomingBatch())
.eq(DistributionParcelListEntity::getOrderPackageStockupStatus, OrderPackageStockupStatusConstant.daibeihuo.getValue())
.eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue())
);
if (Func.isNotEmpty(parcelListEntities)){
String orderpackageCode = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(","));
//订制品订单 查询托盘和库位
String trayName = warehouseTrayGoodsClient.getTrayNameByOrderPackageCode(orderpackageCode,3);
if (Func.isNotBlank(trayName)){
stockupInventoryListDetailExcel.setTrayNames(trayName);
}
String allocationName = warehouseUpdownGoodsClient.getAllocationNameByOrderPackageCode(orderpackageCode,3);
if (Func.isNotBlank(allocationName)){
stockupInventoryListDetailExcel.setAllocationNames(allocationName);
}
}
}else {
//导
String trayName = warehouseTrayGoodsClient.getTrayInfoByInventory(distributionStockLisEntity.getMarketId(),distributionStockLisEntity.getCargoNumber());
if (Func.isNotBlank(trayName)){
stockupInventoryListDetailExcel.setTrayNames(trayName);
}
String allocationName = warehouseUpdownGoodsClient.getAllocationNameByInventory(distributionStockLisEntity.getMarketId(),distributionStockLisEntity.getCargoNumber());
if (Func.isNotBlank(allocationName)){
stockupInventoryListDetailExcel.setAllocationNames(allocationName);
}
}
}
detail.addAll(stockupInventoryListDetailExcels);
}
}
return detail;
}
}

79
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -342,7 +342,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
//新增
distrilbutionBillLading.setConsignee("1");
// distrilbutionBillLading.setConditions("1");
distrilbutionBillLading.setStockupCode(distributionReservationService.bianMa());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
String format = dateFormat.format(new Date());
@ -1690,6 +1690,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
@Override
public DistrilbutionBillLadingVO listNum(Map<String, Object> distrilbutionBillLading) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(ObjectUtils.isNotNull(myCurrentWarehouse)){
distrilbutionBillLading.put("warehouse_id",myCurrentWarehouse.getId());
}
DistrilbutionBillLadingDTO billLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingDTO.class);
DistrilbutionBillLadingVO billLadingVO = baseMapper.getBillLadingNum(billLadingEntity); //查询
@ -1698,7 +1702,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
/**
* 查询详细信息
* 查询详细信息 1 2 3 4 5 6 7 8 9
*
* @param id
* @return
@ -2090,49 +2094,50 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
*/
@Override
public R updateReceivedImage(BillLadingAppDTO billLadingAppDTO) {
//查询全部的图片
List<DistributionPrintEntity> printEntityList = distributionPrintService.list(Wrappers.<DistributionPrintEntity>query().lambda()
.eq(DistributionPrintEntity::getBillLadingId, billLadingAppDTO.getBillLadingId())
);
List<BillLadingAppDTO.Print> addList = new ArrayList<>(); //添加的图片
ListIterator<DistributionPrintEntity> distributionPrintEntityListIterator = printEntityList.listIterator();
List<BillLadingAppDTO.Print> aid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片
List<BillLadingAppDTO.Print> uid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNotNull(i.getId())).collect(Collectors.toList()); //保存的图片
//添加图片
billLadingAppDTO.getPrintList().stream().collect(Collectors.groupingBy(BillLadingAppDTO.Print::getState))
.forEach((k,v) ->{
List<BillLadingAppDTO.Print> aid = v.stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片
addList.addAll(aid);
//处理不需要的图片
while (distributionPrintEntityListIterator.hasNext()){
for (BillLadingAppDTO.Print q : uid) {
DistributionPrintEntity next = distributionPrintEntityListIterator.next();
if(q.getId().toString().equals(next.getId().toString())){
distributionPrintEntityListIterator.remove();
}
List<BillLadingAppDTO.Print> uid = v.stream().filter(i -> ObjectUtils.isNotNull(i.getId())).collect(Collectors.toList()); //保存的图片
uid.forEach(q ->{
//处理不需要的图片
while (distributionPrintEntityListIterator.hasNext()){
DistributionPrintEntity next = distributionPrintEntityListIterator.next();
if(q.getId().equals(next.getId())){
distributionPrintEntityListIterator.remove();
}
}
});
});
//清除需要删除的图片
}
}
//清除需要删除的图片
if(!printEntityList.isEmpty()){
List<Long> collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList());
distributionPrintService.deleteLogic(collect);
}
//新增
List<DistributionPrintEntity> list2 = new ArrayList<>();
billLadingAppDTO.getPrintList().forEach(print -> {
DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity();
distributionPrintEntity.setBillLadingId(billLadingAppDTO.getBillLadingId());
distributionPrintEntity.setGenre(Integer.parseInt(print.getState()));
distributionPrintEntity.setSite(print.getUrl());
distributionPrintEntity.setSiteName(print.getName());
list2.add(distributionPrintEntity);
});
return R.status(distributionPrintService.saveBatch(list2));
if(!aid.isEmpty()){
//新增
List<DistributionPrintEntity> list2 = new ArrayList<>();
aid.forEach(print -> {
DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity();
distributionPrintEntity.setBillLadingId(billLadingAppDTO.getBillLadingId());
distributionPrintEntity.setGenre(Integer.parseInt(print.getState()));
distributionPrintEntity.setSite(print.getUrl());
distributionPrintEntity.setSiteName(print.getName());
list2.add(distributionPrintEntity);
});
distributionPrintService.saveBatch(list2);
if(ObjectUtils.isNotNull(billLadingAppDTO.getRemark())){
DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity();
billLadingEntity.setId(billLadingAppDTO.getBillLadingId());
billLadingEntity.setRemark(billLadingAppDTO.getRemark());
baseMapper.updateById(billLadingEntity);
}
return R.status(true);
}
return R.status(false);
}
/**
@ -2146,7 +2151,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
List<DistributionPrintEntity> list = distributionPrintService.list(Wrappers.<DistributionPrintEntity>query().lambda()
.eq(DistributionPrintEntity::getBillLadingId, billLadingAppDTO.getBillLadingId())
);
Map<String,List<BillLadingAppDTO.Print>> map = new HashMap<>();
Map<String,Object> map = new HashMap<>();
if(!list.isEmpty()){
List<BillLadingAppDTO.Print> list1 = new ArrayList<>();
list.forEach(i ->{
@ -2158,9 +2163,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
list1.add(print);
});
map.put("list",list1);
//查询提货备注
DistrilbutionBillLadingEntity billLadingEntity = baseMapper.selectById(billLadingAppDTO.getBillLadingId());
map.put("remark",billLadingEntity.getRemark());
return R.data(map);
}
map.put("list",null);
map.put("remark",null);
return R.data(map);
}

30
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.java

@ -0,0 +1,30 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.factory.comfac.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
/**
* 老系统推送包件状态失败的记录表
* @author zhy
* @since 2023-03-28
*/
public interface OrderPackageStatusPushFailLogMapper extends BaseMapper<OrderPackageStatusPushFailLogEntity> {
}

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/mapper/OrderPackageStatusPushFailLogMapper.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper">
<!-- 通用查询映射结果 -->
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">-->
<!-- <result column="id" property="id"/>-->
<!-- <result column="req_args" property="reqArgs"/>-->
<!-- <result column="res_body" property="resBody"/>-->
<!-- <result column="type" property="type"/>-->
<!-- <result column="create_user" property="createUser"/>-->
<!-- <result column="create_time" property="createTime"/>-->
<!-- <result column="update_user" property="updateUser"/>-->
<!-- <result column="update_time" property="updateTime"/>-->
<!-- <result column="status" property="status"/>-->
<!-- <result column="is_deleted" property="isDeleted"/>-->
<!-- <result column="create_dept" property="createDept"/>-->
<!-- </resultMap>-->
</mapper>

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java

@ -5,4 +5,14 @@ public interface IFactoryCommonService {
void syncTrayTypeData(String unitNo, Integer trayId, String currentWarehouseId);
/**
* 出来老系统推送的包间数据
* @param status
* @param unitNo
* @param currentWarehouseId
* @param operationTime
* @param trayId
*/
void extracted(String status, String unitNo, String currentWarehouseId, String operationTime, Integer trayId);
}

147
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -1,24 +1,34 @@
package com.logpm.factory.comfac.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Wrapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -31,6 +41,11 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
private final IBasicdataTrayClient basicdataTrayClient;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final IAdvanceDetailClient advanceDetailClient;
private final IPanFactoryDataService panFactoryDataService;
private final OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
private final ITrayClient trayClient;
private final ITrayScanClient trayScanClient;
private final BladeRedis bladeRedis;
@ -39,27 +54,27 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
public void syncTrayTypeData(String unitNo, Integer trayId, String oldWarehouseId) {
//先判断是否两个数据已经执行完成
String ruku = bladeRedis.get("arrive-"+unitNo);
trayId = bladeRedis.get("tray-"+unitNo);
String ruku = bladeRedis.get("arrive-" + unitNo);
trayId = bladeRedis.get("tray-" + unitNo);
if(StringUtil.isBlank(ruku) || Objects.isNull(trayId)){
log.error("###############syncTrayTypeData: 数据不完整,暂不打托 ruku={} trayId={}",ruku,trayId);
throw new CustomerException(403,"数据不完整,暂不打托");
if (StringUtil.isBlank(ruku) || Objects.isNull(trayId)) {
log.error("###############syncTrayTypeData: 数据不完整,暂不打托 ruku={} trayId={}", ruku, trayId);
throw new CustomerException(403, "数据不完整,暂不打托");
}
log.info("###############syncTrayTypeData: 包件打托开始 unitNo={} trayId={} oldWarehouseId={}",unitNo,trayId,oldWarehouseId);
log.info("###############syncTrayTypeData: 包件打托开始 unitNo={} trayId={} oldWarehouseId={}", unitNo, trayId, oldWarehouseId);
//先判断新系统仓库信息是否存在
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(oldWarehouseId));
if(Objects.isNull(warehouseEntity)){
log.error("###############syncTrayTypeData: 仓库信息不存在 oldWarehouseId={}",oldWarehouseId);
throw new CustomerException(403,"仓库信息不存在");
if (Objects.isNull(warehouseEntity)) {
log.error("###############syncTrayTypeData: 仓库信息不存在 oldWarehouseId={}", oldWarehouseId);
throw new CustomerException(403, "仓库信息不存在");
}
Long newWarehouseId = warehouseEntity.getId();
//判断托盘是否已经存在
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
if (Objects.isNull(basicdataTrayEntity)) {
log.info("############syncTrayTypeData: 托盘信息不存在");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
@ -69,9 +84,9 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setPalletCode("T" + trayEntity.getId());
basicdataTrayEntity.setWarehouseId(newWarehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus() + "");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
@ -79,39 +94,113 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
}
//把包件打托到托盘上
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayIdAndOldWarehouseIdAndBindStatus(trayId,oldWarehouseId,1);
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayIdAndOldWarehouseIdAndBindStatus(trayId, oldWarehouseId, 1);
String trayType = "100";
if(!Objects.isNull(trayScanEntity)){
if (!Objects.isNull(trayScanEntity)) {
Integer type = trayScanEntity.getType();
if(1==type){
if (1 == type) {
trayType = "60";
}else if(2==type){
} else if (2 == type) {
trayType = "30";
}else if(3==type){
} else if (3 == type) {
trayType = "50";
}else if(4==type){
} else if (4 == type) {
trayType = "100";
}else if(5==type){
} else if (5 == type) {
trayType = "10";
}else if(6==type){
} else if (6 == type) {
trayType = "20";
}
}
Map<String,Object> map = new HashMap<>();
map.put("trayType",trayType);
map.put("trayCode","T"+trayId);
map.put("warehouseId",newWarehouseId);
map.put("orderPackageCode",unitNo);
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", "T" + trayId);
map.put("warehouseId", newWarehouseId);
map.put("orderPackageCode", unitNo);
//新系统保存打托方式
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(map);
if(!b){
log.error("################syncTrayTypeData: 包件打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
throw new CustomerException(403,"包件打托失败");
if (!b) {
log.error("################syncTrayTypeData: 包件打托失败 unitNo={} trayCode={}", unitNo, "T" + trayId);
throw new CustomerException(403, "包件打托失败");
}
log.info("################syncTrayTypeData: 包件打托成功 unitNo={}", unitNo);
}
@Override
public void extracted(String status, String unitNo, String currentWarehouseId, String operationTime, Integer trayId) {
if ("4".equals(status) || "2".equals(status) || "1".equals(status)) {
//继续判断是否到达目的仓
//查询destinationWarehouse logiBillNo plantId数据
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if (!supplyData.isEmpty()) {
log.error("##############dealWithDataHandler: unitNo={} 没有查询到数据", unitNo);
// 保存到数据库
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
throw new CustomerException(405, "仓库数据有误");
} else {
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// channel.basicAck(deliveryTag,false);
} else {
//真正的处理需要的数据
if (OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)) {
try {
if ("1".equals(status)) {
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
} else if ("2".equals(status)) {
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}
//同步打托数据
syncTrayTypeData(unitNo, trayId, currentWarehouseId);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
} else {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("unit_no", unitNo);
queryWrapper.eq("warehouse_id", currentWarehouseId);
List list = orderPackageStatusPushFailLogMapper.selectList(queryWrapper);
if (list == null || list.isEmpty()) {
OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity = new OrderPackageStatusPushFailLogEntity();
orderPackageStatusPushFailLogEntity.setOrderPackageStatus(status);
orderPackageStatusPushFailLogEntity.setUnitNo(unitNo);
orderPackageStatusPushFailLogEntity.setWarehouseId(currentWarehouseId);
orderPackageStatusPushFailLogEntity.setOperationTime(operationTime);
orderPackageStatusPushFailLogEntity.setTrayId(trayId);
orderPackageStatusPushFailLogEntity.setDataStatus(0);
// 插入之前判断这条数据是否存在系统中
log.info(">>>>>>>>>>>>>>>> 保存到定时任务队列");
orderPackageStatusPushFailLogMapper.insert(orderPackageStatusPushFailLogEntity);
}else{
throw new CustomerException(405, "失败的包件数据状态记录已存在");
}
}
}
log.info("################syncTrayTypeData: 包件打托成功 unitNo={}",unitNo);
}
}

56
blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java

@ -0,0 +1,56 @@
package com.logpm.factory.jobhandler;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 处理包件老系统没有入库 这边无法获取的包件信息
*/
@Log4j2
@AllArgsConstructor
@Component
public class OrderPackageStatusFallJob {
private final OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
private final IFactoryCommonService factoryCommonService;
@XxlJob("getOrderPackageFromOldSystem")
public ReturnT<String> getOrderPackageFromOldSystem(String param) {
// 加载日志列表
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("data_status", 0);
List<OrderPackageStatusPushFailLogEntity> list = orderPackageStatusPushFailLogMapper.selectList(queryWrapper);
for (OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity : list) {
try {
// 重新获取数据
factoryCommonService.extracted(orderPackageStatusPushFailLogEntity.getOrderPackageStatus(),
orderPackageStatusPushFailLogEntity.getUnitNo(), orderPackageStatusPushFailLogEntity.getWarehouseId(),
orderPackageStatusPushFailLogEntity.getOperationTime(), orderPackageStatusPushFailLogEntity.getTrayId()
);
orderPackageStatusPushFailLogEntity.setDataStatus(1);
}catch (Exception e){
XxlJobLogger.log(e);
orderPackageStatusPushFailLogEntity.setDataStatus(2);
}
orderPackageStatusPushFailLogMapper.updateById(orderPackageStatusPushFailLogEntity);
}
return ReturnT.SUCCESS;
}
}

51
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -416,7 +416,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleEntity.setMallName(takeCompany);
distributionStockArticleEntity.setWarehouseEntryTime(date);
distributionStockArticleEntity.setTotalNumber(total);
distributionStockArticleEntity.setHandQuantity(0);
@ -541,43 +540,9 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
}
//保存包件信息
saveOrderPackage(unitNo, distributionStockArticleEntity, basicdataWarehouseEntity, waybillNoNum,operationTime);
//---------------------2023-10-20 17:23:00 增加打托数据
// Integer oldId = basicdataWarehouseEntity.getOldId();
// Long warehouseEntityId = basicdataWarehouseEntity.getId();
// try{
// saveTrayTypeInfoPackage(unitNo,oldId,warehouseEntityId);
// }catch (Exception e){
// logger.error("################handleDataToPlatform: unitNo={} 打托失败",unitNo);
// }
// String waybillNumber = distributionStockArticleEntity.getWaybillNumber();
// if(!waybillNumber.contains(waybillNoNum)){
// waybillNumber = waybillNumber+","+waybillNoNum;
// }
// distributionStockArticleEntity.setWaybillNumber(waybillNumber);
//
// // 修改入库状态
// distributionStockArticleEntity.setHandQuantity(distributionStockArticleEntity.getHandQuantity() +1);
// String orderStatus = checkDistributionStockArticleOrderStatus(distributionStockArticleEntity);
// distributionStockArticleEntity.setOrderStatus(orderStatus);
//
// // 修改收货
// if(distributionStockArticleEntity.getOrderStatus().equals(OrderStatusConstant.ruku.getValue())){
// distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue());
// // 更新齐套状态
// // todo 这里需要多仓齐套的查询条件
// distributionStockArticleEntity.setCompleteSet(1);
// }
// // 修改最新的入库时间
// distributionStockArticleEntity.setWarehouseEntryTimeEnd(new Date());
// distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
// 包件保存成功去修改订单的数量
// distributionStockArticleClient.addHandQuantity(id, 1);
logger.info("#################handleDataToPlatform: 数据处理完成");
} else {
//已存在包件信息那就不处理
@ -682,15 +647,15 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
*/
private void saveOrderPackage(String unitNo, DistributionStockArticleEntity distributionStockArticleEntity, BasicdataWarehouseEntity basicdataWarehouseEntity, String waybillNo,String operationTime) {
DistributionParcelListEntityVO vo;
DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNo(unitNo);;
// 判断当前查询包件不是否为皮阿落
// todo 这里不合理 需要优化
if("皮阿诺".equals(distributionStockArticleEntity.getBrand())){
vo = advanceDetailClient.getByUnitNoByPyl(unitNo);
}else{
vo = advanceDetailClient.getByUnitNo(unitNo);
}
// // todo 这里不合理 需要优化
// if("皮阿诺".equals(distributionStockArticleEntity.getBrand())){
// vo = advanceDetailClient.getByUnitNoByPyl(unitNo);
// }else{
// vo = advanceDetailClient.getByUnitNo(unitNo);
//
// }
//
// DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNo(unitNo);
//// WarehouseWaybillEntity warehouseWaybill = warehouseWaybillClient.findByWaybillNo(waybillNo);

77
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -1,11 +1,15 @@
package com.logpm.factory.receiver;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
@ -17,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -30,16 +35,14 @@ import java.util.Map;
@Component
public class DealWithDataHandler {
@Autowired
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IPanFactoryDataService panFactoryDataService;
@Autowired
private IFactoryCommonService factoryCommonService;
@Autowired
private BladeRedis bladeRedis;
private OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
private Integer retryCount = 1;
@RabbitHandler
public void dealWithDataHandler(Map map, Message message, Channel channel) throws IOException {
@ -50,44 +53,30 @@ public class DealWithDataHandler {
String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
Integer trayId = orderStatusDTO.getTrayId();
if ("4".equals(status) || "2".equals(status)) {
//继续判断是否到达目的仓
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
//查询destinationWarehouse logiBillNo plantId数据
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if(supplyData == null){
log.error("##############dealWithDataHandler: unitNo={} 没有查询到数据",unitNo);
return ;
}
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
throw new CustomerException(405, "仓库数据有误");
} else {
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
// channel.basicAck(deliveryTag,false);
} else {
//真正的处理需要的数据
if("38".equals(currentWarehouseId) || "124".equals(currentWarehouseId) || "30".equals(currentWarehouseId)){
try {
if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
}else if("2".equals(status)){
bladeRedis.setEx("tray-"+unitNo,trayId,30L);
}
//同步打托数据
factoryCommonService.syncTrayTypeData(unitNo,trayId,currentWarehouseId);
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}
} else {
log.info("##############dealWithDataHandler: 不用处理的状态 status={}", status);
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
factoryCommonService.extracted(status, unitNo, currentWarehouseId, operationTime, trayId);
extracted(unitNo,currentWarehouseId);
}
/**
* 更新包件状态
* @param unitNo
* @param currentWarehouseId
*/
private void extracted(String unitNo, String currentWarehouseId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("unit_no", unitNo);
queryWrapper.eq("warehouse_id", currentWarehouseId);
List<OrderPackageStatusPushFailLogEntity> list = orderPackageStatusPushFailLogMapper.selectList(queryWrapper);
for (OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity : list) {
orderPackageStatusPushFailLogEntity.setDataStatus(1);
orderPackageStatusPushFailLogMapper.updateById(orderPackageStatusPushFailLogEntity);
}
}
}

243
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java

@ -1,7 +1,5 @@
package com.logpm.factory.receiver;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.constant.FactoryConstant;
@ -11,16 +9,11 @@ import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.zb.service.IZbFactoryDataService;
import com.logpm.oldproject.entity.AdvanceEntity;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.entity.TrayScanDesEntity;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.feign.IAdvanceClient;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.oldproject.feign.ITrayScanDesClient;
import com.logpm.warehouse.feign.IWarehouseTaryAllocationClient;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import com.logpm.warehouse.feign.*;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
@ -34,7 +27,6 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@ -77,6 +69,10 @@ public class OrderStatusHandler {
private ITrayScanDesClient trayScanDesClient;
@Autowired
private ITrayScanClient trayScanClient;
@Autowired
private IWarehouseTrayGoodsClient warehouseTrayGoodsClient;
@Autowired
private IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient;
@RabbitHandler
@ -143,91 +139,150 @@ public class OrderStatusHandler {
}
String status = orderStatusDTO.getStatus();
if("2".equals(status)){
String currentWarehouse = orderStatusDTO.getCurrentWarehouse();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(currentWarehouse));
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("####################orderStatusHandler: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity);
return;
}
Long warehouseId = basicdataWarehouseEntity.getId();
Integer oldId = basicdataWarehouseEntity.getOldId();
Integer trayId = orderStatusDTO.getTrayId();
if(Objects.isNull(trayId)){
log.warn("####################orderStatusHandler: 托盘id为空 trayId={}",trayId);
return;
}
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############syncTrayTypeData: 托盘信息不存在");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(warehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
basicdataTrayEntity.setId(aLong);
}
TrayScanDesEntity trayScanDesEntity = trayScanDesClient.findScanTypeId(trayId, unitNo, oldId);
if(Objects.isNull(trayScanDesEntity)){
log.warn("####################orderStatusHandler: 没有打托数据 trayId={}",trayId);
return;
}
Integer trayScanId = trayScanDesEntity.getTrayScanId();
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
if(Objects.isNull(trayScanEntity)){
log.warn("####################orderStatusHandler: 没有打托方式数据 trayScanId={}",trayScanId);
return;
}
Integer trayType = trayScanEntity.getType();
String newTrayType = "100";
if(1==trayType){
newTrayType = "60";
}else if(2==trayType){
newTrayType = "30";
}else if(3==trayType){
newTrayType = "50";
}else if(4==trayType){
newTrayType = "100";
}else if(5==trayType){
newTrayType = "10";
}else if(6==trayType){
newTrayType = "20";
}
//判断托盘是否有上架
Long allocationId = taryAllocationClient.findAllocationByTrayId(basicdataTrayEntity.getId());
if(Objects.isNull(allocationId)){
//没有上架就直接打托
Map<String,Object> m = new HashMap<>();
m.put("trayType",newTrayType);
m.put("trayCode","T"+trayId);
m.put("warehouseId",warehouseId);
m.put("orderPackageCode",unitNo);
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(m);
if(!b){
log.warn("####################orderStatusHandler: 打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
return;
}
}else{
//有上架就上架
updownTypeClient.upShelfPackage(unitNo,allocationId,warehouseId);
}
}
// String status = orderStatusDTO.getStatus();
// if("2".equals(status)){
// String currentWarehouse = orderStatusDTO.getCurrentWarehouse();
// BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(currentWarehouse));
// if(Objects.isNull(basicdataWarehouseEntity)){
// log.warn("####################orderStatusHandler: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity);
// return;
// }
// Long warehouseId = basicdataWarehouseEntity.getId();
// Integer oldId = basicdataWarehouseEntity.getOldId();
//
// Integer trayId = orderStatusDTO.getTrayId();
// if(Objects.isNull(trayId)){
// log.warn("####################orderStatusHandler: 托盘id为空 trayId={}",trayId);
// return;
// }
// BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
// if(Objects.isNull(basicdataTrayEntity)){
// log.info("############syncTrayTypeData: 托盘信息不存在");
// //如果托盘不存在就去同步该托盘
// TrayEntity trayEntity = trayClient.getTrayById(trayId);
// basicdataTrayEntity = new BasicdataTrayEntity();
// basicdataTrayEntity.setTenantId("627683");
// basicdataTrayEntity.setCreateUser(1714696768639311873L);
// basicdataTrayEntity.setUpdateUser(1714696768639311873L);
// basicdataTrayEntity.setCreateDept(1649331096241836033L);
// basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
// basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
// basicdataTrayEntity.setWarehouseId(warehouseId);
// basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
// basicdataTrayEntity.setType(1);
// basicdataTrayEntity.setOldId(trayId);
//// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
// Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
// basicdataTrayEntity.setId(aLong);
// }
//
// TrayScanDesEntity trayScanDesEntity = trayScanDesClient.findScanTypeId(trayId, unitNo, oldId);
// if(Objects.isNull(trayScanDesEntity)){
// log.warn("####################orderStatusHandler: 没有打托数据 trayId={}",trayId);
// return;
// }
// Integer trayScanId = trayScanDesEntity.getTrayScanId();
// TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
// if(Objects.isNull(trayScanEntity)){
// log.warn("####################orderStatusHandler: 没有打托方式数据 trayScanId={}",trayScanId);
// return;
// }
// Integer trayType = trayScanEntity.getType();
//
// String newTrayType = "100";
// if(1==trayType){
// newTrayType = "60";
// }else if(2==trayType){
// newTrayType = "30";
// }else if(3==trayType){
// newTrayType = "50";
// }else if(4==trayType){
// newTrayType = "100";
// }else if(5==trayType){
// newTrayType = "10";
// }else if(6==trayType){
// newTrayType = "20";
// }
//
// //判断托盘是否有上架
// Long allocationId = taryAllocationClient.findAllocationByTrayId(basicdataTrayEntity.getId());
// if(Objects.isNull(allocationId)){
// //没有上架就直接打托
// Map<String,Object> m = new HashMap<>();
// m.put("trayType",newTrayType);
// m.put("trayCode","T"+trayId);
// m.put("warehouseId",warehouseId);
// m.put("orderPackageCode",unitNo);
//
// R response = warehouseTrayTypeClient.orderScanOrderPackageCodeReturnR(m);
// int code = response.getCode();
// if(code == 4001){
// log.info("####################orderStatusHandler: 包件已在当前托盘打托 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }else if(code == 4002){
// log.info("####################orderStatusHandler: 包件已在其他托盘打托 unitNo={} ",unitNo);
// WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsClient.findTrayCodeByOrderPackageCode(unitNo);
// if(Objects.isNull(trayGoodsEntity)){
// log.warn("####################orderStatusHandler: 包件未打托 unitNo={}",unitNo);
// }else{
// String oldTrayCode = trayGoodsEntity.getTrayCode();
// Long trayGoodsId = trayGoodsEntity.getId();
// Long wid = trayGoodsEntity.getWarehouseId();
// BasicdataTrayEntity oldTrayEntity = basicdataTrayClient.getTrayByTrayCode(oldTrayCode);
// Long oldTrayId = oldTrayEntity.getId();
// //判断托盘是否有上架
// Long oldAllocationId = taryAllocationClient.findAllocationByTrayId(oldTrayId);
// if (Objects.isNull(oldAllocationId)){
// //没有上架
// //直接解绑托盘
// warehouseTrayGoodsClient.delTrayGoodsById(trayGoodsId,wid);
// }else{
// //有上架
// //下架
// updownTypeClient.downPackage(unitNo,wid);
// }
// }
//
// boolean b1 = warehouseTrayTypeClient.orderScanOrderPackageCode(m);
// if(!b1){
// log.warn("####################orderStatusHandler: 二次打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }else{
// log.info("####################orderStatusHandler: 二次打托成功 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }
// }else if(code == 4003){
// log.info("####################orderStatusHandler: 包件未打托已上架 unitNo={} ",unitNo);
// WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsClient.findEntityByOrderPackageCode(unitNo);
// if(Objects.isNull(updownGoodsEntity)){
// log.warn("####################orderStatusHandler: 包件未上架 unitNo={}",unitNo);
// }else{
// Long wid = updownGoodsEntity.getWarehouseId();
// updownTypeClient.downPackage(unitNo,wid);
// }
// boolean b1 = warehouseTrayTypeClient.orderScanOrderPackageCode(m);
// if(!b1){
// log.warn("####################orderStatusHandler: 二次打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }else{
// log.info("####################orderStatusHandler: 二次打托成功 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }
// }else if(code == 4004){
// log.info("####################orderStatusHandler: 包件打托方式不正确 unitNo={} ",unitNo);
// //先去空置托盘再打托
// warehouseTrayTypeClient.trayToNull("T"+trayId);
// boolean b1 = warehouseTrayTypeClient.orderScanOrderPackageCode(m);
// if(!b1){
// log.warn("####################orderStatusHandler: 二次打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }
// }else{
// String msg1 = r.getMsg();
// int code1 = r.getCode();
// log.warn("######################orderStatusHandler: 打托失败 msg={} code={}",msg1,code1);
// log.warn("######################orderStatusHandler: 打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
// }
//
// }else{
// //有上架就上架
// updownTypeClient.upShelfPackage(unitNo,allocationId,warehouseId);
// }
// }
}
}

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ReceiveInfoHandler.java

@ -73,7 +73,8 @@ public class ReceiveInfoHandler {
r = mtFactoryDataService.sendReceiveInfo(receiveInfoDTO);
}catch (Exception e){
e.printStackTrace();
log.error(">>> 梦天异常报错 ",e);
return ;
}
int code = r.getCode();
if(code == 400 || code == 200){

12
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -36,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileLogsUtil;
import org.springblade.core.oss.model.BladeFile;
@ -728,9 +729,11 @@ public class TestService {
// 获取字典上配置的不
// List<Dict> htUseOpShops = DictCache.getList("ht_use_op_shops");
// System.out.println(htUseOpShops);
String defaultRoleId = DictBizCache.getValue(DictBizConstant.DEFAULT_MALL_ROLE_ID, DictBizConstant.DEFAULT_MALL_ROLE_ID);
// String defaultRoleId = DictBizCache.getValue(DictBizConstant.DEFAULT_MALL_ROLE_ID, DictBizConstant.DEFAULT_MALL_ROLE_ID);
//
// System.out.println(defaultRoleId);
System.out.println(defaultRoleId);
// System.out.println(OldSystemDataPushConfig.getWarehourseIdList().contains(30+""));
}
@ -769,7 +772,7 @@ public class TestService {
public void test17(){
// 解析 Excel
String file ="D:\\data\\工作文件\\slwk\\软件项目\\hyw\\新带解析数据1.5.xlsx";
String file ="D:\\data\\工作文件\\slwk\\软件项目\\hyw\\新带解析数据1.3.xlsx";
EasyExcel.read(file, OrderStatusLogMode.class, new OrderStatusLogListener()).sheet("Sheet1").doRead();
@ -781,5 +784,8 @@ public class TestService {
}
}

71
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java

@ -12,6 +12,8 @@ import com.logpm.oldproject.service.IWayBillService;
import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,41 +41,62 @@ public class OldWaybillClient implements IOldWaybillClient {
@Override
public R waybillDataHandler(String waybillId, String waybillNo) {
// 更加运单ID查询系统数据
log.info("##################pushOldSystemSignInfo: 请求老系统接口 start waybillId {},waybillNo {}", waybillId, waybillNo);
WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId));
try {
// 更加运单ID查询系统数据
log.info("##################pushOldSystemSignInfo: 请求老系统接口 start waybillId {},waybillNo {}", waybillId, waybillNo);
String authCode = oldLogin(byWaybillId.getArriveSiteId() + "");
WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId));
String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId;
String body = HttpRequest.get(url).header("token", authCode).execute().body();
JSONObject jsonObject = JSONObject.parseObject(body);
if (200 == Integer.parseInt(jsonObject.get("code").toString())) {
// 请求成功
JSONArray jsonArray = jsonObject.getJSONArray("data");
// 循环结果
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject temp = jsonArray.getJSONObject(i);
// 订单编号
String orderSelfNum = temp.getString("orderSelfNum");
JSONArray unitNos = temp.getJSONArray("unitNo");
if(byWaybillId==null){
return null;
}
log.info(">>>>>>>>>>>>>>>>> 运单信息 {}", byWaybillId);
log.info(">>>>>>>>>>>>>>>>> 旧仓库ID 集合 {}", OldSystemDataPushConfig.getWarehourseIdList());
for (int i1 = 0; i1 < unitNos.size(); i1++) {
String unitNo = unitNos.getString(i1);
log.info(">>>>>>>> 保存开单推送的已入库包件 {} 保存到新系统",unitNo);
String operationTime = DateUtil.format(new Date(),"yyyy-MM-dd hh:mm:ss");
oldSystemWaybillClient.handleDataToPlatform(unitNo,operationTime);
}
// 需要验证当前需要开启的数据推送仓库 null+""
if (!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId() + "")) {
log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId());
return null;
}
String authCode = oldLogin(byWaybillId.getArriveSiteId() + "");
String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId;
String body = HttpRequest.get(url).header("token", authCode).execute().body();
log.info(">>>>> waybillDataHandler 老系统返回结果 {} ",body);
JSONObject jsonObject = JSONObject.parseObject(body);
if (200 == Integer.parseInt(jsonObject.get("code").toString())) {
// 请求成功
JSONArray jsonArray = jsonObject.getJSONArray("data");
// 循环结果
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject temp = jsonArray.getJSONObject(i);
// 订单编号
String orderSelfNum = temp.getString("orderSelfNum");
JSONArray unitNos = temp.getJSONArray("unitNo");
for (int i1 = 0; i1 < unitNos.size(); i1++) {
String unitNo = unitNos.getString(i1);
log.info(">>>>>>>> 保存开单推送的已入库包件 {} 保存到新系统", unitNo);
String operationTime = DateUtil.format(new Date(), "yyyy-MM-dd hh:mm:ss");
oldSystemWaybillClient.handleDataToPlatform(unitNo, operationTime);
}
}
} else {
log.error("##################waybillDataHandler: 请求老系统接口 失败,url:{},waybillId:{}", url, waybillId);
// 请求失败
}
} else {
// 请求失败
} catch (Exception e) {
log.error(">>>> 运单信息查询解析报错 ", e);
}
return null;
}

18
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml

@ -89,6 +89,7 @@
WHERE
d.unitNo = #{unitNo}
and d.delete_time = 0
and wb.`status` != -1
</select>
@ -101,8 +102,8 @@
ad.firstPackName firsts,
ad.secondPackName `second`,
ad.thirdPackName thirdProduct,
hdp.productcode materialCode,
hdp.productname materialName,
t.productcode materialCode,
t.productname materialName,
ad.mscsNum quantity,
ad.mctsTruck trainNumber,
(
@ -111,13 +112,14 @@
limit 1
) warehouseEntryTimeEnd
from ht_order_detail od
left join ht_advance_detail ad on ad.unitNo = od.unitNo
left join ht_warehouse w on w.id = od.now_warehouse_id
left join ht_location l on od.location_id = l.id
left join ht_shelf s on l.shelf_id = s.id
left join ht_cargo c on s.cargo_id = c.id
left join ht_detail_product hdp on hdp.unit_no = od.unitNo
left join ht_advance_detail ad on ad.unitNo = od.unitNo and ad.delete_time = 0
left join ht_warehouse w on w.id = od.now_warehouse_id
left join ht_location l on od.location_id = l.id
left join ht_shelf s on l.shelf_id = s.id
left join ht_cargo c on s.cargo_id = c.id
left join (select unit_no,productcode,productname from ht_detail_product where unit_no= #{unitNo} limit 1) t on t.unit_no = ad.unitNo
where od.unitNo = #{unitNo}
and od.delete_time = 0
</select>

3
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java

@ -60,7 +60,8 @@ public class AdvanceDetailServiceImpl implements IAdvanceDetailService {
@Override
public AdvanceDetailEntity getOneByUnitNo(String unitNo) {
QueryWrapper<AdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("unitNo",unitNo);
queryWrapper.eq("unitNo",unitNo)
.eq("delete_time",0);
return advanceDetailMapper.selectOne(queryWrapper);
}

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanDesServiceImpl.java

@ -53,7 +53,7 @@ public class TrayScanDesServiceImpl implements ITrayScanDesService {
QueryWrapper<TrayScanDesEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("now_warehouse_id",oldWarehouseId)
.eq("type",1)
.eq("trayId",trayId);
.eq("tray_id",trayId);
return trayScanDesMapper.selectList(queryWrapper);
}
}

7
blade-service/logpm-warehouse/pom.xml

@ -79,7 +79,12 @@
<artifactId>blade-user-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-trunkline-api</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>

107
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java

@ -1196,4 +1196,111 @@ public class WarehouseTrayTypeApiController {
}
//--------------------------------------------同步托盘数据
@ResponseBody
@PostMapping("/findSyncTrayData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询同步托盘数据", notes = "传入trayTypeDTO")
public R findSyncTrayData(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########findSyncTrayData: ";
log.info(method + "移托包件 trayTypeDTO={}", trayTypeDTO);
String trayCode = trayTypeDTO.getTrayCode();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(StringUtil.isBlank(trayCode)){
log.warn(method+"托盘码不能为空 trayCode={}",trayCode);
return R.fail(403,"托盘码不能为空");
}
return warehouseTrayTypeService.findSyncTrayData(trayCode,myCurrentWarehouse.getId());
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/findSyncOldTrayData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询同步老系统托盘数据", notes = "传入trayTypeDTO")
public R findSyncOldTrayData(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########findSyncOldTrayData: ";
log.info(method + "移托包件 trayTypeDTO={}", trayTypeDTO);
String trayCode = trayTypeDTO.getTrayCode();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(StringUtil.isBlank(trayCode)){
log.warn(method+"托盘码不能为空 trayCode={}",trayCode);
return R.fail(403,"托盘码不能为空");
}
return warehouseTrayTypeService.findSyncOldTrayData(trayCode,myCurrentWarehouse.getId());
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/syncOldTrayData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "同步老系统托盘数据", notes = "传入trayTypeDTO")
public R syncOldTrayData(@RequestBody TrayTypeDTO trayTypeDTO) {
String method = "###########syncOldTrayData: ";
log.info(method + "移托包件 trayTypeDTO={}", trayTypeDTO);
List<String> orderPackageCodes = trayTypeDTO.getOrderPackageCodes();
String trayCode = trayTypeDTO.getTrayCode();
String trayType = trayTypeDTO.getTrayType();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(StringUtil.isBlank(trayCode)){
log.warn(method+"托盘码不能为空 trayCode={}",trayCode);
return R.fail(403,"托盘码不能为空");
}
return warehouseTrayTypeService.syncOldTrayData(trayCode,trayType,orderPackageCodes,myCurrentWarehouse.getId());
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
}

71
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java

@ -3,13 +3,11 @@ package com.logpm.warehouse.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.warehouse.dto.TrayInfoDTO;
import com.logpm.warehouse.dto.WaybillDTO;
import com.logpm.warehouse.entity.WarehouseLog;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.service.IWarehouseLogService;
import com.logpm.warehouse.service.IWarehouseTaryAllocationService;
import com.logpm.warehouse.service.IWarehouseTrayTypeService;
import com.logpm.warehouse.service.IWarehouseUpdownTypeService;
import com.logpm.warehouse.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -18,6 +16,7 @@ import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -41,11 +40,18 @@ public class OldSystemPushController {
private final IWarehouseTaryAllocationService taryAllocationService;
private final IWarehouseLogService warehouseLogService;
private final RabbitTemplate rabbitTemplate;
private final IAsyncDataService asyncDataService;
// private final IWarehouseWaybillService warehouseWaybillService;
//
// private final IDistributionStockArticleClient distributionStockArticleClient;
/**
* 该接口需老系统判断这个运单的开单为 当前仓和始发仓为相同才进行推送
* @param waybillDTOS
* @return
*/
@ResponseBody
@PostMapping("/sendWaybillData")
@ApiOperationSupport(order = 1)
@ -96,7 +102,7 @@ public class OldSystemPushController {
WarehouseLog warehouseLog = new WarehouseLog();
warehouseLog.setArgs(JSONObject.toJSONString(map));
warehouseLog.setStatus(1);
warehouseLog.setType(1);
warehouseLog.setType(2);
warehouseLogService.save(warehouseLog);
//先判断托盘有没有数据
@ -132,8 +138,61 @@ public class OldSystemPushController {
}
@ResponseBody
@PostMapping("/sendTrayInfoByOrderPackageCode")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "老系统推送打托数据", notes = "传入waybillDTO")
public R sendTrayInfoByOrderPackageCode(@RequestBody TrayInfoDTO trayInfoDTO) {
log.info("############sendTrayInfoByOrderPackageCode: 请求参数{}",trayInfoDTO);
try{
Integer trayId = trayInfoDTO.getTrayId();
Integer oldWarehouseId = trayInfoDTO.getWarehouseId();
String orderPackageCode = trayInfoDTO.getOrderPackageCode();
Integer type = trayInfoDTO.getType();
if(Objects.isNull(trayId)){
log.warn("##############sendTrayInfoByOrderPackageCode: 托盘id不存在 trayId={}",trayId);
return R.fail(405,"托盘id不存在");
}
if(Objects.isNull(oldWarehouseId)){
log.warn("##############sendTrayInfoByOrderPackageCode: 老系统仓库id不存在 oldWarehouseId={}",oldWarehouseId);
return R.fail(405,"老系统仓库id不存在");
}
if(StringUtil.isBlank(orderPackageCode)){
log.warn("##############sendTrayInfoByOrderPackageCode: 包件码不存在 orderPackageCode={}",orderPackageCode);
return R.fail(405,"包件码不存在");
}
if(Objects.isNull(type)){
log.warn("##############sendTrayInfoByOrderPackageCode: 打托方式不存在 type={}",type);
return R.fail(405,"打托方式不存在");
}
//先保存原始请求数据
WarehouseLog warehouseLog = new WarehouseLog();
warehouseLog.setArgs(JSONObject.toJSONString(trayInfoDTO));
warehouseLog.setStatus(0);
warehouseLog.setType(2);
warehouseLogService.save(warehouseLog);
asyncDataService.sendTrayInfoByOrderPackageCode(trayInfoDTO);
warehouseLog.setStatus(1);
warehouseLogService.updateById(warehouseLog);
return R.success("操作成功");
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error("############sendOrders: 系统异常",e);
return R.fail(500,"############sendOrders: 系统异常");
}
}
}

15
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java

@ -0,0 +1,15 @@
package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class TrayInfoDTO implements Serializable {
private Integer trayId;
private Integer warehouseId;
private String orderPackageCode;
private Integer type;
}

25
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayGoodsClient.java

@ -78,4 +78,29 @@ public class WarehouseTrayGoodsClient implements IWarehouseTrayGoodsClient {
.eq(ObjectUtils.isNotNull(warehouseTrayGoodsEntity.getAssociationType()),WarehouseTrayGoodsEntity::getAssociationType ,warehouseTrayGoodsEntity.getAssociationType())
);
}
@Override
public String getTrayNameByOrderPackageCode(String orderCode,Integer type) {
return warehouseTrayGoodsService.getTrayNameByOrderPackageCode(orderCode,type);
}
@Override
public String getTrayInfoByInventory(Long marketId, String cargoNumber) {
return warehouseTrayGoodsService.getTrayInfoByInventory(marketId,cargoNumber);
}
@Override
public WarehouseTrayGoodsEntity findTrayCodeByOrderPackageCode(String unitNo) {
QueryWrapper<WarehouseTrayGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("association_value",unitNo);
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(queryWrapper);
return trayGoodsEntity;
}
@Override
public void delTrayGoodsById(Long trayGoodsId,Long warehouseId) {
warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId,warehouseId);
}
}

16
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseTrayTypeClient.java

@ -51,6 +51,17 @@ public class WarehouseTrayTypeClient implements IWarehouseTrayTypeClient {
}
}
@Override
public R orderScanOrderPackageCodeReturnR(Map<String, Object> map) {
String trayType = (String) map.get("trayType");
String trayCode = (String) map.get("trayCode");
Long warehouseId = (Long) map.get("warehouseId");
String orderPackageCode = (String) map.get("orderPackageCode");
return warehouseTrayTypeService.orderScanOrderPackageCodeSync(trayType, trayCode, orderPackageCode, warehouseId);
}
@Override
public boolean enterZeroOrderByTrayCode(Map<String, Object> map) {
String trayType = (String) map.get("trayType");
@ -89,5 +100,10 @@ public class WarehouseTrayTypeClient implements IWarehouseTrayTypeClient {
warehouseTrayTypeService.changeTrayWarehouseInfo(trayCode,warehouseId);
}
@Override
public void trayToNull(String trayCode) {
warehouseTrayTypeService.trayToNull(trayCode);
}
}

19
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownGoodsClient.java

@ -1,6 +1,7 @@
package com.logpm.warehouse.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
@ -91,4 +92,22 @@ public class WarehouseUpdownGoodsClient implements IWarehouseUpdownGoodsClient {
.eq(ObjectUtils.isNotNull(warehouseUpdownGoodsEntity.getWarehouseId()),WarehouseUpdownGoodsEntity::getWarehouseId,warehouseUpdownGoodsEntity.getWarehouseId())
);
}
@Override
public String getAllocationNameByOrderPackageCode(String orderPackageCode,Integer type) {
return warehouseUpdownGoodsService.getAllocationNameByOrderPackageCode(orderPackageCode,type);
}
@Override
public String getAllocationNameByInventory(Long marketId, String cargoNumber) {
return warehouseUpdownGoodsService.getAllocationNameByInventory(marketId, cargoNumber);
}
@Override
public WarehouseUpdownGoodsEntity findEntityByOrderPackageCode(String unitNo) {
QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("association_value",unitNo);
return warehouseUpdownGoodsService.getOne(queryWrapper);
}
}

21
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java

@ -59,4 +59,25 @@ public interface WarehouseTrayGoodsMapper extends BaseMapper<WarehouseTrayGoodsE
Integer SumByTrayId(@Param("id") Long trayId);
void updeteWarehouseIdByTrayTypeId(@Param("trayTypeId") Long trayTypeId, @Param("warehouseId") Long warehouseId);
/**
* 查询订单包件所在托盘拼接
* @param orderCode
* @return
*/
String getTrayNameByOrderPackageCode(@Param("orderCode") String[] split,@Param("type")Integer type);
/**
* 查询无数据库存品信息 拼接方式 托盘名称 + 件数
* @param marketId
* @param cargoNumber
* @return
*/
String getTrayInfoByInventory(@Param("marketId") Long marketId,@Param("cargoNumber") String cargoNumber);
List<OrderPackageInfoVO> findOrderPackageCodeInfoList(@Param("trayCode") String trayCode);
List<OrderPackageInfoVO> findZeroOrderInfoList(@Param("trayCode") String trayCode);
List<OrderPackageInfoVO> findStockInfoList(@Param("trayCode") String trayCode);
}

56
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml

@ -318,6 +318,30 @@
<select id="SumByTrayId" resultType="java.lang.Integer">
SELECT sum(lwtg.num) FROM logpm_warehouse_tray_goods lwtg where lwtg.is_deleted =0 and lwtg.tray_id = #{id} GROUP BY lwtg.tray_id
</select>
<select id="getTrayNameByOrderPackageCode" resultType="java.lang.String">
SELECT
GROUP_CONCAT(DISTINCT lwt.pallet_name)
FROM
logpm_warehouse_tray_goods AS lwtg
LEFT JOIN logpm_warehouse_tray AS lwt ON lwtg.tray_id = lwt.id
WHERE
association_type = #{type} and association_value in
<foreach collection="orderCode" item="code" separator="," open="(" close=")">
#{code}
</foreach>
GROUP BY lwt.id
</select>
<select id="getTrayInfoByInventory" resultType="java.lang.String">
SELECT
GROUP_CONCAT(DISTINCT lwt.pallet_name,'-',lwtg.num,'件')
FROM
logpm_warehouse_tray_goods AS lwtg
LEFT JOIN logpm_warehouse_tray AS lwt ON lwtg.tray_id = lwt.id
WHERE
lwtg.association_type = 4 AND lwtg.market_id = #{marketId} AND lwtg.association_value = #{cargoNumber}
GROUP BY
lwt.id
</select>
<update id="updeteWarehouseIdByTrayTypeId">
update logpm_warehouse_tray_goods
@ -325,5 +349,37 @@
where tray_type_id = #{trayTypeId}
</update>
<select id="findOrderPackageCodeInfoList" resultType="com.logpm.warehouse.vo.OrderPackageInfoVO">
select lwtg.association_value orderPackageCode,
ldpl.waybill_number waybillNo,
ldpl.order_code orderCode,
lwtg.num num
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_parcel_list ldpl on ldpl.order_package_code = lwtg.association_value
where lwtg.tray_code = #{trayCode}
and lwtg.association_type = '3'
</select>
<select id="findZeroOrderInfoList" resultType="com.logpm.warehouse.vo.OrderPackageInfoVO">
select lwtg.association_value orderCode,
ldsa.waybill_number waybillNo,
lwtg.num num
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_stock_article ldsa on ldsa.order_code = lwtg.association_value
where lwtg.tray_code = #{trayCode}
and lwtg.association_type = '1'
</select>
<select id="findStockInfoList" resultType="com.logpm.warehouse.vo.OrderPackageInfoVO">
select lwtg.association_value orderCode,
lwtg.market_name waybillNo,
lwtg.association_value orderPackageCode,
lwtg.num num
from logpm_warehouse_tray_goods lwtg
left join logpm_distribution_stock_list ldsl on ldsl.incoming_batch = lwtg.incoming_batch and ldsl.cargo_number = lwtg.association_value and ldsl.market_name = lwtg.market_name
where lwtg.tray_code = #{trayCode}
and lwtg.association_type = '4'
</select>
</mapper>

3
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.vo.OrderPackageInfoVO;
import com.logpm.warehouse.vo.TrayTypeDataListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -32,4 +33,6 @@ public interface WarehouseTrayTypeMapper extends BaseMapper<WarehouseTrayTypeEnt
void updateNumByTrayTypeId(@Param("orderTotalNum") Integer orderTotalNum, @Param("enterNum") Integer enterNum, @Param("trayTypeId") Long trayTypeId);
void updateStockByTrayTypeId(@Param("orderTotalNum")Integer orderTotalNum, @Param("enterNum") Integer enterNum, @Param("trayTypeId") Long trayTypeId);
List<OrderPackageInfoVO> findOrderPackageList(@Param("list")List<String> orderPackageList);
}

15
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml

@ -89,4 +89,19 @@
stock_total_num = #{orderTotalNum}
where id = #{trayTypeId}
</update>
<select id="findOrderPackageList" resultType="com.logpm.warehouse.vo.OrderPackageInfoVO">
select ldpl.waybill_number waybillNo,
ldpl.order_code orderCode,
ldpl.order_package_code orderPackageCode,
ldpl.quantity num
from logpm_distribution_parcel_list ldpl
where 1=1
and ldpl.order_package_code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

15
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java

@ -103,6 +103,21 @@ public interface WarehouseUpdownGoodsMapper extends BaseMapper<WarehouseUpdownGo
List<QuestDetailEntity> allocationDetailByStock(@Param("param") TaskSearchDTO taskSearchDTO);
/**
* 查询保健库位信息拼接
* @param orderPackageCode
* @return
*/
String getAllocationNameByOrderPackageCode(@Param("orderPackageCode") String[] orderPackageCode,@Param("type") Integer type);
/**
* 查询无数据库存品库位信息 库位名称 + 件数
* @param marketId
* @param cargoNumber
* @return
*/
String getAllocationNameByInventory(@Param("marketId") Long marketId,@Param("cargoNumber") String cargoNumber);
// /**
// * 根据货位查询货物

27
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml

@ -396,6 +396,33 @@
</foreach>
</if>
</select>
<select id="getAllocationNameByOrderPackageCode" resultType="java.lang.String">
SELECT
GROUP_CONCAT( DISTINCT CONCAT_WS('-',lwgaa.headline,lwgs.goods_shelf_name,lwga.goods_allocation_name) )
FROM
logpm_warehouse_updown_goods AS lwup
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwup.allocation_id = lwga.id
LEFT JOIN logpm_warehouse_goods_shelf AS lwgs ON lwga.goods_shelf_id = lwgs.id
LEFT JOIN logpm_warehouse_goods_area AS lwgaa ON lwga.goods_area_id = lwgaa.id
WHERE
lwup.association_type = #{type} and lwup.association_value in
<foreach collection="orderPackageCode" item="code" close=")" open="(" separator=",">
#{code}
</foreach>
GROUP BY
lwga.id
</select>
<select id="getAllocationNameByInventory" resultType="java.lang.String">
SELECT
GROUP_CONCAT( DISTINCT CONCAT_WS('-',lwgaa.headline,lwgs.goods_shelf_name,lwga.goods_allocation_name) )
FROM
logpm_warehouse_updown_goods AS lwup
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwup.allocation_id = lwga.id
LEFT JOIN logpm_warehouse_goods_shelf AS lwgs ON lwga.goods_shelf_id = lwgs.id
LEFT JOIN logpm_warehouse_goods_area AS lwgaa ON lwga.goods_area_id = lwgaa.id
WHERE
lwup.association_type = 4 and lwup.association_value = #{cargoNumber} AND lwup.market_id = #{marketId}
</select>
</mapper>

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IAsyncDataService.java

@ -1,7 +1,11 @@
package com.logpm.warehouse.service;
import com.logpm.warehouse.dto.TrayInfoDTO;
public interface IAsyncDataService {
void syncTaskData(String questNum, Long warehouseId);
void sendTrayInfoByOrderPackageCode(TrayInfoDTO trayInfoDTO);
}

21
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java

@ -85,4 +85,25 @@ public interface IWarehouseTrayGoodsService extends BaseService<WarehouseTrayGoo
Integer getNumByZation(Long id);
void updeteWarehouseIdByTrayTypeId(Long trayTypeId, Long warehouseId);
/**
* 查询订单包件所在托盘
* @param orderCode
* @return
*/
String getTrayNameByOrderPackageCode(String orderCode,Integer type);
/**
* 查询无数据库存品托盘信息 拼接方式 托盘名称 + 件数
* @param marketId
* @param cargoNumber
* @return
*/
String getTrayInfoByInventory(Long marketId, String cargoNumber);
List<OrderPackageInfoVO> findOrderPackageCodeInfoList(String trayCode);
List<OrderPackageInfoVO> findZeroOrderInfoList(String trayCode);
List<OrderPackageInfoVO> findStockInfoList(String trayCode);
}

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java

@ -96,4 +96,10 @@ public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayType
List<JSONObject> findAllGoodsByTrayCodeAndWarehouseId(String trayCode, Long warehouseId);
void changeTrayWarehouseInfo(String trayCode, Long warehouseId);
R findSyncTrayData(String trayCode, Long warehouseId);
R findSyncOldTrayData(String trayCode, Long warehouseId);
R syncOldTrayData(String trayCode, String trayType, List<String> orderPackageCodes, Long warehouseId);
}

15
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java

@ -130,4 +130,19 @@ public interface IWarehouseUpdownGoodsService extends BaseService<WarehouseUpdow
Integer selectCountNumByshelf(Long goodsAreaId, Long goodsShelfId);
List<WarehouseUpdownGoodsVO> findUpdownStockByMaterialCode(String materialCode, Long marketId, Long warehouseId);
/**
*
* @param orderPackageCode
* @return
*/
String getAllocationNameByOrderPackageCode(String orderPackageCode,Integer type);
/**
* 查询无数据库存品库位信息 拼接方式 库位名称 + 件数
* @param marketId
* @param cargoNumber
* @return
*/
String getAllocationNameByInventory(Long marketId, String cargoNumber);
}

181
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java

@ -4,16 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity;
import com.logpm.basicdata.entity.BasicdataGoodsShelfEntity;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataGoodsAllocationClient;
import com.logpm.basicdata.feign.IBasicdataGoodsShelfClient;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.feign.IDistributionStockListClient;
import com.logpm.warehouse.dto.UpShelfPackageDTO;
import com.logpm.warehouse.dto.UpShelfStockDTO;
import com.logpm.warehouse.dto.UpShelfZeroOrderDTO;
import com.logpm.warehouse.dto.ZeroOrderVO;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.oldproject.feign.ITrayScanDesClient;
import com.logpm.warehouse.dto.*;
import com.logpm.warehouse.entity.TaskQuestEntity;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.service.*;
@ -60,6 +65,16 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
private IDistributionStockArticleClient distributionStockArticleClient;
@Autowired
private IDistributionStockListClient distributionStockListClient;
@Autowired
private IBasicdataWarehouseClient basicdataWarehouseClient;
@Autowired
private IBasicdataTrayClient basicdataTrayClient;
@Autowired
private ITrayClient trayClient;
@Autowired
private ITrayScanClient trayScanClient;
@Autowired
private ITrayScanDesClient trayScanDesClient;
@Override
@Async
@ -298,6 +313,164 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
log.info("################syncTaskData: 处理完成");
}
@Override
public void sendTrayInfoByOrderPackageCode(TrayInfoDTO trayInfoDTO) {
Integer trayId = trayInfoDTO.getTrayId();
String orderPackageCode = trayInfoDTO.getOrderPackageCode();
Integer oldWarehouseId = trayInfoDTO.getWarehouseId();
Integer type = trayInfoDTO.getType();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("####################sendTrayInfoByOrderPackageCode: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity);
throw new CustomerException(405,"仓库信息为空");
}
Long newWarehouseId = basicdataWarehouseEntity.getId();
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############sendTrayInfoByOrderPackageCode: 托盘信息不存在 同步");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(newWarehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
basicdataTrayEntity.setId(aLong);
}
// TrayScanDesEntity trayScanDesEntity = trayScanDesClient.findScanTypeId(trayId, orderPackageCode, oldWarehouseId);
// if(Objects.isNull(trayScanDesEntity)){
// log.warn("####################sendTrayInfoByOrderPackageCode: 没有打托数据 trayId={}",trayId);
// throw new CustomerException(405,"没有打托数据");
// }
// Integer trayScanId = trayScanDesEntity.getTrayScanId();
// TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
// if(Objects.isNull(trayScanEntity)){
// log.warn("####################sendTrayInfoByOrderPackageCode: 没有打托方式数据 trayScanId={}",trayScanId);
// throw new CustomerException(405,"没有打托方式数据");
// }
// Integer trayType = trayScanEntity.getType();
String newTrayType = "100";
if(1==type){
newTrayType = "60";
}else if(2==type){
newTrayType = "30";
}else if(3==type){
newTrayType = "50";
}else if(4==type){
newTrayType = "100";
}else if(5==type){
newTrayType = "10";
}else if(6==type){
newTrayType = "20";
}
//判断托盘是否有上架
Long allocationId = taryAllocationService.getAllocationIdByTrayId(basicdataTrayEntity.getId());
if(Objects.isNull(allocationId)){
//没有上架就直接打托
R response = trayTypeService.orderScanOrderPackageCodeSync(newTrayType,"T"+trayId,orderPackageCode,newWarehouseId);
int code = response.getCode();
String msg = response.getMsg();
if(code == 4001){
log.info("####################sendTrayInfoByOrderPackageCode: 包件已在当前托盘打托 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}else if(code == 4002){
log.info("####################sendTrayInfoByOrderPackageCode: 包件已在其他托盘打托 orderPackageCode={} ",orderPackageCode);
QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsEntityQueryWrapper = new QueryWrapper<>();
trayGoodsEntityQueryWrapper.eq("association_value",orderPackageCode);
WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getOne(trayGoodsEntityQueryWrapper);
if(Objects.isNull(trayGoodsEntity)){
log.warn("####################sendTrayInfoByOrderPackageCode: 包件未打托 orderPackageCode={}",orderPackageCode);
}else{
String oldTrayCode = trayGoodsEntity.getTrayCode();
Long trayGoodsId = trayGoodsEntity.getId();
Long wid = trayGoodsEntity.getWarehouseId();
BasicdataTrayEntity oldTrayEntity = basicdataTrayClient.getTrayByTrayCode(oldTrayCode);
Long oldTrayId = oldTrayEntity.getId();
//判断托盘是否有上架
Long oldAllocationId = taryAllocationService.getAllocationIdByTrayId(oldTrayId);
if (Objects.isNull(oldAllocationId)){
//没有上架
//直接解绑托盘
trayGoodsService.deleteByTrayGoodsId(trayGoodsId,wid);
}else{
//有上架
//下架
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
updownTypeService.downPackage(upShelfPackageList,wid);
}
}
R r = trayTypeService.orderScanOrderPackageCodeSync(newTrayType,"T"+trayId,orderPackageCode,newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}else{
log.info("####################orderStatusHandler: 二次打托成功 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else if(code == 4003){
log.info("####################orderStatusHandler: 包件未打托已上架 orderPackageCode={} ",orderPackageCode);
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
updownGoodsEntityQueryWrapper.eq("association_value", orderPackageCode);
WarehouseUpdownGoodsEntity updownGoodsEntity = updownGoodsService.getOne(updownGoodsEntityQueryWrapper);
if(Objects.isNull(updownGoodsEntity)){
log.warn("####################orderStatusHandler: 包件未上架 orderPackageCode={}",orderPackageCode);
}else{
Long wid = updownGoodsEntity.getWarehouseId();
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
updownTypeService.downPackage(upShelfPackageList,wid);
}
R r = trayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}else{
log.info("####################orderStatusHandler: 二次打托成功 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else if(code == 4004){
log.info("####################orderStatusHandler: 包件打托方式不正确 orderPackageCode={} ",orderPackageCode);
//先去空置托盘再打托
trayTypeService.trayToNull("T"+trayId);
R r = trayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else{
log.warn("######################orderStatusHandler: 打托失败 msg={} code={}",msg,code);
log.warn("######################orderStatusHandler: 打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else{
//有上架就上架
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
updownTypeService.upShelfPackage(upShelfPackageList,allocationId,newWarehouseId);
}
}
private void dealWithStockTray(String materialCode, String marketName, String incomingBatch, Integer stockNum, String trayCode, String trayType, Long warehouseId) {
log.info("#############dealWithStockTray: 处理库存品的打托");

27
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java

@ -15,6 +15,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.TenantNum;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -280,6 +281,32 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl<WarehouseTray
baseMapper.updeteWarehouseIdByTrayTypeId(trayTypeId,warehouseId);
}
@Override
public String getTrayNameByOrderPackageCode(String orderCode,Integer type) {
String[] split = Func.split(orderCode, ",");
return baseMapper.getTrayNameByOrderPackageCode(split,type);
}
@Override
public String getTrayInfoByInventory(Long marketId, String cargoNumber) {
return baseMapper.getTrayInfoByInventory(marketId,cargoNumber);
}
@Override
public List<OrderPackageInfoVO> findOrderPackageCodeInfoList(String trayCode) {
return baseMapper.findOrderPackageCodeInfoList(trayCode);
}
@Override
public List<OrderPackageInfoVO> findZeroOrderInfoList(String trayCode) {
return baseMapper.findZeroOrderInfoList(trayCode);
}
@Override
public List<OrderPackageInfoVO> findStockInfoList(String trayCode) {
return baseMapper.findStockInfoList(trayCode);
}
@Override
public Boolean deleteByMasterId(Long masterId) {
int delete = baseMapper.delete(new QueryWrapper<WarehouseTrayGoodsEntity>().lambda()

815
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -3,11 +3,16 @@ package com.logpm.warehouse.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
@ -16,6 +21,17 @@ import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.feign.IDistributionStockListClient;
import com.logpm.oldproject.entity.*;
import com.logpm.oldproject.feign.*;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceEntity;
import com.logpm.trunkline.entity.TrunklineDetailProductEntity;
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity;
import com.logpm.trunkline.feign.ITrunklineAdvanceClient;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import com.logpm.trunkline.feign.ITrunklineDetailProductClient;
import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient;
import com.logpm.warehouse.bean.Resp;
import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.dto.ZeroOrderVO;
@ -28,10 +44,17 @@ import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.TenantNum;
import org.springblade.common.constant.apiwarehouse.PalletProductTypeConstant;
import org.springblade.common.constant.order.OrderFreezeStatusConstant;
import org.springblade.common.constant.order.OrderGroundingStatusConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springblade.common.constant.order.OrderStockupStatusConstant;
import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictBizCache;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +62,7 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
@Log4j2
@ -66,6 +90,36 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
private IWarehouseUpdownGoodsService warehouseUpdownGoodsService;
@Autowired
private IBasicdataWarehouseClient basicdataWarehouseClient;
@Autowired
private ITrayScanDesClient trayScanDesClient;
@Autowired
private ITrayScanClient trayScanClient;
@Autowired
private IAdvanceClient advanceClient;
@Autowired
private IOrderCountClient orderCountClient;
@Autowired
private IWayBillClient wayBillClient;
@Autowired
private IBasicdataClientClient basicdataClientClient;
@Autowired
private IOrderDetailClient orderDetailClient;
@Autowired
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IBasicdataStoreBusinessClient basicdataStoreBusinessClient;
@Autowired
private IWarehouseWaybillService warehouseWaybillService;
@Autowired
private ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
@Autowired
private IDetailProductClient detailProductClient;
@Autowired
private ITrunklineWaybillOrderClient waybillOrderClient;
@Autowired
private ITrunklineDetailProductClient trunklineDetailProductClient;
@Autowired
private ITrunklineAdvanceClient trunklineAdvanceClient;
@Override
public IPage<WarehouseTrayTypeVO> orderPageList(TrayTypeDTO trayTypeDTO,Long warehouseId) {
@ -380,7 +434,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
String oldTrayCode = trayGoodsEntity.getTrayCode();
if(oldTrayCode.equals(trayCode)){
log.warn("##############orderScanOrderPackageCode: 该包条已打托 trayCode={}",trayCode);
return Resp.scanFail(2001,"该包条已打托","已扫描");
return Resp.scanFail(4001,"该包条已打托","已扫描");
}
log.warn("#########orderScanOrderPackageCode: 包件已打托 orderPackageCode={}",orderPackageCode);
@ -575,11 +629,11 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
String oldTrayCode = trayGoodsEntity.getTrayCode();
if(oldTrayCode.equals(trayCode)){
log.warn("##############orderScanOrderPackageCode: 该包条已打托 trayCode={}",trayCode);
return Resp.scanFail(2001,"该包条已打托","已扫描");
return Resp.scanFail(4001,"该包条已打托","已扫描");
}
log.warn("#########orderScanOrderPackageCode: 包件已打托 orderPackageCode={}",orderPackageCode);
return Resp.scanFail(2001,"包件已打托","已在"+oldTrayCode+"托盘绑定");
return Resp.scanFail(4002,"包件已打托","已在"+oldTrayCode+"托盘绑定");
}
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
@ -589,7 +643,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
if(!Objects.isNull(updownGoodsEntity)){
String positionCode = updownGoodsEntity.getPositionCode();
log.warn("#########orderScanOrderPackageCode: 包件已上架 orderPackageCode={}",orderPackageCode);
return Resp.scanFail(2001,"包件已上架","包件已上架"+positionCode+",请先下架或进行移库绑定");
return Resp.scanFail(4003,"包件已上架","包件已上架"+positionCode+",请先下架或进行移库绑定");
}
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
@ -659,7 +713,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
if(!tt.equals(trayType)){
log.warn("##############orderScanOrderPackageCode: 打托方式不正确 {}={}",trayType,tt);
return Resp.scanFail(2001,"打托方式不正确","打托方式不正确");
return Resp.scanFail(4004,"打托方式不正确","打托方式不正确");
}
if(StringUtil.isBlank(filterValue)){
@ -2740,6 +2794,757 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
}
@Override
public R findSyncTrayData(String trayCode, Long warehouseId) {
WarehouseTrayTypeVO trayTypeVO = new WarehouseTrayTypeVO();
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
if(Objects.isNull(trayEntity)){
log.warn("###########findSyncTrayData: 托盘信息不存在 trayCode={}",trayCode);
return R.fail(405,"托盘信息不存在");
}
Long trayId = trayEntity.getId();
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(trayId);
if(!Objects.isNull(allocationId)){
log.warn("###########findSyncTrayData: 托盘还未下架 trayCode={}",trayCode);
return R.fail(405,"托盘还未下架");
}
QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_code",trayCode)
.eq("is_deleted",0);
WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectOne(queryWrapper);
if(Objects.isNull(trayTypeEntity)){
trayTypeVO.setTrayName(trayEntity.getPalletName());
trayTypeVO.setTrayCode(trayCode);
trayTypeVO.setTotalNum(0);
trayTypeVO.setOrderTotalNum(0);
trayTypeVO.setStockNum(0);
trayTypeVO.setStockTotalNum(0);
trayTypeVO.setTrayType("100");
trayTypeVO.setTrayTypeName("其他");
}else{
String trayType = trayTypeEntity.getTrayType();
String value = DictBizCache.getValue("pallet_order_type", trayType);
BeanUtil.copy(trayTypeEntity,trayTypeVO);
trayTypeVO.setTrayName(trayEntity.getPalletName());
trayTypeVO.setTrayTypeName(value);
}
List<OrderPackageInfoVO> packageList = warehouseTrayGoodsService.findOrderPackageCodeInfoList(trayCode);
List<OrderPackageInfoVO> zeroList = warehouseTrayGoodsService.findZeroOrderInfoList(trayCode);
List<OrderPackageInfoVO> stockList = warehouseTrayGoodsService.findStockInfoList(trayCode);
packageList.addAll(zeroList);
packageList.addAll(stockList);
trayTypeVO.setPackageList(packageList);
return R.data(trayTypeVO);
}
@Override
public R findSyncOldTrayData(String trayCode, Long warehouseId) {
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("###########findSyncTrayData: 仓库信息不存在 warehouseId={}",warehouseId);
return R.fail(405,"仓库信息不存在");
}
Integer oldWarehouseId = basicdataWarehouseEntity.getOldId();
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
if(Objects.isNull(trayEntity)){
log.warn("###########findSyncTrayData: 托盘信息不存在 trayCode={}",trayCode);
return R.fail(405,"托盘信息不存在");
}
Integer trayId = trayEntity.getOldId();
Map<String,Object> map = new HashMap<>();
//查询所有托盘包件信息
Set<String> set = new TreeSet<>();
List<String> orderPackageList = new ArrayList<>();
List<TrayScanDesEntity> trayScanDesEntityList = trayScanDesClient.findListByTrayId(trayId, oldWarehouseId);
if(trayScanDesEntityList.size() == 0){
return R.data(map);
}
Integer trayScanId = null;
for (TrayScanDesEntity trayScanDesEntity : trayScanDesEntityList) {
String orderPackageCode = trayScanDesEntity.getUnitNo();
trayScanId = trayScanDesEntity.getTrayScanId();
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if(Objects.isNull(parcelListEntity)){
set.add(trayScanDesEntity.getOrderSelfNum());
}
orderPackageList.add(orderPackageCode);
}
for (String orderCode : set) {
saveOrderInfo(orderCode,oldWarehouseId,warehouseId);
}
String newTrayType = "100";
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
if(!Objects.isNull(trayScanEntity)){
Integer type = trayScanEntity.getType();
if(1==type){
newTrayType = "60";
}else if(2==type){
newTrayType = "30";
}else if(3==type){
newTrayType = "50";
}else if(4==type){
newTrayType = "100";
}else if(5==type){
newTrayType = "10";
}else if(6==type){
newTrayType = "20";
}
}
String value = DictBizCache.getValue("pallet_order_type", newTrayType);
List<OrderPackageInfoVO> list = baseMapper.findOrderPackageList(orderPackageList);
map.put("packageList",list);
map.put("trayType",newTrayType);
map.put("trayTypeName",value);
map.put("trayCode",trayCode);
map.put("trayName",trayEntity.getPalletName());
return R.data(map);
}
@Override
public R syncOldTrayData(String trayCode ,String trayType, List<String> orderPackageCodes, Long warehouseId) {
//先空置托盘
trayToNull(trayCode);
//批量打托
for (String orderPackageCode : orderPackageCodes) {
orderScanOrderPackageCode(trayType,trayCode,orderPackageCode,warehouseId);
}
return R.success("打托成功");
}
private void saveOrderInfo(String orderCode, Integer oldWarehouseId, Long newWarehouseId) {
//通过订单号查询暂存单
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderCode);
if(Objects.isNull(advanceEntity)){
log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode);
throw new CustomerException(403,"未查询单订单信息");
}
Integer advanceId = advanceEntity.getId();
//判断新系统是否有这条订单数据
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode,newWarehouseId);
OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderCode,oldWarehouseId);
if(Objects.isNull(orderCountEntity)){
log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode);
throw new CustomerException(403,"未查询单订单信息");
}
Integer total = 0;
List<AdvanceEntity> advanceList = advanceClient.getAdvanceList(orderCode);
for (AdvanceEntity entity : advanceList) {
total = total + entity.getTotal();
}
WayBillEntity wayBillEntity = wayBillClient.getByWayBillByAdvanceId(advanceId);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(newWarehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("#################saveOrderInfo: 未查询到仓库信息 newWarehouseId={}",newWarehouseId);
throw new CustomerException(403,"未查询到仓库信息");
}
Long id;
String wayBillNo = null;
if (Objects.isNull(distributionStockArticleEntity)) {
Date date = new Date();
distributionStockArticleEntity = new DistributionStockArticleEntity();
distributionStockArticleEntity.setOrderCode(orderCode);
distributionStockArticleEntity.setWarehouseEntryTime(orderCountEntity.getCreateTime());
distributionStockArticleEntity.setWarehouseEntryTimeEnd(orderCountEntity.getLatestInTime());
distributionStockArticleEntity.setTotalNumber(total);
distributionStockArticleEntity.setHandQuantity(0);
distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE);// 对应租户ID
log.info("############saveOrderInfo {}", basicdataWarehouseEntity);
distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment());
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName());
distributionStockArticleEntity.setWarehouseId(basicdataWarehouseEntity.getId());
distributionStockArticleEntity.setDealerCode(advanceEntity.getDealerCode());
distributionStockArticleEntity.setDealerName(advanceEntity.getDealerName());
distributionStockArticleEntity.setMallName(advanceEntity.getDealerName());
distributionStockArticleEntity.setMallCode(advanceEntity.getDealerCode());
if (ObjectUtils.isNotNull(wayBillEntity)) {
distributionStockArticleEntity.setConsigneeUnit(wayBillEntity.getTakeCompany());//收货单位(经销商)
distributionStockArticleEntity.setConsigneePerson(wayBillEntity.getTakePerson());//收货人
distributionStockArticleEntity.setConsigneeAddress(wayBillEntity.getTakeAddress());//收货人地址
distributionStockArticleEntity.setConsigneeMobile(wayBillEntity.getTakePhone());//收货人电话
wayBillNo = wayBillEntity.getWaybillNo();
distributionStockArticleEntity.setWaybillNumber(wayBillNo);
// 根据老运单上的仓库名称找寻新的仓库名称
// 发站
String warehouseName = wayBillEntity.getStartSite();
BasicdataWarehouseEntity t = basicdataWarehouseClient.findByName(warehouseName);
if(ObjectUtils.isNotNull(t)){
distributionStockArticleEntity.setSendWarehouseName(t.getName());
distributionStockArticleEntity.setSendWarehouseId(t.getId());
}
//收货仓库
warehouseName = wayBillEntity.getWarehouseName();
t = basicdataWarehouseClient.findByName(warehouseName);
if(ObjectUtils.isNotNull(t)){
distributionStockArticleEntity.setAcceptWarehouseName(t.getName());
distributionStockArticleEntity.setAcceptWarehouseId(t.getId());
}
String customerName = wayBillEntity.getTakeCompany();//客户名称
distributionStockArticleEntity.setTypeService("1");//默认商配
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName);
log.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity);
if (!Objects.isNull(basicdataClientEntity)) {
//商城
distributionStockArticleEntity.setMallId(basicdataClientEntity.getId());
distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName());
distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId());
log.info("订单同步peisongType {} ", peisongType);
if (StringUtil.isNoneBlank(peisongType)) {
distributionStockArticleEntity.setTypeService(peisongType);
}
}
}
distributionStockArticleEntity.setGenre(1);
distributionStockArticleEntity.setAdvanceId(advanceId);
//--------------2023-07-06 新增字段处理
// 增加订单 经销商信息 和门店信息
buildDealerAndStore(distributionStockArticleEntity, advanceEntity);
distributionStockArticleEntity.setCreateUser(1714696768639311873L);
distributionStockArticleEntity.setUpdateUser(1714696768639311873L);
distributionStockArticleEntity.setCreateDept(1649331096241836033L);
distributionStockArticleEntity.setSortingQuantity(0); //分拣件数
distributionStockArticleEntity.setDeliveryQuantity(0); //配送件数
distributionStockArticleEntity.setTransferQuantity(0); //中转件数
distributionStockArticleEntity.setSigninQuantity(0); //签收件数
//1=部分入库,2=已入库,3=已出库,4=部分签收,5=待出库,6=已上架,7=已分拣,8=部分出库,9=部分装车,10=已装车,11=已签收,12=部分配送,13=已配送
distributionStockArticleEntity.setFreezeStatus(OrderFreezeStatusConstant.weidongjie.getValue()); //冻结状态
distributionStockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //预约状态
distributionStockArticleEntity.setStockupStatus(OrderStockupStatusConstant.daibeihuo.getValue()); //备货状态
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
distributionStockArticleEntity.setWarehouseEntryTime(date);
id = distributionStockArticleClient.addData(distributionStockArticleEntity);
distributionStockArticleEntity.setId(id);
if (id == 0) {
log.warn("#################handleDataToPlatform: 保存订单信息失败 orderCode={}", orderCode);
throw new CustomerException(405, "保存订单信息失败");
}
}else{
id = distributionStockArticleEntity.getId();
distributionStockArticleEntity.setTotalNumber(total);
distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
}
//保存包件信息
saveOrderPackage(distributionStockArticleEntity,basicdataWarehouseEntity,wayBillNo, CommonUtil.dateToString(new Date()),oldWarehouseId);
}
private void saveOrderPackage(DistributionStockArticleEntity distributionStockArticleEntity, BasicdataWarehouseEntity basicdataWarehouseEntity, String waybillNo,String operationTime,Integer oldWarehouseId) {
String orderCode = distributionStockArticleEntity.getOrderCode();
//查询订单下的所有包件
List<OrderDetailEntity> orderDetailList = orderDetailClient.findByOrderCode(orderCode,oldWarehouseId);
for (OrderDetailEntity orderDetailEntity:orderDetailList){
String unitNo = orderDetailEntity.getUnitNo();
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo);
if(!Objects.isNull(parcelListEntity)){
log.info("###########saveOrderPackage: 包条已存在,不同步 unitNo={}",unitNo);
continue;
}
// InventoryDetailEntity inventoryDetailEntity = inventoryDetailClient.findUnitNoIsExist(unitNo,inventoryId);
// if(Objects.isNull(inventoryDetailEntity)){
// log.info("###########saveOrderPackage: 包条不在盘点任务中存在,不同步 unitNo={}",unitNo);
// continue;
// }
Integer status = orderDetailEntity.getStatus();
Integer carsType = orderDetailEntity.getCarsType();
Integer signState = orderDetailEntity.getSignState();
waybillNo = orderDetailEntity.getWaybillNo();
Date rukuTime = orderDetailEntity.getCreateTime();
if(StringUtil.isBlank(waybillNo)){
Integer advanceId = orderDetailEntity.getAdvanceId();
AdvanceEntity advanceEntity = advanceClient.fingById(advanceId);
if (!Objects.isNull(advanceEntity)) {
waybillNo = advanceEntity.getWaybillNo();
}
}
log.info("##########waybillNo: waybillNo={} ",waybillNo);
if(waybillNo.contains(",")){
waybillNo = waybillNo.replaceAll(",", "");
}
//存入运单信息
WayBillEntity waybillEntity = saveWaybillEntity(waybillNo);
DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNoAndWarehouseId(unitNo,oldWarehouseId);
DistributionParcelListEntity entity = new DistributionParcelListEntity();
cn.hutool.core.bean.BeanUtil.copyProperties(vo, entity);
entity.setQuantity(1);
entity.setOrderPackageCode(vo.getPacketBarCode());
entity.setConditions(1);
entity.setWarehouse(distributionStockArticleEntity.getWarehouse());
entity.setWarehouseId(distributionStockArticleEntity.getWarehouseId());
entity.setStockArticleId(distributionStockArticleEntity.getId());
entity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue());
//状态:1到货,2分拣,3装车,4卸货,5出库,6配送
// if(1 == status){
// entity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue());
// }
// if(3==carsType||4 == carsType){
// entity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue());
// }
if(2 == signState){
entity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());
}else{
entity.setOrderPackageStatus(OrderPackageStatusConstant.zhongzhuanruku.getValue());
if(!Objects.isNull(waybillEntity)){
String warehouseName = waybillEntity.getWarehouseName();//目的仓
BasicdataWarehouseEntity endhouse = basicdataWarehouseClient.findByName(warehouseName);
Long endWarehouseId = endhouse.getId();
Long warehouseId = distributionStockArticleEntity.getWarehouseId();
if(endWarehouseId.equals(warehouseId)){
entity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue());
}else{
entity.setOrderPackageStatus(OrderPackageStatusConstant.zhongzhuanruku.getValue());
}
}
}
entity.setOrderPackageFreezeStatus(OrderPackageFreezeStatusConstant.weidongjie.getValue());
entity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
entity.setOrderPackageGroundingStatus(OrderPackageGroundingStatusConstant.daishangjia.getValue());
entity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.daibeihuo.getValue());
entity.setOrderCode(distributionStockArticleEntity.getOrderCode());
entity.setServiceNumber(distributionStockArticleEntity.getServiceNumber());
entity.setWaybillNumber(waybillNo);
// 增加 进销商 名称 编码 发站仓
entity.setSendWarehouseName(distributionStockArticleEntity.getSendWarehouseName());
entity.setSendWarehouseId(distributionStockArticleEntity.getSendWarehouseId());
//收货仓库
entity.setAcceptWarehouseName(distributionStockArticleEntity.getAcceptWarehouseName());
entity.setAcceptWarehouseId(distributionStockArticleEntity.getAcceptWarehouseId());
//进销售
entity.setDealerCode(distributionStockArticleEntity.getDealerCode());
entity.setDealerName(distributionStockArticleEntity.getDealerName());
entity.setWarehouseEntryTimeEnd(rukuTime);
entity.setMaterialCode(vo.getMaterialCode());
entity.setMaterialName(vo.getMaterialName());
entity.setCreateUser(1714696768639311873L);
entity.setUpdateUser(1714696768639311873L);
entity.setCreateDept(1649331096241836033L);
entity.setTenantId(TenantNum.HUITONGCODE);
if (StringUtil.isNotBlank(entity.getMaterialName()) && StringUtil.isNotBlank(entity.getMaterialCode())) {
// 查询物料信息
String sku = "";
BasicMaterialEntity basicMaterialEntity = basicMaterialClient.getMaterialOwn(entity.getMaterialCode(), entity.getMaterialName(), sku);
if (ObjectUtils.isNotNull(basicMaterialEntity)) {
entity.setMaterialId(basicMaterialEntity.getId());
entity.setMaterialCode(basicMaterialEntity.getProductCode());
entity.setMaterialUnit(basicMaterialEntity.getLogpmUnit());
}
}
boolean b = distributionParcelListClient.add(entity);
if (!b) {
log.warn("#################handleDataToPlatform: 保存包件信息失败 orderCode={}", entity.getOrderCode());
}else{
log.info("################handleDataToPlatform: 保存包件成功 OrderPackageCode={}",vo.getPacketBarCode());
// distributionStockArticleClient.updateOrderInfo(orderCode,distributionStockArticleEntity.getWarehouseId());
// Integer handQuantity = distributionStockArticleEntity.getHandQuantity();
// Integer totalNumber = distributionStockArticleEntity.getTotalNumber();
//
// if(handQuantity+1 >= totalNumber){
// distributionStockArticleEntity.setCompleteSet(1);
// distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue());
// distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue());
// }else{
// distributionStockArticleEntity.setCompleteSet(0);
// distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.bufenshouhuo.getValue());
// distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue());
// }
// distributionStockArticleEntity.setHandQuantity(handQuantity + 1);
// distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity);
}
}
}
private void buildDealerAndStore(DistributionStockArticleEntity distributionStockArticleEntity, AdvanceEntity advanceEntity) {
// 进销商信息从来系统获取
distributionStockArticleEntity.setStoreName(advanceEntity.getStoreName());
distributionStockArticleEntity.setStoreCode(advanceEntity.getStoreNo());
// 最终客户
distributionStockArticleEntity.setCustomerName(advanceEntity.getCustomerName());
distributionStockArticleEntity.setCustomerAddress(advanceEntity.getCustomerRoad());
distributionStockArticleEntity.setCustomerTelephone(advanceEntity.getCustomerPhone());
// 服务号
distributionStockArticleEntity.setServiceNumber(advanceEntity.getServiceNum());
distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName());
// 品牌
distributionStockArticleEntity.setBrand(advanceEntity.getType());
distributionStockArticleEntity.setResource(advanceEntity.getSystemType());
}
private String getPeisongTypeByClientId(Long id) {
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(id, 3);
log.info(">>>>>>> 查询客户的配送类型{}", basicdataStoreBusinessEntity);
if(ObjectUtil.isEmpty(basicdataStoreBusinessEntity)){
return null;
}
return basicdataStoreBusinessEntity.getMold();
}
private WayBillEntity saveWaybillEntity(String waybillNo) {
log.info("#################handleDataToPlatform.saveWaybillEntity: {}", waybillNo);
if (StringUtil.isBlank(waybillNo)) {
return null;
}
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo);
//通过运单号先去查询新系统是否存在这个运单号
WarehouseWaybillEntity warehouseWaybill = warehouseWaybillService.findByWaybillNo(waybillNo);
log.info("#################handleDataToPlatform.warehouseWaybill: {}", warehouseWaybill);
if (Objects.isNull(warehouseWaybill)) {
log.info("#################handleDataToPlatform.wayBillEntity: {}", wayBillEntity);
if (Objects.isNull(wayBillEntity)) {
log.warn("##############saveWaybillEntity: 老系统中未找到对应运单waybillNo={}", waybillNo);
throw new CustomerException("老系统中未找到对应运单");
}
String startSite = wayBillEntity.getStartSite();//始发仓名称
BasicdataWarehouseEntity starthouse = basicdataWarehouseClient.findByName(startSite);
String warehouseName = wayBillEntity.getWarehouseName();//目的仓
BasicdataWarehouseEntity endhouse = basicdataWarehouseClient.findByName(warehouseName);
Integer number = wayBillEntity.getNumber();//运单总数量
String packname = wayBillEntity.getPackname();
String agent = wayBillEntity.getAgent();
warehouseWaybill = new WarehouseWaybillEntity();
warehouseWaybill.setWaybillNo(waybillNo);
warehouseWaybill.setOrderNo(wayBillEntity.getOrderNo());
warehouseWaybill.setDestinationWarehouseName(warehouseName);
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId());
warehouseWaybill.setDepartureWarehouseName(startSite);
warehouseWaybill.setDepartureWarehouseId(Objects.isNull(starthouse) ? null : starthouse.getId());
warehouseWaybill.setCustomerTrain(wayBillEntity.getCarNo());
warehouseWaybill.setBrand(wayBillEntity.getBrand());
String sendCompany = wayBillEntity.getSendCompany();//发货单位
String takeCompany = wayBillEntity.getTakeCompany();//收货单位
BasicdataClientEntity sendClient = basicdataClientClient.findByName(sendCompany);
BasicdataClientEntity takeClient = basicdataClientClient.findByName(takeCompany);
if (!Objects.isNull(sendClient)) {
Long clientEntityId = sendClient.getId();//基础客户
warehouseWaybill.setShipperId(clientEntityId);
}
if (!Objects.isNull(takeClient)) {
Long clientEntityId = takeClient.getId();//基础客户
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(clientEntityId, 3);
if (!Objects.isNull(basicdataStoreBusinessEntity)) {
warehouseWaybill.setServiceType(Integer.parseInt(basicdataStoreBusinessEntity.getMold()));
}
warehouseWaybill.setConsigneeId(clientEntityId);
}
warehouseWaybill.setShipper(sendCompany);
warehouseWaybill.setShipperName(wayBillEntity.getSendPerson());
warehouseWaybill.setShipperMobile(wayBillEntity.getSendMobile());
warehouseWaybill.setShipperAddress(wayBillEntity.getSendAddress());
warehouseWaybill.setConsignee(takeCompany);
warehouseWaybill.setConsigneeName(wayBillEntity.getTakePerson());
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakeMobile());
warehouseWaybill.setConsigneeAddress(wayBillEntity.getTakeAddress());
warehouseWaybill.setDestination(wayBillEntity.getArriveSite());
warehouseWaybill.setGoodsName(packname);
warehouseWaybill.setTotalCount(number);
warehouseWaybill.setStockCount(number);
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight());
warehouseWaybill.setTotalVolume(wayBillEntity.getVolume());
warehouseWaybill.setDeliveryMethod(wayBillEntity.getSendType());
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()+"");
warehouseWaybill.setReceiptCount(wayBillEntity.getReceiptNum());
warehouseWaybill.setReceiptRequirement(wayBillEntity.getReceiptAsk());
//--------------2023-07-28-------------
warehouseWaybill.setCollectPay(wayBillEntity.getDPay());
warehouseWaybill.setReceivedCollectPay(BigDecimal.ZERO);
warehouseWaybill.setReplacePrice(wayBillEntity.getReplacePrice());
warehouseWaybill.setReceivedReplacePrice(BigDecimal.ZERO);
warehouseWaybill.setReceivedTotalPrice(BigDecimal.ZERO);
warehouseWaybill.setWaybillType(wayBillEntity.getType());
warehouseWaybill.setReceivedStatus(0);
warehouseWaybill.setTotalFreight(wayBillEntity.getFreight());
warehouseWaybill.setDeliveryFee(wayBillEntity.getDeliveryCost());
warehouseWaybill.setPickupFee(wayBillEntity.getTakeCost());
warehouseWaybill.setWarehouseManagementFee(wayBillEntity.getWarehouseManagementFee());
warehouseWaybill.setStorageFee(wayBillEntity.getWarehousingFee());
warehouseWaybill.setHandlingFee(wayBillEntity.getPretendCost());
warehouseWaybill.setOtherFee(wayBillEntity.getOtherFee());
warehouseWaybill.setInsuranceFee(wayBillEntity.getPriceProtectionFee());
warehouseWaybill.setClaimingValue(wayBillEntity.getValue());
warehouseWaybill.setPayType(wayBillEntity.getPayType()+"");
warehouseWaybill.setPayWay(wayBillEntity.getPaymentMethod()+"");
warehouseWaybill.setXPay(wayBillEntity.getXPay());
warehouseWaybill.setDPay(wayBillEntity.getDPay());
warehouseWaybill.setHPay(wayBillEntity.getHPay());
warehouseWaybill.setYPay(wayBillEntity.getYPay());
warehouseWaybill.setThirdOperationFee(wayBillEntity.getThreeHandleFee());
warehouseWaybill.setDeliveryWay(wayBillEntity.getSendType()+"");
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()+"");
warehouseWaybill.setReceipt(wayBillEntity.getReceiptAsk());
warehouseWaybill.setReceiptNum(wayBillEntity.getReceiptNum());
warehouseWaybill.setTransportType(wayBillEntity.getShippingType()+"");
warehouseWaybill.setRebate(wayBillEntity.getRebate());
BasicdataClientEntity agentClient = basicdataClientClient.findByName(agent);
if (!Objects.isNull(agentClient)) {
Long clientEntityId = agentClient.getId();//基础客户
warehouseWaybill.setAgentId(clientEntityId);
}
Date date = new Date();
warehouseWaybill.setAgent(agent);
warehouseWaybill.setDocumentMakingTime(wayBillEntity.getPreparationTime());
warehouseWaybill.setRemark(wayBillEntity.getMsg());
warehouseWaybill.setBatchNo(wayBillEntity.getStartCarsNo());
warehouseWaybill.setFreezeStatus(0);
warehouseWaybill.setStatus(0);
warehouseWaybill.setIsDeleted(0);
warehouseWaybill.setCreateTime(date);
warehouseWaybill.setUpdateTime(date);
warehouseWaybillService.save(warehouseWaybill);
} else {
// warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1);
warehouseWaybill.setUpdateTime(new Date());
warehouseWaybillService.updateById(warehouseWaybill);
}
//暂存单与运单的关联
saveAdvanceData(warehouseWaybill);
return wayBillEntity;
}
private void saveAdvanceData(WarehouseWaybillEntity warehouseWaybill) {
String waybillNo = warehouseWaybill.getWaybillNo();
Long waybillId = warehouseWaybill.getId();
//查看新系统是否有关联数据
List<TrunklineWaybillOrderEntity> waybillOrderList = waybillOrderClient.findListByWaybillNo(waybillNo);
if(waybillOrderList.isEmpty()){
//没有关联订单数据
//查老系统的运单关联哪些订单
List<Integer> advanceIds = wayBillClient.findAdvanceIdsByWaybillNo(waybillNo);
if(advanceIds.isEmpty()){
log.warn("#############saveAdvanceData: 老系统运单未有关联订单 waybillNo={}",waybillNo);
throw new CustomerException(405,"老系统运单未有关联订单");
}
List<AdvanceEntity> advanceList = advanceClient.findListByAdvanceIds(advanceIds);
for (AdvanceEntity advanceEntity : advanceList) {
Integer advanceId = advanceEntity.getId();
Integer oldWarehouseId = advanceEntity.getWarehouseId();
String orderCode = advanceEntity.getOrderSelfNum();
Integer totalNum = advanceEntity.getTotal();
String brand = advanceEntity.getType();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
Date date = new Date();
TrunklineAdvanceEntity trunklineAdvanceEntity = new TrunklineAdvanceEntity();
trunklineAdvanceEntity.setTenantId(TenantNum.HUITONGCODE);
trunklineAdvanceEntity.setCreateUser(1714696768639311873L);
trunklineAdvanceEntity.setCreateTime(date);
trunklineAdvanceEntity.setUpdateUser(1714696768639311873L);
trunklineAdvanceEntity.setUpdateTime(date);
trunklineAdvanceEntity.setStatus(1);
trunklineAdvanceEntity.setIsDeleted(0);
trunklineAdvanceEntity.setCreateDept(1649331096241836033L);
trunklineAdvanceEntity.setWarehouseId(basicdataWarehouseEntity.getId());
trunklineAdvanceEntity.setWarehouseName(basicdataWarehouseEntity.getName());
trunklineAdvanceEntity.setOrderCode(orderCode);
trunklineAdvanceEntity.setSiteName(advanceEntity.getSiteName());
trunklineAdvanceEntity.setArea(advanceEntity.getArea());
trunklineAdvanceEntity.setOrderType(advanceEntity.getOrderTypeName());
trunklineAdvanceEntity.setBrand(advanceEntity.getType());
trunklineAdvanceEntity.setTotalNum(totalNum);
trunklineAdvanceEntity.setPackCode(advanceEntity.getFirstPackCode());
trunklineAdvanceEntity.setPackName(advanceEntity.getFirstPackName());
trunklineAdvanceEntity.setDealerCode(advanceEntity.getDealerCode());
trunklineAdvanceEntity.setDealerName(advanceEntity.getDealerName());
trunklineAdvanceEntity.setCarrierName(advanceEntity.getCarrierName());
trunklineAdvanceEntity.setCustomerName(advanceEntity.getCustomerName());
trunklineAdvanceEntity.setCustomerPhone(advanceEntity.getCustomerPhone());
trunklineAdvanceEntity.setCustomerAddress(advanceEntity.getCustomerRoad());
trunklineAdvanceEntity.setSystemType(advanceEntity.getSystemType());
trunklineAdvanceEntity.setStoreCode(advanceEntity.getStoreNo());
trunklineAdvanceEntity.setStoreName(advanceEntity.getStoreName());
trunklineAdvanceEntity.setServiceNum(advanceEntity.getServiceNum());
trunklineAdvanceEntity.setMatingType(advanceEntity.getMatingCode());
trunklineAdvanceEntity.setSenderName(advanceEntity.getSenderName());
trunklineAdvanceEntity.setSenderPhone(advanceEntity.getSenderMobile());
trunklineAdvanceEntity.setSenderAddress(advanceEntity.getSenderAddress());
Integer waybillStatus = advanceEntity.getWaybillStatus();
if(waybillStatus == 1){
trunklineAdvanceEntity.setWaybillStatus("0");
}else if(waybillStatus == 2){
trunklineAdvanceEntity.setWaybillStatus("1");
}
trunklineAdvanceEntity.setWaybillNo(advanceEntity.getWaybillNo());
trunklineAdvanceEntity.setTrainNumber(advanceEntity.getMctsTruck());
Integer freeze = advanceEntity.getFreeze();
if(freeze == 1){
trunklineAdvanceEntity.setFreezeStatus("0");
}else if(freeze == 2){
trunklineAdvanceEntity.setFreezeStatus("1");
}
String leaveBehind = advanceEntity.getLeaveBehind();
if("N".equals(leaveBehind)){
trunklineAdvanceEntity.setLegacyStatus("0");
}else if("Y".equals(leaveBehind)){
trunklineAdvanceEntity.setLegacyStatus("1");
}
trunklineAdvanceEntity.setDeliveryDate(CommonUtil.StringToDate(advanceEntity.getDueDate()));
Long newAdvanceId = trunklineAdvanceClient.addAdvanceReturnId(trunklineAdvanceEntity);
if(Objects.isNull(newAdvanceId)){
log.warn("#############saveAdvanceData: 保存暂存单失败 orderCode={}",orderCode);
continue;
}else{
//生成对应的运单关联订单信息
TrunklineWaybillOrderEntity trunklineWaybillOrderEntity = new TrunklineWaybillOrderEntity();
trunklineWaybillOrderEntity.setTenantId(TenantNum.HUITONGCODE);
trunklineWaybillOrderEntity.setCreateUser(1714696768639311873L);
trunklineWaybillOrderEntity.setCreateTime(date);
trunklineWaybillOrderEntity.setUpdateUser(1714696768639311873L);
trunklineWaybillOrderEntity.setUpdateTime(date);
trunklineWaybillOrderEntity.setStatus(1);
trunklineWaybillOrderEntity.setIsDeleted(0);
trunklineWaybillOrderEntity.setCreateDept(1649331096241836033L);
trunklineWaybillOrderEntity.setWarehouseId(basicdataWarehouseEntity.getId());
trunklineWaybillOrderEntity.setWaybillNo(basicdataWarehouseEntity.getName());
trunklineWaybillOrderEntity.setWaybillId(waybillId);
trunklineWaybillOrderEntity.setWaybillNo(waybillNo);
trunklineWaybillOrderEntity.setAdvanceId(newAdvanceId);
trunklineWaybillOrderEntity.setOrderCode(orderCode);
trunklineWaybillOrderEntity.setTotalNumber(totalNum);
trunklineWaybillOrderEntity.setHandleNumber(0);
waybillOrderClient.addEntityReturnId(trunklineWaybillOrderEntity);
//查询暂存单包件
List<AdvanceDetailEntity> detailList = advanceDetailClient.findListByAdvanceId(advanceId);
List<TrunklineAdvanceDetailEntity> newPackageList = new ArrayList<>();
for (AdvanceDetailEntity advanceDetailEntity : detailList) {
String unitNo = advanceDetailEntity.getUnitNo();
TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = new TrunklineAdvanceDetailEntity();
trunklineAdvanceDetailEntity.setTenantId(TenantNum.HUITONGCODE);
trunklineAdvanceDetailEntity.setCreateUser(1714696768639311873L);
trunklineAdvanceDetailEntity.setCreateTime(date);
trunklineAdvanceDetailEntity.setUpdateUser(1714696768639311873L);
trunklineAdvanceDetailEntity.setUpdateTime(date);
trunklineAdvanceDetailEntity.setStatus(1);
trunklineAdvanceDetailEntity.setIsDeleted(0);
trunklineAdvanceDetailEntity.setCreateDept(1649331096241836033L);
trunklineAdvanceDetailEntity.setWarehouseId(basicdataWarehouseEntity.getId());
trunklineAdvanceDetailEntity.setWarehouseName(basicdataWarehouseEntity.getName());
trunklineAdvanceDetailEntity.setAdvanceId(newAdvanceId);
trunklineAdvanceDetailEntity.setOrderCode(advanceDetailEntity.getOrderSelfNum());
trunklineAdvanceDetailEntity.setBrand(advanceDetailEntity.getType());
trunklineAdvanceDetailEntity.setSystemType(advanceDetailEntity.getSystemType());
trunklineAdvanceDetailEntity.setFirstPackName(advanceDetailEntity.getFirstPackName());
trunklineAdvanceDetailEntity.setSecondPackName(advanceDetailEntity.getSecondPackName());
trunklineAdvanceDetailEntity.setThirdPackName(advanceDetailEntity.getThirdPackName());
trunklineAdvanceDetailEntity.setSiteCode(advanceDetailEntity.getSiteCode());
trunklineAdvanceDetailEntity.setSiteName(advanceDetailEntity.getSiteName());
trunklineAdvanceDetailEntity.setQuantity(new BigDecimal(advanceDetailEntity.getMscsNum()).intValue());
trunklineAdvanceDetailEntity.setOrderPackageCode(unitNo);
trunklineAdvanceDetailEntity.setTrainNumber(advanceDetailEntity.getMctsTruck());
trunklineAdvanceDetailEntity.setServiceNum(advanceDetailEntity.getServiceNum());
trunklineAdvanceDetailEntity.setWaybillNo(waybillNo);
trunklineAdvanceDetailEntity.setPackageStatus("1");
trunklineAdvanceDetailEntity.setChargeType(1);
newPackageList.add(trunklineAdvanceDetailEntity);
//同步包内明细
List<DetailProductEntity> detailProductList = detailProductClient.findListByUnitNo(unitNo);
List<TrunklineDetailProductEntity> trunklineDetailProductEntities = new ArrayList<>();
for (DetailProductEntity detailProductEntity : detailProductList) {
TrunklineDetailProductEntity trunklineDetailProductEntity = new TrunklineDetailProductEntity();
trunklineDetailProductEntity.setTenantId(TenantNum.HUITONGCODE);
trunklineDetailProductEntity.setCreateUser(1714696768639311873L);
trunklineDetailProductEntity.setCreateTime(date);
trunklineDetailProductEntity.setUpdateUser(1714696768639311873L);
trunklineDetailProductEntity.setUpdateTime(date);
trunklineDetailProductEntity.setStatus(1);
trunklineDetailProductEntity.setIsDeleted(0);
trunklineDetailProductEntity.setCreateDept(1649331096241836033L);
trunklineDetailProductEntity.setWarehouseId(basicdataWarehouseEntity.getId());
trunklineDetailProductEntity.setWarehouseName(basicdataWarehouseEntity.getName());
trunklineDetailProductEntity.setUnitNo(detailProductEntity.getUnitNo());
trunklineDetailProductEntity.setProductCode(detailProductEntity.getProductcode());
trunklineDetailProductEntity.setProductName(detailProductEntity.getProductname());
trunklineDetailProductEntity.setQuantity(detailProductEntity.getDelivernum());
trunklineDetailProductEntities.add(trunklineDetailProductEntity);
}
trunklineDetailProductClient.addListEntity(trunklineDetailProductEntities);
}
trunklineAdvanceDetailClient.addAdvanceBatch(newPackageList);
}
}
log.info("##############saveAdvanceData: 运单同步已完成 waybillNo={}",waybillNo);
}else{
log.info("##############saveAdvanceData: 运单已有关联订单 waybillNo={}",waybillNo);
}
}
private R moveTrayOrderPackageCode(WarehouseTrayTypeEntity trayTypeEntity, String orderPackageCode) {
Long wid = trayTypeEntity.getWarehouseId();

12
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java

@ -33,6 +33,7 @@ import com.logpm.warehouse.vo.WarehouseUpdownGoodsVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -229,4 +230,15 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
return baseMapper.findUpdownStockByMaterialCode(materialCode,marketId,warehouseId);
}
@Override
public String getAllocationNameByOrderPackageCode(String orderPackageCode,Integer type) {
String[] split = Func.split(orderPackageCode, ",");
return baseMapper.getAllocationNameByOrderPackageCode(split,type);
}
@Override
public String getAllocationNameByInventory(Long marketId, String cargoNumber) {
return baseMapper.getAllocationNameByInventory( marketId, cargoNumber);
}
}

14
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

@ -37,6 +37,7 @@ import com.logpm.warehouse.vo.WarehouseWaybillVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.TenantNum;
import org.springblade.common.constant.order.*;
import org.springblade.common.exception.CustomerException;
@ -82,10 +83,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
@Override
@Transactional(rollbackFor = Exception.class)
public void
waybillDataHandler(WaybillDTO waybillDTO) {
public void waybillDataHandler(WaybillDTO waybillDTO) {
// 这里需要通过查询运单信息 判单
@ -105,15 +103,17 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
WayBillEntity wayBillEntity = wayBillClient.getByWaybillId(wayBillId);
if (ObjectUtils.isNull(wayBillEntity)) {
log.warn("##############waybillDataHandler: 老系统中未找到对应运单waybillId={}", waybillDTO.getId());
throw new CustomerException("老系统中未找到对应运单");
}
// 需要验证当前需要开启的数据推送仓库
if(!OldSystemDataPushConfig.getWarehourseIdList().contains(wayBillEntity.getWarehouseId()+"")){
log.info(">>>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", wayBillEntity.getWarehouseId());
throw new CustomerException("当前开单仓库不是目前系统上线运行仓库");
}
String waybillNo = wayBillEntity.getWaybillNo();

Loading…
Cancel
Save