Просмотр исходного кода

出入库申请列表操作直接入库

huang_an 1 год назад
Родитель
Сommit
27ae53e15a

+ 2 - 1
src/views/warehouseManagement/inboundRequests/components/tgTable.vue

@@ -184,7 +184,8 @@
               code: row.code,
               inId: row.id,
               type: '1',
-              sourceType: row.sourceType
+              sourceType: row.sourceType,
+              name: 'inboundRequests'
             }
           });
         } else {

+ 56 - 1
src/views/warehouseManagement/stockManagement/add.vue

@@ -1038,6 +1038,9 @@
       }
     },
     created() {
+      if (this.$route.query.name == 'inboundRequests') {
+        this.getProduct();
+      }
       this.requestDict('不拆物料层规格');
       this.getFieldModel();
       this.getListItems();
@@ -1047,7 +1050,6 @@
         storageApi
           .getApplystorageDetailById(this.$route.query.id)
           .then(async (data) => {
-            console.log(data);
             this.formData.extInfo.assetType = [data.rootCategoryLevelId];
             this.formData.bizType = String(data.type);
             this.formData.sourceBizNo = data.code;
@@ -1261,6 +1263,59 @@
           }
         }
       },
+      //出入库申请列表操作直接入库
+      getProduct() {
+        let aaa = [this.$route.query.inId];
+        console.log(aaa, 'abcabcabcabcabcabcabcabcabc');
+        storageApi.getApplystoragedetails(aaa).then(async (res) => {
+          if (this.$route.query.type == 2) {
+            // 出库
+            let data = await storageApi.getHierarchyFifo({
+              type: 1,
+              builders: res.map((item) => {
+                return {
+                  categoryId: item.categoryId,
+                  num: item.measureQuantity
+                };
+              })
+            });
+            if (data?.length > 0) {
+              this.outboundRequisitionSelection(data, 1, {
+                sourceBizNo: this.$route.query.code,
+                bizType: this.$route.query.sourceType,
+                assetType: Array.from(
+                  new Set(res.map((item) => item.rootCategoryLevelId))
+                ).join(',')
+              });
+            } else {
+              this.$message.warning('该出库申请单无库存');
+            }
+          } else {
+            // 入库
+            const batchNo = await getCode('lot_number_code');
+            let data = res.map((item, index) => {
+              return {
+                ...item,
+                index,
+                packingQuantity: 1,
+                minPackingQuantity: item.measureQuantity,
+                measureUnit: item.measuringUnit,
+                batchNo,
+                id: '',
+                warehouseIds: [item.warehouseId],
+                warehouseNames: [item.warehouseName]
+              };
+            });
+            this.outboundRequisitionSelection(data, 1, {
+              sourceBizNo: this.$route.query.code,
+              bizType: this.$route.query.sourceType,
+              assetType: Array.from(
+                new Set(res.map((item) => item.rootCategoryLevelId))
+              ).join(',')
+            });
+          }
+        });
+      },
       async outboundRequisitionSelection(data, dimension, query) {
         console.log('data-----------', data);
         console.log('query-----------', query);