Browse Source

配送任务状态维护

training
汤建军 1 year ago
parent
commit
389a0f15e8
  1. 152
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

152
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -28,6 +28,7 @@ import org.springblade.common.constant.Inventory.InventorySigningStatusConstant;
import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant; import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant;
import org.springblade.common.constant.loading.LoadingStatusConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springblade.common.constant.order.OrderStatusConstant; import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.order.OrderStockupStatusConstant; import org.springblade.common.constant.order.OrderStockupStatusConstant;
@ -36,6 +37,7 @@ import org.springblade.common.constant.orderpackage.OrderPackageReservationStatu
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant;
import org.springblade.common.constant.reservation.*; import org.springblade.common.constant.reservation.*;
import org.springblade.common.constant.signing.SignforStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant; import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -61,6 +63,7 @@ import java.util.stream.Collectors;
public class DistributionAsyncServiceImpl implements IDistributionAsyncService { public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final DistributionLoadscanMapper distributionLoadscanMapper; private final DistributionLoadscanMapper distributionLoadscanMapper;
private final DistributionLoadscaninvnMapper distributionLoadscaninvnMapper;
private final IDistributionStockArticleService distributionStockArticleService; private final IDistributionStockArticleService distributionStockArticleService;
private final DistributionStockMapper distributionStockService; private final DistributionStockMapper distributionStockService;
private final DistributionStockListMapper distributionStockListMapper; private final DistributionStockListMapper distributionStockListMapper;
@ -457,103 +460,138 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
.ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue())); .ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue()));
boolean inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); boolean inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue()));
boolean inventorySigningFlag = list.stream().allMatch(l -> l.getStockSignfoStatus().equals(InventorySigningStatusConstant.yiqianshou.getValue())); boolean inventorySigningFlag = list.stream().allMatch(l -> l.getStockSignfoStatus().equals(InventorySigningStatusConstant.yiqianshou.getValue()));
List<DistributionReservationStocklistEntity> reservationStockarticleEntityList = distributionReservationStocklistMapper.selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda() List<DistributionReservationStocklistEntity> reservationStocklistEntityList = distributionReservationStocklistMapper.selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
.eq(DistributionReservationStocklistEntity::getReservationId, loadingInventoryDetail.getReservationId()) .eq(DistributionReservationStocklistEntity::getReservationId, loadingInventoryDetail.getReservationId())
.eq(DistributionReservationStocklistEntity::getStocklistId, loadingInventoryDetail.getStockListId()) .eq(DistributionReservationStocklistEntity::getStocklistId, loadingInventoryDetail.getStockListId())
.ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue()));
if (reservationStockarticleEntityList.size() == 1) { if (reservationStocklistEntityList.size() == 1) {
//修改状态 //修改状态
DistributionReservationStocklistEntity reservationStockarticleEntity = reservationStockarticleEntityList.get(0); DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntityList.get(0);
if (inventoryLoadingFlag) { if (inventoryLoadingFlag) {
//查询出库存品进行全部状态的变更 //查询出库存品进行全部状态的变更
reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue());
} else { } else {
inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); inventoryLoadingFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue()));
if (inventoryLoadingFlag) { if (inventoryLoadingFlag) {
reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue());
} else { } else {
reservationStockarticleEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue()); reservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getValue());
} }
} }
if (inventorySigningFlag) { if (inventorySigningFlag) {
//查询出库存品进行全部状态的变更 //查询出库存品进行全部状态的变更
reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.yiqianshou.getValue()); reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.yiqianshou.getValue());
} else { } else {
inventorySigningFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); inventorySigningFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue()));
if (inventorySigningFlag) { if (inventorySigningFlag) {
reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.weiqianshou.getValue()); reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.weiqianshou.getValue());
} else { } else {
reservationStockarticleEntity.setSigningStatus(ReservationInventorySigningStatusConstant.bufenqianshou.getValue()); reservationStocklistEntity.setSigningStatus(ReservationInventorySigningStatusConstant.bufenqianshou.getValue());
} }
} }
distributionReservationStocklistMapper.updateById(reservationStockarticleEntity); distributionReservationStocklistMapper.updateById(reservationStocklistEntity);
} else { } else {
log.error("####库存品记录错误+{" + reservationStockarticleEntityList + "}"); log.error("####库存品记录错误+{" + reservationStocklistEntityList + "}");
return; return;
} }
} }
//查询出这个预约下的包件信息和库存品信息分别进行判断是否都完成装车 //查询出这个预约下的包件信息和库存品信息分别进行判断是否都完成装车
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId); List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId);
reservationEntityList.forEach(r -> { reservationEntityList.forEach(r -> {
//查询预约下的所有包件信息 int reservationTotal = r.getReservationNum() + r.getReservationStockListNum();
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(r.getId()); //查询此预约的包件装车数和库存品装车数
boolean reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); Integer loadingNum = 0;
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities = distributionReservationStocklistMapper.selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda() Integer signNum = 0;
.eq(DistributionReservationStocklistEntity::getReservationId, r.getId()) List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.<DistributionLoadscanEntity>query().lambda()
.ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); .eq(DistributionLoadscanEntity::getReservationId, r.getId())
boolean inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue())); .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
if (reservationLoadingFlag && inventoryLoadingFlag) { );
if (Func.isNotEmpty(loadscanEntityList)){
loadingNum += loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
signNum += loadscanEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
}
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getReservationId, r.getId())
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscanEntityList)){
loadingNum += loadscaninvnEntityList.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum();
signNum += loadscaninvnEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum();
}
if (loadingNum == reservationTotal){
r.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); r.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
} else { }else {
reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue());
inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()));
if (reservationLoadingFlag && inventoryLoadingFlag) {
r.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue());
} else {
r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue());
}
} }
boolean inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue()));
boolean reservationSigningFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
if (inventorySigningFlag && reservationSigningFlag) {
r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue());
} else {
inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> !i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue()));
reservationSigningFlag = parcelListEntities.stream().allMatch(p -> !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
if (inventorySigningFlag && reservationSigningFlag) {
r.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue());
} else { if (signNum == reservationTotal){
r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue()); r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue());
} }else {
r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue());
} }
// //查询预约下的所有包件信息
// List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(r.getId());
// boolean reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue()));
// List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities = distributionReservationStocklistMapper.selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
// .eq(DistributionReservationStocklistEntity::getReservationId, r.getId())
// .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue()));
// boolean inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()));
// if (reservationLoadingFlag && inventoryLoadingFlag) {
// r.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue());
// } else {
// reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()));
// inventoryLoadingFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getLoadingStatus().equals(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()));
// if (reservationLoadingFlag && inventoryLoadingFlag) {
// r.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue());
// } else {
// r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue());
// }
// }
// boolean inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue()));
// boolean reservationSigningFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
// if (inventorySigningFlag && reservationSigningFlag) {
// r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue());
// } else {
// inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> !i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue()));
// reservationSigningFlag = parcelListEntities.stream().allMatch(p -> !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
// if (inventorySigningFlag && reservationSigningFlag) {
// r.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue());
//
// } else {
// r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue());
// }
// }
distributionReservationMapper.updateById(r); distributionReservationMapper.updateById(r);
}); });
List<DistributionParcelListEntity> deliveryParcelListEntityList = distributionDeliveryListMapper.selectPackageListByDeliveryListId(deliveryId);
List<DisStockListDetailEntity> detailEntities = distributionDeliveryListMapper.selectInventoryListByDeliveryListId(deliveryId);
boolean deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
boolean deliveryInventoryLoadingFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()));
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.<DistributionDeliveryListEntity>query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId)); DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.<DistributionDeliveryListEntity>query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId));
if (deliveryLoadingFlag && deliveryInventoryLoadingFlag) { Integer delivertTotal = deliveryListEntity.getDeliveryNumber();
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); Integer deliverySigningNum = 0 ;
} else { List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.<DistributionLoadscanEntity>query().lambda()
deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); .eq(DistributionLoadscanEntity::getDeliveryId, deliveryListEntity.getId())
deliveryInventoryLoadingFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue())); .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
if (deliveryLoadingFlag && deliveryInventoryLoadingFlag) { );
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue()); if (Func.isNotEmpty(loadscanEntityList)){
} else { deliverySigningNum += loadscanEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.bunfenzhuangche.getValue());
}
} }
boolean deliveryPackageSigningFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
boolean deliveryInventorySigningFlag = detailEntities.stream().allMatch(i -> i.getStockLockingStatus().equals(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue())); .eq(DistributionLoadscaninvnEntity::getDeliveryId, deliveryListEntity.getId())
if (deliveryPackageSigningFlag && deliveryInventorySigningFlag) { .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscanEntityList)){
deliverySigningNum += loadscaninvnEntityList.stream().filter(l->l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum();
}
if (deliverySigningNum == delivertTotal){
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue()); deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue());
} else { }else {
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue());
} }
distributionDeliveryListMapper.updateById(deliveryListEntity); distributionDeliveryListMapper.updateById(deliveryListEntity);
} }

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

@ -1171,7 +1171,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListEntity.setUnloadingTeamName(stockup.getUnloaderName()); distributionDeliveryListEntity.setUnloadingTeamName(stockup.getUnloaderName());
} }
distributionDeliveryListEntity.setWarehouseId(myCurrentWarehouse.getId()); distributionDeliveryListEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionDeliveryListEntity.setWarehouseName(String.join(",", warehouseNames)); distributionDeliveryListEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.daipeisong.getValue()); distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.daipeisong.getValue());
distributionDeliveryListEntity.setCustomersNumber(reservationIds.split(",").length); distributionDeliveryListEntity.setCustomersNumber(reservationIds.split(",").length);
distributionDeliveryListEntity.setOrderNumber(orderNum.get()); distributionDeliveryListEntity.setOrderNumber(orderNum.get());

Loading…
Cancel
Save