|
|
|
@ -266,7 +266,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
//生成直发商家签收单
|
|
|
|
|
createCustomerSignOrder(loadId,warehouseId); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("#############startCarByLoadId: 签收单或者更新数量失败"); |
|
|
|
|
log.error("#############startCarByLoadId: 签收单或者更新数量失败",e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -283,9 +283,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
|
|
|
|
|
List<TrunklineLoadSignOrderEntity> list = trunklineCarsOrderService.findSignOrderListBy(loadId,warehouseId); |
|
|
|
|
for (TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity : list) { |
|
|
|
|
// TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity = new TrunklineLoadSignOrderEntity();
|
|
|
|
|
// BeanUtil.copy(entity,trunklineLoadSignOrderEntity);
|
|
|
|
|
trunklineLoadSignOrderEntity.setLoadSignCode(codeClient.getCodeByType(CodeNumConstant.TRUNKLINE_LOAD_SIGN,warehouseCode,"")); |
|
|
|
|
trunklineLoadSignOrderService.save(trunklineLoadSignOrderEntity); |
|
|
|
|
} |
|
|
|
|
trunklineLoadSignOrderService.saveBatch(list); |
|
|
|
|
|
|
|
|
|
for (TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity : list) { |
|
|
|
|
Long signOrderId = trunklineLoadSignOrderEntity.getId(); |
|
|
|
@ -487,6 +489,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
private void cancleCustomerSignOrder(Long loadId, Long warehouseId) { |
|
|
|
|
// List<TrunklineLoadSignOrderEntity> list = trunklineLoadSignOrderService.findAllLoadSignOrderList(loadId,warehouseId);
|
|
|
|
|
trunklineLoadSignOrderService.deleteListBySignStatusAndLoadIdAndWarehouseId(loadId,warehouseId); |
|
|
|
|
trunklineCarsOrderService.clearSignOrderId(loadId,warehouseId); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1350,7 +1354,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
TrunklineCarsLoadLineEntity carsLoadLineEntity = new TrunklineCarsLoadLineEntity(); |
|
|
|
|
BeanUtil.copy(carsLoadLineDTO,carsLoadLineEntity); |
|
|
|
|
carsLoadLineEntity.setLoadId(loadId); |
|
|
|
|
carsLoadLineEntity.setNodeStatus("0"); |
|
|
|
|
carsLoadLineEntity.setNodeStatus("10"); |
|
|
|
|
carsLoadLineEntity.setSignStatus("0"); |
|
|
|
|
carsLoadLineEntity.setUnloadStatus("0"); |
|
|
|
|
carsLoadLineEntity.setLoadingStatus("0"); |
|
|
|
@ -2550,12 +2554,20 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
Long loadScanId = carsLoadScanEntity.getId(); |
|
|
|
|
Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); |
|
|
|
|
Integer isAbnormal = 0; |
|
|
|
|
if(finalNodeId.equals(warehouseId)){ |
|
|
|
|
if(warehouseId.equals(finalNodeId)){ |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(0); |
|
|
|
|
}else{ |
|
|
|
|
isAbnormal = 1; |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(1); |
|
|
|
|
remark = "有数据,有计划,有装车,卸车目的地不正确,异常卸车"; |
|
|
|
|
String loadType = carsLoadEntity.getLoadType(); |
|
|
|
|
if("4".equals(loadType)){ |
|
|
|
|
isAbnormal = 0; |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(0); |
|
|
|
|
remark = "有数据,有计划,有装车,正常卸车"; |
|
|
|
|
}else{ |
|
|
|
|
isAbnormal = 1; |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(1); |
|
|
|
|
remark = "有数据,有计划,有装车,卸车目的地不正确,异常卸车"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
carsLoadScanEntity.setUnloadNodeId(warehouseId); |
|
|
|
|
carsLoadScanEntity.setUnloadNodeName(warehouseName); |
|
|
|
@ -2866,29 +2878,143 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
} |
|
|
|
|
Long loadId = signOrderEntity.getLoadId(); |
|
|
|
|
Long warehouseId = signOrderEntity.getWarehouseId(); |
|
|
|
|
String marketName = signOrderEntity.getMallName(); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if(Objects.isNull(carsLoadEntity)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 配载计划不存在 loadId={}",loadId); |
|
|
|
|
return R.fail(405,"配载计划不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String carsNo = carsLoadEntity.getCarsNo(); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.findEntityByLoadIdAndOrderPackageCode(loadId, orderPackageCode); |
|
|
|
|
if(Objects.isNull(carsLoadScanEntity)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 装车记录不存在 loadId={},orderPackageCode={}",loadId,orderPackageCode); |
|
|
|
|
return R.fail(405,"装车记录不存在"); |
|
|
|
|
} |
|
|
|
|
//因为没有装车记录,补装车记录
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByOrderPackageCodeAndStatus(orderPackageCode); |
|
|
|
|
if(Objects.isNull(parcelListEntity)){ |
|
|
|
|
//没有找到在库的包件信息,所以是无数据包件
|
|
|
|
|
carsLoadScanEntity = new TrunklineCarsLoadScanEntity(); |
|
|
|
|
carsLoadScanEntity.setLoadId(loadId); |
|
|
|
|
carsLoadScanEntity.setLoadCode(carsNo); |
|
|
|
|
carsLoadScanEntity.setScanCode(orderPackageCode); |
|
|
|
|
carsLoadScanEntity.setScanStatus("3"); |
|
|
|
|
carsLoadScanEntity.setNum(1); |
|
|
|
|
carsLoadScanEntity.setType(1); |
|
|
|
|
carsLoadScanEntity.setIsData(0); |
|
|
|
|
carsLoadScanEntity.setLoadingAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(1); |
|
|
|
|
carsLoadScanEntity.setSignTime(new Date()); |
|
|
|
|
carsLoadScanEntity.setSignAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setSignOrderId(signOrderId); |
|
|
|
|
carsLoadScanEntity.setRemark("无数据签收"); |
|
|
|
|
trunklineCarsLoadScanService.save(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
String scanStatus = carsLoadScanEntity.getScanStatus(); |
|
|
|
|
if("2".equals(scanStatus)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件已卸车 loadId={},orderPackageCode={} scanStatus={}",loadId,orderPackageCode,scanStatus); |
|
|
|
|
return R.fail(405,"包件已卸车"); |
|
|
|
|
} |
|
|
|
|
Long wid = carsLoadScanEntity.getWarehouseId(); |
|
|
|
|
if(!wid.equals(warehouseId)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件不在签收计划中 loadId={},orderPackageCode={} scanStatus={}",loadId,orderPackageCode,scanStatus); |
|
|
|
|
return R.fail(405,"包件不在签收计划中"); |
|
|
|
|
trunklineCarsLoadingLogService.savaLoadingLog(null,null,loadId,carsNo,null,null,null,orderPackageCode,1,1,0,1,null,null,null,null,carsLoadScanEntity.getId(),"无数据异常补装车记录"); |
|
|
|
|
|
|
|
|
|
trunklineCarsSignLogService.saveSignLog(null,null,loadId,carsNo,null,null,null,orderPackageCode,1,1,0,1,null,null,null,null,carsLoadScanEntity.getId(),"无数据异常签收"); |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
Long wid = parcelListEntity.getWarehouseId(); |
|
|
|
|
String wName = parcelListEntity.getWarehouse(); |
|
|
|
|
String waybillNumber = parcelListEntity.getWaybillNumber(); |
|
|
|
|
String orderCode = parcelListEntity.getOrderCode(); |
|
|
|
|
Long stockArticleId = parcelListEntity.getStockArticleId(); |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findEntityByStockArticleId(stockArticleId); |
|
|
|
|
if(!Objects.isNull(stockArticleEntity)){ |
|
|
|
|
String mallName = stockArticleEntity.getMallName(); |
|
|
|
|
if(!marketName.equals(mallName)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件属于该商家 marketName={}",marketName); |
|
|
|
|
return R.fail(405,"包件属于该商家"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
carsLoadScanEntity = new TrunklineCarsLoadScanEntity(); |
|
|
|
|
carsLoadScanEntity.setLoadId(loadId); |
|
|
|
|
carsLoadScanEntity.setLoadCode(carsNo); |
|
|
|
|
carsLoadScanEntity.setWarehouseId(wid); |
|
|
|
|
carsLoadScanEntity.setWarehouseName(wName); |
|
|
|
|
carsLoadScanEntity.setWaybillNo(waybillNumber); |
|
|
|
|
carsLoadScanEntity.setOrderCode(orderCode); |
|
|
|
|
carsLoadScanEntity.setScanCode(orderPackageCode); |
|
|
|
|
carsLoadScanEntity.setScanStatus("3"); |
|
|
|
|
carsLoadScanEntity.setNum(1); |
|
|
|
|
carsLoadScanEntity.setType(1); |
|
|
|
|
carsLoadScanEntity.setIsData(1); |
|
|
|
|
carsLoadScanEntity.setLoadingAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(1); |
|
|
|
|
carsLoadScanEntity.setSignTime(new Date()); |
|
|
|
|
carsLoadScanEntity.setSignAbnormal(1); |
|
|
|
|
carsLoadScanEntity.setSignOrderId(signOrderId); |
|
|
|
|
carsLoadScanEntity.setRemark("有数据异常签收"); |
|
|
|
|
trunklineCarsLoadScanService.save(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
//存入补装车记录
|
|
|
|
|
trunklineCarsLoadingLogService.savaLoadingLog(null,null,loadId,carsNo,null,waybillNumber,orderCode,orderPackageCode,1,1,1,1,null,null,null,wid,carsLoadScanEntity.getId(),"有数据异常补装车记录"); |
|
|
|
|
//存入签收记录
|
|
|
|
|
trunklineCarsSignLogService.saveSignLog(null,null,loadId,carsNo,null,waybillNumber,orderCode,orderPackageCode,1,1,1,1,null,null,null,wid,carsLoadScanEntity.getId(),"有数据异常签收"); |
|
|
|
|
//更新包件状态
|
|
|
|
|
distributionParcelListClient.updateOrderPackageCodeById(parcelListEntity.getId(),"70"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); |
|
|
|
|
String waybillNo = carsLoadScanEntity.getWaybillNo(); |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(parcelListEntity)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件信息不存在 fromWarehouseId={},orderPackageCode={}",fromWarehouseId,orderPackageCode); |
|
|
|
|
return R.fail(405,"包件信息不存在"); |
|
|
|
|
} |
|
|
|
|
String orderCode = parcelListEntity.getOrderCode(); |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); |
|
|
|
|
if(Objects.isNull(stockArticleEntity)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 订单信息不存在 fromWarehouseId={},orderPackageCode={}",fromWarehouseId,orderPackageCode); |
|
|
|
|
return R.fail(405,"订单信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String mallName = stockArticleEntity.getMallName(); |
|
|
|
|
if(!marketName.equals(mallName)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件不属于当前商场 fromWarehouseId={},orderPackageCode={}",fromWarehouseId,orderPackageCode); |
|
|
|
|
return R.fail(405,"包件不属于当前商场"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TrunklineCarsOrderEntity carsOrderEntity = trunklineCarsOrderService.findEntityByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(loadId,warehouseId,orderCode,waybillNo); |
|
|
|
|
if(Objects.isNull(carsOrderEntity)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 配载订单信息不存在 loadId={},warehouseId={} orderCode={} waybillNo={}",loadId,warehouseId,orderCode,waybillNo); |
|
|
|
|
return R.fail(405,"配载订单信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String isCustomer = carsOrderEntity.getIsCustomer(); |
|
|
|
|
if("0".equals(isCustomer)){ |
|
|
|
|
carsLoadScanEntity.setSignAbnormal(1); |
|
|
|
|
}else{ |
|
|
|
|
carsLoadScanEntity.setSignAbnormal(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String scanStatus = carsLoadScanEntity.getScanStatus(); |
|
|
|
|
if("2".equals(scanStatus)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件已卸车 loadId={},orderPackageCode={} scanStatus={}",loadId,orderPackageCode,scanStatus); |
|
|
|
|
return R.fail(405,"包件已卸车"); |
|
|
|
|
} |
|
|
|
|
Long wid = carsLoadScanEntity.getWarehouseId(); |
|
|
|
|
if(!wid.equals(warehouseId)){ |
|
|
|
|
log.warn("##############signScanPackageCode: 包件不在签收计划中 loadId={},orderPackageCode={} scanStatus={}",loadId,orderPackageCode,scanStatus); |
|
|
|
|
return R.fail(405,"包件不在签收计划中"); |
|
|
|
|
} |
|
|
|
|
carsLoadScanEntity.setScanStatus("3"); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(1); |
|
|
|
|
carsLoadScanEntity.setSignTime(new Date()); |
|
|
|
|
carsLoadScanEntity.setSignOrderId(signOrderId); |
|
|
|
|
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
//生成签收记录
|
|
|
|
|
trunklineCarsSignLogService.addEntity(carsLoadScanEntity,remark); |
|
|
|
|
} |
|
|
|
|
carsLoadScanEntity.setScanStatus("3"); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(1); |
|
|
|
|
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
//生成签收记录
|
|
|
|
|
trunklineCarsSignLogService.addEntity(carsLoadScanEntity,remark); |
|
|
|
|
//重新计算数量
|
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
//重新计算签收单的数量
|
|
|
|
@ -2906,9 +3032,11 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
Integer loadingNum = signOrderEntity.getLoadingNum(); |
|
|
|
|
|
|
|
|
|
Integer signNum = trunklineCarsOrderService.findSignNumBySignOrderId(signOrderId); |
|
|
|
|
signOrderEntity.setSignNum(signNum); |
|
|
|
|
Integer realSignNum = trunklineCarsLoadScanService.findRealSignNumBySignOrderId(signOrderId); |
|
|
|
|
signOrderEntity.setSignNum(realSignNum); |
|
|
|
|
if(signNum.equals(loadingNum)){ |
|
|
|
|
signOrderEntity.setSignStatus("20"); |
|
|
|
|
signOrderEntity.setSignTime(new Date()); |
|
|
|
|
}else{ |
|
|
|
|
signOrderEntity.setSignStatus("10"); |
|
|
|
|
} |
|
|
|
@ -2947,6 +3075,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
|
|
|
|
|
carsLoadScanEntity.setScanStatus("3"); |
|
|
|
|
carsLoadScanEntity.setUnloadNum(enterNum); |
|
|
|
|
carsLoadScanEntity.setSignTime(new Date()); |
|
|
|
|
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
//生成签收记录
|
|
|
|
|