Browse Source

自提编辑修改维护自提订单信息

pull/31/head
汤建军 12 months ago
parent
commit
e2d2f8374f
  1. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java
  2. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java
  3. 76
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  4. 57
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java

@ -531,17 +531,22 @@ public class DistributionDeliveryListController extends BladeController {
}
@PostMapping("/cancelZeroPackage")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "PC取消零担计划")
public R cancelZeroPackage(@Valid @RequestBody DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
R r = distributionSignforService.cancelZeroPackage(distrilbutionloadingscanDTO);
return r;
}
@PostMapping("/cancelDelivery")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "PC取消配送任务")
public R cancelDelivery(@Valid @RequestBody DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
R r = distributionDeliveryListService.cancelDelivery(distrilbutionloadingscanDTO.getDeliveryId());
// if (r.isSuccess()){
//取消成功,维护配送单状态和数量
// distributionDeliveryListService.maintenanceDeliveryNum(distrilbutionloadingscanDTO.getDeliveryId());
// distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
// }
return r;
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java

@ -321,4 +321,12 @@ public interface IDistributionSignforService extends BaseService<DistributionSig
* @return
*/
List<DistributionSignforOrderExcel> exportDistributionSignforOrderList(Long signforId);
/**
* 取消零担配送计划
* @param distrilbutionloadingscanDTO
* @return
*/
R cancelZeroPackage(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO);
}

76
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -1323,6 +1323,82 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return distributionSignforOrderExcels;
}
/**
* @param distrilbutionloadingscanDTO
* @return
*/
@Override
public R cancelZeroPackage(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
String method = "####################DistributionSignforImpl.cancelZeroPackage";
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getZeroPackageIds())){
log.error(method+"ZeroPackageIds参数缺失");
return R.fail("请联系管理员维护!!!");
}
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())){
log.error(method+"ReservationId参数缺失");
return R.fail("请联系管理员维护!!!");
}
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getDeliveryId())){
log.error(method+"DeliveryId参数缺失");
return R.fail("请联系管理员维护!!!");
}
List<Long> list = Func.toLongList(distrilbutionloadingscanDTO.getZeroPackageIds());
//查询是否进行装车或者签收
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.eq(DistributionLoadscanEntity::getDriverId, distrilbutionloadingscanDTO.getDeliveryId())
.in(DistributionLoadscanEntity::getPackageId, list)
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscanEntityList)){
List<Long> orderIds = loadscanEntityList.stream().map(DistributionLoadscanEntity::getOrderId).distinct().collect(Collectors.toList());
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleService.listByIds(orderIds);
String orderCodes = distributionStockArticleEntities.stream().map(DistributionStockArticleEntity::getOrderCode).collect(Collectors.joining(","));
log.error(method+"取消零担失败,已进行装车或签收orderCodes:{}",orderCodes);
return R.fail(orderCodes+"已进行装车或签收");
}
//剩下的满足取消条件,进行计划内的资源释放即可
List<DistributionReservationZeroPackageEntity> planZeroPackageEntities = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
Map<Long, List<DistributionReservationZeroPackageEntity>> planMap;
if (Func.isNotEmpty(planZeroPackageEntities)){
planMap = planZeroPackageEntities.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getStockArticleId));
} else {
planMap = null;
}
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntities = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
.in(DistributionReservationZeroPackageEntity::getParcelListId, list)
);
if (Func.isNotEmpty(planMap)){
Map<Long, List<DistributionReservationZeroPackageEntity>> cancelMap = reservationZeroPackageEntities.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getStockArticleId));
cancelMap.forEach((k,v)->{
if (!planMap.get(k).isEmpty()){
List<Long> ids = v.stream().map(DistributionReservationZeroPackageEntity::getParcelListId).collect(Collectors.toList());
distributionReservationZeroPackageService.recoverZeroPackage(distrilbutionloadingscanDTO.getReservationId(),ids);
if (planMap.get(k).size() == ids.size()){
distributionReservationStockarticleService.update(new UpdateWrapper<DistributionReservationStockarticleEntity>().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId,distrilbutionloadingscanDTO.getReservationId())
.in(DistributionReservationStockarticleEntity::getStockArticleId,k)
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus,ReservationOrderStatusConstant.quxiao.getValue())
.set(DistributionReservationStockarticleEntity::getStockArticleStatus,ReservationOrderStatusConstant.quxiao.getValue())
);
}
}
});
}else {
log.error(method+"查询原计划零担信息错误reservationId:{},ids:{}",distrilbutionloadingscanDTO.getReservationId(),list);
return R.fail("计划查询错误");
}
return R.success("操作成功");
}
private List<DeliveryNodeVo> handleStockUp(DistributionStockupEntity distributionStockupEntity) {
List<DeliveryNodeVo> nodeVos = new ArrayList<>();
try {

57
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -286,7 +286,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
las = true;
//修改
this.updateById(distrilbutionBillLading);
if (!distrilbutionBillLading.getBillPackageEntityList().isEmpty() || !distrilbutionBillLading.getUnBillPackageEntityList().isEmpty()) {
//修改新增包件
//todo
@ -316,26 +315,36 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
List<DistributionDeliveryChargeEntity> list = distributionDeliveryChargeService.list(Wrappers.<DistributionDeliveryChargeEntity>query().lambda()
.eq(DistributionDeliveryChargeEntity::getBillLading, distrilbutionBillLading.getId())
);
if (!list.isEmpty()) {
list.forEach(i -> {
String s = distrilbutionBillLading.getFei().get(i.getCost());
if (StringUtils.isNotBlank(s)) {
//修改
DistributionDeliveryChargeEntity distributionDeliveryCharge = new DistributionDeliveryChargeEntity();
distributionDeliveryCharge.setId(i.getId());
distributionDeliveryCharge.setMoney(new BigDecimal(s));
distributionDeliveryChargeService.updateById(distributionDeliveryCharge);
distrilbutionBillLading.getFei().remove(i.getCost());
} else {
//删除
distributionDeliveryChargeService.removeById(i.getId());
}
});
}
// List<DistributionDeliveryChargeEntity> deliveryChargeEntities = new ArrayList<>();
// if (!list.isEmpty()) {
// list.forEach(i -> {
// String s = distrilbutionBillLading.getFei().get(i.getCost());
// if (StringUtils.isNotBlank(s)) {
// //修改
// DistributionDeliveryChargeEntity distributionDeliveryCharge = new DistributionDeliveryChargeEntity();
// distributionDeliveryCharge.setId(i.getId());
// distributionDeliveryCharge.setMoney(new BigDecimal(s));
// distributionDeliveryCharge.setCost(i.getCost());
// deliveryChargeEntities.add(distributionDeliveryCharge);
//// distributionDeliveryChargeService.updateById(distributionDeliveryCharge);
// distrilbutionBillLading.getFei().remove(i.getCost());
// } else {
// //删除
// distributionDeliveryChargeService.removeById(i.getId());
// }
// });
// }
// if (!deliveryChargeEntities.isEmpty()){
// distributionDeliveryChargeService.updateBatchById(deliveryChargeEntities);
// }
//修改订单数据
if (!distrilbutionBillLading.getStockArticleList().isEmpty()) {
boolean flag = handleOrder(distrilbutionBillLading);
// boolean order = getOrder(distrilbutionBillLading.getStockArticleList(), distrilbutionBillLading.getId());
String orderIds = distrilbutionBillLading.getStockArticleList().stream().map(DistributionStockArticleEntity::getId).map(String::valueOf).collect(Collectors.joining(","));
distrilbutionBillLading.setStockArticleId(orderIds);
this.updateById(distrilbutionBillLading);
if (!flag) {
throw new ServiceException("修改失败!!");
}
@ -453,6 +462,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
} else {
updateStockBill(distrilbutionBillLading);
}
//修改自提单信息
} else {
//设置lockey
@ -841,6 +851,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//添加费用
if (!distrilbutionBillLading.getFei().isEmpty()) {
//删除和自提相关的所有费用
distributionDeliveryChargeService.update(Wrappers.<DistributionDeliveryChargeEntity>update().lambda()
.eq(DistributionDeliveryChargeEntity::getBillLading,distrilbutionBillLading.getId())
.set(DistributionDeliveryChargeEntity::getIsDeleted,1)
);
List<DistributionDeliveryChargeEntity> listEntity = new ArrayList<>();
distrilbutionBillLading.getFei().forEach((k, v) -> {
DistributionDeliveryChargeEntity distributionDeliveryCharge = new DistributionDeliveryChargeEntity();
@ -1557,9 +1572,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
if (!orderCodes.isEmpty()){
String collect = orderCodes.stream().distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(collect,myCurrentWarehouse.getId());
}
// DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = new DistrilbutionBillLadingEntity();
// distrilbutionBillLadingEntity.setId(distrilbutionBillLading.getId());
// String stockArticleIds = stockArticleList.stream().map(DistributionStockArticleEntity::getId).map(String::valueOf).collect(Collectors.joining(","));
// log.error("##################自提单发生修改,stockArticleIds:{}",stockArticleIds);
// distrilbutionBillLadingEntity.setStockArticleId(stockArticleIds);
// this.updateById(distrilbutionBillLadingEntity);

Loading…
Cancel
Save