|
|
|
@ -7,10 +7,9 @@ import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataClientClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient; |
|
|
|
|
import com.logpm.trunkline.dto.InComingDTO; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineCarsLoadEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
|
|
|
|
import com.logpm.trunkline.entity.*; |
|
|
|
|
import com.logpm.trunkline.service.*; |
|
|
|
|
import com.logpm.trunkline.vo.BillladingPackageVO; |
|
|
|
|
import com.logpm.trunkline.vo.LoadScanWaybillVO; |
|
|
|
|
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWayBillDetail; |
|
|
|
@ -33,6 +32,7 @@ import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@ -62,6 +62,10 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
|
|
|
|
|
private IBasicdataClientClient basicdataClientClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataStoreBusinessClient basicdataStoreBusinessClient; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrunklineBillladingWaybillService trunklineBillladingWaybillService; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrunklineBillladingService trunklineBillladingService; |
|
|
|
|
|
|
|
|
|
@LogpmAsync("asyncExecutor") |
|
|
|
|
@Override |
|
|
|
@ -815,6 +819,72 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@LogpmAsync("asyncExecutor") |
|
|
|
|
@Override |
|
|
|
|
public void dealwithBillladingInfo(List<Long> advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo) { |
|
|
|
|
|
|
|
|
|
List<BillladingPackageVO> billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds); |
|
|
|
|
List<TrunklineBillladingWaybillEntity> addBillladingWaybillEntities = new ArrayList<>(); |
|
|
|
|
List<TrunklineBillladingWaybillEntity> updateBillladingWaybillEntities = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<TrunklineBillladingEntity> updateFeeBilllading = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
//把billladingPackageList转化成以billladingId为key的Map,以billladingId为key,value为BillladingPackageVO
|
|
|
|
|
Map<Long, BillladingPackageVO> billladingPackageMap = billladingPackageList.stream().collect(Collectors.toMap(BillladingPackageVO::getBillladingId, Function.identity())); |
|
|
|
|
|
|
|
|
|
List<Long> billladingIds = new ArrayList<>(billladingPackageMap.keySet()); |
|
|
|
|
|
|
|
|
|
QueryWrapper<TrunklineBillladingEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.in("id", billladingIds) |
|
|
|
|
.eq("is_deleted", 0) |
|
|
|
|
.eq("billlading_status", "2"); |
|
|
|
|
List<TrunklineBillladingEntity> billladingEntities = trunklineBillladingService.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
//把billladingEntities转化成以id为key的Map
|
|
|
|
|
Map<Long, TrunklineBillladingEntity> billladingMap = billladingEntities.stream().collect(Collectors.toMap(TrunklineBillladingEntity::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
List<TrunklineBillladingWaybillEntity> billladingWaybillEntities = trunklineBillladingWaybillService.getNoDataWaybillByBillladingIds(billladingIds); |
|
|
|
|
|
|
|
|
|
//把billladingWaybillEntities转化成以billladingId为key的Map
|
|
|
|
|
Map<Long, TrunklineBillladingWaybillEntity> billladingWaybillMap = billladingWaybillEntities.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getId, Function.identity())); |
|
|
|
|
|
|
|
|
|
billladingPackageMap.keySet().forEach(billladingId -> { |
|
|
|
|
BillladingPackageVO billladingPackageVO = billladingPackageMap.get(billladingId); |
|
|
|
|
Integer num = billladingPackageVO.getNum(); |
|
|
|
|
TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillMap.get(billladingId); |
|
|
|
|
if(!Objects.isNull(billladingWaybillEntity)){ |
|
|
|
|
TrunklineBillladingEntity billladingEntity = billladingMap.get(billladingId); |
|
|
|
|
Integer realNum = billladingWaybillEntity.getRealNum(); |
|
|
|
|
if (realNum > num) { |
|
|
|
|
billladingWaybillEntity.setRealNum(realNum - num); |
|
|
|
|
} else if (realNum.equals(num)) { |
|
|
|
|
billladingWaybillEntity.setRealNum(0); |
|
|
|
|
billladingWaybillEntity.setIsDeleted(1); |
|
|
|
|
} |
|
|
|
|
updateBillladingWaybillEntities.add(billladingWaybillEntity); |
|
|
|
|
TrunklineBillladingWaybillEntity addbillladingWaybillEntity = new TrunklineBillladingWaybillEntity(); |
|
|
|
|
addbillladingWaybillEntity.setWarehouseId(warehouseId); |
|
|
|
|
addbillladingWaybillEntity.setWarehouseName(warehouseName); |
|
|
|
|
addbillladingWaybillEntity.setBillladingId(billladingId); |
|
|
|
|
addbillladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode()); |
|
|
|
|
addbillladingWaybillEntity.setWaybillId(waybillId); |
|
|
|
|
addbillladingWaybillEntity.setWaybillNo(waybillNo); |
|
|
|
|
addbillladingWaybillEntity.setRealNum(num); |
|
|
|
|
addbillladingWaybillEntity.setRealVolume(BigDecimal.ZERO); |
|
|
|
|
addbillladingWaybillEntity.setRealWeight(BigDecimal.ZERO); |
|
|
|
|
addBillladingWaybillEntities.add(addbillladingWaybillEntity); |
|
|
|
|
updateFeeBilllading.add(billladingEntity); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
trunklineBillladingWaybillService.updateBatchById(updateBillladingWaybillEntities); |
|
|
|
|
trunklineBillladingWaybillService.saveBatch(addBillladingWaybillEntities); |
|
|
|
|
|
|
|
|
|
//更新提货单对应的运单的提货费用
|
|
|
|
|
for (TrunklineBillladingEntity billladingEntity : updateFeeBilllading) { |
|
|
|
|
trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|