|
|
|
@ -59,7 +59,6 @@ import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
|
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWaybillEntity; |
|
|
|
|
import com.logpm.warehouse.feign.*; |
|
|
|
|
import com.logpm.warehouse.vo.TrayTypeDataVO; |
|
|
|
|
import com.logpm.warehouse.vo.WarehouseRetentionScanVO; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
import org.apache.logging.log4j.util.Strings; |
|
|
|
@ -82,7 +81,6 @@ import org.springblade.common.constant.orderpackage.*;
|
|
|
|
|
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; |
|
|
|
|
import org.springblade.common.constant.reservation.*; |
|
|
|
|
import org.springblade.common.constant.retention.RetentionSourceTypeConstant; |
|
|
|
|
import org.springblade.common.constant.retention.RetentionTypeConstant; |
|
|
|
|
import org.springblade.common.constant.signing.SignforStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
@ -1882,7 +1880,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//库存品
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = this.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//获取当前用户司机
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity, AuthUtil.getUser(), distrilbutionloadingscanDTO, true); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity, AuthUtil.getUser(), distrilbutionloadingscanDTO.getVehicleNub(), true); |
|
|
|
|
|
|
|
|
|
// DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity();
|
|
|
|
@ -2584,7 +2582,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (Func.isNotEmpty(loadscanEntityList) && loadscanEntityList.size() > 0) { |
|
|
|
|
//此配送任务存在装车 无法进行司机切换
|
|
|
|
|
log.error("配送任务存在装车数据,无法进行司机切换"); |
|
|
|
|
throw new CustomerException("任务已装车联系司机滞留货物后进行司机切换..."); |
|
|
|
|
throw new CustomerException("任务已装车联系司机将货物回库后进行司机切换..."); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2913,17 +2911,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
orderTotal.getAndIncrement(); |
|
|
|
|
//添加缓存
|
|
|
|
|
if (!packageLockIds.isEmpty()) { |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode()); |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + s.getOrderCode()); |
|
|
|
|
if (Func.isNotEmpty(a)) { |
|
|
|
|
boolean flag = a.stream().anyMatch(f -> packageLockIds.contains(f)); |
|
|
|
|
if (flag) { |
|
|
|
|
throw new RuntimeException(s.getOrderCode() + "正在操作,请刷新后尝试"); |
|
|
|
|
} else { |
|
|
|
|
packageLockIds.addAll(a); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 60L); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + s.getOrderCode(), packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 60L); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + s.getOrderCode(), packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -3362,14 +3360,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(s.getOrderCode(), myCurrentWarehouse.getId()); |
|
|
|
|
} |
|
|
|
|
if (!packageLockIds.isEmpty()) { |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode()); |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + s.getOrderCode()); |
|
|
|
|
if (Func.isNotEmpty(a)) { |
|
|
|
|
boolean flag = a.stream().anyMatch(f -> packageLockIds.contains(f)); |
|
|
|
|
if (flag) { |
|
|
|
|
throw new RuntimeException(s.getOrderCode() + "正在操作,请刷新后尝试"); |
|
|
|
|
} else { |
|
|
|
|
packageLockIds.addAll(a); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(), packageLockIds, 5 * 60L); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + s.getOrderCode(), packageLockIds, 5 * 60L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -3427,7 +3425,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(n.get(0).getStockArticleId()); |
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(stockArticleEntity.getOrderCode(), myCurrentWarehouse.getId()); |
|
|
|
|
bladeRedis.del("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + stockArticleEntity.getOrderCode()); |
|
|
|
|
bladeRedis.del("warehouseId:" + myCurrentWarehouse.getId() + ":orderCode:" + stockArticleEntity.getOrderCode()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//重新维护预约信息
|
|
|
|
@ -4661,7 +4659,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanFail("请勿重复发车", "请勿重复发车"); |
|
|
|
|
} |
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO.getVehicleNub(), isDriverFlag); |
|
|
|
|
distributionDeliverySelfEntity.setDepartureTime(format); |
|
|
|
|
b = distributionDeliverySelfService.updateById(distributionDeliverySelfEntity); |
|
|
|
|
isEnd = isEndDriver(distributionDeliveryListEntity.getId()); |
|
|
|
@ -5919,14 +5917,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DistributionParcelNumberVO> getDeliveryZeroOrderDetail(Long deliveryId, Long orderId) { |
|
|
|
|
public R getDeliveryZeroOrderDetail(Long deliveryId, Long orderId) { |
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderId, orderId) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!Func.isEmpty(loadscanEntityList)) { |
|
|
|
|
return null; |
|
|
|
|
return R.fail("当前零担已装车"); |
|
|
|
|
} |
|
|
|
|
List<DistributionParcelNumberVO> zeroOrderDetail = distributionStockArticleService.getZeroOrderDetail(orderId); |
|
|
|
|
List<DistributionParcelNumberVO> parcelNumberVOS = baseMapper.selectDeliveryZeroOrderDetail(orderId, deliveryId); |
|
|
|
@ -5940,7 +5938,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
int quantity = z.getHandQuantity() - z.getDeliveryQuantity() + integer; |
|
|
|
|
z.setNumber(quantity); |
|
|
|
|
}); |
|
|
|
|
return zeroOrderDetail; |
|
|
|
|
return R.data(zeroOrderDetail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -6802,7 +6800,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
if (row == 1) { |
|
|
|
|
//存在计划
|
|
|
|
|
|
|
|
|
|
//进行了一条包件任务的取消,此时就应该对预约、配送任务进行数量的维护
|
|
|
|
|
distributionAsyncService.checkRetentionReservationAndDeliveryInfo(reservationId, deliveryId); |
|
|
|
|
} |
|
|
|
@ -6810,37 +6807,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//包件未预约 处于异常驳回状态
|
|
|
|
|
//查询异常信息,对异常信息进行清理
|
|
|
|
|
log.info("滞留查询审核列表信息:{}", row); |
|
|
|
|
|
|
|
|
|
DistributionLoadscanAbnormalEntity abnormalEntity = distributionLoadscanAbnormalService.getOne(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getPackageId, orderPackageId) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getDeliveryListId, deliveryId) |
|
|
|
|
.eq(DistributionLoadscanAbnormalEntity::getAuditingStatus, 3) |
|
|
|
|
); |
|
|
|
|
log.info("滞留查询审核列表信息:{}", abnormalEntity); |
|
|
|
|
if (!Objects.isNull(abnormalEntity)) { |
|
|
|
|
//清理异常信息
|
|
|
|
|
distributionLoadscanAbnormalService.removeById(abnormalEntity); |
|
|
|
|
} else { |
|
|
|
|
log.error(">>>>>>>>>>>>>>>查询异常信息错误:{}", orderPackageId); |
|
|
|
|
} |
|
|
|
|
//查询出多个包件信息
|
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(loadscanEntity)) { |
|
|
|
|
//修改包件状态 达到回库的状态
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId()); |
|
|
|
|
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiruku.getValue()); |
|
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
|
//已经进行装车
|
|
|
|
|
loadscanEntity.setScanStatus(LoadingStatusConstant.quxiao.getValue()); |
|
|
|
|
distributionLoadscanService.updateById(loadscanEntity); |
|
|
|
|
// 对应签收信息的装车数量要进行扣减
|
|
|
|
|
int a = distributionSignforMapper.deductionLoadingPacjageNum(loadscanEntity.getReservationId(), loadscanEntity.getDeliveryId(), loadscanEntity.getLoadedNub()); |
|
|
|
|
//维护订单状态
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), parcelListEntity.getWarehouseId()); |
|
|
|
|
//增加滞留信息
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getScanUser() + "取消配车,取消方式:滞留扫描,取消计划,配送车次号:" + loadscanEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getScanUser() + "取消配送,取消方式:异常驳回,配送车次号:" + loadscanEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
JSONObject js = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.CANCEL_DISTRIBUTION.getCode()); |
|
|
|
|
aaa.add(js); |
|
|
|
|
//对滞留包件进行签收信息数量减少
|
|
|
|
@ -8009,7 +7986,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (!driver) { |
|
|
|
|
return Resp.scanFail("此按钮只能司机操作!", "此按钮只能司机操作!"); |
|
|
|
|
} |
|
|
|
|
DistributionDeliverySelfEntity deliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO, driver); |
|
|
|
|
DistributionDeliverySelfEntity deliverySelfEntity = getDriver(distributionDeliveryListEntity, user, distrilbutionloadingscanDTO.getVehicleNub(), driver); |
|
|
|
|
if (Objects.isNull(deliverySelfEntity)) { |
|
|
|
|
return Resp.scanFail("当前司机不属于该车次!", "当前司机不属于该车次!"); |
|
|
|
|
} |
|
|
|
@ -8632,17 +8609,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//日志信息收集
|
|
|
|
|
List<JSONObject> packageLogs = new ArrayList<>(); |
|
|
|
|
//查询司机信息
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity, user, distrilbutionloadingscanDTO.getVehicleNub(), isDriverFlag); |
|
|
|
|
if (Objects.isNull(distributionDeliverySelfEntity)) { |
|
|
|
|
return Resp.fail("当前操作人不合法"); |
|
|
|
|
} |
|
|
|
|
switch (type) { |
|
|
|
|
case 1: |
|
|
|
|
|
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getBarcode())) { |
|
|
|
|
log.error(method + "参数缺失Barcode"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
String orderPackageCode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
//校验当前包件是否存在回库任务
|
|
|
|
|
boolean isHaveRetention = retentionScanClient.judgeIsHaveRetention(orderPackageCode,myCurrentWarehouse.getId()); |
|
|
|
|
if (isHaveRetention){ |
|
|
|
|
return Resp.scanFail("当前包件存在回库任务","当前包件存在回库任务"); |
|
|
|
|
} |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListMapper.selectByOrderPackageCode(orderPackageCode, myCurrentWarehouse.getId()); |
|
|
|
|
if (Objects.isNull(parcelListEntity)) { |
|
|
|
|
//查询是否为库存品
|
|
|
|
@ -8667,6 +8650,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (!loadscanEntityList.isEmpty()) { |
|
|
|
|
return Resp.scanFail("此包件已装车", "此包件已装车"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询是否满足计划 以及计划在哪个客户中
|
|
|
|
|
Long reservationId = baseMapper.selectPackageByorderPackageCodeAndDeliveryId(orderPackageCode, deliveryId, warehouseId); |
|
|
|
|
if (Objects.isNull(reservationId)) { |
|
|
|
@ -8678,6 +8662,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Boolean isAbnormalLoadingFlag = judgeIsAbnormalLoading(deliveryId, parcelListEntity, reservationId); |
|
|
|
|
if (isAbnormalLoadingFlag) { |
|
|
|
|
log.info("异常装车判定成功>>>>>>packageCode:{},reservationId:{}", distrilbutionloadingscanDTO.getBarcode(), distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
//已发车无法进行异常装车
|
|
|
|
|
if (DeliveryStartStatusConstant.yifache.equals(deliveryListEntity.getIsStart())){ |
|
|
|
|
return Resp.scanFail("已发车无法进行异常装车", "已发车无法进行异常装车"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车"); |
|
|
|
|
} |
|
|
|
@ -8783,6 +8771,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (parcelListDTO.getLoadingNum() <= reservationZeroPackageEntity.getQuantity()) { |
|
|
|
|
//零担修改装车
|
|
|
|
|
DistributionLoadscanEntity zeroLoadscanEntity = loadscanEntities.get(0); |
|
|
|
|
if (!distributionDeliverySelfEntity.getVehicleNub().equals(zeroLoadscanEntity.getVehicleName())) { |
|
|
|
|
//零担装车只能在一个车上
|
|
|
|
|
return Resp.scanFail("零担同一品类需在一个车", "零担同一品类需在一个车"); |
|
|
|
|
} |
|
|
|
|
updateZeroLoadingEntity(zeroLoadscanEntity, parcelListDTO, myCurrentWarehouse, zeroPackageMap); |
|
|
|
|
JSONObject zeroJsonObject = new JSONObject(); |
|
|
|
|
zeroJsonObject.put("code", zeroParcelListEntity.getOrderCode()); |
|
|
|
@ -9133,9 +9125,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderPackageCode, barcode) |
|
|
|
|
.eq(DistributionLoadscanEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!Objects.isNull(loadscanEntityList)) { |
|
|
|
|
if (!loadscanEntityList.isEmpty()) { |
|
|
|
|
//校验是否重复扫描
|
|
|
|
|
boolean isRepeatFlag = loadscanEntityList.stream().anyMatch(f -> reservationId.equals(f.getReservationId())); |
|
|
|
|
if (isRepeatFlag) { |
|
|
|
@ -9144,7 +9136,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} else { |
|
|
|
|
//校验是否在其他车次存在异常
|
|
|
|
|
String abnormalTrainNumber = loadscanEntityList.stream().map(DistributionLoadscanEntity::getTrainNumber).distinct().collect(Collectors.joining(",")); |
|
|
|
|
return Resp.scanFail("此包件在" + abnormalTrainNumber + "存在异常操作", "此包件在" + abnormalTrainNumber + "存在异常操作"); |
|
|
|
|
return Resp.scanFail("此包件在" + abnormalTrainNumber + "存在异常操作", "此包件" + abnormalTrainNumber + "存在异常操作"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
@ -9153,8 +9145,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
List<JSONObject> aaa = new ArrayList<>(); |
|
|
|
|
//查询当前司机信息
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryList, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryList, user, distrilbutionloadingscanDTO.getVehicleNub(), isDriverFlag); |
|
|
|
|
DistributionReservationEntity reservationEntity = null; |
|
|
|
|
switch (deliveryList.getType()) { |
|
|
|
|
case "1": |
|
|
|
@ -9188,6 +9179,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
DistributionLoadscanEntity distributionLoadscanEntity = createdDistributionLoadscanEntity(deliveryList, distributionDeliverySelfEntity, reservationId, parcelListEntity, myCurrentWarehouse, user); |
|
|
|
|
distributionLoadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
distributionLoadscanService.save(distributionLoadscanEntity); |
|
|
|
|
DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity = new DistributionLoadscanAbnormalEntity(); |
|
|
|
|
distributionLoadscanAbnormalEntity.setAuditingStatus(LoadingAbnormalAuditingStatusConstant.daishenhe.getValue()); |
|
|
|
|
distributionLoadscanAbnormalEntity.setStockArticleId(parcelListEntity.getStockArticleId()); |
|
|
|
@ -9208,17 +9200,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionLoadscanAbnormalEntity.setLoadingId(distributionLoadscanEntity.getId()); |
|
|
|
|
distributionLoadscanAbnormalEntity.setGoodsType(1); |
|
|
|
|
distributionLoadscanAbnormalEntity.setAbnormalType(LoadingAbnormalTypeConstant.jihuayichang.getValue()); |
|
|
|
|
orderPackageCodes.add(loadscanEntity.getOrderPackageCode()); |
|
|
|
|
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + loadscanEntity.getScanUser() + "扫描异常装车,配送车次号:" + deliveryList.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
orderPackageCodes.add(distributionLoadscanEntity.getOrderPackageCode()); |
|
|
|
|
distributionLoadscanAbnormalService.save(distributionLoadscanAbnormalEntity); |
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + distributionLoadscanEntity.getScanUser() + "扫描异常装车,配送车次号:" + deliveryList.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
JSONObject trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_LOADING.getCode()); |
|
|
|
|
aaa.add(trunklinePackageTrackLog); |
|
|
|
|
|
|
|
|
|
List<JSONObject> jsonObjects = new ArrayList<>(); |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
jsonObject.put("code", loadscanEntity.getOrderPackageCode()); |
|
|
|
|
jsonObject.put("code", distributionLoadscanEntity.getOrderPackageCode()); |
|
|
|
|
jsonObject.put("warehouseId", myCurrentWarehouse.getId()); |
|
|
|
|
jsonObject.put("taskId", loadscanEntity.getReservationId()); |
|
|
|
|
jsonObject.put("taskId", distributionLoadscanEntity.getReservationId()); |
|
|
|
|
jsonObject.put("type", 1); |
|
|
|
|
jsonObject.put("num", 1); |
|
|
|
|
jsonObject.put("remark", "异常装车下架"); |
|
|
|
@ -9237,10 +9229,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
|
distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); |
|
|
|
|
distributionSignforMapper.updateloadByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); |
|
|
|
|
//维护订单信息
|
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(parcelListEntity.getOrderCode(), myCurrentWarehouse.getId()); |
|
|
|
|
packageLockIds.add(loadscanEntity.getPackageId()); |
|
|
|
|
packageLockIds.add(distributionLoadscanEntity.getPackageId()); |
|
|
|
|
DistributionSignforEntity signforEntity = distributionSignforService.getOne(Wrappers.<DistributionSignforEntity>query().lambda() |
|
|
|
|
.eq(DistributionSignforEntity::getReservationId, reservationEntity.getId()) |
|
|
|
|
.eq(DistributionSignforEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())); |
|
|
|
@ -9253,25 +9245,25 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<DistributionLoadscanEntity> abnormalLoadingPack = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryList.getId()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getIsAbnormalLoading, 2) |
|
|
|
|
.ne(DistributionLoadscanEntity::getIsAbnormalLoading, 2) |
|
|
|
|
); |
|
|
|
|
int abnormalTotal = 0; |
|
|
|
|
if (Func.isNotEmpty(abnormalLoadingPack)) { |
|
|
|
|
abnormalTotal = abnormalLoadingPack.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); |
|
|
|
|
} |
|
|
|
|
if (!packageLockIds.isEmpty()) { |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryList.getTrainNumber() + "orderPackageCode:"); |
|
|
|
|
if (Func.isNotEmpty(a)) { |
|
|
|
|
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + ":trainNumber:" + deliveryList.getTrainNumber() + ":orderPackageIds:"); |
|
|
|
|
if (!Objects.isNull(a)) { |
|
|
|
|
boolean flag = a.stream().anyMatch(any -> packageLockIds.contains(any)); |
|
|
|
|
if (flag) { |
|
|
|
|
//正在操作,请稍后重试
|
|
|
|
|
throw new CustomerException("该包件正在被操作,请稍后再试!!!"); |
|
|
|
|
} else { |
|
|
|
|
packageLockIds.addAll(a); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryList.getTrainNumber() + "orderPackageCode:", packageLockIds, 60L); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + ":trainNumber:" + deliveryList.getTrainNumber() + ":orderPackageIds:", packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryList.getTrainNumber() + "orderPackageCode:", packageLockIds, 60L); |
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + ":trainNumber:" + deliveryList.getTrainNumber() + ":orderPackageIds:", packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
@ -9358,7 +9350,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
log.error(method + "DeliveryId参数缺失"); |
|
|
|
|
return R.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouseAndConfig = warehouseClient.getMyCurrentWarehouseAndConfig(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouseAndConfig)) { |
|
|
|
|
return R.fail(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
log.error(method + "ReservationId参数缺失"); |
|
|
|
|
return R.fail("参数缺失,请联系管理员"); |
|
|
|
@ -9368,24 +9363,230 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
log.error(method + "LoadingAbnormalIds参数缺失"); |
|
|
|
|
return R.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.listByIds(Func.toIntList(distrilbutionloadingscanDTO.getLoadingAbnormalIds())); |
|
|
|
|
boolean isAuditingFlag = abnormalEntities.stream().anyMatch(a -> LoadingAbnormalAuditingStatusConstant.daishenhe.getValue().equals(a.getAuditingStatus())); |
|
|
|
|
|
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.listByIds(Func.toLongList(distrilbutionloadingscanDTO.getLoadingAbnormalIds())); |
|
|
|
|
boolean isAuditingFlag = abnormalEntities.stream().anyMatch(a -> !LoadingAbnormalAuditingStatusConstant.daishenhe.getValue().equals(a.getAuditingStatus())); |
|
|
|
|
if (isAuditingFlag) { |
|
|
|
|
String orderPackageCode = abnormalEntities.stream().filter(a -> !LoadingAbnormalAuditingStatusConstant.daishenhe.getValue().equals(a.getAuditingStatus())).map(String::valueOf).collect(Collectors.joining(",")); |
|
|
|
|
String orderPackageCode = abnormalEntities.stream().filter(a -> !LoadingAbnormalAuditingStatusConstant.daishenhe.getValue().equals(a.getAuditingStatus())).map(DistributionLoadscanAbnormalEntity::getPackageCode).collect(Collectors.joining(",")); |
|
|
|
|
return R.fail("取消失败" + orderPackageCode + "已处理"); |
|
|
|
|
} |
|
|
|
|
Long reservationId = distrilbutionloadingscanDTO.getReservationId(); |
|
|
|
|
Long deliveryId = distrilbutionloadingscanDTO.getDeliveryId(); |
|
|
|
|
//进行批量取消异常并且取消计划
|
|
|
|
|
cancelLoadscanAbnormalEntity(abnormalEntities,reservationId,deliveryId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
return cancelLoadscanAbnormalEntity(abnormalEntities, reservationId, deliveryId,myCurrentWarehouseAndConfig.getId()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R getAppDeliveryreservationNewTrays(DistributionAppDeliveryListDTO distributionDeliveryList) { |
|
|
|
|
String method = "#############################################DistributionDeliveryInfoServiceImpl.getAppDeliveryreservationNewTrays"; |
|
|
|
|
if (Objects.isNull(distributionDeliveryList.getReservationId())) { |
|
|
|
|
log.error(method + "reservationId参数缺失"); |
|
|
|
|
return R.fail("参数错误,联系管理员"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
//查询预约信息
|
|
|
|
|
Long reservationId = Long.parseLong(distributionDeliveryList.getReservationId()); |
|
|
|
|
DistributionAppNewReservationVO reservationAppDetailVO = distributionDeliveryInfoMapper.selectNewAppcustom(reservationId); |
|
|
|
|
if (Objects.isNull(reservationAppDetailVO)) { |
|
|
|
|
log.error(method + "查询预约计划失败:{}", distributionDeliveryList.getReservationId()); |
|
|
|
|
return R.fail("参数错误,联系管理员"); |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>(); |
|
|
|
|
//查询托盘信息
|
|
|
|
|
List<String> trayList = distributionReservationMapper.selectTrayInfoByReservationId(reservationId); |
|
|
|
|
if (!trayList.isEmpty()) { |
|
|
|
|
for (String string : trayList) { |
|
|
|
|
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient.selectListByTrayCode(string); |
|
|
|
|
if (Func.isNotEmpty(trayTypeDataVO)) { |
|
|
|
|
String trayName = trayTypeDataVO.getTrayCode(); |
|
|
|
|
List<WarehouseTrayGoodsEntity> goodsLsit = trayTypeDataVO.getGoodsLsit(); |
|
|
|
|
if (Func.isNotEmpty(goodsLsit)) { |
|
|
|
|
List<Long> longs = goodsLsit.stream().map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList()); |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.listByIds(longs); |
|
|
|
|
List<DistributionParcelListEntity> reservationPackageList = distributionReservationMapper.selectPackageListByReservationId(Long.parseLong(distributionDeliveryList.getReservationId())); |
|
|
|
|
Map<Long, DistributionParcelListEntity> packageMap = reservationPackageList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity(), (k1, k2) -> k2)); |
|
|
|
|
//该托盘的所有包件满足该计划下的所有
|
|
|
|
|
boolean flag = parcelListEntities.stream().allMatch(p -> Func.isNotEmpty(packageMap.get(p.getId()))); |
|
|
|
|
if (flag) { |
|
|
|
|
int sum = parcelListEntities.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("trayName", trayName); |
|
|
|
|
map.put("trayCode", trayTypeDataVO.getTrayCode()); |
|
|
|
|
map.put("trayNum", sum); |
|
|
|
|
map.put("type", "定制品"); |
|
|
|
|
List<Map<String, Object>> packageList = createdTrayPackage(goodsLsit); |
|
|
|
|
if (!packageList.isEmpty()) { |
|
|
|
|
map.put("packageList", packageList); |
|
|
|
|
} |
|
|
|
|
mapList.add(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//组装已装车的托盘信息
|
|
|
|
|
List<Map<String, Object>> loadingMapTray = distributionReservationMapper.selectLoadingTrayInfoByReservationId(reservationId); |
|
|
|
|
if (!loadingMapTray.isEmpty()) { |
|
|
|
|
for (Map<String, Object> map : loadingMapTray) { |
|
|
|
|
List<Map<String, Object>> packageList = handleLoadingTrayPackage(String.valueOf(map.get("trayName")), reservationId); |
|
|
|
|
if (!packageList.isEmpty()) { |
|
|
|
|
map.put("packageList", packageList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
mapList.addAll(loadingMapTray); |
|
|
|
|
} |
|
|
|
|
if (!mapList.isEmpty()) { |
|
|
|
|
for (Map<String, Object> map : mapList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
reservationAppDetailVO.setTrayList(mapList); |
|
|
|
|
} |
|
|
|
|
return R.data(reservationAppDetailVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<Map<String, Object>> handleLoadingTrayPackage(String trayName, Long reservationId) { |
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>(); |
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
.eq(DistributionLoadscanEntity::getTrayNo, trayName) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!loadscanEntityList.isEmpty()) { |
|
|
|
|
List<Long> packageIds = loadscanEntityList.stream().map(DistributionLoadscanEntity::getPackageId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : distributionParcelListService.listByIds(packageIds)) { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("orderPackageCode", parcelListEntity.getOrderPackageCode()); |
|
|
|
|
map.put("first", parcelListEntity.getFirsts()); |
|
|
|
|
map.put("second", parcelListEntity.getSecond()); |
|
|
|
|
map.put("thirdProduct", parcelListEntity.getThirdProduct()); |
|
|
|
|
map.put("orderPackageLoadingStatus", parcelListEntity.getOrderPackageLoadingStatus()); |
|
|
|
|
mapList.add(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return mapList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<Map<String, Object>> createdTrayPackage(List<WarehouseTrayGoodsEntity> goodsLsit) { |
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>(); |
|
|
|
|
List<Long> packageIds = goodsLsit.stream().map(WarehouseTrayGoodsEntity::getAssociationId).distinct().collect(Collectors.toList()); |
|
|
|
|
if (!packageIds.isEmpty()) { |
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : distributionParcelListService.listByIds(packageIds)) { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("orderPackageCode", parcelListEntity.getOrderPackageCode()); |
|
|
|
|
map.put("first", parcelListEntity.getFirsts()); |
|
|
|
|
map.put("second", parcelListEntity.getSecond()); |
|
|
|
|
map.put("thirdProduct", parcelListEntity.getThirdProduct()); |
|
|
|
|
map.put("orderPackageLoadingStatus", parcelListEntity.getOrderPackageLoadingStatus()); |
|
|
|
|
mapList.add(map); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return mapList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void cancelLoadscanAbnormalEntity(List<DistributionLoadscanAbnormalEntity> abnormalEntities,Long reservationId,Long deliveryId) { |
|
|
|
|
@Override |
|
|
|
|
public R createdZeroRetention(String barcode) { |
|
|
|
|
String method = "#############################################DistributionDeliveryInfoServiceImpl.getAppDeliveryreservationNewTrays"; |
|
|
|
|
if (Objects.isNull(barcode)) { |
|
|
|
|
log.error(method + "barcode参数缺失"); |
|
|
|
|
return R.fail("参数错误,联系管理员"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)) { |
|
|
|
|
log.error(method + "barcode参数缺失"); |
|
|
|
|
return R.fail(403, "未授权!!!"); |
|
|
|
|
} |
|
|
|
|
//查询此订单是否有效
|
|
|
|
|
DistributionStockArticleEntity order = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>query().lambda() |
|
|
|
|
.eq(DistributionStockArticleEntity::getOrderCode, barcode) |
|
|
|
|
.eq(DistributionStockArticleEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
if (Objects.isNull(order)) { |
|
|
|
|
log.error(method + "查询订单错误ordercode:{},warehouseId:{}", barcode, myCurrentWarehouse.getId()); |
|
|
|
|
return R.fail(barcode + "此订单信息不存在"); |
|
|
|
|
} |
|
|
|
|
//查询此订单的装车数量进行回库数据构建
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderId, order.getId()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
List<DistributionRetentionScanEntity> retentionScanVos = new ArrayList<>(); |
|
|
|
|
if (!loadscanEntityList.isEmpty()) { |
|
|
|
|
boolean isAllSignfor = loadscanEntityList.stream().allMatch(a -> Objects.equals(a.getPackageNub(), a.getReceivedQuantity())); |
|
|
|
|
if (isAllSignfor) { |
|
|
|
|
return R.fail("当前订单已完成签收"); |
|
|
|
|
} |
|
|
|
|
List<DistributionLoadscanEntity> returnZeroList = loadscanEntityList.stream().filter(a -> !Objects.equals(a.getPackageNub(), a.getReceivedQuantity())).collect(Collectors.toList()); |
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : returnZeroList) { |
|
|
|
|
DistributionRetentionScanEntity packageRetentionScanVo = buildZeroRetentionEntity(distributionLoadscanEntity); |
|
|
|
|
retentionScanVos.add(packageRetentionScanVo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.data(retentionScanVos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public boolean retentionReservationZeroPackageByNum(Long deliveryId, Long reservationId, Long orderPackageId, Integer retentionQuantity, Long orderId) { |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
|
ids.add(orderId); |
|
|
|
|
distributionReservationZeroPackageService.reduceNum(reservationId,orderId,orderPackageId,retentionQuantity); |
|
|
|
|
distributionStockArticleService.maintenanceOrderInfoByIds(ids); |
|
|
|
|
distributionParcelListService.maintenanceZerpPackageInfo(orderPackageId); |
|
|
|
|
distributionParcelListService.maintenanceZerpPackageInfo(orderPackageId); |
|
|
|
|
distributionReservationService.maintenanceReservationNum(reservationId); |
|
|
|
|
distributionReservationService.maintenanceReservationInfo(reservationId); |
|
|
|
|
distributionDeliveryListService.maintenanceDeliveryNum(deliveryId); |
|
|
|
|
distributionDeliveryListService.maintenanceDeliveryInfo(deliveryId); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DistributionRetentionScanEntity buildZeroRetentionEntity(DistributionLoadscanEntity loadscanEntity) { |
|
|
|
|
DistributionRetentionScanEntity packageRetentionScanEntity = new DistributionRetentionScanEntity(); |
|
|
|
|
|
|
|
|
|
packageRetentionScanEntity.setDeliveryId(loadscanEntity.getDeliveryId()); |
|
|
|
|
packageRetentionScanEntity.setOrderId(loadscanEntity.getOrderId()); |
|
|
|
|
packageRetentionScanEntity.setReservationId(loadscanEntity.getReservationId()); |
|
|
|
|
packageRetentionScanEntity.setTrainNumber(loadscanEntity.getTrainNumber()); |
|
|
|
|
packageRetentionScanEntity.setConditions(1); |
|
|
|
|
packageRetentionScanEntity.setRetentionQuantity(loadscanEntity.getPackageNub() - loadscanEntity.getReceivedQuantity()); |
|
|
|
|
packageRetentionScanEntity.setOrderPackageId(loadscanEntity.getPackageId()); |
|
|
|
|
//查询包件
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId()); |
|
|
|
|
packageRetentionScanEntity.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
packageRetentionScanEntity.setOrderPackageCode(parcelListEntity.getOrderCode()); |
|
|
|
|
packageRetentionScanEntity.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
packageRetentionScanEntity.setMaterialName(parcelListEntity.getFirsts()); |
|
|
|
|
packageRetentionScanEntity.setMaterialNumber(parcelListEntity.getMaterialCode()); |
|
|
|
|
packageRetentionScanEntity.setWaybillId(parcelListEntity.getWaybillId()); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(loadscanEntity.getReservationId()); |
|
|
|
|
packageRetentionScanEntity.setReservationCode(reservationEntity.getReservationCode()); |
|
|
|
|
packageRetentionScanEntity.setWarehouseId(loadscanEntity.getWarehouseId()); |
|
|
|
|
packageRetentionScanEntity.setWarehouseName(loadscanEntity.getWarehouseName()); |
|
|
|
|
packageRetentionScanEntity.setLoadingId(loadscanEntity.getId()); |
|
|
|
|
packageRetentionScanEntity.setRetentionType(RetentionSourceTypeConstant.zizhuxinzeng.getValue()); |
|
|
|
|
packageRetentionScanEntity.setVehicleNumber(loadscanEntity.getVehicleName()); |
|
|
|
|
// packageRetentionScanEntity.setTaskCode(distributionReservationService.retentionMa());
|
|
|
|
|
packageRetentionScanEntity.setDeliveryType(Integer.parseInt(reservationEntity.getDeliveryType())); |
|
|
|
|
return packageRetentionScanEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private R cancelLoadscanAbnormalEntity(List<DistributionLoadscanAbnormalEntity> abnormalEntities, Long reservationId, Long deliveryId,Long warehouseId) { |
|
|
|
|
List<Long> packageIds = new ArrayList<>(); |
|
|
|
|
List<Long> inventoryPackageIds = new ArrayList<>(); |
|
|
|
|
List<DistributionLoadscanAbnormalEntity> cancelZeroData = new ArrayList<>(); |
|
|
|
|
//进行异常的取消标注
|
|
|
|
|
List<Long> cancelIds = new ArrayList<>(); |
|
|
|
|
for (DistributionLoadscanAbnormalEntity abnormalEntity : abnormalEntities) { |
|
|
|
|
abnormalEntity.setAuditingStatus(LoadingAbnormalAuditingStatusConstant.yiquxiao.getValue()); |
|
|
|
|
abnormalEntity.setAuditingUser(AuthUtil.getUserName()); |
|
|
|
@ -9396,6 +9597,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//订制品
|
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
cancelZeroData.add(abnormalEntity); |
|
|
|
|
//零担
|
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
@ -9403,6 +9605,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
inventoryPackageIds.add(abnormalEntity.getPackageId()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
cancelIds.add(abnormalEntity.getId()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (!packageIds.isEmpty()) { |
|
|
|
@ -9421,11 +9624,24 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionCancelReservationPackageDTO.setDeliveryId(deliveryId); |
|
|
|
|
distributionReservationService.cancelReservationPackage(distributionCancelReservationPackageDTO); |
|
|
|
|
} |
|
|
|
|
if (!cancelZeroData.isEmpty()) { |
|
|
|
|
distributionReservationService.cancelReservationZeroPackage(cancelZeroData,warehouseId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!cancelIds.isEmpty()) { |
|
|
|
|
distributionLoadscanAbnormalService.update(Wrappers.<DistributionLoadscanAbnormalEntity>update().lambda() |
|
|
|
|
.in(DistributionLoadscanAbnormalEntity::getId, cancelIds) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingUser, AuthUtil.getNickName()) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingTime, new Date()) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingStatus, LoadingAbnormalAuditingStatusConstant.yiquxiao.getValue()) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getComplete, Integer.parseInt(IsOrNoConstant.yes.getValue())) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
distributionReservationService.maintenanceReservationInfo(reservationId); |
|
|
|
|
distributionReservationService.maintenanceReservationNum(reservationId); |
|
|
|
|
distributionDeliveryListService.maintenanceDeliveryInfo(deliveryId); |
|
|
|
|
distributionDeliveryListService.maintenanceDeliveryNum(deliveryId); |
|
|
|
|
|
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -9634,7 +9850,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return loadscanEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DistributionDeliverySelfEntity getDriver(DistributionDeliveryListEntity deliveryListEntity, BladeUser user, DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, boolean isDriverFlag) { |
|
|
|
|
@Override |
|
|
|
|
public DistributionDeliverySelfEntity getDriver(DistributionDeliveryListEntity deliveryListEntity, BladeUser user, String vehicleNub, boolean isDriverFlag) { |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity(); |
|
|
|
|
if ("1".equals(deliveryListEntity.getKind())) { |
|
|
|
|
if (isDriverFlag) { |
|
|
|
@ -9646,12 +9863,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询当前扫描司机是否属于当前配送任务
|
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndDriverId(driverArtery.getId(), deliveryListEntity.getId()); |
|
|
|
|
} else { |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getVehicleNub())) { |
|
|
|
|
if (Objects.isNull(vehicleNub)) { |
|
|
|
|
log.error("文员扫描未选择司机!!"); |
|
|
|
|
throw new CustomerException("文员扫描未选择司机"); |
|
|
|
|
} |
|
|
|
|
//默认为文员进行扫描,此时需要文员选择进行帮助扫描的司机
|
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndVehicleNub(deliveryListEntity.getId(), distrilbutionloadingscanDTO.getVehicleNub()); |
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndVehicleNub(deliveryListEntity.getId(), vehicleNub); |
|
|
|
|
if (Objects.isNull(distributionDeliverySelfEntity)) { |
|
|
|
|
log.error("没有司机的信息!!"); |
|
|
|
|
throw new CustomerException("没有司机的信息"); |
|
|
|
|