|
|
|
@ -210,444 +210,444 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
if(questTarget.equals(2)){ |
|
|
|
|
if(isChangeAt == 1){ |
|
|
|
|
List<UpShelfZeroOrderDTO> upShelfZeroOrderDTOS = new ArrayList<>(); |
|
|
|
|
UpShelfZeroOrderDTO upShelfZeroOrderDTO = new UpShelfZeroOrderDTO(); |
|
|
|
|
upShelfZeroOrderDTO.setOrderCode(orderCode); |
|
|
|
|
upShelfZeroOrderDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfZeroOrderDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfZeroOrderDTOS.add(upShelfZeroOrderDTO); |
|
|
|
|
if(!Objects.isNull(groundingAllocationId)){ |
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
R r = updownTypeService.downZeroOrder(upShelfZeroOrderDTOS, warehouseId,"盘点零担下架"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
if(StringUtil.isNotBlank(newTrayCode)){ |
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
R r = updownTypeService.downZeroOrder(upShelfZeroOrderDTOS, warehouseId,"盘点零担下架"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
List<ZeroOrderVO> zeroList = new ArrayList<>(); |
|
|
|
|
ZeroOrderVO zeroOrderVO = new ZeroOrderVO(); |
|
|
|
|
zeroOrderVO.setOrderId(orderId); |
|
|
|
|
zeroOrderVO.setOrderCode(orderCode); |
|
|
|
|
zeroOrderVO.setNum(stockNum); |
|
|
|
|
zeroList.add(zeroOrderVO); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
zeroList.get(0).setNum(nowStockNum); |
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
List<ZeroOrderVO> zeroList = new ArrayList<>(); |
|
|
|
|
ZeroOrderVO zeroOrderVO = new ZeroOrderVO(); |
|
|
|
|
zeroOrderVO.setOrderId(orderId); |
|
|
|
|
zeroOrderVO.setOrderCode(orderCode); |
|
|
|
|
zeroOrderVO.setNum(stockNum); |
|
|
|
|
zeroList.add(zeroOrderVO); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
zeroList.get(0).setNum(nowStockNum); |
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(newTrayCode); |
|
|
|
|
if(Objects.isNull(trayEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在newTrayCode="+newTrayCode,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long newTrayId = trayEntity.getId(); |
|
|
|
|
Long newAllocationId = taryAllocationService.getAllocationIdByTrayId(newTrayId); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(!Objects.isNull(newAllocationId)){ |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,newAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,newAllocationId,warehouseId,"盘点零担上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
List<ZeroOrderVO> zeroList = new ArrayList<>(); |
|
|
|
|
ZeroOrderVO zeroOrderVO = new ZeroOrderVO(); |
|
|
|
|
zeroOrderVO.setOrderId(orderId); |
|
|
|
|
zeroOrderVO.setOrderCode(orderCode); |
|
|
|
|
zeroOrderVO.setNum(stockNum); |
|
|
|
|
zeroList.add(zeroOrderVO); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
zeroList.get(0).setNum(nowStockNum); |
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(isChange == 1 && isChangeAt == 0){ |
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
List<UpShelfZeroOrderDTO> upShelfZeroOrderDTOS = new ArrayList<>(); |
|
|
|
|
UpShelfZeroOrderDTO upShelfZeroOrderDTO = new UpShelfZeroOrderDTO(); |
|
|
|
|
upShelfZeroOrderDTO.setOrderCode(orderCode); |
|
|
|
|
upShelfZeroOrderDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfZeroOrderDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfZeroOrderDTOS.add(upShelfZeroOrderDTO); |
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(!Objects.isNull(nowStockNum) && stockNum-nowStockNum != 0){ |
|
|
|
|
upShelfZeroOrderDTOS.get(0).setEnterNum(stockNum-nowStockNum); |
|
|
|
|
updownTypeService.downZeroOrder(upShelfZeroOrderDTOS,warehouseId,"盘点下架零担"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
List<ZeroOrderVO> zeroList = new ArrayList<>(); |
|
|
|
|
ZeroOrderVO zeroOrderVO = new ZeroOrderVO(); |
|
|
|
|
zeroOrderVO.setOrderId(orderId); |
|
|
|
|
zeroOrderVO.setOrderCode(orderCode); |
|
|
|
|
zeroOrderVO.setNum(nowStockNum); |
|
|
|
|
zeroList.add(zeroOrderVO); |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterZeroOrderByTrayCode(trayType,trayCode,zeroList,warehouseId,"盘点零担打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else if (questTarget.equals(3)){ |
|
|
|
|
|
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListClient.getStockListById(stockId); |
|
|
|
|
if(Objects.isNull(stockListEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品信息不存在stockId="+stockId,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long marketId = stockListEntity.getMarketId(); |
|
|
|
|
String cargoNumber = stockListEntity.getCargoNumber(); |
|
|
|
|
String incomingBatch = stockListEntity.getIncomingBatch(); |
|
|
|
|
Long materialId = stockListEntity.getMaterialId(); |
|
|
|
|
if(isChangeAt == 1){ |
|
|
|
|
if(!Objects.isNull(groundingAllocationId)){ |
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
R r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfStockList.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId); |
|
|
|
|
// if(isChangeAt == 1){
|
|
|
|
|
// List<UpShelfZeroOrderDTO> upShelfZeroOrderDTOS = new ArrayList<>();
|
|
|
|
|
// UpShelfZeroOrderDTO upShelfZeroOrderDTO = new UpShelfZeroOrderDTO();
|
|
|
|
|
// upShelfZeroOrderDTO.setOrderCode(orderCode);
|
|
|
|
|
// upShelfZeroOrderDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfZeroOrderDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfZeroOrderDTOS.add(upShelfZeroOrderDTO);
|
|
|
|
|
// if(!Objects.isNull(groundingAllocationId)){
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// R r = updownTypeService.downZeroOrder(upShelfZeroOrderDTOS, warehouseId,"盘点零担下架");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if(StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,groundingAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// if(StringUtil.isNotBlank(newTrayCode)){
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// R r = updownTypeService.downZeroOrder(upShelfZeroOrderDTOS, warehouseId,"盘点零担下架");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// List<ZeroOrderVO> zeroList = new ArrayList<>();
|
|
|
|
|
// ZeroOrderVO zeroOrderVO = new ZeroOrderVO();
|
|
|
|
|
// zeroOrderVO.setOrderId(orderId);
|
|
|
|
|
// zeroOrderVO.setOrderCode(orderCode);
|
|
|
|
|
// zeroOrderVO.setNum(stockNum);
|
|
|
|
|
// zeroList.add(zeroOrderVO);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// zeroList.get(0).setNum(nowStockNum);
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if(StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// List<ZeroOrderVO> zeroList = new ArrayList<>();
|
|
|
|
|
// ZeroOrderVO zeroOrderVO = new ZeroOrderVO();
|
|
|
|
|
// zeroOrderVO.setOrderId(orderId);
|
|
|
|
|
// zeroOrderVO.setOrderCode(orderCode);
|
|
|
|
|
// zeroOrderVO.setNum(stockNum);
|
|
|
|
|
// zeroList.add(zeroOrderVO);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// zeroList.get(0).setNum(nowStockNum);
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
//
|
|
|
|
|
// BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(newTrayCode);
|
|
|
|
|
// if(Objects.isNull(trayEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在newTrayCode="+newTrayCode,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long newTrayId = trayEntity.getId();
|
|
|
|
|
// Long newAllocationId = taryAllocationService.getAllocationIdByTrayId(newTrayId);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(!Objects.isNull(newAllocationId)){
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,newAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfZeroOrderDTOS.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfZeroOrder(upShelfZeroOrderDTOS,newAllocationId,warehouseId,"盘点零担上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// List<ZeroOrderVO> zeroList = new ArrayList<>();
|
|
|
|
|
// ZeroOrderVO zeroOrderVO = new ZeroOrderVO();
|
|
|
|
|
// zeroOrderVO.setOrderId(orderId);
|
|
|
|
|
// zeroOrderVO.setOrderCode(orderCode);
|
|
|
|
|
// zeroOrderVO.setNum(stockNum);
|
|
|
|
|
// zeroList.add(zeroOrderVO);
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// zeroList.get(0).setNum(nowStockNum);
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,newTrayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if(isChange == 1 && isChangeAt == 0){
|
|
|
|
|
//
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// List<UpShelfZeroOrderDTO> upShelfZeroOrderDTOS = new ArrayList<>();
|
|
|
|
|
// UpShelfZeroOrderDTO upShelfZeroOrderDTO = new UpShelfZeroOrderDTO();
|
|
|
|
|
// upShelfZeroOrderDTO.setOrderCode(orderCode);
|
|
|
|
|
// upShelfZeroOrderDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfZeroOrderDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfZeroOrderDTOS.add(upShelfZeroOrderDTO);
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(!Objects.isNull(nowStockNum) && stockNum-nowStockNum != 0){
|
|
|
|
|
// upShelfZeroOrderDTOS.get(0).setEnterNum(stockNum-nowStockNum);
|
|
|
|
|
// updownTypeService.downZeroOrder(upShelfZeroOrderDTOS,warehouseId,"盘点下架零担");
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if(StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// R r = trayTypeService.deleteZeroOrderByTrayCode(orderCode, trayCode, warehouseId, "盘点零担解托");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId); |
|
|
|
|
if(Objects.isNull(trayGoodsEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long trayGoodsId = trayGoodsEntity.getId(); |
|
|
|
|
R r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(groundingAllocationId); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfStockList.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(groundingAllocationId); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfStockList.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
if(StringUtil.isNotBlank(newTrayCode)){ |
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
R r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode); |
|
|
|
|
if(Objects.isNull(trayEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在trayCode="+trayCode,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long oldTrayId = trayEntity.getId(); |
|
|
|
|
Long oldAllocationId = taryAllocationService.getAllocationIdByTrayId(oldTrayId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
R r = null; |
|
|
|
|
if(!Objects.isNull(oldAllocationId)){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架"); |
|
|
|
|
}else{ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId); |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId); |
|
|
|
|
if(Objects.isNull(trayGoodsEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long trayGoodsId = trayGoodsEntity.getId(); |
|
|
|
|
r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托"); |
|
|
|
|
} |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(newTrayCode); |
|
|
|
|
if(Objects.isNull(trayEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在newTrayCode="+newTrayCode,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long newTrayId = trayEntity.getId(); |
|
|
|
|
Long newAllocationId = taryAllocationService.getAllocationIdByTrayId(newTrayId); |
|
|
|
|
if(!Objects.isNull(newAllocationId)){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(groundingAllocationId); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,newAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
upShelfStockList.get(0).setEnterNum(nowStockNum); |
|
|
|
|
updownTypeService.upShelfStockList(upShelfStockList,newAllocationId,warehouseId,"盘点无数据库存品上架"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId); |
|
|
|
|
String trayType = "100"; |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
List<ZeroOrderVO> zeroList = new ArrayList<>(); |
|
|
|
|
ZeroOrderVO zeroOrderVO = new ZeroOrderVO(); |
|
|
|
|
zeroOrderVO.setOrderId(orderId); |
|
|
|
|
zeroOrderVO.setOrderCode(orderCode); |
|
|
|
|
zeroOrderVO.setNum(stockNum); |
|
|
|
|
zeroList.add(zeroOrderVO); |
|
|
|
|
//查询目前在库件数
|
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(Objects.isNull(nowStockNum)){ |
|
|
|
|
//打托
|
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
}else{ |
|
|
|
|
if(!nowStockNum.equals(0)){ |
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// List<ZeroOrderVO> zeroList = new ArrayList<>();
|
|
|
|
|
// ZeroOrderVO zeroOrderVO = new ZeroOrderVO();
|
|
|
|
|
// zeroOrderVO.setOrderId(orderId);
|
|
|
|
|
// zeroOrderVO.setOrderCode(orderCode);
|
|
|
|
|
// zeroOrderVO.setNum(nowStockNum);
|
|
|
|
|
// zeroList.add(zeroOrderVO);
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterZeroOrderByTrayCode(trayType,trayCode,zeroList,warehouseId,"盘点零担打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else if (questTarget.equals(3)){ |
|
|
|
|
|
|
|
|
|
if(isChange == 1 && isChangeAt == 0){ |
|
|
|
|
//暂不处理数量问题
|
|
|
|
|
if(StringUtil.isNotBlank(allocationId)){ |
|
|
|
|
List<UpShelfStockDTO> upShelfStockList = new ArrayList<>(); |
|
|
|
|
UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO(); |
|
|
|
|
upShelfStockDTO.setMarketId(marketId); |
|
|
|
|
upShelfStockDTO.setMaterialCode(cargoNumber); |
|
|
|
|
upShelfStockDTO.setAllocationId(Long.parseLong(allocationId)); |
|
|
|
|
upShelfStockDTO.setEnterNum(stockNum); |
|
|
|
|
upShelfStockDTO.setIncomingBatch(incomingBatch); |
|
|
|
|
upShelfStockList.add(upShelfStockDTO); |
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
if(!Objects.isNull(nowStockNum) && stockNum-nowStockNum != 0){ |
|
|
|
|
upShelfStockList.get(0).setEnterNum(stockNum-nowStockNum); |
|
|
|
|
updownTypeService.downStock(upShelfStockList,warehouseId,"盘点无数据库存品下架"); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if (StringUtil.isNotBlank(trayCode)){ |
|
|
|
|
String trayType = "100"; |
|
|
|
|
TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId); |
|
|
|
|
if(!Objects.isNull(entityByTrayCode)){ |
|
|
|
|
trayType = entityByTrayCode.getTrayType(); |
|
|
|
|
} |
|
|
|
|
WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId); |
|
|
|
|
if(Objects.isNull(trayGoodsEntity)){ |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Long trayGoodsId = trayGoodsEntity.getId(); |
|
|
|
|
R r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托"); |
|
|
|
|
if(r.getCode() == 200){ |
|
|
|
|
Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child"); |
|
|
|
|
trayTypeService.enterStockNoDataMaterialCode(trayCode,trayType,cargoNumber,marketId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// DistributionStockListEntity stockListEntity = distributionStockListClient.getStockListById(stockId);
|
|
|
|
|
// if(Objects.isNull(stockListEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品信息不存在stockId="+stockId,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long marketId = stockListEntity.getMarketId();
|
|
|
|
|
// String cargoNumber = stockListEntity.getCargoNumber();
|
|
|
|
|
// String incomingBatch = stockListEntity.getIncomingBatch();
|
|
|
|
|
// Long materialId = stockListEntity.getMaterialId();
|
|
|
|
|
// if(isChangeAt == 1){
|
|
|
|
|
// if(!Objects.isNull(groundingAllocationId)){
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// R r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfStockList.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if(StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId);
|
|
|
|
|
//// String trayType = "100";
|
|
|
|
|
//// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
//// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
//// }
|
|
|
|
|
// WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId);
|
|
|
|
|
// if(Objects.isNull(trayGoodsEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long trayGoodsId = trayGoodsEntity.getId();
|
|
|
|
|
// R r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(groundingAllocationId);
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfStockList.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(groundingAllocationId);
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfStockList.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,groundingAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// if(StringUtil.isNotBlank(newTrayCode)){
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// R r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if(StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
|
|
|
|
|
// if(Objects.isNull(trayEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在trayCode="+trayCode,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long oldTrayId = trayEntity.getId();
|
|
|
|
|
// Long oldAllocationId = taryAllocationService.getAllocationIdByTrayId(oldTrayId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// R r = null;
|
|
|
|
|
// if(!Objects.isNull(oldAllocationId)){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// r = updownTypeService.downStock(upShelfStockList, warehouseId,"盘点无数据库存品下架");
|
|
|
|
|
// }else{
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId);
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId);
|
|
|
|
|
// if(Objects.isNull(trayGoodsEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long trayGoodsId = trayGoodsEntity.getId();
|
|
|
|
|
// r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托");
|
|
|
|
|
// }
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(newTrayCode);
|
|
|
|
|
// if(Objects.isNull(trayEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,托盘信息不存在newTrayCode="+newTrayCode,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long newTrayId = trayEntity.getId();
|
|
|
|
|
// Long newAllocationId = taryAllocationService.getAllocationIdByTrayId(newTrayId);
|
|
|
|
|
// if(!Objects.isNull(newAllocationId)){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(groundingAllocationId);
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,newAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// upShelfStockList.get(0).setEnterNum(nowStockNum);
|
|
|
|
|
// updownTypeService.upShelfStockList(upShelfStockList,newAllocationId,warehouseId,"盘点无数据库存品上架");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(newTrayCode, warehouseId);
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// List<ZeroOrderVO> zeroList = new ArrayList<>();
|
|
|
|
|
// ZeroOrderVO zeroOrderVO = new ZeroOrderVO();
|
|
|
|
|
// zeroOrderVO.setOrderId(orderId);
|
|
|
|
|
// zeroOrderVO.setOrderCode(orderCode);
|
|
|
|
|
// zeroOrderVO.setNum(stockNum);
|
|
|
|
|
// zeroList.add(zeroOrderVO);
|
|
|
|
|
// //查询目前在库件数
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(Objects.isNull(nowStockNum)){
|
|
|
|
|
// //打托
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,stockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }else{
|
|
|
|
|
// if(!nowStockNum.equals(0)){
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(newTrayCode,trayType,cargoNumber,materialId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if(isChange == 1 && isChangeAt == 0){
|
|
|
|
|
// //暂不处理数量问题
|
|
|
|
|
// if(StringUtil.isNotBlank(allocationId)){
|
|
|
|
|
// List<UpShelfStockDTO> upShelfStockList = new ArrayList<>();
|
|
|
|
|
// UpShelfStockDTO upShelfStockDTO = new UpShelfStockDTO();
|
|
|
|
|
// upShelfStockDTO.setMarketId(marketId);
|
|
|
|
|
// upShelfStockDTO.setMaterialCode(cargoNumber);
|
|
|
|
|
// upShelfStockDTO.setAllocationId(Long.parseLong(allocationId));
|
|
|
|
|
// upShelfStockDTO.setEnterNum(stockNum);
|
|
|
|
|
// upShelfStockDTO.setIncomingBatch(incomingBatch);
|
|
|
|
|
// upShelfStockList.add(upShelfStockDTO);
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// if(!Objects.isNull(nowStockNum) && stockNum-nowStockNum != 0){
|
|
|
|
|
// upShelfStockList.get(0).setEnterNum(stockNum-nowStockNum);
|
|
|
|
|
// updownTypeService.downStock(upShelfStockList,warehouseId,"盘点无数据库存品下架");
|
|
|
|
|
// }
|
|
|
|
|
// }else{
|
|
|
|
|
// if (StringUtil.isNotBlank(trayCode)){
|
|
|
|
|
// String trayType = "100";
|
|
|
|
|
// TrayTypeDataVO entityByTrayCode = trayTypeService.getEntityByTrayCode(trayCode, warehouseId);
|
|
|
|
|
// if(!Objects.isNull(entityByTrayCode)){
|
|
|
|
|
// trayType = entityByTrayCode.getTrayType();
|
|
|
|
|
// }
|
|
|
|
|
// WarehouseTrayGoodsEntity trayGoodsEntity = trayGoodsService.getStockDataByMaterialIdAndMarketId(materialId, marketId, entityByTrayCode.getTrayTypeId(), incomingBatch, warehouseId);
|
|
|
|
|
// if(Objects.isNull(trayGoodsEntity)){
|
|
|
|
|
// syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,库存品上架记录不存在stockId="+stockId,tenantId,userId,nickName,deptId));
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// Long trayGoodsId = trayGoodsEntity.getId();
|
|
|
|
|
// R r = trayTypeService.deleteStockByTrayGoodsId(trayGoodsId,warehouseId,"盘点无数据库存品解托");
|
|
|
|
|
// if(r.getCode() == 200){
|
|
|
|
|
// Integer nowStockNum = taskQuestService.findStockNum(questDetailId,questNum+"_child");
|
|
|
|
|
// trayTypeService.enterStockNoDataMaterialCode(trayCode,trayType,cargoNumber,marketId,nowStockNum,incomingBatch,warehouseId,"盘点无数据库存品打托");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
syncTaskErrorLogList.add(createErrorLog(questNum,questDetailId,"无数据,数据类型错误questTarget="+questTarget,tenantId,userId,nickName,deptId)); |
|
|
|
|