|
|
|
@ -1102,7 +1102,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
queryWrapper.eq("load_id", loadId) |
|
|
|
|
.eq("unload_node_id", warehouseId) |
|
|
|
|
.eq("type", 2) |
|
|
|
|
.ne("scan_status", "1"); |
|
|
|
|
.ne("scan_status", "1") |
|
|
|
|
.isNull("unload_tray_code"); |
|
|
|
|
|
|
|
|
|
List<TrunklineCarsLoadScanEntity> carsLoadScanEntityList = trunklineCarsLoadScanService.list(queryWrapper); |
|
|
|
|
if(CollUtil.isNotEmpty(carsLoadScanEntityList)){ |
|
|
|
@ -8487,6 +8488,179 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public R unloadZeroWithTray(Long loadId, String waybillNo, Integer enterNun, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark,String unloadTrayName,String unloadTrayCode) { |
|
|
|
|
log.info("#############unloadZero: 卸车零担"); |
|
|
|
|
|
|
|
|
|
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId); |
|
|
|
|
if (Objects.isNull(carsLoadEntity)) { |
|
|
|
|
log.warn("#############unloadZero: 配载计划信息不存在 loadId={}", loadId); |
|
|
|
|
return R.fail(405, "配载计划信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String loadCode = carsLoadEntity.getCarsNo(); |
|
|
|
|
TrunklineCarsLoadLineEntity loadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
|
|
|
|
if (Objects.isNull(loadLineEntity)) { |
|
|
|
|
log.warn("############unloadZero: 配载计划节点信息不存在 loadId={} warehouseId={}", loadId, warehouseId); |
|
|
|
|
return R.fail(405, "配载计划节点信息不存在"); |
|
|
|
|
} |
|
|
|
|
String unloadStatus = loadLineEntity.getUnloadStatus(); |
|
|
|
|
if (!"0".equals(unloadStatus)) { |
|
|
|
|
log.warn("############unloadZero: 当前网点已经卸车确认 loadId={} warehouseId={}", loadId, warehouseId); |
|
|
|
|
return R.fail(405, "当前网点已经卸车确认"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
|
if (Objects.isNull(basicdataWarehouseEntity)) { |
|
|
|
|
log.warn("#############unloadZero: 仓库信息不存在 warehouseId={}", warehouseId); |
|
|
|
|
return R.fail(405, "仓库信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String warehouseName = basicdataWarehouseEntity.getName(); |
|
|
|
|
|
|
|
|
|
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); |
|
|
|
|
if (Objects.isNull(waybillEntity)) { |
|
|
|
|
log.warn("#############unloadZero: 运单信息不存在 waybillNo={}", waybillNo); |
|
|
|
|
return R.fail(405, "运单信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long trayId = null; |
|
|
|
|
String trayName = null; |
|
|
|
|
if (!StringUtil.isBlank(trayCode)) { |
|
|
|
|
BasicdataTrayEntity trayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode); |
|
|
|
|
if (!Objects.isNull(trayEntity)) { |
|
|
|
|
trayId = trayEntity.getId(); |
|
|
|
|
trayName = trayEntity.getPalletName(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryWrapper<TrunklineCarsLoadScanEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("waybill_no", waybillNo) |
|
|
|
|
.eq("load_id", loadId) |
|
|
|
|
.eq("final_node_id", warehouseId) |
|
|
|
|
.eq("order_code", orderCode); |
|
|
|
|
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.getOne(queryWrapper); |
|
|
|
|
if (Objects.isNull(carsLoadScanEntity)) { |
|
|
|
|
log.warn("#############unloadZero: 零担信息不存在 waybillNo={} order_code={} loadId={} finalNodeId={}", waybillNo, orderCode, loadId, warehouseId); |
|
|
|
|
return R.fail(405, "零担信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Integer isAbnormal = 0; |
|
|
|
|
Integer num = carsLoadScanEntity.getNum(); |
|
|
|
|
Long fromWarehouseId = carsLoadScanEntity.getFromWarehouseId(); |
|
|
|
|
Long waybillId = carsLoadScanEntity.getWaybillId(); |
|
|
|
|
String scanCode = carsLoadScanEntity.getScanCode(); |
|
|
|
|
Long loadScanId = carsLoadScanEntity.getId(); |
|
|
|
|
if (enterNun > num) { |
|
|
|
|
log.warn("#############unloadZero: 零担信息卸车数量大于装车件数 enterNun={} num={}", enterNun, num); |
|
|
|
|
return R.fail(405, "零担信息卸车数量大于装车件数"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
carsLoadScanEntity.setUnloadNum(enterNun); |
|
|
|
|
carsLoadScanEntity.setUnloadNodeId(warehouseId); |
|
|
|
|
carsLoadScanEntity.setUnloadNodeName(warehouseName); |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(0); |
|
|
|
|
carsLoadScanEntity.setScanStatus("2"); |
|
|
|
|
carsLoadScanEntity.setLoadingUserName(AuthUtil.getNickName()); |
|
|
|
|
carsLoadScanEntity.setUnloadUserName(AuthUtil.getNickName()); |
|
|
|
|
carsLoadScanEntity.setUnloadTime(new Date()); |
|
|
|
|
carsLoadScanEntity.setUnloadTrayName(unloadTrayName); |
|
|
|
|
carsLoadScanEntity.setUnloadTrayCode(unloadTrayCode); |
|
|
|
|
trunklineCarsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
trunklineCarsUnloadLogService.savaUnloadLog(warehouseId, warehouseName, loadId, loadCode, waybillId, waybillNo, orderCode, |
|
|
|
|
scanCode, enterNun, 2, 1, isAbnormal, trayId, trayCode, trayName, fromWarehouseId, loadScanId, remark); |
|
|
|
|
|
|
|
|
|
if (unbindTray == 1) { |
|
|
|
|
if (!StringUtil.isBlank(trayCode)) { |
|
|
|
|
trayTypeClient.deleteZeroOrderByTrayCode(orderCode, trayCode, fromWarehouseId, "干线卸车零担解托"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DistributionStockArticleEntity newStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); |
|
|
|
|
if (Objects.isNull(newStockArticleEntity)) { |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, fromWarehouseId); |
|
|
|
|
newStockArticleEntity = new DistributionStockArticleEntity(); |
|
|
|
|
BeanUtil.copy(stockArticleEntity, newStockArticleEntity); |
|
|
|
|
newStockArticleEntity.setId(null); |
|
|
|
|
newStockArticleEntity.setOrderReceiveStatus("20"); |
|
|
|
|
newStockArticleEntity.setOrderStatus("10"); |
|
|
|
|
newStockArticleEntity.setHandQuantity(enterNun); |
|
|
|
|
newStockArticleEntity.setIncomingNum(enterNun); |
|
|
|
|
newStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName()); |
|
|
|
|
newStockArticleEntity.setWarehouseId(basicdataWarehouseEntity.getId()); |
|
|
|
|
newStockArticleEntity.setCarsLoadNum(0); |
|
|
|
|
Long orderId = distributionStockArticleClient.addData(newStockArticleEntity); |
|
|
|
|
if (orderId != 0) { |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findEntityListByOrderCode(orderCode, fromWarehouseId); |
|
|
|
|
List<DistributionParcelNumberEntity> ls = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { |
|
|
|
|
DistributionParcelListEntity newParcelListEntity = new DistributionParcelListEntity(); |
|
|
|
|
BeanUtil.copy(parcelListEntity, newParcelListEntity); |
|
|
|
|
newParcelListEntity.setId(null); |
|
|
|
|
newParcelListEntity.setWarehouseId(warehouseId); |
|
|
|
|
newParcelListEntity.setWarehouse(warehouseName); |
|
|
|
|
newParcelListEntity.setStockArticleId(orderId); |
|
|
|
|
Long acceptWarehouseId = parcelListEntity.getAcceptWarehouseId(); |
|
|
|
|
if(warehouseId.equals(acceptWarehouseId)){ |
|
|
|
|
newParcelListEntity.setIsTransfer(0); |
|
|
|
|
}else{ |
|
|
|
|
newParcelListEntity.setIsTransfer(1); |
|
|
|
|
} |
|
|
|
|
Long orderPackageId = distributionParcelListClient.addReturnId(newParcelListEntity); |
|
|
|
|
|
|
|
|
|
DistributionParcelNumberEntity parcelNumberEntity = new DistributionParcelNumberEntity(); |
|
|
|
|
parcelNumberEntity.setStockArticleId(orderId); |
|
|
|
|
parcelNumberEntity.setParcelListId(orderPackageId); |
|
|
|
|
parcelNumberEntity.setQuantity(newParcelListEntity.getQuantity()); |
|
|
|
|
parcelNumberEntity.setHandQuantity(0); |
|
|
|
|
parcelNumberEntity.setDeliveryQuantity(0); |
|
|
|
|
parcelNumberEntity.setSigninQuantity(0); |
|
|
|
|
parcelNumberEntity.setOutboundQuantity(0); |
|
|
|
|
parcelNumberEntity.setWarehouseId(warehouseId); |
|
|
|
|
ls.add(parcelNumberEntity); |
|
|
|
|
} |
|
|
|
|
distributionParcelNumberClient.addBatch(ls); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Integer handQuantity = newStockArticleEntity.getHandQuantity() + enterNun; |
|
|
|
|
Integer incomingNum = newStockArticleEntity.getIncomingNum() + enterNun; |
|
|
|
|
Integer totalNumber = newStockArticleEntity.getTotalNumber(); |
|
|
|
|
|
|
|
|
|
if (incomingNum.equals(totalNumber)) { |
|
|
|
|
if (handQuantity.equals(totalNumber)) { |
|
|
|
|
newStockArticleEntity.setOrderStatus("20"); |
|
|
|
|
} else { |
|
|
|
|
newStockArticleEntity.setOrderStatus("30"); |
|
|
|
|
} |
|
|
|
|
newStockArticleEntity.setOrderReceiveStatus("30"); |
|
|
|
|
} else { |
|
|
|
|
if (incomingNum.equals(handQuantity)) { |
|
|
|
|
newStockArticleEntity.setOrderStatus("10"); |
|
|
|
|
} else { |
|
|
|
|
newStockArticleEntity.setOrderStatus("30"); |
|
|
|
|
} |
|
|
|
|
newStockArticleEntity.setOrderReceiveStatus("20"); |
|
|
|
|
} |
|
|
|
|
newStockArticleEntity.setHandQuantity(handQuantity); |
|
|
|
|
newStockArticleEntity.setIncomingNum(incomingNum); |
|
|
|
|
|
|
|
|
|
distributionStockArticleClient.saveOrUpdate(newStockArticleEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateNumByLoadId(loadId); |
|
|
|
|
|
|
|
|
|
// JSONObject jsonObject = trunklineCarsLoadScanService.findUnloadNumAudio(loadId,warehouseId);
|
|
|
|
|
// Integer totalUnloadNum = jsonObject.getInteger("totalUnloadNum");
|
|
|
|
|
// Integer abnormalUnloadNum = jsonObject.getInteger("abnormalUnloadNum");
|
|
|
|
|
// StringBuilder audio = new StringBuilder();
|
|
|
|
|
// audio.append("卸车").append(totalUnloadNum).append("件");
|
|
|
|
|
// if(!Objects.isNull(abnormalUnloadNum) && !abnormalUnloadNum.equals(0)){
|
|
|
|
|
// audio.append("异常卸车").append(abnormalUnloadNum).append("件");
|
|
|
|
|
// }
|
|
|
|
|
return R.success("卸车成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public R unloadZeroNoXz(Long loadId, String waybillNo, Integer enterNun, Long warehouseId, Integer unbindTray, String trayCode, String orderCode, String remark) { |
|
|
|
|
log.info("#############unloadZero: 卸车零担"); |
|
|
|
|
|
|
|
|
@ -8761,7 +8935,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
|
|
|
|
|
String waybillNo = carsLoadScanEntity.getWaybillNo(); |
|
|
|
|
Integer num = carsLoadScanEntity.getNum(); |
|
|
|
|
String orderCode = carsLoadScanEntity.getOrderCode(); |
|
|
|
|
unloadZero(loadId, waybillNo, num, warehouseId, 0, trayCode, orderCode, "托盘零担正常卸车",palletName,trayCode); |
|
|
|
|
unloadZeroWithTray(loadId, waybillNo, num, warehouseId, 0, trayCode, orderCode, "托盘零担正常卸车",palletName,trayCode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|