|
|
|
@ -174,6 +174,140 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
|
|
|
|
|
return String.join(",",allocations); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@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: 托盘信息不存在 同步"); |
|
|
|
|
throw new CustomerException(405,"托盘信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 = warehouseTaryAllocationService.getAllocationIdByTrayId(basicdataTrayEntity.getId()); |
|
|
|
|
if(Objects.isNull(allocationId)){ |
|
|
|
|
//没有上架就直接打托
|
|
|
|
|
R response = warehouseTrayTypeService.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 = 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<UpShelfPackageDTO> 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<WarehouseUpdownGoodsEntity> 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<UpShelfPackageDTO> 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<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>(); |
|
|
|
|
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO(); |
|
|
|
|
upShelfPackageDTO.setOrderPackageCode(orderPackageCode); |
|
|
|
|
upShelfPackageList.add(upShelfPackageDTO); |
|
|
|
|
upShelfPackage(upShelfPackageList,allocationId,newWarehouseId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void packageChangeStockByAllocaton(WarehouseUpdownGoodsEntity one) { |
|
|
|
|
|
|
|
|
|
//当前登录人选择的仓库
|
|
|
|
|