Przeglądaj źródła

feat:库存调拨数为可用数量

liujt 1 miesiąc temu
rodzic
commit
2a57dc2101

+ 37 - 35
src/views/warehouseManagement/inventoryAllocation/add.vue

@@ -392,7 +392,7 @@
                 v-model="row.quantity" 
                 controls-position="right" 
                 :min="0" 
-                :max="row.measureQuantity"
+                :max="row.availableQuantity"
                 :precision="2"
                 style="width: 100%"
               ></el-input-number>
@@ -545,6 +545,12 @@
             showOverflowTooltip: true,
             minWidth: 110
           },
+          {
+            prop: 'availableQuantity',
+            label: '可用数量',
+            align: 'center',
+            showOverflowTooltip: true,
+          },
           {
             prop: 'measureQuantity',
             label: '计量数量',
@@ -563,17 +569,6 @@
             align: 'center',
             showOverflowTooltip: true,
           },
-          {
-            prop: 'availableQuantity',
-            label: '可用数量',
-            align: 'center',
-            showOverflowTooltip: true,
-            formatter: (row) => {
-              const measure = Number(row.measureQuantity) || 0;
-              const lock = Number(row.lockQuantity) || 0;
-              return (measure * 100 - lock * 100) / 100;
-            },
-          },
           {
             prop: 'brandNum',
             label: '牌号',
@@ -924,13 +919,20 @@
           warehouseAreaGoodsId: this.params.outShelvesId,
           warehouseAreaGoodsShelvesId: this.params.outFreightId
         };
-        const data = await storageApi[
+        let data = await storageApi[
           this.dimension == 1 ? 'getProductList' : this.dimension == 2 ? 'getBatchList' : 'getPackingList'
         ]({
           ...params,
           pageNum: page,
           size: limit
         });
+        console.log('data------', data);
+        data.list = data.list.map(item => {
+          const measure = Number(item.measureQuantity) || 0;
+          const lock = Number(item.lockQuantity) || 0;
+          item.availableQuantity = (measure * 100 - lock * 100) / 100;
+          return item;
+        })
         return data;
       },
       onDone(res) {
@@ -1086,14 +1088,14 @@
           if(!this.params.targetFactoriesId){
             this.searchState.hasError = true;
             const errorMsg = '调入工厂不能为空';
-            this.$message.error(errorMsg);
+            this.$message.warning(errorMsg);
             return reject(new Error(errorMsg));
           }
 
           if(!this.params.inWarehouseId){
             this.searchState.hasError = true;
             const errorMsg = '调入仓库不能为空';
-            this.$message.error(errorMsg);
+            this.$message.warning(errorMsg);
             return reject(new Error(errorMsg));
           }
 
@@ -1101,7 +1103,7 @@
           if(this.tableData.some((item) => !item.quantity || item.quantity <= 0)) {
             this.searchState.hasError = true;
             const errorMsg = '调拨数量不能为0';
-            this.$message.error(errorMsg);
+            this.$message.warning(errorMsg);
             return reject(new Error(errorMsg));
           }
 
@@ -1112,7 +1114,7 @@
                 this.productList = [];
                 this.searchState.hasError = true;
                 const errorMsg = '调入货位不能与调出货位相同';
-                this.$message.error(errorMsg);
+                this.$message.warning(errorMsg);
                 return reject(new Error(errorMsg));
               }
             } else if (!this.params.inFreightId && !this.params.outFreightId) {
@@ -1121,7 +1123,7 @@
                   this.productList = [];
                   this.searchState.hasError = true;
                   const errorMsg = '调入货架不能与调出货架相同';
-                  this.$message.error(errorMsg);
+                  this.$message.warning(errorMsg);
                   return reject(new Error(errorMsg));
                 }
               } else if (!this.params.inShelvesId && !this.params.outShelvesId) {
@@ -1130,7 +1132,7 @@
                     this.productList = [];
                     this.searchState.hasError = true;
                     const errorMsg = '调入库区不能与调出库区相同';
-                    this.$message.error(errorMsg);
+                    this.$message.warning(errorMsg);
                     return reject(new Error(errorMsg));
                   }
                 } else if (
@@ -1140,27 +1142,27 @@
                   this.productList = [];
                   this.searchState.hasError = true;
                   const errorMsg = '调入库区与调出库区不能为空';
-                  this.$message.error(errorMsg);
+                  this.$message.warning(errorMsg);
                   return reject(new Error(errorMsg));
                 } else {
                   this.productList = [];
                   this.searchState.hasError = true;
                   const errorMsg = '调入库区与调出库区必须同时填写';
-                  this.$message.error(errorMsg);
+                  this.$message.warning(errorMsg);
                   return reject(new Error(errorMsg));
                 }
               } else {
                 this.productList = [];
                 this.searchState.hasError = true;
                 const errorMsg = '调入货架与调出货架必须同时填写';
-                this.$message.error(errorMsg);
+                this.$message.warning(errorMsg);
                 return reject(new Error(errorMsg));
               }
             } else {
               this.productList = [];
               this.searchState.hasError = true;
               const errorMsg = '调入货位与调出货位必须同时填写';
-              this.$message.error(errorMsg);
+              this.$message.warning(errorMsg);
               return reject(new Error(errorMsg));
             }
             // 验证通过,获取产品列表
@@ -1557,14 +1559,14 @@
             const saleOrderNos = params.allotApplyAddPOBuilders.map((item) => item.saleOrderNos);
           
             if (new Set(customerNames).size !== 1, new Set(saleOrderNos).size !== 1) {
-              return this.$message.error('不同客户,不同销售订单的产品不允许调拨');
+              return this.$message.warning('不同客户,不同销售订单的产品不允许调拨');
             } 
             storageApi.allotApplySave(params).then(() => {
               this.$message.success('保存成功');
               this.$router.go(-1);
             });
           } else {
-            this.$message.error('请调入相关数据');
+            this.$message.warning('请调入相关数据');
           }
         }).catch((error) => {
           // 验证失败,不提交数据
@@ -1648,7 +1650,7 @@
       },
       tuneClick(id, name, boolen) {
         if (!this.currentPullAreaId) {
-          return this.$message.error('请先选择调出库');
+          return this.$message.warning('请先选择调出库');
         }
         if (boolen) {
           return false;
@@ -1666,10 +1668,10 @@
       },
       async merge() {
         if (!this.params.outWarehouseId) {
-          return this.$message.error('请先选择调出仓库');
+          return this.$message.warning('请先选择调出仓库');
         }
         if (!this.params.inWarehouseId) {
-          return this.$message.error('请先选择调入仓库');
+          return this.$message.warning('请先选择调入仓库');
         }
         if (this.selection.length > 0) {
           console.log(this.selection);
@@ -1723,7 +1725,7 @@
                 console.log(this.selection[i].areaId);
                 console.log(this.params.inCargoAreaId);
                 if (this.selection[i].areaId == this.params.inCargoAreaId) {
-                  return this.$message.error('所选物品库区与调入库区重复');
+                  return this.$message.warning('所选物品库区与调入库区重复');
                 }
               }
             } else if (this.params.inShelvesId && !this.params.inFreightId) {
@@ -1735,7 +1737,7 @@
                     this.selection[i].goodsShelfId == this.params.inShelvesId
                   ) {
                     // 货架相同
-                    return this.$message.error(
+                    return this.$message.warning(
                       '所选物品库区/货架与调入库区/货架重复'
                     );
                   } else {
@@ -1759,7 +1761,7 @@
                       this.params.inFreightId
                     ) {
                       // 货位相同
-                      return this.$message.error(
+                      return this.$message.warning(
                         '所选物品库区/货架/货位与调入库区/货架/货位重复'
                       );
                     } else {
@@ -1773,7 +1775,7 @@
                 }
               }
             } else {
-              return this.$message.error('调入库区不能为空');
+              return this.$message.warning('调入库区不能为空');
             }
 
             this.selectionIds = this.selectionIds.concat(
@@ -1789,7 +1791,7 @@
                   saleOrderNos: item.saleOrderInfo?.saleOrderNos || '',
                   customerNames: item.saleOrderInfo?.customerNames || '',
                   outInDetailRecordId: item.id,
-                  quantity: item.quantity || item.measureQuantity,
+                  quantity: item.quantity || item.availableQuantity,
                   categoryId: item.categoryId,
                   warehouseId: this.params.outWarehouseId,
                   warehouseName: this.params.outWarehouseName,
@@ -1835,10 +1837,10 @@
             );
             console.log('this.tableData---------', this.tableData);
           } else {
-            this.$message.error('请选择正确的行');
+            this.$message.warning('请选择正确的行');
           }
         } else {
-          this.$message.error('请选择调出物品信息');
+          this.$message.warning('请选择调出物品信息');
         }
       }
     }