|
|
|
@ -21,6 +21,7 @@ import com.logpm.factory.mt.dto.MtReceiveDTO;
|
|
|
|
|
import com.logpm.factory.mt.dto.MtReceiveImagesDTO; |
|
|
|
|
import com.logpm.factory.mt.feign.IMtOrderMainClinet; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; |
|
|
|
|
import com.sun.xml.bind.v2.TODO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.springblade.common.constant.DistributionTypeConstant; |
|
|
|
@ -78,7 +79,9 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
|
|
|
|
|
private final DistributionStockupMapper distributionStockupService; |
|
|
|
|
private final DistributionStockupInfoMapper distributionStockupInfoMapper; |
|
|
|
|
private final DistributionReservationStockarticleMapper distributionReservationStockarticleMapper; |
|
|
|
|
private final IDistributionReservationStockarticleService distributionReservationStockarticleService; |
|
|
|
|
private final DistributionReservationStocklistMapper distributionReservationStocklistMapper; |
|
|
|
|
private final IDistributionReservationStocklistService distributionReservationStocklistService; |
|
|
|
|
private final DistributionBillLadingScanMapper distributionBillLadingScanMapper; |
|
|
|
|
private final DistrilbutionBillStockMapper distrilbutionBillStockMapper; |
|
|
|
|
private final DistrilbutionBillLadingMapper distrilbutionBillLadingMapper; |
|
|
|
@ -1477,10 +1480,81 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Async |
|
|
|
|
@Transactional |
|
|
|
|
public void maintenanceOrderStatus(String orderCode, Long warehouseId) { |
|
|
|
|
distributionStockArticleService.updateOrderInfo(orderCode,warehouseId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
@Async |
|
|
|
|
public void releaseSource(Long reservationId,Long warehouseId) { |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(reservationId); |
|
|
|
|
|
|
|
|
|
if (reservationEntity.getReservationNum() > 0){ |
|
|
|
|
//存在订单
|
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId); |
|
|
|
|
if (Func.isNotEmpty(distributionParcelListEntities)){ |
|
|
|
|
List<Long> packageIds = distributionParcelListEntities.stream() |
|
|
|
|
.filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) && !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) |
|
|
|
|
.map(DistributionParcelListEntity::getId) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(packageIds)){ |
|
|
|
|
//对包件进行批量的修改
|
|
|
|
|
//将这些包件恢复到初始状态
|
|
|
|
|
int row = distributionParcelListMapper.updateOrderPackageInceptionStatus(packageIds); |
|
|
|
|
} |
|
|
|
|
//维护这些进行包件对应的订单
|
|
|
|
|
String orderCodes = distributionParcelListEntities.stream() |
|
|
|
|
.filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) && !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) |
|
|
|
|
.map(DistributionParcelListEntity::getOrderCode) |
|
|
|
|
.distinct().collect(Collectors.joining(",")); |
|
|
|
|
distributionStockArticleService.maintenanceOrderInfo(orderCodes,warehouseId); |
|
|
|
|
|
|
|
|
|
//完成对该客户下此包件任务的取消
|
|
|
|
|
int row = distributionReservationMapper.updatePackageDeliveryStatus(reservationId,packageIds); |
|
|
|
|
//TODO 欠缺零担的资源释放
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维护预约订单状态
|
|
|
|
|
distributionReservationStockarticleService.maintenanceReservationStockArticle(reservationId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//存在库存品信息
|
|
|
|
|
if (reservationEntity.getReservationStockListNum() > 0){ |
|
|
|
|
//进行库存品的资源释放
|
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = distributionReservationMapper.selectInventoryListByReservation(reservationId); |
|
|
|
|
if (Func.isNotEmpty(disStockListDetailEntities)){ |
|
|
|
|
//未签收并且未装车
|
|
|
|
|
List<DisStockListDetailEntity> inventoryList = disStockListDetailEntities.stream().filter(inven -> inven.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue()) && inven.getStockLockingStatus().equals(InventorySigningStatusConstant.weiqianshou.getValue())).collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(inventoryList)){ |
|
|
|
|
Map<Long, List<DisStockListDetailEntity>> stockListMap = inventoryList.stream().collect(Collectors.groupingBy(DisStockListDetailEntity::getStockListId)); |
|
|
|
|
stockListMap.forEach((k,v)->{ |
|
|
|
|
//扣减对应批次库存品的冻结数量
|
|
|
|
|
distributionStockListMapper.decreaseStockListQuantityOccupied(k,v.size()); |
|
|
|
|
//维护对应的客户库存品的
|
|
|
|
|
for (DisStockListDetailEntity disStockListDetailEntity : v) { |
|
|
|
|
//取消对应的库存品包件信息
|
|
|
|
|
disStockListDetailEntity.setStockPackageStatus(ReservationPackageStatusConstant.quxiao.getValue()); |
|
|
|
|
disStockListDetailService.updateById(disStockListDetailEntity); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//维护对应的库存品计划状态
|
|
|
|
|
distributionReservationStocklistService.maintenanceReservationStockList(reservationId); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Map<String,List<MtReceiveContentDTO>> handkeBrandsPackageList(String[] split, List<DistributionStockArticleEntity> distributionStockArticleEntities, Long warehouseId,Long reservationId,String deliveryCode) { |
|
|
|
|
Map<String,List<MtReceiveContentDTO>> packageList = new HashMap<>(); |
|
|
|
|
Map<String, List<DistributionStockArticleEntity>> orderMap = distributionStockArticleEntities.stream().collect(Collectors.groupingBy(DistributionStockArticleEntity::getBrand)); |
|
|
|
|