Sfoglia il codice sorgente

订单管理打印出库单添加记录批号相关功能

lph 1 anno fa
parent
commit
222dca8735

+ 121 - 2
zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue

@@ -23,7 +23,7 @@
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :span="8">
           <el-form-item label="备注:" prop="remark" size="normal">
             <el-input
               v-model="form.remark"
@@ -33,7 +33,7 @@
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="12">
+        <el-col :span="8">
           <el-form-item label="出库日期:" prop="remark" size="normal">
             <el-date-picker
               v-model="form.outStockDate"
@@ -44,6 +44,35 @@
             </el-date-picker>
           </el-form-item>
         </el-col>
+        <el-col :span="8">
+          <el-form-item label="批次:" prop="batchNumber" size="normal">
+            <el-select
+              v-model="form.batchNumber"
+              clearable
+              filterable
+              @change="batchChangeHandler"
+            >
+              <el-option
+                v-for="item in batchOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item>
+            <el-button
+              :disabled="isCanRecordBatch"
+              type="primary"
+              size="small"
+              @click="myRecordBatchHandler"
+              >记录批次</el-button
+            >
+          </el-form-item>
+        </el-col>
       </el-form>
     </el-row>
     <el-table ref="tableRef" v-if="tableShow" :data="tableData" border stripe>
@@ -79,6 +108,11 @@
       ></el-table-column>
       <el-table-column label="单价" prop="productUnitPrice"></el-table-column>
       <el-table-column label="金额" prop="productAmounts"></el-table-column>
+      <el-table-column label="批次状态" prop="batchState">
+        <template slot-scope="scope">
+          {{ scope.row.batchState == 0 ? "正常" : "撤销登账" }}
+        </template>
+      </el-table-column>
     </el-table>
   </div>
 </template>
@@ -88,6 +122,7 @@ import {
   productInvoiceInfo,
   outboundOrderInfo,
   printOutsourceOrderList,
+  printOutsourceOrder,
 } from "@/api/tablelist/commonTable";
 import { listOldRecord } from "@/api/system/oldRecord.js";
 import { mapState } from "vuex";
@@ -97,12 +132,14 @@ export default {
   components: {},
   data() {
     return {
+      batchOptions: [], //批号选项数据
       isRetail: false,
       tableShow: true,
       form: {
         unitName: "",
         remark: "",
         outStockDate: new Date(),
+        batchNumber: "",
       },
       rules: {
         // unitName: [
@@ -136,6 +173,7 @@ export default {
           label: "名称",
         },
       ],
+      allTableData: [], //所有表格数据
     };
   },
   computed: {
@@ -143,6 +181,13 @@ export default {
       username: (state) => state.user.name,
       nickName: (state) => state.user?.nickName,
     }),
+    isCanRecordBatch() {
+      return (
+        (this.form.batchNumber != "" ||
+          this.tableData.some((item) => item.batchState == "1")) &&
+        !this.tableData.length
+      );
+    },
   },
   watch: {
     isRetail(val) {
@@ -153,6 +198,58 @@ export default {
     },
   },
   methods: {
+    // 记录批次回调
+    async myRecordBatchHandler(row, btnData) {
+      let payload = this.tableData.map((item) => {
+        let { saleNo } = this.currentRow;
+        return {
+          accountingType: "1",
+          accountsReceivableDate: new Date(),
+          saleNo,
+          noticeNumber: item.noticeNumber,
+          // saleProductNo: item.saleProductNo,
+          productId: item.productId,
+          productName: item.productName,
+          productSpecifications: item.productSpecifications,
+          productColour: item.productColour,
+          productId: item.productId,
+          lotNumber: item.lotNumber,
+          weight: item.productNumber,
+          productPrice: item.productUnitPrice,
+          amountReceivable: Number(
+            (
+              Number(item.productNumber) * Number(item.productUnitPrice)
+            ).toFixed(2)
+          ),
+          billingType: "1",
+          accountsReceivableRemark: this.form.remark,
+          receivedAmount: 0,
+          status: 1,
+          boxNum: item.boxNum,
+          productLevel: item.productLevel,
+          returnReceipt: "0",
+        };
+      });
+      let result = await printOutsourceOrder(payload);
+      if (result.code == 200) {
+        this.$message.success("记录成功");
+      } else {
+        throw new Error(result.msg);
+      }
+    },
+    // 批次改变回调
+    batchChangeHandler(val) {
+      // if (val) {
+      this.tableData = JSON.parse(
+        JSON.stringify(
+          this.allTableData.filter((v) => v.batchNumber == val) || []
+        )
+      );
+      // }
+      // else {
+      //   this.tableData = JSON.parse(JSON.stringify(this.allTableData));
+      // }
+    },
     // 重置表单
     resetForm() {
       Object.assign(this.form, {
@@ -201,10 +298,32 @@ export default {
             item.unit = "";
           });
           this.tableData = res.data;
+          this.allTableData = JSON.parse(JSON.stringify(res.data));
+          this.getBatchOptions(res.data); //获取批号选项数据
+          this.batchChangeHandler(""); //默认显示当前批次数据
           this.isRetail = isRetail;
         }
       } catch (error) {}
     },
+    // 获取批号选项数据
+    getBatchOptions(rows) {
+      let batchOptions = [];
+      rows.forEach((row) => {
+        if (
+          !batchOptions.find((item) => item.value == row.batchNumber)?.value
+        ) {
+          batchOptions.push({
+            value: row.batchNumber,
+            label: row.batchNumber,
+          });
+        }
+      });
+      batchOptions.push({
+        value: "",
+        label: "当前批次",
+      });
+      this.batchOptions = batchOptions;
+    },
     // 获取打印数据
     async getPrintData() {
       let res = {

+ 5 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/oldOutBound.vue

@@ -76,6 +76,11 @@
       <el-table-column :label="'数量'" prop="actualWeight"></el-table-column>
       <el-table-column label="单价" prop="productUnitPrice"></el-table-column>
       <el-table-column label="金额" prop="productAmounts"></el-table-column>
+      <!-- <el-table-column label="批次状态" prop="batchState">
+        <template slot-scope="scope">
+          {{ scope.row.batchState == 0 ? "正常" : "撤销登账" }}
+        </template>
+      </el-table-column> -->
     </el-table>
   </div>
 </template>

+ 44 - 9
zkqy-ui/src/views/orderMange/index.vue

@@ -1293,14 +1293,13 @@ export default {
                 returnReceipt: "0",
               };
             });
-            let result = await printOutsourceOrder(payload);
-            // return;
-            if (result.code == 200) {
-              res.data.form.printUser = this.nickName;
-              outBoundPrint(res.data, "printDom", false);
-            } else {
-              throw new Error(result.msg);
-            }
+            // let result = await printOutsourceOrder(payload);
+            // if (result.code == 200) {
+            res.data.form.printUser = this.nickName;
+            outBoundPrint(res.data, "printDom", false);
+            // } else {
+            //   throw new Error(result.msg);
+            // }
           } else {
             res.data.form.printUser = this.nickName;
             oldOutBoundPrint(res.data, "printDom", false);
@@ -1749,6 +1748,14 @@ export default {
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
             }
+            // {
+            //   btnName: "记录批次",
+            //   btnType: "recordBatch",
+            //   btnIcon: "",
+            //   btnShowCondition: "",
+            //   children: [],
+            //   btnHasPermi: "huaxian:xsglddgl:INSERT",
+            // }
           );
           // }
 
@@ -3483,7 +3490,7 @@ export default {
         this.$refs.deliverRef.productInvoiceInfo(row);
       });
     },
-    // 出库详情回调
+    // 出库明细回调
     handleOutDetail(row) {
       this.outStockShow = true;
       this.$nextTick(() => {
@@ -3542,10 +3549,38 @@ export default {
         case "deliver": //发货
           this.myDeliverHandler(row, btnData);
           break;
+        case "recordBatch": //记录批次
+          this.myRecordBatchHandler(row, btnData);
+          break;
         default:
           break;
       }
     },
+    // 记录批次回调
+    async myRecordBatchHandler(row, btnData) {
+      console.log(row);
+      // return;
+      this.$confirm("请确认是否记录批次?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          let result = await printOutsourceOrder({ saleNo: row.saleNo });
+          if (result.code == 200) {
+            res.data.form.printUser = this.nickName;
+            outBoundPrint(res.data, "printDom", false);
+          } else {
+            throw new Error(result.msg);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消完成",
+          });
+        });
+    },
     // 完成回调
     async myComplateHandler(row) {
       this.$confirm("即将确认完成, 是否继续?", "提示", {