فهرست منبع

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

xieyong 3 هفته پیش
والد
کامیت
bf70fdcc7a

+ 6 - 5
src/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue

@@ -204,9 +204,8 @@
             type: 'selection',
             type: 'selection',
             columnKey: 'selection',
             columnKey: 'selection',
             align: 'center',
             align: 'center',
-            // 不保留勾选:搜索、切换分页/排序后必须清空历史勾选的库存,
-            // reserveSelection 会让 el-table 在数据变化后按 rowKey 恢复勾选,这里必须关闭
-            reserveSelection: false,
+            // 分页切换后保留已勾选的库存,确认时可以一次提交多页选择
+            reserveSelection: true,
             selectable: (row) => {
             selectable: (row) => {
               return this.getAvailableStockCount(row) != 0;
               return this.getAvailableStockCount(row) != 0;
             }
             }
@@ -485,9 +484,11 @@
         this.$refs.table.reload({ pageNum: 1, where: where });
         this.$refs.table.reload({ pageNum: 1, where: where });
       },
       },
 
 
-      /* 表格数据加载完成:分页、排序等表格内部触发的加载同样清空历史勾选 */
+      /* 分页、排序后清除当前行,避免解锁操作误用上一页数据,但保留跨页勾选 */
       handleTableDone() {
       handleTableDone() {
-        this.clearTableSelection();
+        this.currentRow = null;
+        this.current = null;
+        this.radio = '';
       },
       },
 
 
       handleNodeClick(data, node) {
       handleNodeClick(data, node) {

+ 5 - 5
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -1948,10 +1948,12 @@
         });
         });
       },
       },
       //获取订单详情
       //获取订单详情
-      async getpurchaseorderDetail(id) {
+      async getpurchaseorderDetail(id, isEdit = false) {
         this.businessId = id;
         this.businessId = id;
         this.loading = true;
         this.loading = true;
-        const data = await getpurchaseorderDetail(id);
+        const data = isEdit
+          ? await getByIdForEdit(id)
+          : await getpurchaseorderDetail(id);
         this.loading = false;
         this.loading = false;
         data.settlementDate = data.startSettlementDate ? [data.startSettlementDate, data.endSettlementDate] : [];
         data.settlementDate = data.startSettlementDate ? [data.startSettlementDate, data.endSettlementDate] : [];
         this.form = data;
         this.form = data;
@@ -2273,7 +2275,7 @@
           this.form.isGeneratePaymentPlan = +this.isGenReceiptPlan;
           this.form.isGeneratePaymentPlan = +this.isGenReceiptPlan;
         } else {
         } else {
           this.isUpdate = true;
           this.isUpdate = true;
-          await this.getpurchaseorderDetail(row.id);
+          await this.getpurchaseorderDetail(row.id, true);
         }
         }
       },
       },
       getEnterprisePage() {
       getEnterprisePage() {
@@ -2523,8 +2525,6 @@
 
 
           if (this.isUpdate) {
           if (this.isUpdate) {
             try {
             try {
-              // 更新前先拉取最新编辑数据,确保基于最新版本提交
-              await getByIdForEdit(this.form.id || this.businessId);
               const res = await UpdateInformation(commitData);
               const res = await UpdateInformation(commitData);
               this.loading = false;
               this.loading = false;
               this.$message.success('修改成功');
               this.$message.success('修改成功');

+ 50 - 27
src/views/saleManage/saleOrder/components/printTemplateHt.vue

@@ -179,7 +179,7 @@
 
 
 <script>
 <script>
   import { getSaleOrderDetails } from '@/api/saleManage/saleorder';
   import { getSaleOrderDetails } from '@/api/saleManage/saleorder';
-  import { getInfoBySourceBizNoAll } from '@/api/wms';
+  import { getBatchList } from '@/api/wms';
   import { mapGetters } from 'vuex';
   import { mapGetters } from 'vuex';
   import { saveAs } from 'file-saver';
   import { saveAs } from 'file-saver';
   export default {
   export default {
@@ -212,32 +212,37 @@
         const list = await getSaleOrderDetails(id);
         const list = await getSaleOrderDetails(id);
         this.formData = await Promise.all(
         this.formData = await Promise.all(
           list.map(async (wrapperItem) => {
           list.map(async (wrapperItem) => {
-            let outInDetailList = [];
-            try {
-              const outboundList = await getInfoBySourceBizNoAll(wrapperItem.orderNo);
-              outInDetailList = outboundList?.[0]?.outInDetailList || [];
-            } catch (e) {
-              outInDetailList = [];
-            }
-            const productList = (wrapperItem.productList || []).map((item) => {
-              const candidates = outInDetailList.filter(
-                (detail) =>
-                  detail.categoryCode === item.productCode ||
-                  String(detail.categoryId) === String(item.productId)
-              );
-              const outDetail =
-                candidates.find(
-                  (detail) =>
-                    (item.batchNo && detail.batchNo === item.batchNo) ||
-                    (item.systemBatchNo && detail.systemBatchNo === item.systemBatchNo)
-                ) || (candidates.length === 1 ? candidates[0] : {});
-              return {
-                ...item,
-                batchNo: item.batchNo || outDetail.batchNo || '',
-                cuttingLength: item.cuttingLength || outDetail.cuttingLength || '',
-                reelSpecification: item.reelSpecification || outDetail.reelSpecification || ''
-              };
-            });
+            const batchRowsCache = new Map();
+            // 同一批次只查一次 WMS 批次台账,避免明细多时重复请求
+            const getBatchRowsByItem = (item) => {
+              const key = item.batchNo || item.systemBatchNo;
+              if (!key) {
+                return Promise.resolve([]);
+              }
+              if (!batchRowsCache.has(key)) {
+                batchRowsCache.set(key, this.getBatchRows(item));
+              }
+              return batchRowsCache.get(key);
+            };
+            const productList = await Promise.all(
+              (wrapperItem.productList || []).map(async (item) => {
+                const batchRows = await getBatchRowsByItem(item);
+                const candidates = batchRows.filter(
+                  (row) =>
+                    row.categoryCode === item.productCode ||
+                    String(row.categoryId) === String(item.productId)
+                );
+                const batchDetail =
+                  candidates.find((row) => item.batchNo && row.batchNo === item.batchNo) ||
+                  (candidates.length === 1 ? candidates[0] : {});
+                return {
+                  ...item,
+                  batchNo: item.batchNo || batchDetail.batchNo || '',
+                  cuttingLength: item.cuttingLength || '',
+                  reelSpecification: item.reelSpecification || batchDetail.reelSpecification || ''
+                };
+              })
+            );
             return { ...wrapperItem, productList };
             return { ...wrapperItem, productList };
           })
           })
         );
         );
@@ -246,6 +251,24 @@
 
 
         //包装维度
         //包装维度
       },
       },
+
+      // 按物品批次查询 WMS 批次库存台账,返回可匹配的候选行
+      async getBatchRows(item) {
+        if (!item.batchNo && !item.systemBatchNo) {
+          return [];
+        }
+        try {
+          const page = await getBatchList({
+            batchNo: item.batchNo || undefined,
+            systemBatchNo: item.systemBatchNo || undefined,
+            pageNum: 1,
+            size: 100
+          });
+          return page?.list || [];
+        } catch (e) {
+          return [];
+        }
+      },
       close() {
       close() {
         this.QRvisible = false;
         this.QRvisible = false;
       },
       },

+ 50 - 31
src/views/saleManage/saleOrder/components/printTemplateHtBatch.vue

@@ -173,7 +173,7 @@
 
 
 <script>
 <script>
   import { getSaleOrderDetails } from '@/api/saleManage/saleorder';
   import { getSaleOrderDetails } from '@/api/saleManage/saleorder';
-  import { getInfoBySourceBizNoAll } from '@/api/wms';
+  import { getBatchList } from '@/api/wms';
   import { mapGetters } from 'vuex';
   import { mapGetters } from 'vuex';
   import { saveAs } from 'file-saver';
   import { saveAs } from 'file-saver';
   export default {
   export default {
@@ -203,43 +203,62 @@
     methods: {
     methods: {
       async open(id) {
       async open(id) {
         const list = await getSaleOrderDetails(id);
         const list = await getSaleOrderDetails(id);
-        // 逐单查询出库单信息,补充裁剪米段/盘具字段(销售订单明细缺省时)
         this.formData = await Promise.all(
         this.formData = await Promise.all(
           list.map(async (wrapperItem) => {
           list.map(async (wrapperItem) => {
-            let outInDetailList = [];
-            try {
-              const outboundList = await getInfoBySourceBizNoAll(
-                wrapperItem.orderNo
-              );
-              outInDetailList = outboundList?.[0]?.outInDetailList || [];
-            } catch (e) {
-              outInDetailList = [];
-            }
-            const productList = (wrapperItem.productList || []).map((item) => {
-              const candidates = outInDetailList.filter(
-                (detail) =>
-                  detail.categoryCode === item.productCode ||
-                  String(detail.categoryId) === String(item.productId)
-              );
-              const outDetail =
-                candidates.find(
-                  (detail) =>
-                    (item.batchNo && detail.batchNo === item.batchNo) ||
-                    (item.systemBatchNo && detail.systemBatchNo === item.systemBatchNo)
-                ) || (candidates.length === 1 ? candidates[0] : {});
-              return {
-                ...item,
-                batchNo: item.batchNo || outDetail.batchNo || '',
-                cuttingLength: item.cuttingLength || outDetail.cuttingLength || '',
-                reelSpecification:
-                  item.reelSpecification || outDetail.reelSpecification || ''
-              };
-            });
+            const batchRowsCache = new Map();
+            // 同一批次只查一次 WMS 批次台账,避免明细多时重复请求
+            const getBatchRowsByItem = (item) => {
+              const key = item.batchNo || item.systemBatchNo;
+              if (!key) {
+                return Promise.resolve([]);
+              }
+              if (!batchRowsCache.has(key)) {
+                batchRowsCache.set(key, this.getBatchRows(item));
+              }
+              return batchRowsCache.get(key);
+            };
+            const productList = await Promise.all(
+              (wrapperItem.productList || []).map(async (item) => {
+                const batchRows = await getBatchRowsByItem(item);
+                const candidates = batchRows.filter(
+                  (row) =>
+                    row.categoryCode === item.productCode ||
+                    String(row.categoryId) === String(item.productId)
+                );
+                const batchDetail =
+                  candidates.find((row) => item.batchNo && row.batchNo === item.batchNo) ||
+                  (candidates.length === 1 ? candidates[0] : {});
+                return {
+                  ...item,
+                  batchNo: item.batchNo || batchDetail.batchNo || '',
+                  cuttingLength: item.cuttingLength || '',
+                  reelSpecification: item.reelSpecification || batchDetail.reelSpecification || ''
+                };
+              })
+            );
             return { ...wrapperItem, productList };
             return { ...wrapperItem, productList };
           })
           })
         );
         );
         this.QRvisible = true;
         this.QRvisible = true;
       },
       },
+
+      // 按物品批次查询 WMS 批次库存台账,返回可匹配的候选行
+      async getBatchRows(item) {
+        if (!item.batchNo && !item.systemBatchNo) {
+          return [];
+        }
+        try {
+          const page = await getBatchList({
+            batchNo: item.batchNo || undefined,
+            systemBatchNo: item.systemBatchNo || undefined,
+            pageNum: 1,
+            size: 100
+          });
+          return page?.list || [];
+        } catch (e) {
+          return [];
+        }
+      },
       close() {
       close() {
         this.QRvisible = false;
         this.QRvisible = false;
       },
       },