Kaynağa Gözat

修改码单打印部分字段逻辑/添加删除码单记录功能

lph 1 yıl önce
ebeveyn
işleme
a9eb8e12df

+ 36 - 6
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -137,7 +137,7 @@
                   type="danger"
                   size="mini"
                   :disabled="chooseState"
-                  @click="handleDeleteOne(scope.$index)"
+                  @click="handleDeleteOne(scope.$index, scope.row)"
                   >删除
                 </el-button>
               </template>
@@ -215,12 +215,13 @@
                     clearable
                     filterable
                     size="mini"
+                    @change="machineToolChange"
                   >
                     <el-option
                       v-for="(item, index) in lineOptions"
                       :key="index"
                       :label="item.productionLineName"
-                      :value="item.productionLineNo"
+                      :value="item.id"
                     >
                       <span class="discribe" style="float: left">{{
                         item.productionLineName
@@ -485,6 +486,7 @@ import {
   getQrCode,
   AutoPrinting,
   getPrintDataNew,
+  removeProductCodeASInventory,
 } from "@/api/codeListManage/productCodeList";
 import codeListPrint from "@/utils/print/codeListPrint";
 import { getServerPrintData } from "@/utils/print/printUtils";
@@ -541,6 +543,7 @@ export default {
       },
 
       form: {
+        machineToolNo: "", //机台编号
         // 表单参数
         packaging: "", //包装
         machineTool: "", //机台
@@ -713,6 +716,15 @@ export default {
   },
 
   methods: {
+    // 机台改变回调
+    machineToolChange(id) {
+      if (id) {
+        this.form.machineToolNo = this.lineOptions.find(
+          (item) => item.id == id
+        ).productionLineNo;
+      }
+      this.getAllBatchData(id);
+    },
     // 打印按钮回调
     async printBtnHandler() {
       let res = await this.validateAndPrint();
@@ -865,6 +877,7 @@ export default {
         printFormat,
         levels,
         remark,
+        machineToolNo,
       } = this.form;
       console.log(this.currentRow);
       let {
@@ -880,6 +893,7 @@ export default {
       )?.label;
 
       newData = {
+        machineToolNo,
         // qrCode: this.getBoxOrderNum(), //箱单号
         packaging, //包装方式 1:车丝 2:小包装  3:大包装
         qrCode: this.qrCode, //箱单号
@@ -904,6 +918,7 @@ export default {
         directionOfTwistLabel, //捻向label
         remark,
         productId,
+        qrCodeId: uuidv4().slice(0, 8),
       };
       this.getOrderData(newData);
     },
@@ -1015,8 +1030,20 @@ export default {
       console.log(row);
     },
     // 删除表格一条数据回调
-    handleDeleteOne(index) {
-      this.tableData.splice(index, 1);
+    async handleDeleteOne(index, row) {
+      console.log(row);
+      this.$modal
+        .confirm("是否确认该条打印记录?")
+        .then(function () {
+          return removeProductCodeASInventory(row);
+        })
+        .then(() => {
+          this.tableData.splice(index, 1);
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {
+          this.$modal.msgError("删除失败!请检查库存");
+        });
     },
     // 确认保存修改一条数据
     async handleSaveOne(row) {
@@ -1024,6 +1051,7 @@ export default {
         let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
           this.count;
         let rowData = JSON.parse(JSON.stringify(row));
+
         let payLoad = {
           ...this.form,
           qrCode: rowData.qrCode,
@@ -1112,6 +1140,7 @@ export default {
             this.printTableData = [rowData];
             let payLoad = {
               ...this.form,
+              qrCodeId: rowData.qrCodeId,
               qrCode: rowData.qrCode,
               lotNum: rowData.lotNum,
               // boxNum: sumBoxNum,
@@ -1397,9 +1426,10 @@ export default {
       });
     },
     // 获取所有批次数据
-    async getAllBatchData() {
+    async getAllBatchData(id) {
       try {
-        let res = await finishedProductList();
+        let payload = { machineTool: id };
+        let res = await finishedProductList(payload);
         if (res.code == 200) {
           this.batchData = res.data;
           this.batchTableData = res.data;

+ 1 - 0
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -1020,6 +1020,7 @@ export default {
         this.productionOptions = this.allProductionOptions.slice(0, 500);
       }
     },
+
     // 出库单回调
     async myPrintOutBoundHandler(row, data) {
       console.log("row", row);