From 8e94984c433d9b44962a6f3f6375628c21295a6c Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Sat, 16 Dec 2023 20:13:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=90=8C=E6=AD=A5=E6=89=98=E7=9B=98=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/IWarehouseTrayTypeClient.java | 2 +- .../warehouse/vo/OrderPackageInfoVO.java | 15 ++ .../warehouse/vo/WarehouseTrayTypeVO.java | 7 + .../api/WarehouseTrayTypeApiController.java | 71 +++++++ .../controller/OldSystemPushController.java | 64 ++++++- .../com/logpm/warehouse/dto/TrayInfoDTO.java | 15 ++ .../mapper/WarehouseTrayGoodsMapper.java | 6 + .../mapper/WarehouseTrayGoodsMapper.xml | 32 ++++ .../warehouse/service/IAsyncDataService.java | 4 + .../service/IWarehouseTrayGoodsService.java | 6 + .../service/IWarehouseTrayTypeService.java | 4 + .../service/impl/AsyncDataServiceImpl.java | 181 +++++++++++++++++- .../impl/WarehouseTrayGoodsServiceImpl.java | 15 ++ .../impl/WarehouseTrayTypeServiceImpl.java | 88 ++++++++- 14 files changed, 499 insertions(+), 11 deletions(-) create mode 100644 blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/OrderPackageInfoVO.java create mode 100644 blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java index 8ff7aff97..a180dc3bc 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseTrayTypeClient.java @@ -58,7 +58,7 @@ public interface IWarehouseTrayTypeClient { @PostMapping(API_PREFIX+"/orderScanOrderPackageCode") boolean orderScanOrderPackageCode(@RequestBody Map map); - @PostMapping(API_PREFIX+"/orderScanOrderPackageCode") + @PostMapping(API_PREFIX+"/orderScanOrderPackageCodeReturnR") R orderScanOrderPackageCodeReturnR(@RequestBody Map map); @PostMapping(API_PREFIX+"/enterZeroOrderByTrayCode") diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/OrderPackageInfoVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/OrderPackageInfoVO.java new file mode 100644 index 000000000..c0713e631 --- /dev/null +++ b/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; + +} diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java index 2c5ff64b5..541a8c96b 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayTypeVO.java +++ b/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 packageList = new ArrayList<>(); + + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java index 105e1ffaa..17a8284c4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTrayTypeApiController.java @@ -1196,4 +1196,75 @@ 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,"系统异常,联系管理员"); + } + } + + + } 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 eb7ac9bcb..3eb9a50a4 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 @@ -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,13 @@ 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 @@ -137,7 +138,60 @@ 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: 系统异常"); + } + } 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 new file mode 100644 index 000000000..67f58e6cb --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java index 99ddf89df..5314b28cf 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java @@ -74,4 +74,10 @@ public interface WarehouseTrayGoodsMapper extends BaseMapper findOrderPackageCodeInfoList(@Param("trayCode") String trayCode); + + List findZeroOrderInfoList(@Param("trayCode") String trayCode); + + List findStockInfoList(@Param("trayCode") String trayCode); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml index b513e472f..f67be2fa4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml @@ -349,5 +349,37 @@ where tray_type_id = #{trayTypeId} + + + + + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IAsyncDataService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IAsyncDataService.java index 3fd92e693..295daaef5 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IAsyncDataService.java +++ b/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); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java index 17f33e2f8..4706091e0 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java @@ -100,4 +100,10 @@ public interface IWarehouseTrayGoodsService extends BaseService findOrderPackageCodeInfoList(String trayCode); + + List findZeroOrderInfoList(String trayCode); + + List findStockInfoList(String trayCode); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java index 884632b61..909ecc80b 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java @@ -96,4 +96,8 @@ public interface IWarehouseTrayTypeService extends BaseService findAllGoodsByTrayCodeAndWarehouseId(String trayCode, Long warehouseId); void changeTrayWarehouseInfo(String trayCode, Long warehouseId); + + R findSyncTrayData(String trayCode, Long warehouseId); + + R findSyncOldTrayData(String trayCode, Long warehouseId); } 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 cc2242cb5..1c24d4534 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 @@ -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.orderScanOrderPackageCode(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 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 upShelfPackageList = new ArrayList<>(); + UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO(); + upShelfPackageDTO.setOrderPackageCode(orderPackageCode); + upShelfPackageList.add(upShelfPackageDTO); + + updownTypeService.downPackage(upShelfPackageList,wid); + } + } + + R r = trayTypeService.orderScanOrderPackageCode(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 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 upShelfPackageList = new ArrayList<>(); + UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO(); + upShelfPackageDTO.setOrderPackageCode(orderPackageCode); + upShelfPackageList.add(upShelfPackageDTO); + + updownTypeService.downPackage(upShelfPackageList,wid); + } + R r = trayTypeService.orderScanOrderPackageCode(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.orderScanOrderPackageCode(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 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: 处理库存品的打托"); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java index fcc393c58..2ba4de9e1 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java @@ -292,6 +292,21 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl findOrderPackageCodeInfoList(String trayCode) { + return baseMapper.findOrderPackageCodeInfoList(trayCode); + } + + @Override + public List findZeroOrderInfoList(String trayCode) { + return baseMapper.findZeroOrderInfoList(trayCode); + } + + @Override + public List findStockInfoList(String trayCode) { + return baseMapper.findStockInfoList(trayCode); + } + @Override public Boolean deleteByMasterId(Long masterId) { int delete = baseMapper.delete(new QueryWrapper().lambda() diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java index 84caa6457..ded3204c4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java @@ -16,10 +16,16 @@ 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.TrayScanDesEntity; +import com.logpm.oldproject.feign.ITrayScanClient; +import com.logpm.oldproject.feign.ITrayScanDesClient; import com.logpm.warehouse.bean.Resp; import com.logpm.warehouse.dto.TrayTypeDTO; import com.logpm.warehouse.dto.ZeroOrderVO; -import com.logpm.warehouse.entity.*; +import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; +import com.logpm.warehouse.entity.WarehouseTrayGoodsLogEntity; +import com.logpm.warehouse.entity.WarehouseTrayTypeEntity; +import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity; import com.logpm.warehouse.mapper.WarehouseTrayTypeMapper; import com.logpm.warehouse.service.*; import com.logpm.warehouse.vo.*; @@ -66,6 +72,10 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl orderPageList(TrayTypeDTO trayTypeDTO,Long warehouseId) { @@ -2740,6 +2750,82 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl 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); + }else{ + BeanUtil.copy(trayTypeEntity,trayTypeVO); + trayTypeVO.setTrayName(trayEntity.getPalletName()); + } + + List packageList = warehouseTrayGoodsService.findOrderPackageCodeInfoList(trayCode); + List zeroList = warehouseTrayGoodsService.findZeroOrderInfoList(trayCode); + List 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 oldTrayId = trayEntity.getOldId(); + //查询所有托盘包件信息 + Set set = new TreeSet<>(); + List trayScanDesEntityList = trayScanDesClient.findListByTrayId(oldTrayId, oldWarehouseId); + for (TrayScanDesEntity trayScanDesEntity : trayScanDesEntityList) { + String orderPackageCode = trayScanDesEntity.getUnitNo(); + DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); + if(Objects.isNull(parcelListEntity)){ + set.add(trayScanDesEntity.getOrderSelfNum()); + } + } + + + + + return null; + } + private R moveTrayOrderPackageCode(WarehouseTrayTypeEntity trayTypeEntity, String orderPackageCode) { Long wid = trayTypeEntity.getWarehouseId();