Commit afe422ce6b87a7401dd98a274b829f8e2c3b4f14

Authored by yeqianyong
1 parent dd45f888

楚江erp:查询可以撤销/补货/变更列表增加实发数据

... ... @@ -24,6 +24,7 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
24 24 import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService;
25 25 import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService;
26 26 import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService;
  27 +import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
27 28 import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService;
28 29 import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService;
29 30 import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService;
... ... @@ -36,6 +37,7 @@ import io.swagger.annotations.Api;
36 37 import io.swagger.annotations.ApiOperation;
37 38
38 39 import java.util.*;
  40 +import java.util.function.Function;
39 41 import java.util.stream.Collectors;
40 42 import javax.annotation.Resource;
41 43 import javax.validation.Valid;
... ... @@ -87,6 +89,8 @@ public class ScSelectorController extends DefaultBaseController {
87 89 private SysUserDeptService sysUserDeptService;
88 90 @Resource
89 91 private SysDeptService sysDeptService;
  92 + @Resource
  93 + private ShipmentsPlanDetailService shipmentsPlanDetailService;
90 94
91 95
92 96 /**
... ... @@ -321,17 +325,36 @@ public class ScSelectorController extends DefaultBaseController {
321 325 if (CollectionUtils.isEmpty(orderLineList)) {
322 326 return InvokeResultBuilder.success(result);
323 327 }
  328 + List<String> orderSpecIds = new ArrayList<>();
324 329 Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>();
325 330 for (PurchaseOrderLine orderLine : orderLineList) {
326 331 String orderId = orderLine.getPurchaseOrderId();
327 332 List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>());
328 333 list.add(orderLine);
  334 +
  335 + orderSpecIds.add(orderLine.getId());
  336 + }
  337 + // 获取发货明细数据
  338 + Map<String, ShipmentsPlanDetail> shipmentsDetailMap = new HashMap<>();
  339 + List<ShipmentsPlanDetail> shipmentsDetails = shipmentsPlanDetailService.listBySpecIds(orderSpecIds);
  340 + if (CollectionUtils.isNotEmpty(shipmentsDetails)) {
  341 + shipmentsDetailMap = shipmentsDetails.stream().collect(Collectors.toMap(ShipmentsPlanDetail::getOrderSpecId
  342 + , Function.identity(), (v1, v2) -> v1));
329 343 }
330 344 for (GetPurchaseOrderInfoBo orderInfoBo : result) {
331 345 String orderId = orderInfoBo.getId();
332 346 List<PurchaseOrderLine> lineList = orderLineMap.get(orderId);
333 347 //生产人员不展示价格
334 348 processPrice(lineList);
  349 + // 实发数
  350 + if (CollectionUtils.isNotEmpty(lineList)) {
  351 + for (PurchaseOrderLine orderLine : lineList) {
  352 + ShipmentsPlanDetail detail = shipmentsDetailMap.get(orderLine.getId());
  353 + if (detail != null) {
  354 + orderLine.setActualShipmentQuantity(detail.getActualShipmentQuantity());
  355 + }
  356 + }
  357 + }
335 358 orderInfoBo.setPurchaseOrderLineList(lineList);
336 359 }
337 360 return InvokeResultBuilder.success(result);
... ...
... ... @@ -105,6 +105,12 @@ public class PurchaseOrderLine extends BaseEntity implements BaseDto {
105 105 private BigDecimal quantity;
106 106
107 107 /**
  108 + * 实发数
  109 + */
  110 + @TableField(exist = false)
  111 + private Double actualShipmentQuantity;
  112 +
  113 + /**
108 114 * 销售价格
109 115 */
110 116 private BigDecimal salesPrice;
... ...
... ... @@ -345,6 +345,19 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
345 345 }
346 346 }
347 347
  348 + @Override
  349 + public List<ShipmentsPlanDetail> listBySpecIds(List<String> specIds) {
  350 + if (CollectionUtils.isEmpty(specIds)) {
  351 + return Collections.emptyList();
  352 + }
  353 + LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class);
  354 + queryWrapper.in(ShipmentsPlanDetail::getOrderSpecId, specIds)
  355 + .eq(ShipmentsPlanDetail::getDelFlag, Boolean.FALSE)
  356 + .eq(ShipmentsPlanDetail::getPreShipments, Boolean.FALSE);
  357 +
  358 + return getBaseMapper().selectList(queryWrapper);
  359 + }
  360 +
348 361
349 362 /**
350 363 * 封装发货计划明细数据
... ...
... ... @@ -113,4 +113,12 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD
113 113 * @param planId 计划ID
114 114 */
115 115 void completed(String planId);
  116 +
  117 + /**
  118 + * 根据订货单规格ID批量查询
  119 + *
  120 + * @param specIds 规格ID集合
  121 + * @return List<ShipmentsPlanDetail>
  122 + */
  123 + List<ShipmentsPlanDetail> listBySpecIds(List<String> specIds);
116 124 }
... ...