Przeglądaj źródła

fix(库存调拨): 添加调拨数量有效性校验

liujt 7 miesięcy temu
rodzic
commit
880737b821

+ 8 - 1
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -995,13 +995,20 @@
           this.searchState.hasError = false;
 
           if(!this.params.inWarehouseId){
-            
             this.searchState.hasError = true;
             const errorMsg = '调入仓库不能为空';
             this.$message.error(errorMsg);
             return reject(new Error(errorMsg));
           }
 
+          // 检查是否存在quantity小于等于0或无效的项
+          if(this.tableData.some((item) => !item.quantity || item.quantity <= 0)) {
+            this.searchState.hasError = true;
+            const errorMsg = '调拨数量不能为0';
+            this.$message.error(errorMsg);
+            return reject(new Error(errorMsg));
+          }
+
           if (this.allocateId == 1) {
             // 库内调拨
             if (this.params.inFreightId && this.params.outFreightId) {