|
|
@ -63,6 +63,9 @@ import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusCon |
|
|
|
import org.springblade.common.constant.reservation.*; |
|
|
|
import org.springblade.common.constant.reservation.*; |
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
import org.springblade.common.constant.stockup.StockupTypeConstant; |
|
|
|
import org.springblade.common.constant.stockup.StockupTypeConstant; |
|
|
|
|
|
|
|
import org.springblade.common.enums.BizOperationEnums; |
|
|
|
|
|
|
|
import org.springblade.common.model.NodeFanoutMsg; |
|
|
|
|
|
|
|
import org.springblade.common.model.ReservationVO; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
@ -127,6 +130,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { |
|
|
|
private final ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient; |
|
|
|
private final ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient; |
|
|
|
private final IDistributionPrintService distributionPrintService; |
|
|
|
private final IDistributionPrintService distributionPrintService; |
|
|
|
private final IBasicdataClientClient basicdataClientClient; |
|
|
|
private final IBasicdataClientClient basicdataClientClient; |
|
|
|
|
|
|
|
private final IDistributionNodeWorkService nodeWorkService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -893,8 +897,9 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//维护预约的预约数量
|
|
|
|
//维护预约的预约数量
|
|
|
|
|
|
|
|
maintenanceReservationStatus(reservationId,deliveryId); |
|
|
|
// maintenanceReservationPackageNum(reservationId);
|
|
|
|
// maintenanceReservationPackageNum(reservationId);
|
|
|
|
// maintenanceDeliveryPackageNum(deliveryId);
|
|
|
|
maintenanceDeliveryPackageNum(deliveryId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1804,6 +1809,19 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void maintenanceDeliveryStatus(Long deliveryId) { |
|
|
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(deliveryId); |
|
|
|
|
|
|
|
if (Func.isNotEmpty(distributionDeliveryListEntity)) { |
|
|
|
|
|
|
|
List<DistributionReservationEntity> distributionReservationEntities = distributionDeliveryListMapper.selectReservationByDeliveryListId(distributionDeliveryListEntity.getId()); |
|
|
|
|
|
|
|
Integer planNum = 0 ; |
|
|
|
|
|
|
|
if (Func.isNotEmpty(distributionReservationEntities)) { |
|
|
|
|
|
|
|
planNum += distributionReservationEntities.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum() + distributionReservationEntities.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (planNum == 0) { |
|
|
|
|
|
|
|
distributionDeliveryListMapper.deleteById(distributionDeliveryListEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 维护预约数量和状态 |
|
|
|
* 维护预约数量和状态 |
|
|
@ -1837,6 +1855,88 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void maintenanceReservationStatus(Long reservationId,Long deliveryId) { |
|
|
|
|
|
|
|
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(reservationId); |
|
|
|
|
|
|
|
if (Func.isNotEmpty(distributionReservationEntity)) { |
|
|
|
|
|
|
|
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationMapper.selectStockArticleByReservationId(distributionReservationEntity.getId()); |
|
|
|
|
|
|
|
Integer planNum = 0; |
|
|
|
|
|
|
|
if (Func.isNotEmpty(distributionReservationStockarticleEntities)) { |
|
|
|
|
|
|
|
planNum += distributionReservationStockarticleEntities.stream().mapToInt(DistributionReservationStockarticleEntity::getReservationNum).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities = distributionReservationMapper.selectStockListByReservationId(distributionReservationEntity.getId()); |
|
|
|
|
|
|
|
if (Func.isNotEmpty(distributionReservationStocklistEntities)) { |
|
|
|
|
|
|
|
//统计库存品数
|
|
|
|
|
|
|
|
planNum += distributionReservationStocklistEntities.stream().mapToInt(DistributionReservationStocklistEntity::getReservationNum).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
|
|
|
.eq(DistributionLoadscanEntity::getReservationId, reservationId) |
|
|
|
|
|
|
|
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryId) |
|
|
|
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (!loadscanEntityList.isEmpty()) { |
|
|
|
|
|
|
|
planNum += loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() |
|
|
|
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getReservationId, reservationId) |
|
|
|
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getDeliveryId, deliveryId) |
|
|
|
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (!loadscaninvnEntityList.isEmpty()) { |
|
|
|
|
|
|
|
planNum += loadscaninvnEntityList.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
distributionReservationMapper.updateById(distributionReservationEntity); |
|
|
|
|
|
|
|
if (planNum == 0 ) { |
|
|
|
|
|
|
|
distributionReservationEntity.setIsDeleted(1); |
|
|
|
|
|
|
|
distributionReservationEntity.setCancelReason("无计划数据,系统取消"); |
|
|
|
|
|
|
|
distributionReservationEntity.setReservationStatus(ReservationStatusConstant.yiquexiao.getValue()); |
|
|
|
|
|
|
|
distributionReservationMapper.updateById(distributionReservationEntity); |
|
|
|
|
|
|
|
//删除签收表数据
|
|
|
|
|
|
|
|
distributionSignforMapper.deleteByReservationAndDeliveryId(reservationId,deliveryId); |
|
|
|
|
|
|
|
NodeFanoutMsg<ReservationVO> nodeFanoutMsg =buildNodeFanoutMsgByReservationByCancel(distributionReservationEntity); |
|
|
|
|
|
|
|
nodeWorkService.cancelReservation(nodeFanoutMsg,AuthUtil.getUser()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<ReservationVO> buildNodeFanoutMsgByReservationByCancel(DistributionReservationEntity reservationEntity) { |
|
|
|
|
|
|
|
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = new NodeFanoutMsg<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.PLANNED_RESERVATION); |
|
|
|
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.DELETE); |
|
|
|
|
|
|
|
nodeFanoutMsg.setOperator(AuthUtil.getNickName()); |
|
|
|
|
|
|
|
nodeFanoutMsg.setOperatorTime(new Date()); |
|
|
|
|
|
|
|
nodeFanoutMsg.setWarehouse(reservationEntity.getWarehouseName()); |
|
|
|
|
|
|
|
nodeFanoutMsg.setWarehouseId(reservationEntity.getWarehouseId()); |
|
|
|
|
|
|
|
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReservationVO reservationVO = getReservationVO(reservationEntity); |
|
|
|
|
|
|
|
nodeFanoutMsg.setMain(reservationVO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReservationVO getReservationVO(DistributionReservationEntity reservationEntity) { |
|
|
|
|
|
|
|
ReservationVO reservationVO = new ReservationVO(); |
|
|
|
|
|
|
|
reservationVO.setReservationCode(reservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
reservationVO.setReservationDate(reservationEntity.getReservationDate()); |
|
|
|
|
|
|
|
reservationVO.setConsignee(reservationEntity.getConsignee()); |
|
|
|
|
|
|
|
reservationVO.setDeliveryAddress(reservationEntity.getDeliveryAddress()); |
|
|
|
|
|
|
|
reservationVO.setDeliveryPhone(reservationEntity.getDeliveryPhone()); |
|
|
|
|
|
|
|
reservationVO.setMallName(reservationEntity.getMallName()); |
|
|
|
|
|
|
|
reservationVO.setStoreName(reservationEntity.getStoreName()); |
|
|
|
|
|
|
|
reservationVO.setWarehouseName(reservationEntity.getWarehouseName()); |
|
|
|
|
|
|
|
reservationVO.setDeliveryType(reservationEntity.getDeliveryType()); |
|
|
|
|
|
|
|
reservationVO.setReservationNum(reservationEntity.getReservationNum()); |
|
|
|
|
|
|
|
reservationVO.setReceivingUnit(reservationEntity.getReceivingUnit()); |
|
|
|
|
|
|
|
reservationVO.setId(reservationEntity.getId()); |
|
|
|
|
|
|
|
reservationVO.setReservationStockListNum(reservationEntity.getReservationStockListNum()); |
|
|
|
|
|
|
|
return reservationVO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// @Transactional
|
|
|
|
// @Transactional
|
|
|
|
private void checkReservationAndDeliverySigningStatus(Long reservationId, Long deliveryId) { |
|
|
|
private void checkReservationAndDeliverySigningStatus(Long reservationId, Long deliveryId) { |
|
|
|
//维护客户签收状态
|
|
|
|
//维护客户签收状态
|
|
|
|