|
|
|
@ -252,6 +252,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataDriverArteryClient arteryClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionDeliveryDetailsService distributionDeliveryDetailsService; |
|
|
|
|
|
|
|
|
|
// private final IWarehouseRetentionScanClient warehouseRetentionScanClient;
|
|
|
|
|
|
|
|
|
|
// @Lazy
|
|
|
|
@ -4849,14 +4852,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<DistrilbutionBillPackageEntity> distrilbutionBillPackageEntities = distrilbutionBillPackageMapper.selectList(distrilbutionBillStockEntityLambdaQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 得到所以的订单列表
|
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = null; |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntities = new ArrayList<>(); |
|
|
|
|
if (!distrilbutionBillPackageEntities.isEmpty()) { |
|
|
|
|
List<Long> ids = distrilbutionBillPackageEntities.stream().map(DistrilbutionBillPackageEntity::getParceListId).collect(Collectors.toList()); |
|
|
|
|
distributionParcelListEntities = distributionParcelListMapper.selectBatchIds(ids); |
|
|
|
|
|
|
|
|
|
distributionParcelListEntities = distributionParcelListMapper.selectBatchIds(ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("自提单号", distrilbutionBillLadingEntity.getPickupBatch()); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(map.get("自提单号").toString()); |
|
|
|
@ -4864,9 +4868,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// map.put("收货单单位", reservationEntity.getReceivingUnit());//收货单单位
|
|
|
|
|
// map.put("商场名称", reservationEntity.getStoreName());//商场名称
|
|
|
|
|
// 构建map集合中收货单和商场名称
|
|
|
|
|
if (!distributionParcelListEntities.isEmpty() && !distrilbutionBillStockEntities.isEmpty()){ |
|
|
|
|
buildMapByDistrilbutionBillLadingEntity(map, distrilbutionBillStockEntities, distributionParcelListEntities, distrilbutionBillLadingEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
map.put("提货人", distrilbutionBillLadingEntity.getConsignee());//提货人
|
|
|
|
|
map.put("联系电话", distrilbutionBillLadingEntity.getConsigneePhone());//收货人电话
|
|
|
|
|
BasicdataWarehouseEntity entityWarehouseId = warehouseClient.getEntityWarehouseId(distrilbutionBillLadingEntity.getWarehouseId()); |
|
|
|
@ -4919,24 +4922,71 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private void buildMapByDistrilbutionBillLadingEntity(Map<String, Object> map, List<DistrilbutionBillStockEntity> distrilbutionBillStockEntities, List<DistributionParcelListEntity> distributionParcelListEntities, DistrilbutionBillLadingEntity distrilbutionBillLadingEntity) { |
|
|
|
|
|
|
|
|
|
// 查询订单集合
|
|
|
|
|
Set<Long> ids = new HashSet<Long>(); |
|
|
|
|
for (DistrilbutionBillStockEntity distrilbutionBillStockEntity : distrilbutionBillStockEntities) { |
|
|
|
|
ids.add(distrilbutionBillStockEntity.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
// 得到所以的订单列表
|
|
|
|
|
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleMapper.selectBatchIds(ids); |
|
|
|
|
int a = 1; |
|
|
|
|
List<Map<String, Object>> ls = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
// 获取订单中的商城和收货单位
|
|
|
|
|
StringBuilder consigneeUnit = new StringBuilder(); |
|
|
|
|
StringBuilder mailNames = new StringBuilder(); |
|
|
|
|
List<Map<String, Object>> ls = new ArrayList<>(); |
|
|
|
|
int hejiNum = 0; |
|
|
|
|
Map<String, Object> m = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询库存品信息
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> detailsEntities = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.ne(DistributionDeliveryDetailsEntity::getStockStatus, ReservationOrderStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (!detailsEntities.isEmpty()) { |
|
|
|
|
Map<Long, List<DistributionDeliveryDetailsEntity>> inventoryMap = detailsEntities.stream().collect(Collectors.groupingBy(DistributionDeliveryDetailsEntity::getStockListId)); |
|
|
|
|
List<Long> inventoryIds = detailsEntities.stream().map(DistributionDeliveryDetailsEntity::getStockListId).collect(Collectors.toList()); |
|
|
|
|
List<DistributionStockListEntity> distributionStockListEntities = distributionStockListService.listByIds(inventoryIds); |
|
|
|
|
if (!distributionStockListEntities.isEmpty()) { |
|
|
|
|
for (DistributionStockListEntity distributionStockListEntity : distributionStockListEntities) { |
|
|
|
|
Map<String, Object> tempMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
tempMap.put("序号", a); |
|
|
|
|
|
|
|
|
|
tempMap.put("运单号", distributionStockListEntity.getIncomingBatch()); |
|
|
|
|
tempMap.put("合同号", distributionStockListEntity.getOrderCode()); |
|
|
|
|
tempMap.put("物料名称", distributionStockListEntity.getDescriptionGoods()); |
|
|
|
|
//构建产品明细
|
|
|
|
|
Map<String,Object> map1 = new HashMap<>(); |
|
|
|
|
map1.put("物料编码",distributionStockListEntity.getCargoNumber()); |
|
|
|
|
map1.put("物料单位",distributionStockListEntity.getCargoUnit()); |
|
|
|
|
map1.put("物料规格",distributionStockListEntity.getCargoNorms()); |
|
|
|
|
//查询此订制品库位信息
|
|
|
|
|
DistributionDeliveryDetailsEntity distributionDeliveryDetailsEntity = inventoryMap.get(distributionStockListEntity.getId()).get(0); |
|
|
|
|
Integer quantity = distributionDeliveryDetailsEntity.getQuantity(); |
|
|
|
|
map1.put("计划数量",quantity); |
|
|
|
|
hejiNum += quantity; |
|
|
|
|
tempMap.put("小计", quantity); |
|
|
|
|
tempMap.put("货位", ""); |
|
|
|
|
tempMap.put("产品明细", map1); |
|
|
|
|
tempMap.put("备货区", ""); |
|
|
|
|
ls.add(tempMap); |
|
|
|
|
a++; |
|
|
|
|
if (!mailNames.toString().contains(distributionStockListEntity.getMarketName())) { |
|
|
|
|
if (!mailNames.toString().isEmpty()) { |
|
|
|
|
mailNames.append(","); |
|
|
|
|
} |
|
|
|
|
mailNames.append(distributionStockListEntity.getMarketName()); |
|
|
|
|
} |
|
|
|
|
if (!consigneeUnit.toString().contains(distributionStockListEntity.getMarketName())) { |
|
|
|
|
if (!consigneeUnit.toString().isEmpty()) { |
|
|
|
|
consigneeUnit.append(","); |
|
|
|
|
} |
|
|
|
|
consigneeUnit.append(distributionStockListEntity.getMarketName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int a = 1; |
|
|
|
|
|
|
|
|
|
// 构建产品明细的表头 -- 这里目前只处理了定制品和有数据的库存品,对于零担 还没有处理
|
|
|
|
|
List<Map<String, Object>> listMapTemp = new ArrayList<>(); |
|
|
|
|
Map<String, Object> m = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
int hejiNum = 0; |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
if (StringUtils.isBlank(distributionParcelListEntity.getThirdProduct())) { |
|
|
|
|
distributionParcelListEntity.setThirdProduct("其它"); |
|
|
|
@ -4952,98 +5002,111 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// 加入到集合中的去 目的是为了获取分类头部
|
|
|
|
|
listMapTemp.add(m); |
|
|
|
|
|
|
|
|
|
if (!distrilbutionBillStockEntities.isEmpty()) { |
|
|
|
|
List<Long> ids = distrilbutionBillStockEntities.stream().map(DistrilbutionBillStockEntity::getStockArticleId).collect(Collectors.toList()); |
|
|
|
|
// 得到所以的订单列表
|
|
|
|
|
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleMapper.selectBatchIds(ids); |
|
|
|
|
for (DistributionStockArticleEntity distributionStockArticleEntity : distributionStockArticleEntities) { |
|
|
|
|
Map<String, Object> tempMap = new HashMap<>(); |
|
|
|
|
// 需要从所有的包件的
|
|
|
|
|
List<DistributionParcelListEntity> ts = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
if (distributionParcelListEntity.getStockArticleId().equals(distributionStockArticleEntity.getId())) { |
|
|
|
|
ts.add(distributionParcelListEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DistributionStockArticleEntity distributionStockArticleEntity : distributionStockArticleEntities) { |
|
|
|
|
|
|
|
|
|
// 需要从所有的包件的
|
|
|
|
|
List<DistributionParcelListEntity> ts = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { |
|
|
|
|
if (distributionParcelListEntity.getStockArticleId().equals(distributionStockArticleEntity.getId())) { |
|
|
|
|
ts.add(distributionParcelListEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!mailNames.toString().contains(distributionStockArticleEntity.getMallName())) { |
|
|
|
|
if (!mailNames.toString().isEmpty()) { |
|
|
|
|
mailNames.append(","); |
|
|
|
|
} |
|
|
|
|
mailNames.append(distributionStockArticleEntity.getMallName()); |
|
|
|
|
} |
|
|
|
|
if (!consigneeUnit.toString().contains(distributionStockArticleEntity.getConsigneeUnit())) { |
|
|
|
|
if (!consigneeUnit.toString().isEmpty()) { |
|
|
|
|
consigneeUnit.append(","); |
|
|
|
|
} |
|
|
|
|
consigneeUnit.append(distributionStockArticleEntity.getConsigneeUnit()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!mailNames.toString().contains(distributionStockArticleEntity.getMallName())) { |
|
|
|
|
if (!mailNames.toString().isEmpty()) { |
|
|
|
|
mailNames.append(","); |
|
|
|
|
} |
|
|
|
|
mailNames.append(distributionStockArticleEntity.getMallName()); |
|
|
|
|
} |
|
|
|
|
if (!consigneeUnit.toString().contains(distributionStockArticleEntity.getConsigneeUnit())) { |
|
|
|
|
if (!consigneeUnit.toString().isEmpty()) { |
|
|
|
|
consigneeUnit.append(","); |
|
|
|
|
} |
|
|
|
|
consigneeUnit.append(distributionStockArticleEntity.getConsigneeUnit()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, Object> tempMap = new HashMap<>(); |
|
|
|
|
tempMap.put("序号", a); |
|
|
|
|
tempMap.put("运单号", distributionStockArticleEntity.getWaybillNumber()); |
|
|
|
|
tempMap.put("合同号", distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
String materialNameStr = buildMaterialNameStr(distributionParcelListEntities); |
|
|
|
|
tempMap.put("物料名称", materialNameStr); |
|
|
|
|
|
|
|
|
|
tempMap.put("序号", a); |
|
|
|
|
tempMap.put("运单号", distributionStockArticleEntity.getWaybillNumber()); |
|
|
|
|
tempMap.put("合同号", distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
String materialNameStr = buildMaterialNameStr(distributionParcelListEntities); |
|
|
|
|
tempMap.put("物料名称", materialNameStr); |
|
|
|
|
|
|
|
|
|
// 构建产品明细 --对于每一个订单
|
|
|
|
|
buildProductDetail(tempMap, m, ts); |
|
|
|
|
|
|
|
|
|
// 构建产品明细 --对于每一个订单
|
|
|
|
|
buildProductDetail(tempMap, m, ts); |
|
|
|
|
Map<String, Object> os = (Map<String, Object>) tempMap.get("产品明细"); |
|
|
|
|
|
|
|
|
|
Map<String, Object> os = (Map<String, Object>) tempMap.get("产品明细"); |
|
|
|
|
Set<String> strings = os.keySet(); |
|
|
|
|
int sumNum = 0; |
|
|
|
|
for (String string : strings) { |
|
|
|
|
Object o = os.get(string); |
|
|
|
|
sumNum += (o != null) ? (int) o : 0; |
|
|
|
|
} |
|
|
|
|
tempMap.put("小计", sumNum); |
|
|
|
|
hejiNum += sumNum; |
|
|
|
|
// 查询货物货位
|
|
|
|
|
|
|
|
|
|
Set<String> strings = os.keySet(); |
|
|
|
|
int sumNum = 0; |
|
|
|
|
for (String string : strings) { |
|
|
|
|
Object o = os.get(string); |
|
|
|
|
sumNum += (o != null) ? (int) o : 0; |
|
|
|
|
} |
|
|
|
|
tempMap.put("小计", sumNum); |
|
|
|
|
hejiNum += sumNum; |
|
|
|
|
// 查询货物货位
|
|
|
|
|
//通过订单id和预约id查询对应包件的库位信息
|
|
|
|
|
List<String> orderPackageCodes = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getOrderPackageCode) // 获取每个对象的orderPackageCode
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的库位信息
|
|
|
|
|
List<String> orderPackageCodes = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getOrderPackageCode) // 获取每个对象的orderPackageCode
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<Long> orderPackageIds = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getId) // 获取每个对象的包件ID
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(orderPackageCodes)) { |
|
|
|
|
List<String> allocationStrList = distributionParcelListMapper.selectAllocationInforByOrderPackageCode(orderPackageCodes, distrilbutionBillLadingEntity.getWarehouseId()); |
|
|
|
|
String allocationStr = StringUtils.join(allocationStrList, ","); |
|
|
|
|
tempMap.put("货位", allocationStr); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Long> orderPackageIds = ts.stream() |
|
|
|
|
.map(DistributionParcelListEntity::getId) // 获取每个对象的包件ID
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
if (Func.isNotEmpty(orderPackageCodes)) { |
|
|
|
|
List<String> allocationStrList = distributionParcelListMapper.selectAllocationInforByOrderPackageCode(orderPackageCodes, distrilbutionBillLadingEntity.getWarehouseId()); |
|
|
|
|
String allocationStr = StringUtils.join(allocationStrList, ","); |
|
|
|
|
tempMap.put("货位", allocationStr); |
|
|
|
|
} |
|
|
|
|
//通过订单id和预约id查询对应包件的备货区信息
|
|
|
|
|
LambdaQueryWrapper<DistributionStockEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.in(DistributionStockEntity::getParcelListId, orderPackageIds); |
|
|
|
|
List<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper); |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的备货区信息
|
|
|
|
|
LambdaQueryWrapper<DistributionStockEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) |
|
|
|
|
.in(DistributionStockEntity::getParcelListId, orderPackageIds); |
|
|
|
|
List<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper); |
|
|
|
|
Set<String> stockupAreaStrList = distributionStockEntities.stream().map(DistributionStockEntity::getStockupArea).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
Set<String> stockupAreaStrList = distributionStockEntities.stream().map(DistributionStockEntity::getStockupArea).collect(Collectors.toSet()); |
|
|
|
|
String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); |
|
|
|
|
tempMap.put("备货区", stockupAreaStr); |
|
|
|
|
|
|
|
|
|
String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); |
|
|
|
|
tempMap.put("备货区", stockupAreaStr); |
|
|
|
|
|
|
|
|
|
ls.add(tempMap); |
|
|
|
|
a++; |
|
|
|
|
|
|
|
|
|
ls.add(tempMap); |
|
|
|
|
a++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("收货单单位", consigneeUnit.toString()); |
|
|
|
|
map.put("商场名称", mailNames.toString()); |
|
|
|
|
|
|
|
|
|
map.put("明细", ls); |
|
|
|
|
Map<String, Object> m1 = new HashMap<>(); |
|
|
|
|
m1.put("产品明细", m); |
|
|
|
|
if (!m.isEmpty()) { |
|
|
|
|
m1.put("产品明细", m); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
m1.put("合计数量", hejiNum); |
|
|
|
|
map.put("合计", m1); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建分类明细 |
|
|
|
|
* |
|
|
|
|