|
...
|
...
|
@@ -150,6 +150,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
150
|
150
|
if (plan == null) {
|
|
151
|
151
|
throw new DefaultClientException("发货计划不存在!");
|
|
152
|
152
|
}
|
|
|
153
|
+ vo.setWorkshopId(plan.getWorkshopId());
|
|
153
|
154
|
// 获取已经存在的明细数据
|
|
154
|
155
|
List<String> orderSpecIds = getBaseMapper().getExistsOrderSpecIds(plan.getAfTomoPreShipDate());
|
|
155
|
156
|
if (CollectionUtils.isNotEmpty(orderSpecIds)) {
|
|
...
|
...
|
@@ -223,7 +224,25 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
223
|
224
|
// 获取订货单数据
|
|
224
|
225
|
Map<String, PurchaseOrderInfo> orderInfoMap = new HashMap<>();
|
|
225
|
226
|
if (CollectionUtils.isNotEmpty(orderLineList)) {
|
|
226
|
|
- List<String> orderIds = orderLineList.stream().map(PurchaseOrderLine::getPurchaseOrderId).collect(Collectors.toList());
|
|
|
227
|
+ List<String> orderIds = new ArrayList<>();
|
|
|
228
|
+ List<String> orderSpecIds = new ArrayList<>();
|
|
|
229
|
+ // 获取发货明细
|
|
|
230
|
+ for (PurchaseOrderLine orderLine : orderLineList) {
|
|
|
231
|
+ orderSpecIds.add(orderLine.getId());
|
|
|
232
|
+ String orderId = orderLine.getPurchaseOrderId();
|
|
|
233
|
+ if (StringUtils.isNotBlank(orderId) && !orderIds.contains(orderId)) {
|
|
|
234
|
+ orderIds.add(orderId);
|
|
|
235
|
+ }
|
|
|
236
|
+ }
|
|
|
237
|
+ QueryShipmentsPlanDetailVo detailVo = new QueryShipmentsPlanDetailVo();
|
|
|
238
|
+ detailVo.setOrderSpecIds(orderSpecIds);
|
|
|
239
|
+ detailVo.setCompleted(Boolean.TRUE);
|
|
|
240
|
+ List<ShipmentsPlanDetail> detailList = query(detailVo);
|
|
|
241
|
+ if (CollectionUtils.isNotEmpty(detailList)) {
|
|
|
242
|
+ List<String> orderSpecIdList = detailList.stream().map(ShipmentsPlanDetail::getOrderSpecId).distinct().collect(Collectors.toList());
|
|
|
243
|
+ // 过滤掉已发货的数据
|
|
|
244
|
+ orderLineList.removeIf(next -> orderSpecIdList.contains(next.getId()));
|
|
|
245
|
+ }
|
|
227
|
246
|
List<PurchaseOrderInfo> orderInfoList = purchaseOrderInfoService.listByIds(orderIds);
|
|
228
|
247
|
if (CollectionUtils.isNotEmpty(orderInfoList)) {
|
|
229
|
248
|
orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(PurchaseOrderInfo::getId, Function.identity()));
|
|
...
|
...
|
@@ -252,6 +271,17 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
252
|
271
|
if (orderInfo == null) {
|
|
253
|
272
|
continue;
|
|
254
|
273
|
}
|
|
|
274
|
+ String type = orderInfo.getType();
|
|
|
275
|
+ String examineStatus = orderInfo.getExamineStatus();
|
|
|
276
|
+ String status = orderInfo.getStatus();
|
|
|
277
|
+ String revokeStatus = orderInfo.getRevokeStatus();
|
|
|
278
|
+ String specChangeStatus = orderInfo.getSpecChangeStatus();
|
|
|
279
|
+ // 过滤掉无需发货的数据
|
|
|
280
|
+ if (!"PRODUCTION".equals(type) || !"PASS".equals(examineStatus)
|
|
|
281
|
+ || "SHIPPED".equals(status) || "DELIVERED".equals(status) || "CANCEL".equals(status)
|
|
|
282
|
+ || "UNDOING".equals(revokeStatus) || "IN_PROGRESS".equals(specChangeStatus)) {
|
|
|
283
|
+ continue;
|
|
|
284
|
+ }
|
|
255
|
285
|
String workshopId = orderInfo.getWorkshopId();
|
|
256
|
286
|
if (!workshop.getId().equals(workshopId)) {
|
|
257
|
287
|
continue;
|
...
|
...
|
|