|
|
|
@ -61,46 +61,65 @@ public class InComingServiceImpl implements IInComingService {
|
|
|
|
|
String packageStatus = advanceDetailEntity.getPackageStatus(); |
|
|
|
|
Long advanceId = advanceDetailEntity.getAdvanceId(); |
|
|
|
|
if("1".equals(packageStatus)){ |
|
|
|
|
log.warn("############incomingPackage: 包件已入库 packageCode={} warehouseId={}",packageCode,warehouseId); |
|
|
|
|
return Resp.scanFail(405,"包件已入库","包件已入库"); |
|
|
|
|
} |
|
|
|
|
if(incomingType != 1){ |
|
|
|
|
log.warn("############incomingPackage: 包件已入库 packageCode={} warehouseId={}",packageCode,warehouseId); |
|
|
|
|
return Resp.scanFail(405,"包件已入库","包件已入库"); |
|
|
|
|
}else{ |
|
|
|
|
if(!Objects.isNull(billladingId)){ |
|
|
|
|
//先判断该包件是否已经有提货记录了
|
|
|
|
|
TrunklineBillladingPackageEntity billladingPackageEntity = billladingPackageServicie.findBillladingPackage(packageCode); |
|
|
|
|
if(Objects.isNull(billladingPackageEntity)){ |
|
|
|
|
billladingPackageServicie.saveEntity(packageCode,billladingId,warehouseId,incomingType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(StringUtil.isBlank(warehouseName)){ |
|
|
|
|
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if(!Objects.isNull(warehouseEntity)){ |
|
|
|
|
warehouseName = warehouseEntity.getName(); |
|
|
|
|
//4.如果有托盘码
|
|
|
|
|
if(StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)){ |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("trayType",trayType); |
|
|
|
|
map.put("trayCode",trayCode); |
|
|
|
|
map.put("warehouseId",warehouseId); |
|
|
|
|
map.put("orderPackageCode",packageCode); |
|
|
|
|
warehouseTrayTypeClient.orderScanOrderPackageCode(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//1.修改暂存单包件入库状态
|
|
|
|
|
advanceDetailService.updatePackageStatusById("1",advanceDetailId,warehouseId,warehouseName); |
|
|
|
|
List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId); |
|
|
|
|
advanceService.updateIncomingWarehouseName(String.join(",",incomingWarehouseNames),advanceId); |
|
|
|
|
|
|
|
|
|
//2.判断包件和订单是否已经存入在库订单
|
|
|
|
|
boolean b = advanceService.saveOrderAndPackage(advanceDetailEntity, warehouseId); |
|
|
|
|
|
|
|
|
|
if(b){ |
|
|
|
|
//3.根据是否有提货单id绑定提货单
|
|
|
|
|
if(!Objects.isNull(billladingId)){ |
|
|
|
|
//先判断该包件是否已经有提货记录了
|
|
|
|
|
TrunklineBillladingPackageEntity billladingPackageEntity = billladingPackageServicie.findBillladingPackage(packageCode); |
|
|
|
|
if(Objects.isNull(billladingPackageEntity)){ |
|
|
|
|
billladingPackageServicie.saveEntity(packageCode,billladingId,warehouseId,incomingType); |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isBlank(warehouseName)){ |
|
|
|
|
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if(!Objects.isNull(warehouseEntity)){ |
|
|
|
|
warehouseName = warehouseEntity.getName(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//4.如果有托盘码
|
|
|
|
|
if(StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)){ |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("trayType",trayType); |
|
|
|
|
map.put("trayCode",trayCode); |
|
|
|
|
map.put("warehouseId",warehouseId); |
|
|
|
|
map.put("orderPackageCode",packageCode); |
|
|
|
|
warehouseTrayTypeClient.orderScanOrderPackageCode(map); |
|
|
|
|
//1.修改暂存单包件入库状态
|
|
|
|
|
advanceDetailService.updatePackageStatusById("1",advanceDetailId,warehouseId,warehouseName); |
|
|
|
|
List<String> incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId); |
|
|
|
|
advanceService.updateIncomingWarehouseName(String.join(",",incomingWarehouseNames),advanceId); |
|
|
|
|
|
|
|
|
|
//2.判断包件和订单是否已经存入在库订单
|
|
|
|
|
boolean b = advanceService.saveOrderAndPackage(advanceDetailEntity, warehouseId); |
|
|
|
|
|
|
|
|
|
if(b){ |
|
|
|
|
//3.根据是否有提货单id绑定提货单
|
|
|
|
|
if(!Objects.isNull(billladingId)){ |
|
|
|
|
//先判断该包件是否已经有提货记录了
|
|
|
|
|
TrunklineBillladingPackageEntity billladingPackageEntity = billladingPackageServicie.findBillladingPackage(packageCode); |
|
|
|
|
if(Objects.isNull(billladingPackageEntity)){ |
|
|
|
|
billladingPackageServicie.saveEntity(packageCode,billladingId,warehouseId,incomingType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//4.如果有托盘码
|
|
|
|
|
if(StringUtil.isNotBlank(trayCode) && StringUtil.isNotBlank(trayType)){ |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("trayType",trayType); |
|
|
|
|
map.put("trayCode",trayCode); |
|
|
|
|
map.put("warehouseId",warehouseId); |
|
|
|
|
map.put("orderPackageCode",packageCode); |
|
|
|
|
warehouseTrayTypeClient.orderScanOrderPackageCode(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return R.success("入库成功"); |
|
|
|
|
} |
|
|
|
|