Przeglądaj źródła

fix:修改发货单选择批次号没有修改systemBatchNo字段的问题

mlchen 1 tydzień temu
rodzic
commit
6036e13ff3

+ 8 - 0
src/BIZComponents/inventoryTable.vue

@@ -1175,6 +1175,14 @@ export default {
           align: 'center',
           isNone: this.quoteType === 2
         },
+        {
+          minWidth: 180,
+          prop: 'systemBatchNo',
+          label: '系统内部批次号',
+          align: 'center',
+          isNone: this.quoteType === 2,
+          formatter: (row) => row.systemBatchNo || '-'
+        },
         {
           width: 120,
           prop: 'warehouseName',

+ 11 - 0
src/BIZComponents/selectStockLedger/item-search.vue

@@ -115,6 +115,15 @@
             ></el-input>
           </el-form-item>
         </el-col>  
+        <el-col :span="6" v-if="params.dimension == 2">
+          <el-form-item label="系统批次:" prop="systemBatchNo">
+            <el-input
+              clearable
+              v-model.trim="params.systemBatchNo"
+              placeholder="请输入完整系统内部批次号"
+            ></el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="6">
           <el-form-item label="关键字:" prop="keyWord">
             <el-input
@@ -157,6 +166,7 @@
       // 默认表单数据
       const defaultParams = {
         batchNo: '',
+        systemBatchNo: '',
         informationName: '',
         warehouseId: '',
         manualBatchNo: '',
@@ -175,6 +185,7 @@
         colorKey: '',
       };
       return {
+        defaultParams,
         // 表单数据
         params: { ...defaultParams },
 

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

@@ -205,6 +205,18 @@
           }:{
               width:1
           },
+          this.dimension == "2"
+            ? {
+                prop: 'systemBatchNo',
+                label: '系统内部批次号',
+                align: 'center',
+                minWidth: 180,
+                showOverflowTooltip: true,
+                formatter: (row) => row.systemBatchNo || '-'
+              }
+            : {
+                width: 1
+              },
           {
             prop: 'categoryModel',
             label: '型号',
@@ -417,25 +429,49 @@
         this.radio = '';
       },
 
+      isSameStockRecord(source, target) {
+        if (source.batchStockId && target.id) {
+          return source.batchStockId == target.id;
+        }
+        const sourceProductId = source.productId || source.categoryId;
+        const targetProductId = target.categoryId || target.productId;
+        const sourceProductCode =
+          source.productCode || source.categoryCode || source.code;
+        const targetProductCode =
+          target.categoryCode || target.productCode || target.code;
+        const sameProduct =
+          sourceProductId && targetProductId
+            ? sourceProductId == targetProductId
+            : sourceProductCode == targetProductCode;
+        const sameWarehouse =
+          !source.warehouseId ||
+          !target.warehouseId ||
+          source.warehouseId == target.warehouseId;
+        return (
+          sameProduct &&
+          sameWarehouse &&
+          source.batchNo == target.batchNo &&
+          (source.systemBatchNo || '') == (target.systemBatchNo || '')
+        );
+      },
+
       async selected() {
         if (!this.current && !this.selection.length) {
           return this.$message.warning('请至少选择一条数据');
         }
         if (this.currentIndex != -1) {
           if (
-            this.data
-              .map((item) => item.productCode)
-              .includes(this.current.code)
+            this.data.some((item) => this.isSameStockRecord(item, this.current))
           ) {
-            return this.$message.error('选择的物品已经存在列表了');
+            return this.$message.error('选择的库存记录已经存在列表了');
           }
         } else {
           if (
             this.selection.some((item) =>
-              this.data.some((i) => i.productCode == item.code)
+              this.data.some((source) => this.isSameStockRecord(source, item))
             )
           ) {
-            return this.$message.error('选择的物品已经存在列表了');
+            return this.$message.error('选择的库存记录已经存在列表了');
           }
         }
         let list = this.currentIndex == -1 ? this.selection : [this.current];
@@ -476,8 +512,11 @@
           //item.weightUnit = item.weightUnit;
           // item.warehouseNum = item.measureQuantity;
           item.productId = item.categoryId;
+          item.batchStockId = item.id;
           item.id = '';
           item.batchNo = this.dimension != 1 ? item.batchNo : '';
+          item.systemBatchNo =
+            this.dimension != 1 ? item.systemBatchNo || '' : '';
 
           // item.specification = item.specification;
         });

+ 4 - 1
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -1035,6 +1035,7 @@
                 v.productCode == v2.productCode &&
                 v.taskId == v2.taskId &&
                 v.batchNo == v2.batchNo &&
+                (v.systemBatchNo || '') == (v2.systemBatchNo || '') &&
                 v.colorKey == v2.colorKey &&
                 v.provenance?.join() == v2.provenance?.join() &&
                 v.modelKey == v2.modelKey &&
@@ -1047,7 +1048,9 @@
           });
 
           if (is) {
-            this.$message.error('同产品,工序、批次号、颜色不能完全一致!');
+            this.$message.error(
+              '同产品、工序、外部批次号、系统内部批次号和颜色不能完全一致!'
+            );
             return;
           }
 

+ 12 - 1
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -671,6 +671,13 @@
             slot: 'batchStockId',
             align: 'center'
           },
+          {
+            minWidth: 180,
+            prop: 'systemBatchNo',
+            label: '系统内部批次号',
+            align: 'center',
+            formatter: (row) => row.systemBatchNo || '-'
+          },
           {
             width: 160,
             prop: 'productBrand',
@@ -1136,6 +1143,7 @@
         if (isReset) {
           this.$set(this.form.datasource[index], 'batchStockId', '');
           this.$set(this.form.datasource[index], 'batchNo', '');
+          this.$set(this.form.datasource[index], 'systemBatchNo', '');
         }
       },
 
@@ -1652,8 +1660,11 @@
           let tempBatchNoList = templist1?.list || [];
           console.log('888~~~~', index, item.batchNo);
 
+          // 新数据按系统批次精确匹配,历史数据保持按外部批次号兼容匹配
           const batchNoObj = tempBatchNoList.find(
-            (i) => i.batchNo == item.batchNo
+            (i) =>
+              i.batchNo == item.batchNo &&
+              (!item.systemBatchNo || i.systemBatchNo == item.systemBatchNo)
           );
 
           if (batchNoObj) {

+ 7 - 0
src/views/saleManage/saleOrder/invoice/components/inventoryTableDetails.vue

@@ -115,6 +115,13 @@
             slot: 'batchNo',
             align: 'center'
           },
+          {
+            minWidth: 180,
+            prop: 'systemBatchNo',
+            label: '系统内部批次号',
+            align: 'center',
+            formatter: (row) => row.systemBatchNo || '-'
+          },
           {
             width: 160,
             prop: 'productBrand',

+ 7 - 0
src/views/saleManage/saleOrder/invoice/components/replaceTable.vue

@@ -618,6 +618,13 @@
             slot: 'batchNo',
             align: 'center'
           },
+          {
+            minWidth: 180,
+            prop: 'systemBatchNo',
+            label: '系统内部批次号',
+            align: 'center',
+            formatter: (row) => row.systemBatchNo || '-'
+          },
           {
             width: 160,
             prop: 'productBrand',

+ 45 - 6
src/views/saleManage/saleOrder/invoice/components/selectStockLedger/selectStockLedgerDialog.vue

@@ -176,6 +176,18 @@
           }:{
               width:1
           },
+          this.dimension == "2"
+            ? {
+                prop: 'systemBatchNo',
+                label: '系统内部批次号',
+                align: 'center',
+                minWidth: 180,
+                showOverflowTooltip: true,
+                formatter: (row) => row.systemBatchNo || '-'
+              }
+            : {
+                width: 1
+              },
           {
             prop: 'categoryModel',
             label: '型号',
@@ -322,25 +334,49 @@
         this.radio = '';
       },
 
+      isSameStockRecord(source, target) {
+        if (source.batchStockId && target.id) {
+          return source.batchStockId == target.id;
+        }
+        const sourceProductId = source.productId || source.categoryId;
+        const targetProductId = target.categoryId || target.productId;
+        const sourceProductCode =
+          source.productCode || source.categoryCode || source.code;
+        const targetProductCode =
+          target.categoryCode || target.productCode || target.code;
+        const sameProduct =
+          sourceProductId && targetProductId
+            ? sourceProductId == targetProductId
+            : sourceProductCode == targetProductCode;
+        const sameWarehouse =
+          !source.warehouseId ||
+          !target.warehouseId ||
+          source.warehouseId == target.warehouseId;
+        return (
+          sameProduct &&
+          sameWarehouse &&
+          source.batchNo == target.batchNo &&
+          (source.systemBatchNo || '') == (target.systemBatchNo || '')
+        );
+      },
+
       async selected() {
         if (!this.current && !this.selection.length) {
           return this.$message.warning('请至少选择一条数据');
         }
         if (this.currentIndex != -1) {
           if (
-            this.data
-              .map((item) => item.productCode)
-              .includes(this.current.code)
+            this.data.some((item) => this.isSameStockRecord(item, this.current))
           ) {
-            return this.$message.error('选择的物品已经存在列表了');
+            return this.$message.error('选择的库存记录已经存在列表了');
           }
         } else {
           if (
             this.selection.some((item) =>
-              this.data.some((i) => i.productCode == item.code)
+              this.data.some((source) => this.isSameStockRecord(source, item))
             )
           ) {
-            return this.$message.error('选择的物品已经存在列表了');
+            return this.$message.error('选择的库存记录已经存在列表了');
           }
         }
         let list = this.currentIndex == -1 ? this.selection : [this.current];
@@ -378,7 +414,10 @@
           //item.weightUnit = item.weightUnit;
           // item.warehouseNum = item.measureQuantity;
           item.productId = item.categoryId;
+          item.batchStockId = item.id;
           item.id = '';
+          item.systemBatchNo =
+            this.dimension != 1 ? item.systemBatchNo || '' : '';
 
           // item.specification = item.specification;
         });

+ 9 - 1
vue.config.js

@@ -1,3 +1,11 @@
+/*
+ * @Author: mlchen 374826075@qq.com
+ * @Date: 2026-07-22 15:43:30
+ * @LastEditors: mlchen 374826075@qq.com
+ * @LastEditTime: 2026-07-27 09:31:46
+ * @FilePath: /kd-aiot-frontend-eom/vue.config.js
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 const CompressionWebpackPlugin = require('compression-webpack-plugin');
 const { transformElementScss } = require('ele-admin/lib/utils/dynamic-theme');
 const path = require('path');
@@ -36,7 +44,7 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.1.10:18086', //开发
+        target: 'http://localhost:18086', //开发
         // target: 'http://192.168.1.251:18186', //测试
         // target: 'http://192.168.1.15:18086',//罗
         // target: 'http://192.168.1.144:18086',//付