Commit db5f24994bd622b13c9f57deeace333e2be26c0d
Merge remote-tracking branch 'origin/master_0929' into master_0929
Showing
2 changed files
with
56 additions
and
31 deletions
| ... | ... | @@ -6,18 +6,16 @@ import com.lframework.starter.web.core.components.resp.InvokeResult; |
| 6 | 6 | import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; |
| 7 | 7 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 8 | 8 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 9 | +import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderInfoBo; | |
| 9 | 10 | import com.lframework.xingyun.sc.bo.paytype.OrderPayTypeBo; |
| 10 | 11 | import com.lframework.xingyun.sc.bo.purchase.PurchaseOrderSelectorBo; |
| 11 | 12 | import com.lframework.xingyun.sc.bo.purchase.receive.ReceiveSheetSelectorBo; |
| 12 | 13 | import com.lframework.xingyun.sc.bo.stock.adjust.stock.reason.StockAdjustReasonSelectorBo; |
| 13 | 14 | import com.lframework.xingyun.sc.bo.stock.take.plan.TakeStockPlanSelectorBo; |
| 14 | 15 | import com.lframework.xingyun.sc.bo.stock.take.pre.PreTakeStockSheetSelectorBo; |
| 15 | -import com.lframework.xingyun.sc.entity.OrderPayType; | |
| 16 | -import com.lframework.xingyun.sc.entity.PreTakeStockSheet; | |
| 17 | -import com.lframework.xingyun.sc.entity.PurchaseOrder; | |
| 18 | -import com.lframework.xingyun.sc.entity.ReceiveSheet; | |
| 19 | -import com.lframework.xingyun.sc.entity.StockAdjustReason; | |
| 20 | -import com.lframework.xingyun.sc.entity.TakeStockPlan; | |
| 16 | +import com.lframework.xingyun.sc.entity.*; | |
| 17 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 18 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | |
| 21 | 19 | import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService; |
| 22 | 20 | import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService; |
| 23 | 21 | import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService; |
| ... | ... | @@ -31,11 +29,14 @@ import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo; |
| 31 | 29 | import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo; |
| 32 | 30 | import io.swagger.annotations.Api; |
| 33 | 31 | import io.swagger.annotations.ApiOperation; |
| 34 | -import java.util.List; | |
| 35 | -import java.util.Objects; | |
| 32 | + | |
| 33 | +import java.util.*; | |
| 36 | 34 | import java.util.stream.Collectors; |
| 35 | +import javax.annotation.Resource; | |
| 37 | 36 | import javax.validation.Valid; |
| 38 | 37 | import javax.validation.constraints.NotBlank; |
| 38 | + | |
| 39 | +import org.apache.commons.collections.CollectionUtils; | |
| 39 | 40 | import org.springframework.beans.factory.annotation.Autowired; |
| 40 | 41 | import org.springframework.validation.annotation.Validated; |
| 41 | 42 | import org.springframework.web.bind.annotation.GetMapping; |
| ... | ... | @@ -73,6 +74,12 @@ public class ScSelectorController extends DefaultBaseController { |
| 73 | 74 | @Autowired |
| 74 | 75 | private StockAdjustReasonService stockAdjustReasonService; |
| 75 | 76 | |
| 77 | + @Resource | |
| 78 | + private PurchaseOrderInfoService orderInfoService; | |
| 79 | + @Resource | |
| 80 | + private PurchaseOrderLineService orderLineService; | |
| 81 | + | |
| 82 | + | |
| 76 | 83 | /** |
| 77 | 84 | * 采购订单 |
| 78 | 85 | */ |
| ... | ... | @@ -278,4 +285,44 @@ public class ScSelectorController extends DefaultBaseController { |
| 278 | 285 | .collect(Collectors.toList()); |
| 279 | 286 | return InvokeResultBuilder.success(results); |
| 280 | 287 | } |
| 288 | + | |
| 289 | + /** | |
| 290 | + * 根据ID加载订货单数据 | |
| 291 | + */ | |
| 292 | + @ApiOperation("根据ID加载订货单数据") | |
| 293 | + @PostMapping("/order/load") | |
| 294 | + public InvokeResult<List<GetPurchaseOrderInfoBo>> loadOrderInfo(@RequestBody(required = false) List<String> ids) { | |
| 295 | + if (CollectionUtil.isEmpty(ids)) { | |
| 296 | + return InvokeResultBuilder.success(CollectionUtil.emptyList()); | |
| 297 | + } | |
| 298 | + List<PurchaseOrderInfo> orderInfoList = orderInfoService.listByIds(ids); | |
| 299 | + if (CollectionUtils.isEmpty(orderInfoList)) { | |
| 300 | + return new InvokeResult<>(); | |
| 301 | + } | |
| 302 | + List<GetPurchaseOrderInfoBo> result = new ArrayList<>(); | |
| 303 | + List<String> orderIds = new ArrayList<>(); | |
| 304 | + for (PurchaseOrderInfo orderInfo : orderInfoList) { | |
| 305 | + GetPurchaseOrderInfoBo orderInfoBo = new GetPurchaseOrderInfoBo(orderInfo); | |
| 306 | + result.add(orderInfoBo); | |
| 307 | + | |
| 308 | + orderIds.add(orderInfo.getId()); | |
| 309 | + } | |
| 310 | + // 获取物料行数据 | |
| 311 | + List<PurchaseOrderLine> orderLineList = orderLineService.listByOrderIds(orderIds); | |
| 312 | + if (CollectionUtils.isEmpty(orderLineList)) { | |
| 313 | + return InvokeResultBuilder.success(result); | |
| 314 | + } | |
| 315 | + Map<String, List<PurchaseOrderLine>> orderLineMap = new HashMap<>(); | |
| 316 | + for (PurchaseOrderLine orderLine : orderLineList) { | |
| 317 | + String orderId = orderLine.getPurchaseOrderId(); | |
| 318 | + List<PurchaseOrderLine> list = orderLineMap.computeIfAbsent(orderId, k -> new ArrayList<>()); | |
| 319 | + list.add(orderLine); | |
| 320 | + } | |
| 321 | + for (GetPurchaseOrderInfoBo orderInfoBo : result) { | |
| 322 | + String orderId = orderInfoBo.getId(); | |
| 323 | + List<PurchaseOrderLine> lineList = orderLineMap.get(orderId); | |
| 324 | + orderInfoBo.setPurchaseOrderLineList(lineList); | |
| 325 | + } | |
| 326 | + return InvokeResultBuilder.success(result); | |
| 327 | + } | |
| 281 | 328 | } | ... | ... |
| ... | ... | @@ -103,29 +103,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 103 | 103 | |
| 104 | 104 | @Override |
| 105 | 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 | - } | |
| 127 | - | |
| 128 | - return orderInfoList; | |
| 106 | + return getBaseMapper().queryCanRevokeOrChangeList(vo); | |
| 129 | 107 | } |
| 130 | 108 | |
| 131 | 109 | @Override | ... | ... |