From c318aa9c9e416a41fae5b858820d51cc17ada542 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 26 Dec 2023 17:59:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=80=81=E7=B3=BB=E7=BB=9F=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=98=E7=9B=98=E6=8E=A5=E5=8F=A3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basicdata/feign/IBasicdataTrayClient.java | 3 +- .../logpm/oldproject/feign/ITrayClient.java | 2 + .../basicdata/feign/BasicdataTrayClient.java | 8 ++++ .../logpm/oldproject/feign/TrayClient.java | 5 +++ .../logpm/oldproject/mapper/TrayMapper.java | 2 + .../logpm/oldproject/mapper/TrayMapper.xml | 6 +++ .../oldproject/service/ITrayService.java | 1 + .../service/impl/TrayServiceImpl.java | 5 +++ .../controller/OldSystemPushController.java | 6 +-- .../com/logpm/warehouse/dto/TrayInfoDTO.java | 4 ++ .../service/impl/AsyncDataServiceImpl.java | 42 ++++++++++--------- 11 files changed, 61 insertions(+), 23 deletions(-) diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java index 4e3cd06f9..f79d9a4c2 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java @@ -69,5 +69,6 @@ public interface IBasicdataTrayClient { @GetMapping(GETTRAYENTITYLIST) List getTrayEntityList(); - + @GetMapping(API_PREFIX+"/getTrayByTrayNo") + BasicdataTrayEntity getTrayByTrayNo(@RequestParam String trayNo); } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java index 7c12978c8..3d16f3bd0 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java @@ -43,6 +43,8 @@ public interface ITrayClient { @GetMapping(API_PREFIX+"/getTrayById") TrayEntity getTrayById(@RequestParam Integer trayId); + @GetMapping(API_PREFIX+"/getTrayByTrayNo") + TrayEntity getTrayByTrayNo(@RequestParam String trayNo); // @GetMapping(API_PREFIX + "/getOrderByOrderSelfNum") diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java index a7da3cce3..8abf71c72 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java @@ -101,4 +101,12 @@ public class BasicdataTrayClient implements IBasicdataTrayClient { return basicdataTrayService.list(); } + @Override + public BasicdataTrayEntity getTrayByTrayNo(String trayNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("pallet_name",trayNo) + .eq("is_deleted",0); + return basicdataTrayService.getOne(queryWrapper); + } + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java index f8b6dad8f..a402c8cdf 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java @@ -24,4 +24,9 @@ public class TrayClient implements ITrayClient{ public TrayEntity getTrayById(Integer trayId) { return trayService.getTrayById(trayId); } + + @Override + public TrayEntity getTrayByTrayNo(String trayNo) { + return trayService.getTrayByTrayNo(trayNo); + } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.java index 31d429c73..833bdff66 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.java @@ -3,7 +3,9 @@ package com.logpm.oldproject.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.logpm.oldproject.entity.TrayEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; @Mapper public interface TrayMapper extends BaseMapper { + TrayEntity getTrayByTrayNo(@Param("trayNo") String trayNo); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml index b0507f8ea..7be7c8c99 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml @@ -2,4 +2,10 @@ + + diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java index f1db9721d..b100d26e8 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java @@ -11,4 +11,5 @@ public interface ITrayService { TrayEntity getTrayById(Integer trayId); + TrayEntity getTrayByTrayNo(String trayNo); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java index 6444bb45e..3093d97f8 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java @@ -28,4 +28,9 @@ public class TrayServiceImpl implements ITrayService { public TrayEntity getTrayById(Integer trayId) { return trayMapper.selectById(trayId); } + + @Override + public TrayEntity getTrayByTrayNo(String trayNo) { + return trayMapper.getTrayByTrayNo(trayNo); + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java index 9f64c46fc..2c42c283e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java @@ -202,11 +202,11 @@ public class OldSystemPushController { log.info("############addCreateTrayData: 请求参数{}",trayInfoDTO); try{ - Integer trayId = trayInfoDTO.getTrayId(); + List trayNos = trayInfoDTO.getTrayNos(); Integer warehouseId = trayInfoDTO.getWarehouseId(); - if(Objects.isNull(trayId)){ - log.warn("##############addCreateTrayData: 托盘id不存在 trayId={}",trayId); + if(trayNos.size() == 0){ + log.warn("##############addCreateTrayData: 托盘id不存在 trayNos={}",trayNos); return R.fail(405,"托盘id不存在"); } if(Objects.isNull(warehouseId)){ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java index 67f58e6cb..2d465c47f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java @@ -3,6 +3,8 @@ package com.logpm.warehouse.dto; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; @Data public class TrayInfoDTO implements Serializable { @@ -12,4 +14,6 @@ public class TrayInfoDTO implements Serializable { private String orderPackageCode; private Integer type; + private List trayNos = new ArrayList<>(); + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java index 4c46ff43e..3b3ad0d5c 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java @@ -473,7 +473,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService { @Override public void addCreateTrayData(TrayInfoDTO trayInfoDTO) { - Integer trayId = trayInfoDTO.getTrayId(); + List trayNos = trayInfoDTO.getTrayNos(); Integer oldWarehouseId = trayInfoDTO.getWarehouseId(); BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId); @@ -483,26 +483,30 @@ public class AsyncDataServiceImpl implements IAsyncDataService { } Long warehouseId = 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(warehouseId); - basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+""); - basicdataTrayEntity.setType(1); - basicdataTrayEntity.setOldId(trayId); + for (String trayNo : trayNos) { + BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayNo(trayNo); + if(Objects.isNull(basicdataTrayEntity)){ + log.info("############sendTrayInfoByOrderPackageCode: 托盘信息不存在 同步"); + //如果托盘不存在就去同步该托盘 + TrayEntity trayEntity = trayClient.getTrayByTrayNo(trayNo); + 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(trayEntity.getId()); // basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId); - Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity); - basicdataTrayEntity.setId(aLong); + Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity); + basicdataTrayEntity.setId(aLong); + } } + + } private void dealWithStockTray(String materialCode, String marketName, String incomingBatch, Integer stockNum, String trayCode, String trayType, Long warehouseId) {