diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java index f03f145e3..9d3f171c6 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java @@ -1,7 +1,7 @@ package com.logpm.warehouse.feign; import com.logpm.warehouse.dto.TrayInfoDTO; -import com.logpm.warehouse.service.IAsyncDataService; +import com.logpm.warehouse.service.IWarehouseUpdownTypeService; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.RestController; @@ -12,7 +12,7 @@ import springfox.documentation.annotations.ApiIgnore; @AllArgsConstructor public class SyncOldTrayTypeClient implements ISyncOldTrayTypeClient{ - private final IAsyncDataService asyncDataService; + private final IWarehouseUpdownTypeService warehouseUpdownTypeService; @Override public R budaOldTrayTypeData(String orderPackageCode, Integer trayId, Integer type, Integer oldWarehouseId) { @@ -24,7 +24,7 @@ public class SyncOldTrayTypeClient implements ISyncOldTrayTypeClient{ trayInfoDTO.setWarehouseId(oldWarehouseId); try{ - asyncDataService.sendTrayInfoByOrderPackageCode(trayInfoDTO); + warehouseUpdownTypeService.sendTrayInfoByOrderPackageCode(trayInfoDTO); }catch (Exception e){ return R.fail(405,"打托失败"); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java index e23a2031b..29d43b854 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java @@ -1,10 +1,7 @@ package com.logpm.warehouse.service; import com.alibaba.fastjson.JSONObject; -import com.logpm.warehouse.dto.UpShelfOrderDTO; -import com.logpm.warehouse.dto.UpShelfPackageDTO; -import com.logpm.warehouse.dto.UpShelfStockDTO; -import com.logpm.warehouse.dto.UpShelfZeroOrderDTO; +import com.logpm.warehouse.dto.*; import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity; import com.logpm.warehouse.vo.*; import org.springblade.core.mp.base.BaseService; @@ -90,4 +87,6 @@ public interface IWarehouseUpdownTypeService extends BaseService orderUpshelfDetailByAllocationId(String orderCode, Long allocationId, Long warehouseId); String findStockListAllocations(Long warehouseId, Long mallId, String sku); + + void sendTrayInfoByOrderPackageCode(TrayInfoDTO trayInfoDTO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java index f9c9b77b6..959d8bd09 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java @@ -174,6 +174,140 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl trayGoodsEntityQueryWrapper = new QueryWrapper<>(); + trayGoodsEntityQueryWrapper.eq("association_value",orderPackageCode); + WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.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 = warehouseTaryAllocationService.getAllocationIdByTrayId(oldTrayId); + if (Objects.isNull(oldAllocationId)){ + //没有上架 + //直接解绑托盘 + warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId,wid); + }else{ + //有上架 + //下架 + List upShelfPackageList = new ArrayList<>(); + UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO(); + upShelfPackageDTO.setOrderPackageCode(orderPackageCode); + upShelfPackageList.add(upShelfPackageDTO); + + downPackage(upShelfPackageList,wid); + } + } + + R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType,"T"+trayId,orderPackageCode,newWarehouseId); + int code1 = r.getCode(); + if(code1 != 200){ + log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId); + throw new CustomerException(code1,"二次打托失败"); + }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 = warehouseUpdownGoodsService.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); + + downPackage(upShelfPackageList,wid); + } + R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId); + int code1 = r.getCode(); + if(code1 != 200){ + log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId); + throw new CustomerException(code1,"二次打托失败"); + }else{ + log.info("####################orderStatusHandler: 二次打托成功 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId); + } + }else if(code == 4004){ + log.info("####################orderStatusHandler: 包件打托方式不正确 orderPackageCode={} ",orderPackageCode); + //先去空置托盘再打托 + warehouseTrayTypeService.trayToNull("T"+trayId); + + R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId); + int code1 = r.getCode(); + if(code1 != 200){ + log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId); + throw new CustomerException(code1,"二次打托失败"); + } + }else{ + log.warn("######################orderStatusHandler: 打托失败 msg={} code={}",msg,code); + log.warn("######################orderStatusHandler: 打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId); + throw new CustomerException(code,"二次打托失败"); + } + + }else{ + //有上架就上架 + List upShelfPackageList = new ArrayList<>(); + UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO(); + upShelfPackageDTO.setOrderPackageCode(orderPackageCode); + upShelfPackageList.add(upShelfPackageDTO); + upShelfPackage(upShelfPackageList,allocationId,newWarehouseId); + } + } + private void packageChangeStockByAllocaton(WarehouseUpdownGoodsEntity one) { //当前登录人选择的仓库