فهرست منبع

入库管理新增重复入库验证功能并优化批次号输入类型

yusheng 9 ماه پیش
والد
کامیت
1405a5137b
2فایلهای تغییر یافته به همراه48 افزوده شده و 2 حذف شده
  1. 11 0
      src/api/warehouseManagement/index.js
  2. 37 2
      src/views/warehouseManagement/stockManagement/add.vue

+ 11 - 0
src/api/warehouseManagement/index.js

@@ -557,6 +557,17 @@ export default {
       return res.data.data;
     }
     return Promise.reject(new Error(res.data.message));
+  },
+  //验证是否重复入库
+  isVerifyRepeatIsStock: async (data) => {
+    const res = await request.post(
+      '/wms/outindetailtwo/isVerifyRepeatIsStock',
+      data
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
   }
 };
 

+ 37 - 2
src/views/warehouseManagement/stockManagement/add.vue

@@ -195,7 +195,8 @@
                     @keyup.native="
                       moveFocus($event, $index, 'batchNo', '产品', row)
                     "
-                    v-model.number="row.batchNo"
+                    type="number"
+                    v-model="row.batchNo"
                   >
                   </el-input>
                 </el-form-item>
@@ -2320,6 +2321,12 @@
             // obj.isSkip = 1;
             this.saveLoading = true;
             console.log(obj, 'objobjobjobjobjobj');
+            // if(){}
+            if (!(await this.isVerifyRepeatIsStock())) {
+              this.saveLoading = false;
+
+              return;
+            }
             let api = obj.id ? storageApi.update : storageApi.storage;
             api(obj)
               .then(async (res) => {
@@ -2359,6 +2366,35 @@
           }
         });
       },
+      async isVerifyRepeatIsStock() {
+        const isVerifyData = await storageApi.isVerifyRepeatIsStock({
+          categoryCodes: this.productList.map((item) => item.categoryCode),
+          batchNos: this.productList.map((item) => item.batchNo)
+        });
+
+        return new Promise((resolve, reject) => {
+          if (isVerifyData?.length) {
+            this.$confirm(
+              `当前批次:${isVerifyData[0].batchNo},物品${isVerifyData
+                .map((item) => item.categoryName)
+                .join(',')}已有入库记录,是否继续入库!`,
+              {
+                confirmButtonText: '是',
+                cancelButtonText: '否'
+              }
+            )
+              .then(() => {
+                resolve(true);
+              })
+              .catch(() => {
+                resolve(false);
+              });
+          } else {
+            resolve(true);
+          }
+        });
+      },
+
       pickingHandleScroll() {
         // console.log('---------pickingHandleScroll------------');
         // console.log(this.packingList);
@@ -2867,7 +2903,6 @@
       },
       //产品保存操作
       async listSave(row, index) {
-        console.log('row22222222', row);
         return new Promise(async (resolve, reject) => {
           try {
             await this.validateFormIndividually(index);