skyouc
2 天以前 1068673dcf41cdf7a7a06a26aaeb5652d734eb2d
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReportMsgServiceImpl.java
@@ -382,44 +382,34 @@
                    throw new RuntimeException(e);
                }
            } else if (order.getType().equals(OrderType.ORDER_OUT.type)){
                List<Stock> stocks = stockService.list(new LambdaQueryWrapper<Stock>().eq(Stock::getSourceCode, order.getCode()));
                if (stocks.isEmpty()) {
                    throw new CoolException("出庫歷史不存在!!");
                List<StockItem> stockItems = stockItemService.list(new LambdaQueryWrapper<StockItem>().eq(StockItem::getSourceItemId, orderItem.getId()));
                if (stockItems.isEmpty()) {
                    return;
                }
                String finalNickName = nickName;
                stocks.forEach(stock -> {
                    //筛选当前唯一字段所有出入库信息
                    List<StockItem> stockItems = stockItemService.list(new LambdaQueryWrapper<StockItem>()
                            .eq(StockItem::getStockId, stock.getId()));
                    if (stockItems.isEmpty()) {
                        throw new CoolException("出庫單明細不存在!!");
                    }
                    //获取库存中订单库位
//                Set<Long> longSet = stockItems.stream().map(StockItem::getStockId).collect(Collectors.toSet());
                    stockItems.forEach(items -> {
                stockItems.forEach(stockItem -> {
                        List<ReportDataParam> dataParams = new ArrayList<>();
                        //获取索引内容
                        Map<String, String> fields = FieldsUtils.getFields(items.getFieldsIndex());
                    Map<String, String> fields = FieldsUtils.getFields(stockItem.getFieldsIndex());
                        //设置通用参数
                        param.setWMSNO(order.getCode())
                                .setPONO(order.getPoCode())
                                .setOrderNO(order.getPoCode())
                                .setOrderDate(order.getCreateTime())
                                .setItemCode(items.getMatnrCode())
                            .setItemCode(stockItem.getMatnrCode())
                                .setEditUser(finalNickName)
                                .setEditDate(order.getUpdateTime())
                                .setGoodsNO(fields.get("crushNo"))
                                .setMemoDtl(order.getMemo());
                        if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_DONE_IN.type)) {
                            //采购入库单
                            params.setOrderType("PO_Instock").setAction("Update");
                            //获取指定查询字段CrushNo 票号
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE_RETURN.type)) {
                            //采购退货
                            params.setOrderType("PR_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER_TERANSFER_IN.type)) {
                            //调拔入库单
                            params.setOrderType("Mv_Instock").setAction("Update");
@@ -429,27 +419,27 @@
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PURCHASE.type)) {
                            //生产退料
                            params.setOrderType("WR_Instock").setAction("Update");
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_RETURN_ORDER.type)) {
                            //生产领料
                            params.setOrderType("WO_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_PROD_ADDITION.type)) {
                            //生产补料
                            params.setOrderType("WR_Instock_BL").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_FIX_OUT.type)) {
                            params.setOrderType("WO_Outstock_WR").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type)) {
                            //其它入库单/手动入库单
                            params.setOrderType("In_Instock").setAction("Update");
                            param.setInQty(items.getQty());
                        param.setInQty(stockItem.getAnfme());
                        } else if (order.getWkType().equals(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)) {
                            //其它出库单/手动出库单
                            params.setOrderType("Io_Outstock").setAction("Update");
                            param.setOutQty(items.getQty());
                        param.setOutQty(stockItem.getAnfme());
                        }
                        dataParams.add(param);
@@ -469,7 +459,6 @@
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                    });
                });
            }
        });