|
|
|
@ -3494,90 +3494,99 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R removeCarsLoadScan(Long carsLoadScanId, Long warehouseId) { |
|
|
|
|
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.getById(carsLoadScanId); |
|
|
|
|
if(Objects.isNull(carsLoadScanEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 配载装车扫描不存在 carsLoadScanId={}",carsLoadScanId); |
|
|
|
|
return R.fail(405,"配载装车扫描不存在"); |
|
|
|
|
} |
|
|
|
|
Long loadId = carsLoadScanEntity.getLoadId(); |
|
|
|
|
public R removeCarsLoadScan(String carsLoadScanIds, Long warehouseId) { |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if(Objects.isNull(carsLoadEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 配载计划不存在 loadId={}",loadId); |
|
|
|
|
return R.fail(405,"配载计划不存在"); |
|
|
|
|
} |
|
|
|
|
String[] split = carsLoadScanIds.split(","); |
|
|
|
|
|
|
|
|
|
Long nowWarehouseId = carsLoadEntity.getNowWarehouseId(); |
|
|
|
|
for (String str : split) { |
|
|
|
|
long carsLoadScanId = Long.parseLong(str); |
|
|
|
|
|
|
|
|
|
if(!nowWarehouseId.equals(warehouseId)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 暂未有权限进行操作 nowWarehouseId={} warehouseId={}",nowWarehouseId,warehouseId); |
|
|
|
|
return R.fail(405,"暂未有权限进行操作"); |
|
|
|
|
} |
|
|
|
|
String loadStatus = carsLoadEntity.getLoadStatus(); |
|
|
|
|
if(!"0".equals(loadStatus) && !"20".equals(loadStatus)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前配载计划不属于到车状态 loadStatus={} warehouseId={}",loadStatus,warehouseId); |
|
|
|
|
return R.fail(405,"当前配载计划不属于到车状态"); |
|
|
|
|
} |
|
|
|
|
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.getById(carsLoadScanId); |
|
|
|
|
if(Objects.isNull(carsLoadScanEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 配载装车扫描不存在 carsLoadScanId={}",carsLoadScanId); |
|
|
|
|
return R.fail(405,"配载装车扫描不存在"); |
|
|
|
|
} |
|
|
|
|
Long loadId = carsLoadScanEntity.getLoadId(); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
|
|
|
|
if(Objects.isNull(carsLoadLineEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前节点信息不存在 loadId={} warehouseId={}",loadId,warehouseId); |
|
|
|
|
return R.fail(405,"当前节点信息不存在"); |
|
|
|
|
} |
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if(Objects.isNull(carsLoadEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 配载计划不存在 loadId={}",loadId); |
|
|
|
|
return R.fail(405,"配载计划不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String nodeStatus = carsLoadLineEntity.getNodeStatus(); |
|
|
|
|
if(!"10".equals(nodeStatus)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前节点不是到车状态 nodeStatus={} warehouseId={}",nodeStatus,warehouseId); |
|
|
|
|
return R.fail(405,"当前节点不是到车状态"); |
|
|
|
|
} |
|
|
|
|
Long nowWarehouseId = carsLoadEntity.getNowWarehouseId(); |
|
|
|
|
|
|
|
|
|
//删除
|
|
|
|
|
boolean b = trunklineCarsLoadScanService.deleteEntityByCarsLoadScanId(carsLoadScanId); |
|
|
|
|
if(b){ |
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
Integer isAbnormal = carsLoadScanEntity.getLoadingAbnormal(); |
|
|
|
|
Integer isData = carsLoadScanEntity.getIsData(); |
|
|
|
|
Integer num = carsLoadScanEntity.getNum(); |
|
|
|
|
Long trayId = carsLoadScanEntity.getTrayId(); |
|
|
|
|
String trayCode = carsLoadScanEntity.getTrayCode(); |
|
|
|
|
String orderCode = carsLoadScanEntity.getOrderCode(); |
|
|
|
|
String waybillNo = carsLoadScanEntity.getWaybillNo(); |
|
|
|
|
String scanCode = carsLoadScanEntity.getScanCode(); |
|
|
|
|
Integer type = carsLoadScanEntity.getType(); |
|
|
|
|
Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); |
|
|
|
|
if(!nowWarehouseId.equals(warehouseId)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 暂未有权限进行操作 nowWarehouseId={} warehouseId={}",nowWarehouseId,warehouseId); |
|
|
|
|
return R.fail(405,"暂未有权限进行操作"); |
|
|
|
|
} |
|
|
|
|
String loadStatus = carsLoadEntity.getLoadStatus(); |
|
|
|
|
if(!"0".equals(loadStatus) && !"20".equals(loadStatus)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前配载计划不属于到车状态 loadStatus={} warehouseId={}",loadStatus,warehouseId); |
|
|
|
|
return R.fail(405,"当前配载计划不属于到车状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(stockArticleEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 订单信息不存在 fromWarehouseId={} orderCode={}",fromWarehouseId,orderCode); |
|
|
|
|
return R.fail(405,"订单信息不存在"); |
|
|
|
|
TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
|
|
|
|
if(Objects.isNull(carsLoadLineEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前节点信息不存在 loadId={} warehouseId={}",loadId,warehouseId); |
|
|
|
|
return R.fail(405,"当前节点信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long articleId = stockArticleEntity.getId(); |
|
|
|
|
distributionStockArticleClient.submitHandleNumByOrderId(-num,articleId); |
|
|
|
|
|
|
|
|
|
if(isData == 1){ |
|
|
|
|
if(type == 1){ |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(scanCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(parcelListEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 包件信息不存在 fromWarehouseId={} scanCode={}",fromWarehouseId,scanCode); |
|
|
|
|
return R.fail(405,"包件信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long wid = parcelListEntity.getWarehouseId(); |
|
|
|
|
String waybillNumber = parcelListEntity.getWaybillNumber(); |
|
|
|
|
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNumber); |
|
|
|
|
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); |
|
|
|
|
if(destinationWarehouseId.equals(wid)){ |
|
|
|
|
parcelListEntity.setOrderPackageStatus("10"); |
|
|
|
|
|
|
|
|
|
String nodeStatus = carsLoadLineEntity.getNodeStatus(); |
|
|
|
|
if(!"10".equals(nodeStatus)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 当前节点不是到车状态 nodeStatus={} warehouseId={}",nodeStatus,warehouseId); |
|
|
|
|
return R.fail(405,"当前节点不是到车状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除
|
|
|
|
|
boolean b = trunklineCarsLoadScanService.deleteEntityByCarsLoadScanId(carsLoadScanId); |
|
|
|
|
if(b){ |
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
Integer isAbnormal = carsLoadScanEntity.getLoadingAbnormal(); |
|
|
|
|
Integer isData = carsLoadScanEntity.getIsData(); |
|
|
|
|
Integer num = carsLoadScanEntity.getNum(); |
|
|
|
|
Long trayId = carsLoadScanEntity.getTrayId(); |
|
|
|
|
String trayCode = carsLoadScanEntity.getTrayCode(); |
|
|
|
|
String orderCode = carsLoadScanEntity.getOrderCode(); |
|
|
|
|
String waybillNo = carsLoadScanEntity.getWaybillNo(); |
|
|
|
|
String scanCode = carsLoadScanEntity.getScanCode(); |
|
|
|
|
Integer type = carsLoadScanEntity.getType(); |
|
|
|
|
Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); |
|
|
|
|
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(stockArticleEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 订单信息不存在 fromWarehouseId={} orderCode={}",fromWarehouseId,orderCode); |
|
|
|
|
return R.fail(405,"订单信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long articleId = stockArticleEntity.getId(); |
|
|
|
|
distributionStockArticleClient.submitHandleNumByOrderId(-num,articleId); |
|
|
|
|
|
|
|
|
|
if(isData == 1){ |
|
|
|
|
if(type == 1){ |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(scanCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(parcelListEntity)){ |
|
|
|
|
log.warn("##################removeCarsLoadScan: 包件信息不存在 fromWarehouseId={} scanCode={}",fromWarehouseId,scanCode); |
|
|
|
|
return R.fail(405,"包件信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long wid = parcelListEntity.getWarehouseId(); |
|
|
|
|
String waybillNumber = parcelListEntity.getWaybillNumber(); |
|
|
|
|
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNumber); |
|
|
|
|
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); |
|
|
|
|
if(destinationWarehouseId.equals(wid)){ |
|
|
|
|
parcelListEntity.setOrderPackageStatus("10"); |
|
|
|
|
}else{ |
|
|
|
|
parcelListEntity.setOrderPackageStatus("20"); |
|
|
|
|
} |
|
|
|
|
distributionParcelListClient.update(parcelListEntity); |
|
|
|
|
updownTypeClient.downPackageOrDelTray(scanCode,warehouseId); |
|
|
|
|
}else{ |
|
|
|
|
parcelListEntity.setOrderPackageStatus("20"); |
|
|
|
|
trayTypeClient.deleteZeroOrderByTrayCode(orderCode,trayCode,warehouseId); |
|
|
|
|
} |
|
|
|
|
distributionParcelListClient.update(parcelListEntity); |
|
|
|
|
updownTypeClient.downPackageOrDelTray(scanCode,warehouseId); |
|
|
|
|
}else{ |
|
|
|
|
trayTypeClient.deleteZeroOrderByTrayCode(orderCode,trayCode,warehouseId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// updateNumByLoadId(loadId);
|
|
|
|
|
|
|
|
|
|
return R.success("删除成功"); |
|
|
|
|