Browse Source

出库入库修改

yusheng 1 năm trước cách đây
mục cha
commit
d57c915bb1

+ 21 - 4
src/api/warehouseManagement/index.js

@@ -26,6 +26,14 @@ export default {
     }
     return Promise.reject(new Error(res.data.message));
   },
+  // 入库
+  update: async (data) => {
+    const res = await request.post('/wms/outintwo/update', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
   // 批量获取包装编码
   getAssetNum: async (data) => {
     const res = await request.post('/wms/outintwo/getAssetNum', data);
@@ -173,10 +181,19 @@ export default {
     }
     return Promise.reject(new Error(res.data.message));
   },
+  // 更新出库
+  outUpdate: async (data) => {
+    const res = await request.post('/wms/outintwo/outUpdate', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
   // 包装维度流水
   outInRecordsPage: async (params) => {
     const res = await request.get(
-      `/wms/outInDetailRecordTwo/outInRecordsPage`, {
+      `/wms/outInDetailRecordTwo/outInRecordsPage`,
+      {
         params
       }
     );
@@ -303,7 +320,8 @@ export default {
   // 通过入库单号获取入库明细
   getOutInRecordsPage: async (data) => {
     const res = await request.get(
-      `/wms/outInDetailRecordTwo/outInRecordsPage`, {
+      `/wms/outInDetailRecordTwo/outInRecordsPage`,
+      {
         params: data
       }
     );
@@ -539,6 +557,5 @@ export default {
       return res.data.data;
     }
     return Promise.reject(new Error(res.data.message));
-  },
-
+  }
 };

+ 90 - 7
src/views/warehouseManagement/outgoingManagement/add.vue

@@ -34,7 +34,7 @@
             <el-form-item label="领料人部门" prop="extInfo.verifyDeptCode">
               <selectTree ref="tree" class="form-ipt" size="medium" style="width: 100%"
                 :value="formData.extInfo.verifyDeptCode" clearable :options="treeList" :props="{
-                  value: 'code',
+                  value: 'id',
                   label: 'name',
                   children: 'children'
                 }" @getValue="auditorDeptClick" />
@@ -227,7 +227,8 @@
         </div> -->
       </div>
       <div class="center mt20">
-        <el-button type="primary" @click="handleSave" :loading="saveLoading">保存</el-button>
+        <el-button type="primary" @click="handleSave('save')" :loading="saveLoading">保存</el-button>
+        <el-button type="primary" @click="handleSave" :loading="saveLoading">出库</el-button>
         <el-button @click="$router.go(-1)">返回</el-button>
       </div>
     </el-card>
@@ -356,6 +357,10 @@ export default {
         this.$refs.outboundRequisitionDialogRef.handleMine([queryObj]);
       });
     }
+    console.log(queryObj,'queryObj.detailId')
+    if (queryObj.detailId) {
+     this._getInfo(queryObj.detailId)
+    }
   },
   methods: {
     outboundRequisitionSelection(data, dimension, query) {
@@ -438,6 +443,72 @@ export default {
         return '';
       }
     },
+    // getDeptName() {
+    //   if (this.formData?.extInfo?.createUserId) {
+    //     storageApi.getGroupById(this.formData.extInfo.createUserId).then((res) => {
+    //       this.formData.extInfo.deptName = res?.groupName
+    //     });
+    //   }
+    // },
+    async _getInfo(detailId) {
+      let res=await storageApi.getInboundDetailsById(detailId);
+
+      this.formData = res;
+      this.formData.extInfo.assetType = res.extInfo?.assetType?.split(',');
+      this.formData.bizType = res.bizType+''
+      console.log(this.formData.extInfo,'')
+      this.auditorDeptClick({
+        id:this.formData.extInfo?.verifyDeptCode,
+        name:this.formData.extInfo?.verifyDeptName
+      })
+      // this.getDeptName()
+      this.productList = res.outInDetailList.map(
+        (productItem, productIndex) => {
+          return {
+            ...productItem,
+            outInDetailRecordRequestList:
+              productItem.outInDetailRecordRequestList.map((packingItem) => {
+                return {
+                  ...packingItem,
+                  categoryName: productItem.categoryName,
+                  categoryCode: productItem.categoryCode,
+                  materialDetailList: packingItem.materialDetailList.map(
+                    (materialItem) => {
+                      return {
+                        ...materialItem,
+                        categoryName: productItem.categoryName,
+                        categoryCode: productItem.categoryCode
+                      };
+                    }
+                  )
+                };
+              })
+          };
+        }
+      );
+      // 获取包装维度数据
+      const arr = [];
+      for (const key in this.productList) {
+        for (const k in this.productList[key].outInDetailRecordRequestList) {
+          arr.push({
+            ...this.productList[key].outInDetailRecordRequestList[k]
+          });
+        }
+      }
+      this.packingList = arr;
+      // 获取物料维度数据
+      let iArr = [];
+      arr.forEach((item) => {
+        item.materialDetailList.forEach((ele) => {
+          iArr.push({ ...ele });
+        });
+      });
+      this.materialList = iArr;
+      console.log(this.packingList);
+      console.log(this.materialList);
+      this.pickingFetchData();
+      this.materielFetchData();
+    },
     detailData(data, dimension) {
       this.dimension = dimension;
 
@@ -543,7 +614,7 @@ export default {
       this.materielFetchData();
 
     },
-    handleSave() {
+    handleSave(type) {
       this.$refs.formName.validate(async (valid) => {
         if (valid) {
           if (!this.productList?.length) {
@@ -573,13 +644,22 @@ export default {
           });
           obj.warehouseIds = warehouseId;
           obj.warehouseNames = warehouseName;
-          console.log('2222', obj);
+     
           try {
-            const res = await storageApi.outStorage(obj);
+            let api=obj.id?storageApi.outUpdate:storageApi.outStorage
+            const res = await api(obj);
+
             if (res.code == 0) {
-              await storageApi.submitInsideTwo({ outInIds: res.data });
+             
+              if(type!='save'){
+                await storageApi.submitInsideTwo({ outInIds: res.data });
+                this.$message.success('出库成功!');
+              }else{
+                this.$message.success('保存成功!');
+
+              }
               this.$router.push('/warehouseManagement/outgoingManagement');
-              this.$message.success('保存成功!');
+              
             }
             this.saveLoading = false;
           } catch (error) {
@@ -616,6 +696,9 @@ export default {
       console.log(data);
       this.formData.extInfo.verifyDeptCode = data?.id;
       this.formData.extInfo.verifyDeptName = data?.name;
+      this.$set(this.formData.extInfo,'verifyDeptCode',data?.id)
+      this.$set(this.formData.extInfo,'verifyDeptName',data?.name)
+  
       this.formData.verifyId = '';
       this.formData.verifyName = '';
       this.$refs.formName.validateField('verifyDeptName');

+ 4 - 4
src/views/warehouseManagement/outgoingManagement/index.vue

@@ -231,7 +231,7 @@
             type="warning"
             :underline="false"
             icon="el-icon-edit"
-            v-if="row.verifyStatus == 3"
+            v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
             @click="edit(row)"
           >
             修改
@@ -419,7 +419,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 150,
+            width: 200,
             align: 'center',
             slot: 'action',
             showOverflowTooltip: true
@@ -485,9 +485,9 @@
       },
       edit(row) {
         this.$router.push({
-          path: '/warehouseManagement/outgoingManagement/edit',
+          path: '/warehouseManagement/outgoingManagement/add',
           query: {
-            id: row.id
+            detailId: row.id
           }
         });
       },

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

@@ -472,7 +472,8 @@
         </el-table>
       </div>
       <div class="storage_btn">
-        <el-button type="primary" :loading="saveLoading" @click="handleStorage">入库</el-button>
+        <el-button type="primary" :loading="saveLoading" @click="handleStorage('save')">保存</el-button>
+        <el-button type="primary" :loading="saveLoading" @click="handleStorage('Storage')">入库</el-button>
       </div>
     </el-card>
     <!-- 产品选择弹框 -->
@@ -624,6 +625,9 @@ export default {
           this.formData.extInfo.assetType = [data.rootCategoryLevelId];
           this.formData.bizType = String(data.type);
           this.formData.sourceBizNo = data.code;
+          this.formData.id = data.id;
+          this.formData.bizNo = data.bizNo;
+          
           const batchNo = await getCode('lot_number_code');
           this.productList = data.detailList.map((item, index) => {
             return {
@@ -664,6 +668,9 @@ export default {
         .then(async (data) => {
           this.formData.extInfo.assetType = data.extInfo.assetType.split(',');
           this.formData.bizType = String(data.bizType);
+          this.formData.sourceBizNo = data.code;
+          this.formData.id = data.id;
+          this.formData.bizNo = data.bizNo;
           const batchNo = await getCode('lot_number_code');
           this.productList = data.outInDetailList.map(
             (productItem, productIndex) => {
@@ -1438,7 +1445,7 @@ export default {
         });
     },
     // 入库
-    handleStorage() {
+    handleStorage(type) {
       let boolen = this.productList.every((item) => item.isSave);
       if (!boolen) {
         this.$message.warning('请先保存所有产品信息');
@@ -1497,15 +1504,15 @@ export default {
       // obj.isSkip = 1;
       this.saveLoading = true;
       console.log(obj, 'objobjobjobjobjobj');
-
-      storageApi
-        .storage(obj)
+      let api=obj.id?storageApi.update:storageApi.storage
+      api(obj)
         .then(async (res) => {
           console.log('入库成功', res);
           if (res.code == 0) {
+    
             try {
-              // 委外入库(非采购)
-              if (obj.bizType == '12') {
+              if(type!='save'){
+                if (obj.bizType == '12') {
                 await storageApi.qualityInspectionTwo({
                   outInId: res.data[0]
                 });
@@ -1513,6 +1520,12 @@ export default {
                 await storageApi.submitTwo({ outInId: res.data[0] });
               }
               this.$message.success('入库成功');
+             }else{
+              this.$message.success('操作成功');
+
+             }
+              // 委外入库(非采购)
+             
               this.saveLoading = false;
               this.$router.push('/warehouseManagement/stockManagement');
             } catch (error) {

+ 7 - 6
src/views/warehouseManagement/stockManagement/index.vue

@@ -121,14 +121,15 @@
             v-if="row.verifyStatus == 0 || row.verifyStatus == 3" @click="submit(row)">
             提交
           </el-link>
-          <!-- <el-link
+          <el-link
             type="primary"
             :underline="false"
             icon="el-icon-view"
-            @click="details(row)"
+            @click="edit(row)"
+            v-if="row.verifyStatus == 0 || row.verifyStatus == 3"
           >
-            详情
-          </el-link> -->
+            修改
+          </el-link>
           <!-- <el-link v-if="row.verifyStatus == 2 && clientEnvironmentId == 3" type="primary" :underline="false"
             icon="el-icon-view" @click="quality(row)">
             质检
@@ -473,9 +474,9 @@ export default {
     },
     edit(row) {
       this.$router.push({
-        path: '/warehouseManagement/stockManagement/edit',
+        path: '/warehouseManagement/stockManagement/add',
         query: {
-          id: row.id
+          detailId: row.id
         }
       });
     },

+ 1 - 1
vue.config.js

@@ -39,7 +39,7 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.132:18086',
 
-        target: 'http://192.168.1.251:18186', //开发
+        target: 'http://192.168.1.105:18086', //开发
         // target: 'http://192.168.1.251:18186', //测试
 
         // target: 'http://192.168.1.116:18086',