Przeglądaj źródła

入库自动添加仓库

huang_an 1 rok temu
rodzic
commit
ef001c3437

+ 3 - 3
src/views/warehouseManagement/components/WarehousingDialog.vue

@@ -82,7 +82,8 @@
           return this.$message.warning('请添加仓库!');
           return this.$message.warning('请添加仓库!');
         }
         }
         let total = this.tableDate.reduce(
         let total = this.tableDate.reduce(
-          (total, currentObj) => total + currentObj.packingQuantity,
+          (total, currentObj) =>
+            Number(total) + Number(currentObj.packingQuantity),
           0
           0
         );
         );
         if (total == this.packingQuantity) {
         if (total == this.packingQuantity) {
@@ -136,11 +137,10 @@
         if (warehouseId && warehouseName) {
         if (warehouseId && warehouseName) {
           this.warehouseId = warehouseId;
           this.warehouseId = warehouseId;
           this.tableDate.push({
           this.tableDate.push({
-            packingQuantity: this.packingQuantity,
+            packingQuantity: packingQuantity,
             warehouseName: warehouseName,
             warehouseName: warehouseName,
             warehouseId: warehouseId
             warehouseId: warehouseId
           });
           });
-          // this.$emit('selection', this.tableDate, this.currentIndex);
         }
         }
       }
       }
     }
     }

+ 93 - 20
src/views/warehouseManagement/stockManagement/add.vue

@@ -1000,7 +1000,7 @@
         pickingPageNum: 1, // 包装虚拟分页页数
         pickingPageNum: 1, // 包装虚拟分页页数
         materielPageNum: 1, // 物料虚拟分页页数
         materielPageNum: 1, // 物料虚拟分页页数
         packingSpecificationOption: [], // 包装规格下拉
         packingSpecificationOption: [], // 包装规格下拉
-        proData: {}
+        proData: []
       };
       };
     },
     },
     computed: {
     computed: {
@@ -1208,14 +1208,28 @@
         if (row.packingQuantity && row.packingUnit) {
         if (row.packingQuantity && row.packingUnit) {
           //获取仓库
           //获取仓库
           const res = await warehouseDefinition.list({
           const res = await warehouseDefinition.list({
-            inventoryType: this.proData[0]?.categoryLevelPathIdParent
+            inventoryType: row?.categoryLevelPathIdParent
           });
           });
-          if (res.length > 0) {
+          // 只有一个仓库自动显示出来
+          if (res.length == 1) {
             let name = res[0]?.factoryName + '-' + res[0]?.name;
             let name = res[0]?.factoryName + '-' + res[0]?.name;
             console.log('仓库-----------------------------', res);
             console.log('仓库-----------------------------', res);
             this.$set(this.productList[index], 'warehouseId', res[0].id);
             this.$set(this.productList[index], 'warehouseId', res[0].id);
             this.$set(this.productList[index], 'warehouseName', name);
             this.$set(this.productList[index], 'warehouseName', name);
+
+            let aaa = [];
+            aaa.push({
+              packingQuantity: row.packingQuantity,
+              warehouseName: name,
+              warehouseId: res[0].id
+            });
+
+            this.AAAAAA(aaa, index);
+          } else {
+            this.$set(this.productList[index], 'warehouseId', '');
+            this.$set(this.productList[index], 'warehouseName', '');
           }
           }
+
           let startIndex = row.packingSpecificationOption.findIndex((ite) => {
           let startIndex = row.packingSpecificationOption.findIndex((ite) => {
             return (
             return (
               row.measuringUnit == ite.packingUnit &&
               row.measuringUnit == ite.packingUnit &&
@@ -1247,6 +1261,53 @@
           }
           }
         }
         }
       },
       },
+      AAAAAA(argum, idx) {
+        let warehouseIds = [];
+        let warehouseNames = [];
+        argum.forEach((item) => {
+          for (let index = 0; index < item.packingQuantity; index++) {
+            warehouseIds.push(item.warehouseId);
+            warehouseNames.push(item.warehouseName);
+          }
+        });
+        console.log(warehouseIds);
+        console.log(warehouseNames);
+        console.log(argum, 'argumargumargumargumargumargum');
+        console.log(idx, 'idxidxidxidxidxidx');
+        if (idx > -1) {
+          this.$set(
+            this.productList[idx],
+            'warehouseId',
+            argum.map((item) => item.warehouseId).join(',')
+          );
+          this.$set(
+            this.productList[idx],
+            'warehouseName',
+            argum.map((item) => item.warehouseName).join(',')
+          );
+          this.$set(this.productList[idx], 'warehouseIds', warehouseIds);
+          this.$set(this.productList[idx], 'warehouseNames', warehouseNames);
+        } else {
+          this.productList.map((item, index) => {
+            this.$set(
+              this.productList[index],
+              'warehouseId',
+              argum.map((item) => item.warehouseId).join(',')
+            );
+            this.$set(
+              this.productList[index],
+              'warehouseName',
+              argum.map((item) => item.warehouseName).join(',')
+            );
+            this.$set(this.productList[index], 'warehouseIds', warehouseIds);
+            this.$set(
+              this.productList[index],
+              'warehouseNames',
+              warehouseNames
+            );
+          });
+        }
+      },
       async outboundRequisitionSelection(data, dimension, query) {
       async outboundRequisitionSelection(data, dimension, query) {
         console.log('data-----------', data);
         console.log('data-----------', data);
         console.log('query-----------', query);
         console.log('query-----------', query);
@@ -1762,17 +1823,6 @@
         obj.warehouseIds = warehouseId;
         obj.warehouseIds = warehouseId;
         obj.warehouseNames = warehouseName;
         obj.warehouseNames = warehouseName;
 
 
-        obj.outInDetailList.map((item) => {
-          item.outInDetailRecordRequestList =
-            item.outInDetailRecordRequestList.map((packingItem) => {
-              delete packingItem.warehouseId;
-              delete packingItem.warehouseName;
-              return {
-                ...packingItem
-              };
-            });
-        });
-
         console.log('入库数据', obj);
         console.log('入库数据', obj);
 
 
         // 是否需要审核(0审核 1跳过审核)
         // 是否需要审核(0审核 1跳过审核)
@@ -1782,7 +1832,7 @@
           obj.isSkip = 0;
           obj.isSkip = 0;
         }
         }
         // obj.isSkip = 1;
         // obj.isSkip = 1;
-        console.log(obj);
+        console.log(this.productList);
         this.saveLoading = true;
         this.saveLoading = true;
         storageApi
         storageApi
           .storage(obj)
           .storage(obj)
@@ -1813,10 +1863,10 @@
           });
           });
       },
       },
       pickingHandleScroll() {
       pickingHandleScroll() {
-        console.log('---------pickingHandleScroll------------');
-        console.log(this.packingList);
-        console.log(this.showPackingList);
-        console.log(this.pageSize);
+        // console.log('---------pickingHandleScroll------------');
+        // console.log(this.packingList);
+        // console.log(this.showPackingList);
+        // console.log(this.pageSize);
         if (this.showPackingList.length < this.packingList.length) {
         if (this.showPackingList.length < this.packingList.length) {
           if (this.packingList.length > this.pageSize) {
           if (this.packingList.length > this.pageSize) {
             this.pickingPageNum += 1;
             this.pickingPageNum += 1;
@@ -2146,7 +2196,8 @@
             totalMoney: '', // 总价
             totalMoney: '', // 总价
             price: item.price, // 单价
             price: item.price, // 单价
             purpose: '', // 用途
             purpose: '', // 用途
-            isUnpack: item.isUnpack // 是否允许拆包
+            isUnpack: item.isUnpack, // 是否允许拆包
+            categoryLevelPathIdParent: item.categoryLevelPathIdParent
           };
           };
         });
         });
         this.productList = this.productList.concat(productList);
         this.productList = this.productList.concat(productList);
@@ -2289,6 +2340,27 @@
               if (!row.isSave) {
               if (!row.isSave) {
                 this.generateWrappers(row, index, packingCodeList[index]);
                 this.generateWrappers(row, index, packingCodeList[index]);
                 this.$set(this.productList[index], 'isSave', true);
                 this.$set(this.productList[index], 'isSave', true);
+                this.$set(
+                  this.productList[index],
+                  'warehouseId',
+                  row.warehouseId
+                );
+                this.$set(
+                  this.productList[index],
+                  'warehouseName',
+                  row.warehouseName
+                );
+
+                this.$set(
+                  this.productList[index],
+                  'warehouseIds',
+                  row.warehouseId
+                );
+                this.$set(
+                  this.productList[index],
+                  'warehouseNames',
+                  row.warehouseName
+                );
               }
               }
             });
             });
             // 加载虚拟列表数据(分页)
             // 加载虚拟列表数据(分页)
@@ -2583,6 +2655,7 @@
         });
         });
         console.log(warehouseIds);
         console.log(warehouseIds);
         console.log(warehouseNames);
         console.log(warehouseNames);
+        console.log(argum, 'argumargumargumargumargumargum');
         if (idx > -1) {
         if (idx > -1) {
           this.$set(
           this.$set(
             this.productList[idx],
             this.productList[idx],