|
|
|
@ -21,6 +21,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
@ -600,10 +601,36 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
} else { |
|
|
|
|
updateStockBill(distrilbutionBillLading); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改自提单信息
|
|
|
|
|
//进行自提单的修改日志记录
|
|
|
|
|
Integer integer = baseMapper.selectBillLadingPlanNum(distrilbutionBillLading.getId()); |
|
|
|
|
handleUpdateDistributionPlanLog(billLadingEntity, distrilbutionBillLading, AuthUtil.getUser(), myCurrentWarehouse, integer); |
|
|
|
|
|
|
|
|
|
// 查询当前自提任务的 包件 信息
|
|
|
|
|
LambdaQueryWrapper<DistrilbutionBillPackageEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(DistrilbutionBillPackageEntity::getBillLadingId, distrilbutionBillLading.getId()); |
|
|
|
|
wrapper.ne(DistrilbutionBillPackageEntity::getPacketBarStatus, 2);// 不查询取消的
|
|
|
|
|
List<DistrilbutionBillPackageEntity> list = distrilbutionBillPackageService.list(wrapper); |
|
|
|
|
packageEntityList.addAll(list); // 将目前修改后的包件加入集合中
|
|
|
|
|
|
|
|
|
|
// 查询自提任务的零担
|
|
|
|
|
LambdaQueryWrapper<DistributionReservationZeroPackageEntity> lambdaQueryWrapper =new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionReservationZeroPackageEntity::getReservationId, distrilbutionBillLading.getId()); |
|
|
|
|
lambdaQueryWrapper.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, 2); |
|
|
|
|
List<DistributionReservationZeroPackageEntity> list1 = distributionZeroPackageService.list(lambdaQueryWrapper); |
|
|
|
|
zeroPackageEntityList.addAll(list1); |
|
|
|
|
|
|
|
|
|
// 查询库存
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<DistributionDeliveryDetailsEntity> wrapper1 = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper1.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLading.getId()); |
|
|
|
|
wrapper1.ne(DistributionDeliveryDetailsEntity::getInventoryStatus, 2); |
|
|
|
|
List<DistributionDeliveryDetailsEntity> list2 = distributionDeliveryDetailsService.list(wrapper1); |
|
|
|
|
detailsEntities.addAll(list2); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
//设置lockey
|
|
|
|
|
String lockKey = "lock:" + distrilbutionBillLading.getStockArticleId(); |
|
|
|
@ -1047,14 +1074,17 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
|
|
|
|
|
List<DeliveryOfPickupPlanFeiVO> deliveryOfPickupPlanFeiVOList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
listEntity.forEach(t -> { |
|
|
|
|
DeliveryOfPickupPlanFeiVO deliveryOfPickupPlanFeiVO = new DeliveryOfPickupPlanFeiVO(); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setCost(t.getCost()); |
|
|
|
|
String deliveryType = DictBizCache.getValue("deliveryType", deliveryOfPickupPlanFeiVO.getCost()); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setCostName(deliveryType); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setMoney(t.getMoney()); |
|
|
|
|
deliveryOfPickupPlanFeiVOList.add(deliveryOfPickupPlanFeiVO); |
|
|
|
|
}); |
|
|
|
|
if(listEntity!=null){ |
|
|
|
|
listEntity.forEach(t -> { |
|
|
|
|
DeliveryOfPickupPlanFeiVO deliveryOfPickupPlanFeiVO = new DeliveryOfPickupPlanFeiVO(); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setCost(t.getCost()); |
|
|
|
|
String deliveryType = DictBizCache.getValue("deliveryType", deliveryOfPickupPlanFeiVO.getCost()); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setCostName(deliveryType); |
|
|
|
|
deliveryOfPickupPlanFeiVO.setMoney(t.getMoney()); |
|
|
|
|
deliveryOfPickupPlanFeiVOList.add(deliveryOfPickupPlanFeiVO); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
deliveryOfPickupPlanVO.setDeliveryOfPickupPlanFeiVOList(deliveryOfPickupPlanFeiVOList); |
|
|
|
|
|
|
|
|
@ -1065,61 +1095,72 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void builkPackageDataByZero(List<DistributionReservationZeroPackageEntity> zeroPackageEntityList, List<PackageData> packageDataList) { |
|
|
|
|
zeroPackageEntityList.forEach(t -> { |
|
|
|
|
|
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.LTL); |
|
|
|
|
packageData.setNumber(t.getQuantity()); |
|
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(t.getParcelListId()); |
|
|
|
|
if (Func.isNotEmpty(byId)) { |
|
|
|
|
packageData.setOrderCode(byId.getOrderCode()); |
|
|
|
|
if (Func.isEmpty(byId.getBrandName())) { |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(byId.getStockArticleId()); |
|
|
|
|
if (ObjectUtils.isNotNull(stockArticleEntity)) { |
|
|
|
|
packageData.setBrand(stockArticleEntity.getBrand()); |
|
|
|
|
if(zeroPackageEntityList!=null){ |
|
|
|
|
zeroPackageEntityList.forEach(t -> { |
|
|
|
|
|
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.LTL); |
|
|
|
|
packageData.setNumber(t.getQuantity()); |
|
|
|
|
DistributionParcelListEntity byId = distributionParcelListService.getById(t.getParcelListId()); |
|
|
|
|
if (Func.isNotEmpty(byId)) { |
|
|
|
|
packageData.setOrderCode(byId.getOrderCode()); |
|
|
|
|
if (Func.isEmpty(byId.getBrandName())) { |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(byId.getStockArticleId()); |
|
|
|
|
if (ObjectUtils.isNotNull(stockArticleEntity)) { |
|
|
|
|
packageData.setBrand(stockArticleEntity.getBrand()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
packageData.setBrand(byId.getBrandName()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
packageData.setBrand(byId.getBrandName()); |
|
|
|
|
packageData.setWaybillNumber(byId.getWaybillNumber()); |
|
|
|
|
} |
|
|
|
|
packageData.setWaybillNumber(byId.getWaybillNumber()); |
|
|
|
|
} |
|
|
|
|
packageData.setProductName(t.getCategoryName()); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
packageData.setProductName(t.getCategoryName()); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void buildPackageDataByStockExtracted(List<DistributionDeliveryDetailsEntity> detailsEntities, List<PackageData> packageDataList) { |
|
|
|
|
detailsEntities.forEach(t -> { |
|
|
|
|
|
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
Long stockListId = t.getStockListId(); |
|
|
|
|
DistributionStockListEntity byId = distributionStockListService.getById(stockListId); |
|
|
|
|
if (byId != null) { |
|
|
|
|
packageData.setPickupBatch(byId.getIncomingBatch()); |
|
|
|
|
packageData.setBrand(byId.getBrandName()); |
|
|
|
|
packageData.setMaterialName(byId.getDescriptionGoods()); |
|
|
|
|
packageData.setMallName(byId.getMarketName()); |
|
|
|
|
packageData.setMaterialCode(byId.getCargoNumber()); |
|
|
|
|
packageData.setNumber(t.getQuantity()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.INV); |
|
|
|
|
if(detailsEntities!=null){ |
|
|
|
|
detailsEntities.forEach(t -> { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
Long stockListId = t.getStockListId(); |
|
|
|
|
DistributionStockListEntity byId = distributionStockListService.getById(stockListId); |
|
|
|
|
if (byId != null) { |
|
|
|
|
packageData.setPickupBatch(byId.getIncomingBatch()); |
|
|
|
|
packageData.setBrand(byId.getBrandName()); |
|
|
|
|
packageData.setMaterialName(byId.getDescriptionGoods()); |
|
|
|
|
packageData.setMallName(byId.getMarketName()); |
|
|
|
|
packageData.setMaterialCode(byId.getCargoNumber()); |
|
|
|
|
packageData.setNumber(t.getQuantity()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.INV); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
} |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void buildPackageByBillPackageExtracted(List<DistrilbutionBillPackageEntity> packageEntityList, List<PackageData> packageDataList) { |
|
|
|
|
packageEntityList.forEach(t -> { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageCode(t.getPacketBarCode()); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.CMP); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
if(packageEntityList!=null){ |
|
|
|
|
packageEntityList.forEach(t -> { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageCode(t.getPacketBarCode()); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.CMP); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1252,12 +1293,22 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
if (!cancelLogList.isEmpty()) { |
|
|
|
|
distributionPlanLogService.saveBatch(cancelLogList); |
|
|
|
|
} |
|
|
|
|
for (DistrilbutionBillLadingEntity distrilbutionBillLadingEntity : distrilbutionBillLadingEntities) { |
|
|
|
|
|
|
|
|
|
DistrilbutionBillLadingDTO dto = new DistrilbutionBillLadingDTO(); |
|
|
|
|
dto.setPickupBatch(distrilbutionBillLadingEntity.getPickupBatch()); |
|
|
|
|
dto.setWarehouse(myCurrentWarehouse.getName()); |
|
|
|
|
buildNodeFanoutMsgForBillByOption(dto, null, null, null, null, BizOperationEnums.DELETE); |
|
|
|
|
} |
|
|
|
|
return R.status(true); |
|
|
|
|
case 1: |
|
|
|
|
return R.fail("未授权!!!"); |
|
|
|
|
case 2: |
|
|
|
|
return R.fail("存在签收包件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return R.status(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|