|
@@ -9,10 +9,7 @@ import com.lframework.starter.web.core.utils.*; |
|
@@ -9,10 +9,7 @@ import com.lframework.starter.web.core.utils.*; |
|
9
|
import com.lframework.xingyun.basedata.entity.Workshop;
|
9
|
import com.lframework.xingyun.basedata.entity.Workshop;
|
|
10
|
import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
|
10
|
import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
|
|
11
|
import com.lframework.xingyun.basedata.vo.workshop.QueryWorkshopVo;
|
11
|
import com.lframework.xingyun.basedata.vo.workshop.QueryWorkshopVo;
|
|
12
|
-import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
|
|
|
|
13
|
-import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
|
|
|
|
14
|
-import com.lframework.xingyun.sc.entity.ShipmentsPlan;
|
|
|
|
15
|
-import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail;
|
12
|
+import com.lframework.xingyun.sc.entity.*;
|
|
16
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
13
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
|
17
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
14
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
|
18
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
15
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
|
@@ -23,6 +20,8 @@ import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
|
@@ -23,6 +20,8 @@ import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
|
23
|
import com.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper;
|
20
|
import com.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper;
|
|
24
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
|
21
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
|
|
25
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
|
22
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
|
|
|
|
23
|
+import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
|
|
|
|
24
|
+import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
|
|
26
|
import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
|
25
|
import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
|
|
27
|
import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService;
|
26
|
import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService;
|
|
28
|
import com.lframework.xingyun.sc.utils.CommonUtil;
|
27
|
import com.lframework.xingyun.sc.utils.CommonUtil;
|
|
@@ -54,6 +53,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -54,6 +53,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
54
|
private WorkshopService workshopService;
|
53
|
private WorkshopService workshopService;
|
|
55
|
@Resource
|
54
|
@Resource
|
|
56
|
private PurchaseOrderInfoService purchaseOrderInfoService;
|
55
|
private PurchaseOrderInfoService purchaseOrderInfoService;
|
|
|
|
56
|
+ @Resource
|
|
|
|
57
|
+ private ReplenishmentOrderLineService replenishmentOrderLineService;
|
|
|
|
58
|
+ @Resource
|
|
|
|
59
|
+ private ReplenishmentOrderService replenishmentOrderService;
|
|
57
|
|
60
|
|
|
58
|
|
61
|
|
|
59
|
@Override
|
62
|
@Override
|
|
@@ -147,7 +150,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -147,7 +150,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
147
|
* @param pageIndex 分页页码
|
150
|
* @param pageIndex 分页页码
|
|
148
|
* @param pageSize 分页大小
|
151
|
* @param pageSize 分页大小
|
|
149
|
* @param vo 查询条件
|
152
|
* @param vo 查询条件
|
|
150
|
- * @return PageResult<ShipmentsPlanDetail>
|
153
|
+ * @return PageResult<ShipmentsPlanDetail>
|
|
151
|
*/
|
154
|
*/
|
|
152
|
@Override
|
155
|
@Override
|
|
153
|
public PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) {
|
156
|
public PageResult<ShipmentsPlanDetail> queryCanShipmentsData(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) {
|
|
@@ -170,7 +173,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -170,7 +173,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
170
|
/**
|
173
|
/**
|
|
171
|
* 计划明细拆分
|
174
|
* 计划明细拆分
|
|
172
|
*
|
175
|
*
|
|
173
|
- * @param vo 条件
|
176
|
+ * @param vo 条件
|
|
174
|
*/
|
177
|
*/
|
|
175
|
@Override
|
178
|
@Override
|
|
176
|
public void planDetailSplit(ShipmentsPlanDetailSplitVo vo) {
|
179
|
public void planDetailSplit(ShipmentsPlanDetailSplitVo vo) {
|
|
@@ -233,6 +236,18 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -233,6 +236,18 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
233
|
orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(PurchaseOrderInfo::getId, Function.identity()));
|
236
|
orderInfoMap = orderInfoList.stream().collect(Collectors.toMap(PurchaseOrderInfo::getId, Function.identity()));
|
|
234
|
}
|
237
|
}
|
|
235
|
}
|
238
|
}
|
|
|
|
239
|
+
|
|
|
|
240
|
+ // 获取补货单数据
|
|
|
|
241
|
+ List<ReplenishmentOrderLine> replenishmentOrderLineList = replenishmentOrderLineService.listByShipmentDate(dateList);
|
|
|
|
242
|
+ Map<String, ReplenishmentOrder> replenishmentOrderMap = new HashMap<>();
|
|
|
|
243
|
+ if (CollectionUtils.isNotEmpty(replenishmentOrderLineList)) {
|
|
|
|
244
|
+ List<String> replenishmentOrderIdList = replenishmentOrderLineList.stream().map(ReplenishmentOrderLine::getReplenishmentOrderId).collect(Collectors.toList());
|
|
|
|
245
|
+ List<ReplenishmentOrder> replenishmentOrderList = replenishmentOrderService.listByIds(replenishmentOrderIdList);
|
|
|
|
246
|
+ if (CollectionUtils.isNotEmpty(replenishmentOrderList)) {
|
|
|
|
247
|
+ replenishmentOrderMap = replenishmentOrderList.stream().collect(Collectors.toMap(ReplenishmentOrder::getId, Function.identity()));
|
|
|
|
248
|
+ }
|
|
|
|
249
|
+ }
|
|
|
|
250
|
+
|
|
236
|
for (Workshop workshop : workshopList) {
|
251
|
for (Workshop workshop : workshopList) {
|
|
237
|
// 生成发货计划
|
252
|
// 生成发货计划
|
|
238
|
ShipmentsPlan plan = new ShipmentsPlan();
|
253
|
ShipmentsPlan plan = new ShipmentsPlan();
|
|
@@ -244,8 +259,8 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -244,8 +259,8 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
244
|
|
259
|
|
|
245
|
shipmentsPlanService.getBaseMapper().insert(plan);
|
260
|
shipmentsPlanService.getBaseMapper().insert(plan);
|
|
246
|
// 生成发货计划明细
|
261
|
// 生成发货计划明细
|
|
|
|
262
|
+ List<ShipmentsPlanDetail> planDetails = new ArrayList<>();
|
|
247
|
if (CollectionUtils.isNotEmpty(orderLineList)) {
|
263
|
if (CollectionUtils.isNotEmpty(orderLineList)) {
|
|
248
|
- List<ShipmentsPlanDetail> planDetails = new ArrayList<>();
|
|
|
|
249
|
for (PurchaseOrderLine line : orderLineList) {
|
264
|
for (PurchaseOrderLine line : orderLineList) {
|
|
250
|
ShipmentsPlanDetail detail = new ShipmentsPlanDetail();
|
265
|
ShipmentsPlanDetail detail = new ShipmentsPlanDetail();
|
|
251
|
detail.setId(IdUtil.getId());
|
266
|
detail.setId(IdUtil.getId());
|
|
@@ -269,17 +284,45 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -269,17 +284,45 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
269
|
|
284
|
|
|
270
|
planDetails.add(detail);
|
285
|
planDetails.add(detail);
|
|
271
|
}
|
286
|
}
|
|
272
|
- if (CollectionUtils.isNotEmpty(planDetails)) {
|
|
|
|
273
|
- getBaseMapper().batchAdd(planDetails);
|
287
|
+ }
|
|
|
|
288
|
+ // 补货单生成发货单明细
|
|
|
|
289
|
+ if (CollectionUtils.isNotEmpty(replenishmentOrderLineList)) {
|
|
|
|
290
|
+ for (ReplenishmentOrderLine replenishmentOrderLine : replenishmentOrderLineList) {
|
|
|
|
291
|
+ ReplenishmentOrder replenishmentOrder = replenishmentOrderMap.get(replenishmentOrderLine.getReplenishmentOrderId());
|
|
|
|
292
|
+ if (replenishmentOrder == null) {
|
|
|
|
293
|
+ continue;
|
|
|
|
294
|
+ }
|
|
|
|
295
|
+
|
|
|
|
296
|
+ if (!workshop.getId().equals(replenishmentOrder.getWorkshopId())) {
|
|
|
|
297
|
+ continue;
|
|
|
|
298
|
+ }
|
|
|
|
299
|
+
|
|
|
|
300
|
+ ShipmentsPlanDetail detail = new ShipmentsPlanDetail();
|
|
|
|
301
|
+ detail.setId(IdUtil.getId());
|
|
|
|
302
|
+ detail.setPlanId(plan.getId());
|
|
|
|
303
|
+ detail.setOrderId(replenishmentOrder.getId());
|
|
|
|
304
|
+ detail.setOrderSpecId(replenishmentOrderLine.getId());
|
|
|
|
305
|
+ detail.setShipmentsDate(replenishmentOrderLine.getConfirmedDeliveryDate());
|
|
|
|
306
|
+ detail.setPreShipments(afTomorrow.equals(replenishmentOrderLine.getConfirmedDeliveryDate()));
|
|
|
|
307
|
+ detail.setDelFlag(Boolean.FALSE);
|
|
|
|
308
|
+
|
|
|
|
309
|
+ detail.setCreateById("1");
|
|
|
|
310
|
+ detail.setUpdateById("1");
|
|
|
|
311
|
+
|
|
|
|
312
|
+ planDetails.add(detail);
|
|
274
|
}
|
313
|
}
|
|
275
|
}
|
314
|
}
|
|
|
|
315
|
+
|
|
|
|
316
|
+ if (CollectionUtils.isNotEmpty(planDetails)) {
|
|
|
|
317
|
+ getBaseMapper().batchAdd(planDetails);
|
|
|
|
318
|
+ }
|
|
276
|
}
|
319
|
}
|
|
277
|
}
|
320
|
}
|
|
278
|
|
321
|
|
|
279
|
/**
|
322
|
/**
|
|
280
|
* 批量删除
|
323
|
* 批量删除
|
|
281
|
*
|
324
|
*
|
|
282
|
- * @param ids 主键ID集合
|
325
|
+ * @param ids 主键ID集合
|
|
283
|
*/
|
326
|
*/
|
|
284
|
@Override
|
327
|
@Override
|
|
285
|
public void batchDelete(List<String> ids) {
|
328
|
public void batchDelete(List<String> ids) {
|
|
@@ -331,10 +374,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
@@ -331,10 +374,10 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
|
331
|
/**
|
374
|
/**
|
|
332
|
* 封装发货计划明细数据
|
375
|
* 封装发货计划明细数据
|
|
333
|
*
|
376
|
*
|
|
334
|
- * @param quantity 数量
|
|
|
|
335
|
- * @param detail 原数据
|
|
|
|
336
|
- * @param userId 人员ID
|
|
|
|
337
|
- * @return ShipmentsPlanDetail
|
377
|
+ * @param quantity 数量
|
|
|
|
378
|
+ * @param detail 原数据
|
|
|
|
379
|
+ * @param userId 人员ID
|
|
|
|
380
|
+ * @return ShipmentsPlanDetail
|
|
338
|
*/
|
381
|
*/
|
|
339
|
private static ShipmentsPlanDetail getShipmentsPlanDetail(BigDecimal quantity, ShipmentsPlanDetail detail, String userId) {
|
382
|
private static ShipmentsPlanDetail getShipmentsPlanDetail(BigDecimal quantity, ShipmentsPlanDetail detail, String userId) {
|
|
340
|
ShipmentsPlanDetail data = new ShipmentsPlanDetail();
|
383
|
ShipmentsPlanDetail data = new ShipmentsPlanDetail();
|