Browse Source

商配增加同时操作订单拦截

pull/10/head
汤建军 10 months ago
parent
commit
3b54e8778e
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  3. 49
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  4. 32
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

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

@ -534,7 +534,7 @@ public class DistributionDeliveryListController extends BladeController {
@PostMapping("/cancelDelivery")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "PC取消包件")
@ApiOperation(value = "PC取消配送任务")
public R cancelDelivery(@Valid @RequestBody DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
R r = distributionDeliveryListService.cancelDelivery(distrilbutionloadingscanDTO.getDeliveryId());
// if (r.isSuccess()){

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -887,6 +887,8 @@
</if>
</where>
GROUP BY
lddl.id
ORDER BY lddl.create_time DESC
</select>
<select id="getDeliveryStockArticleInfo" resultType="com.logpm.distribution.vo.DistributionStockArticleVO">

49
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -2773,6 +2773,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationMapper.insert(reservationEntity);
//新增一个客户
v.forEach(s -> {
List<Long> packageLockIds = new ArrayList<>();
//预约单数据填充
if (Func.isNotEmpty(s.getMallName())) {
mallName.add(s.getMallName());
@ -2841,7 +2842,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
packageLockIds.add(dp.getId());
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
@ -2861,6 +2862,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
packageLockIds.add(p.getId());
//这里根据包件进行订单状态的改变
// distributionAsyncService.checkStockArticleReservationStatus(p);
});
@ -2888,6 +2890,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionParcelNumberService.updateById(p);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(p, DistributionParcelNumberEntity.class));
packageLockIds.add(p.getParcelListId());
}
});
} else {
@ -2908,6 +2912,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionParcelNumberService.updateById(l);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(l, DistributionParcelNumberEntity.class));
packageLockIds.add(l.getParcelListId());
});
} else {
log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId());
@ -2926,6 +2932,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationStockarticleService.save(reservationStockarticleEntity);
packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
orderTotal.getAndIncrement();
//添加缓存
if (!packageLockIds.isEmpty()){
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 {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds,5*60L);
}
}
}
});
// -----------------------客户收货信息完善-------------------------
reservationEntity.setConsignee(String.join(",", consigneeName));
@ -2979,6 +2997,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
Map<Long, List<DistributionReservationStockarticleEntity>> oldOrder = reservationStockarticleEntityList.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId));
v.forEach(s -> {
List<Long> packageLockIds = new ArrayList<>();
orderTotal.getAndIncrement();
//预约单数据填充
if (Func.isNotEmpty(s.getMallName())) {
@ -3040,6 +3059,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
packageLockIds.add(p.getId());
//这里根据包件进行订单状态的改变
// distributionAsyncService.checkStockArticleReservationStatus(p);
});
@ -3070,6 +3090,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
packageLockIds.add(dp.getId());
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
@ -3101,7 +3123,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionParcelNumberService.updateById(p);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(p, DistributionParcelNumberEntity.class));
packageLockIds.add(p.getParcelListId());
}
});
} else {
@ -3122,6 +3144,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionParcelNumberService.updateById(l);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(l, DistributionParcelNumberEntity.class));
packageLockIds.add(l.getParcelListId());
});
} else {
log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId());
@ -3177,6 +3201,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity);
distributionAsyncService.checkStockArticleReservationStatus(p);
packageLockIds.add(p.getId());
} else {
//依然存在包件,
oldPackageList.remove(p.getId());
@ -3197,6 +3222,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
if (Func.isNotEmpty(bladeRedis.get("warehouseId:"+myCurrentWarehouse.getId()+"orderCode:"+parcelListEntity.getOrderCode()))){
List<Long> ids = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode());
int indexOf = ids.indexOf(parcelListEntity.getId());
if (indexOf>0){
ids.remove(indexOf);
bladeRedis.set("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode(),ids);
}
}
// distributionAsyncService.checkStockArticleReservationStatus(parcelListEntity);
});
} else {
@ -3282,6 +3315,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//预约订单上的包件数量维护
packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
}
if (!packageLockIds.isEmpty()){
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 {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds,5*60L);
}
}
}
});
if (Func.isNotEmpty(oldOrder)) {
oldOrder.forEach((m, n) -> {
@ -3322,6 +3366,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());
});
}
//重新维护预约信息

32
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -1682,8 +1682,15 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
if (Func.isNotEmpty(bladeRedis.get("warehouseId:"+myCurrentWarehouse.getId()+"orderCode:"+parcelListEntity.getOrderCode()))){
List<Long> ids = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode());
int indexOf = ids.indexOf(parcelListEntity.getId());
if (indexOf>0){
ids.remove(indexOf);
bladeRedis.set("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + parcelListEntity.getOrderCode(),ids);
}
}
//移除缓存
bladeRedis.del("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + distributionStockArticleDTO.getOrderCode());
});
reservationStockarticleEntity.setReservationNum(packageNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
@ -1796,8 +1803,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds,5*60L);
}
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + v.get(0).getOrderCode(),packageLockIds,5*60L);
}
}
});
@ -2136,6 +2141,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//运单客户收货单位
HashSet<String> consignee = new HashSet<>();
v.forEach(s -> {
List<Long> packageLockIds = new ArrayList<>();
DistributionStockArticleDTO stockArticleDTO = Func.copy(s, DistributionStockArticleDTO.class);
// WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(s.getWaybillNumber());
// if (Func.isNotEmpty(warehouseWaybillEntity.getConsigneeMobile())){
@ -2212,6 +2218,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
packageLockIds.add(p.getId());
//这里根据包件进行订单状态的改变
// distributionAsyncService.checkStockArticleReservationStatus(p);
});
@ -2245,7 +2252,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
packageLockIds.add(dp.getId());
}
}
@ -2280,6 +2287,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionParcelNumberService.updateById(p);
reservationOrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(p, DistributionParcelNumberEntity.class));
packageLockIds.add(p.getParcelListId());
}
});
} else {
@ -2313,6 +2322,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionStockArticleService.maintenanceOrderInfo(s.getOrderCode(),s.getWarehouseId());
//维护包件状态
distributionParcelListService.maintenanceZeroPackageInfo(l.getParcelListId(),l.getWarehouseId());
packageLockIds.add(l.getParcelListId());
}
});
} else {
@ -2336,6 +2347,19 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
orderTotal.getAndIncrement();
distributionAsyncService.changeOrderReservationStatus(stockArticleDTO);
//进行订单的缓存添加
if (!packageLockIds.isEmpty()){
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){
log.info("###################商配存在同时操作订单,订单号:" + s.getOrderCode() + "###################");
throw new RuntimeException(s.getOrderCode()+"正在操作,请刷新后尝试");
}
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "orderCode:" + s.getOrderCode(),packageLockIds,5*60L);
}
}
});
//维护备货任务
DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity();

Loading…
Cancel
Save