|
...
|
...
|
@@ -23,6 +23,7 @@ import com.lframework.starter.common.utils.Assert; |
|
23
|
23
|
import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
|
|
24
|
24
|
import com.lframework.xingyun.sc.entity.CustomerCredit;
|
|
25
|
25
|
import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
|
|
|
26
|
+import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
|
|
26
|
27
|
import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;
|
|
27
|
28
|
import com.lframework.xingyun.sc.mappers.PurchaseOrderInfoMapper;
|
|
28
|
29
|
import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
|
|
...
|
...
|
@@ -36,7 +37,10 @@ import org.springframework.transaction.annotation.Transactional; |
|
36
|
37
|
import org.springframework.stereotype.Service;
|
|
37
|
38
|
|
|
38
|
39
|
import javax.annotation.Resource;
|
|
|
40
|
+import java.util.ArrayList;
|
|
|
41
|
+import java.util.HashMap;
|
|
39
|
42
|
import java.util.List;
|
|
|
43
|
+import java.util.Map;
|
|
40
|
44
|
import java.util.stream.Collectors;
|
|
41
|
45
|
|
|
42
|
46
|
@Service
|
|
...
|
...
|
@@ -99,8 +103,29 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
|
99
|
103
|
|
|
100
|
104
|
@Override
|
|
101
|
105
|
public List<PurchaseOrderInfo> queryCanRevokeOrChangeList(QueryPurchaseOrderInfoVo vo) {
|
|
|
106
|
+ List<PurchaseOrderInfo> orderInfoList = getBaseMapper().queryCanRevokeOrChangeList(vo);
|
|
|
107
|
+ if (CollectionUtils.isEmpty(orderInfoList)) {
|
|
|
108
|
+ return new ArrayList<>();
|
|
|
109
|
+ }
|
|
|
110
|
+ List<String> orderIds = orderInfoList.stream().map(PurchaseOrderInfo::getId).distinct().collect(Collectors.toList());
|
|
|
111
|
+ // 获取物料行数据
|
|
|
112
|
+ List<PurchaseOrderLine> orderLineList = purchaseOrderLineService.listByOrderIds(orderIds);
|
|
|
113
|
+ if (CollectionUtils.isEmpty(orderLineList)) {
|
|
|
114
|
+ return orderInfoList;
|
|
|
115
|
+ }
|
|
|
116
|
+ Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>();
|
|
|
117
|
+ for (PurchaseOrderLine orderLine : orderLineList) {
|
|
|
118
|
+ String orderId = orderLine.getPurchaseOrderId();
|
|
|
119
|
+ List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>());
|
|
|
120
|
+ list.add(orderLine);
|
|
|
121
|
+ }
|
|
|
122
|
+ for (PurchaseOrderInfo purchaseOrderInfo : orderInfoList) {
|
|
|
123
|
+ String orderId = purchaseOrderInfo.getId();
|
|
|
124
|
+ List<PurchaseOrderLine> lineList = orderLineMap.get(orderId);
|
|
|
125
|
+ purchaseOrderInfo.setPurchaseOrderLineList(lineList);
|
|
|
126
|
+ }
|
|
102
|
127
|
|
|
103
|
|
- return getBaseMapper().queryCanRevokeOrChangeList(vo);
|
|
|
128
|
+ return orderInfoList;
|
|
104
|
129
|
}
|
|
105
|
130
|
|
|
106
|
131
|
@Override
|
...
|
...
|
|