Browse Source

退货入库修改操作流程

Qukatie 3 days ago
parent
commit
da442c9aac

+ 7 - 0
src/api/tirePartsMall/purchasingManagement/warehouseEntryOrder.js

@@ -124,4 +124,11 @@ export const revokeShipment = (data) => {
     method: 'POST',
     data: data
   })
+}
+export const submitList = (data) => {
+  return request({
+    url: '/api/blade-sales-part/shipItems/submitList',
+    method: 'POST',
+    data: data
+  })
 }

+ 1 - 1
src/views/tirePartsMall/basicData/customerInformation/detailsPage.vue

@@ -144,7 +144,7 @@
         :data="corpsFiles"
         display
         :enumerationValue="35.1"
-        :disabled="detailData.status == 1"
+        :disabled="detailData.status == 1||editDisabled"
       ></c-upload>
       <el-dialog
         title="设置客户分类"

+ 17 - 3
src/views/tirePartsMall/basicData/reservoirArea/index.vue

@@ -94,17 +94,31 @@ export default {
           {
             label: "仓库",
             prop: "storageName",
-            disabled: true,
+            disabled: true
           },
           {
             label: "库区编码",
             prop: "code",
-            search: true
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "库区名称",
             prop: "cname",
-            search: true
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "备注",

+ 1 - 1
src/views/tirePartsMall/purchaseService/outStorage/components/viewArea.vue

@@ -13,7 +13,7 @@
           :filterable="true"
           @selectChange="dicChange('dot', $event)"
         ></dic-select>
-        <div style="color: #F56C6C;margin-left: 100px;">采购数量:{{ qtyMax }}</div>
+        <el-tag type="danger">出库数量:{{ 采购数量 }}</el-tag>
       </div>
       <avue-crud
         v-if="dialogVisible"

+ 2 - 1
src/views/tirePartsMall/purchasingManagement/warehouseEntryOrder/components/viewArea.vue

@@ -24,6 +24,7 @@
               :filterable="true"
               :allowCreate="true"
             ></dic-select>
+            <el-tag type="danger">入库数量:{{ qtyMax }}</el-tag>
           </div>
         </template>
         <template slot="reservoirAreaName" slot-scope="{ row }">
@@ -54,7 +55,7 @@
           />
         </template>
         <template slot-scope="{ row, index }" slot="menu">
-          <el-button icon="el-icon-delete" :disabled="disabled" type="text" @click="rowDel(row, index)">删除 </el-button>
+          <el-button icon="el-icon-delete" :disabled="disabled" size="small" type="text" @click="rowDel(row, index)">删除 </el-button>
         </template>
       </avue-crud>
       <span slot="footer" class="dialog-footer">

+ 37 - 30
src/views/tirePartsMall/purchasingManagement/warehouseEntryOrder/detailsPage.vue

@@ -246,7 +246,8 @@ import {
   dotList,
   getWarehouseKeeper,
   dotListAll,
-  removeItem
+  removeItem,
+  submitList
 } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
 import { itemRemove } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
 import { dateFormat } from "@/util/date";
@@ -264,7 +265,8 @@ export default {
       diaVisible: false,
       fixForm: {
         reservoirAreaId: null,
-        reservoirAreaName: null
+        reservoirAreaName: null,
+          balanceQuantity:0
       },
       numberDecimal: 0,
       // 上传附件的需要参数
@@ -918,16 +920,12 @@ export default {
           }
           itemRemove({ ids: ids.join(",") }).then(res => {
             row.historyList = [];
-            row.reservoirAreaId = null;
-            row.reservoirAreaName = null;
             row.dot = null;
             row.sendNum = 0;
           });
         });
       } else {
         row.historyList = [];
-        row.reservoirAreaId = null;
-        row.reservoirAreaName = null;
         row.dot = null;
         row.sendNum = 0;
       }
@@ -941,6 +939,11 @@ export default {
       this.form.shipItemsList[index].dot = row.dot;
       this.form.shipItemsList[index].sendNum = row.sendNum;
       this.form.shipItemsList[index].historyList = row.historyList;
+      if (row.historyList.filter(item => !item.id).length) {
+        submitList(this.form.shipItemsList).then(res => {
+          this.form.shipItemsList = res.data.data;
+        });
+      }
     },
     allClick(name) {
       if (name == "修改库区") {
@@ -951,31 +954,29 @@ export default {
         }
         this.fixForm = {
           reservoirAreaId: null,
-          reservoirAreaName: null
+          reservoirAreaName: null,
+          balanceQuantity:0
         };
         this.diaVisible = true;
       }
       if (name == "修改") {
-        this.$confirm("是否确认修改库区?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          for (let item of this.selectionMultilist) {
-            this.form.shipItemsList.forEach(row => {
-              if (item.id == row.id) {
-                row.historyList.push({
-                  reservoirAreaId: this.fixForm.reservoirAreaId,
-                  reservoirAreaName: this.fixForm.reservoirAreaName,
-                  balanceQuantity: this.fixForm.balanceQuantity,
-                  quantity: row.goodsNum
-                });
-                row.sendNum = row.goodsNum;
-              }
-            });
-          }
-          this.diaVisible = false;
+        for (let item of this.selectionMultilist) {
+          this.form.shipItemsList.forEach(row => {
+            if (item.id == row.id) {
+              row.historyList.push({
+                reservoirAreaId: this.fixForm.reservoirAreaId,
+                reservoirAreaName: this.fixForm.reservoirAreaName,
+                balanceQuantity: this.fixForm.balanceQuantity,
+                quantity: row.goodsNum
+              });
+              row.sendNum = row.goodsNum;
+            }
+          });
+        }
+        submitList(this.form.shipItemsList).then(res => {
+          this.form.shipItemsList = res.data.data;
         });
+        this.diaVisible = false;
       }
       if (name == "导入库区") {
         for (let item of this.form.shipItemsList) {
@@ -1000,11 +1001,17 @@ export default {
               }
             } else {
               row.historyList = [];
+              row.dot = null;
+              row.sendNum = 0;
+            }
+            if (ids.length) {
+              itemRemove({ ids: ids.join(",") }).then(res => {
+                this.$message.success("操作成功");
+                row.historyList = [];
+                row.dot = null;
+                row.sendNum = 0;
+              });
             }
-            itemRemove({ ids: ids.join(",") }).then(res => {
-              this.$message.success("操作成功");
-              this.refresh(this.form.id);
-            });
           }
         });
       }

+ 1 - 3
src/views/tirePartsMall/salesManagement/outboundWorkOrder/components/viewArea.vue

@@ -13,9 +13,7 @@
           :filterable="true"
           @selectChange="dicChange('dot', $event)"
         ></dic-select>
-        <div style="color: #F56C6C;margin-left: 100px;">
-          出库数量:{{ qtyMax }}
-        </div>
+        <el-tag type="danger">出库数量:{{ qtyMax }}</el-tag>
       </div>
 
       <avue-crud

+ 3 - 1
src/views/tirePartsMall/salesService/inStorage/components/viewArea.vue

@@ -24,6 +24,7 @@
               :filterable="true"
               :allowCreate="true"
             ></dic-select>
+            <el-tag type="danger">销售数量:{{ qtyMax }}</el-tag>
           </div>
         </template>
         <template slot="reservoirAreaName" slot-scope="{ row }">
@@ -36,6 +37,7 @@
             :filterable="true"
             :remote="true"
             dataName="cname"
+            :disabled="disabled"
             @selectChange="rowDicChange('reservoirAreaName', $event, row)"
             :slotRight="true"
             rightLabel="balanceQuantity"
@@ -53,7 +55,7 @@
           />
         </template>
         <template slot-scope="{ row, index }" slot="menu">
-          <el-button icon="el-icon-delete" :disabled="disabled" type="text" @click="rowDel(row, index)">删除 </el-button>
+          <el-button icon="el-icon-delete" :disabled="disabled" size="small" type="text" @click="rowDel(row, index)">删除 </el-button>
         </template>
       </avue-crud>
       <span slot="footer" class="dialog-footer">

+ 122 - 36
src/views/tirePartsMall/salesService/inStorage/detailsPage.vue

@@ -67,6 +67,18 @@
                             </template> -->
               <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
                 <el-button
+                  v-if="reservoirArea == 1 && row.historyList.length"
+                  :size="size"
+                  :disabled="!row.id || form.statusName == '已入库' || isEdit || isEdits"
+                  type="text"
+                  @click="rowDelArea(row, index)"
+                >
+                  清空库区
+                </el-button>
+                <el-button v-if="reservoirArea == 1" :size="size" :disabled="!row.id" type="text" @click="rowArea(row, index)">
+                  {{ row.historyList.length ? "查看库区" : "选择库区" }}
+                </el-button>
+                <el-button
                   :size="size"
                   :disabled="disabled || isEdit"
                   :type="type"
@@ -109,6 +121,9 @@
                 <el-button v-if="reservoirArea == 1" type="success" size="small" @click="allClick('导入库区')" :disabled="disabled || isEdit"
                   >导入库区</el-button
                 >
+                <el-button v-if="reservoirArea == 1" type="success" size="small" @click="allClick('一键清空库区')" :disabled="disabled || isEdit"
+                  >一键清空库区</el-button
+                >
               </template>
               <template slot-scope="{ row }" slot="reservoirAreaName">
                 <dic-select
@@ -167,6 +182,7 @@
         :enumerationValue="35.1"
       ></c-upload>
     </div>
+     <view-area ref="viewArea" @areaData="areaData" :disabled="disabled || form.statusName == '已入库' || isEdit || isEdits"></view-area>
     <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
       <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter">
         <template slot="excelTemplate">
@@ -234,12 +250,15 @@ import {
   dotListAll,
   removeItem
 } from "@/api/tirePartsMall/salesService/outboundWorkOrder";
+import { submitList } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
+import { itemRemove } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
 import { dateFormat } from "@/util/date";
 import { getToken } from "@/util/auth";
 import { getMenu } from "@/api/system/menu";
 import reportDialog from "@/components/report-dialog/main";
 import { corpsDescListAll } from "@/api/tirePartsMall/salesService/saleOrder";
 import { isProcurement } from "@/api/basicData/configuration";
+import viewArea from "./components/viewArea.vue";
 export default {
   name: "detailsPage",
   data() {
@@ -612,13 +631,13 @@ export default {
             //     dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP'
             // }, {
           },
-          {
-            label: "库区",
-            prop: "reservoirAreaName",
-            width: 140,
-            hide: true,
-            overHidden: true
-          },
+          // {
+          //   label: "库区",
+          //   prop: "reservoirAreaName",
+          //   width: 140,
+          //   hide: true,
+          //   overHidden: true
+          // },
           {
             label: "品牌",
             prop: "brandName",
@@ -811,9 +830,6 @@ export default {
     };
     this.optionContacts = await this.getColumnData(this.getColumnName(348), this.optionContactsBack);
     isProcurement({ param: "reservoir.area" }).then(res => {
-      if (res.data.data == 1) {
-        this.findObject(this.optionContacts.column, "reservoirAreaName").hide = false;
-      }
       this.reservoirArea = res.data.data;
     });
     this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
@@ -886,49 +902,131 @@ export default {
   },
   components: {
     reportDialog,
-    dicSelect
+    dicSelect,
+    viewArea
   },
   activated() {
     this.$store.commit("DOMIO_IN_DETAIL");
   },
   methods: {
+    rowDelArea(row, index) {
+      if (row.historyList.filter(item => item.id).length) {
+        this.$confirm("是否撤销库区?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          let ids = [];
+          for (let item of row.historyList) {
+            ids.push(item.id);
+          }
+          itemRemove({ ids: ids.join(",") }).then(res => {
+            row.historyList = [];
+            row.dot = null;
+            row.sendNum = 0;
+          });
+        });
+      } else {
+        row.historyList = [];
+        row.dot = null;
+        row.sendNum = 0;
+      }
+    },
+    rowArea(row, index) {
+      this.$refs.viewArea.openDialog(this.form, row, index);
+    },
+    areaData(row, index) {
+      this.form.shipItemsList[index].reservoirAreaId = row.reservoirAreaId;
+      this.form.shipItemsList[index].reservoirAreaName = row.reservoirAreaName;
+      this.form.shipItemsList[index].dot = row.dot;
+      this.form.shipItemsList[index].sendNum = row.sendNum;
+      this.form.shipItemsList[index].historyList = row.historyList;
+      if (row.historyList.filter(item => !item.id).length) {
+        submitList(this.form.shipItemsList).then(res => {
+          this.form.shipItemsList = res.data.data;
+        });
+      }
+    },
     allClick(name) {
       if (name == "修改库区") {
+        for (let item of this.selectionMultilist) {
+          if (item.historyList.length > 0) {
+            return this.$message.error("请选择没有选择库区的数据");
+          }
+        }
         this.fixForm = {
           reservoirAreaId: null,
-          reservoirAreaName: null
+          reservoirAreaName: null,
+          balanceQuantity: 0
         };
         this.diaVisible = true;
       }
       if (name == "修改") {
-        this.$confirm("是否确认修改库区?", "提示", {
+        for (let item of this.selectionMultilist) {
+          this.form.shipItemsList.forEach(row => {
+            if (item.id == row.id) {
+              row.historyList.push({
+                reservoirAreaId: this.fixForm.reservoirAreaId,
+                reservoirAreaName: this.fixForm.reservoirAreaName,
+                balanceQuantity: this.fixForm.balanceQuantity,
+                quantity: row.goodsNum
+              });
+              row.sendNum = row.goodsNum;
+            }
+          });
+        }
+        submitList(this.form.shipItemsList).then(res => {
+          this.form.shipItemsList = res.data.data;
+        });
+        this.diaVisible = false;
+      }
+      if (name == "导入库区") {
+        for (let item of this.form.shipItemsList) {
+          if (item.historyList.length) {
+            return this.$message.error("请清空库区");
+          }
+        }
+        this.findObject(this.excelOption2.column, "excelFile").action = "/api/blade-sales-part/ship/importReservoirArea?id=" + this.form.id;
+        this.excelBox2 = true;
+      }
+      if (name == "一键清空库区") {
+        this.$confirm("是否一键清空库区?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
         }).then(() => {
-          for (let item of this.selectionMultilist) {
-            this.form.shipItemsList.forEach(row => {
-              if (item.id == row.id) {
-                row.reservoirAreaId = this.fixForm.reservoirAreaId;
-                row.reservoirAreaName = this.fixForm.reservoirAreaName;
+          for (let row of this.form.shipItemsList) {
+            let ids = [];
+            if (row.historyList.filter(item => item.id).length) {
+              for (let item of row.historyList) {
+                ids.push(item.id);
               }
-            });
+            } else {
+              row.historyList = [];
+              row.dot = null;
+              row.sendNum = 0;
+            }
+            if (ids.length) {
+              itemRemove({ ids: ids.join(",") }).then(res => {
+                this.$message.success("操作成功");
+                row.historyList = [];
+                row.dot = null;
+                row.sendNum = 0;
+              });
+            }
           }
-          this.diaVisible = false;
         });
       }
-      if (name == "导入库区") {
-        this.findObject(this.excelOption2.column, "excelFile").action = "/api/blade-sales-part/ship/importReservoirArea?id=" + this.form.id;
-        this.excelBox2 = true;
-      }
     },
     dicChange(name, row) {
       if (name == "reservoirAreaName") {
         if (row) {
           this.fixForm.reservoirAreaId = row.id;
+          this.fixForm.balanceQuantity = row.balanceQuantity;
         } else {
           this.fixForm.reservoirAreaId = null;
           this.fixForm.reservoirAreaName = null;
+          this.fixForm.balanceQuantity = row.balanceQuantity;
         }
       }
     },
@@ -1322,12 +1420,6 @@ export default {
        * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
        */
       const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
-      isProcurement({ param: "reservoir.area" }).then(res => {
-        if (res.data.data == 1) {
-          this.findObject(this.optionContacts.column, "reservoirAreaName").hide = false;
-        }
-        this.reservoirArea = res.data.data;
-      });
       if (inSave) {
         this.$message.success("保存成功");
         //关闭窗口b
@@ -1338,12 +1430,6 @@ export default {
     async resetColumnTwo(ref, option, optionBack, code) {
       this[option] = this[optionBack];
       const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
-      isProcurement({ param: "reservoir.area" }).then(res => {
-        if (res.data.data == 1) {
-          this.findObject(this.optionContacts.column, "reservoirAreaName").hide = false;
-        }
-        this.reservoirArea = res.data.data;
-      });
       if (inSave) {
         this.$message.success("重置成功");
         this.$refs[ref].$refs.dialogColumn.columnBox = false;