Эх сурвалжийг харах

添加英文码单打印/修改码单编码获取逻辑

lph 1 жил өмнө
parent
commit
e86d537a8a

+ 8 - 0
zkqy-ui/src/api/codeListManage/productCodeList.js

@@ -92,5 +92,13 @@ export function getPrintData(id) {
     baseURL: process.env.VUE_APP_BASE_API1
   })
 }
+// 获取箱号编码接口
+export function getQrCode(id) {
+  return request({
+    url: `/system/productCodeList/getQrCode`,
+    method: 'get',
+    baseURL: process.env.VUE_APP_BASE_API1
+  })
+}
 
 

+ 155 - 34
zkqy-ui/src/utils/print/codeListPrint.js

@@ -1,7 +1,6 @@
 import moment from 'moment'
 import QRCode from 'qrcodejs2'
 import { v4 as uuidv4 } from "uuid";
-
 function codeListPrint(data, domId) {
   if (data.length == 0) {
     return
@@ -28,7 +27,7 @@ function codeListPrint(data, domId) {
       grossWeight,//毛重
       suttle,//净重
       workShifts,//班次
-      tubecolor,//管色
+      tubeColor,//管色
       boxOrderNum, //生成的随机码
       myNO,//箱号
       productionDate, //日期
@@ -40,19 +39,96 @@ function codeListPrint(data, domId) {
       levels,//等级
       directionOfTwist,//捻向
       qrCodeData,
-      boxNumber//箱号
+      boxNumber,//箱号
+      packaging
     } = item
-    let theNumber = Number(printFormat) //小包装:1  大包装:2
+    // let theNumber = Number(printFormat) //小包装:1  大包装:2
+    let theNumber = packaging == 3 ? 2 : 1;  //车丝和小包装都是1  大包装是2
+
+    console.log(theNumber);
+    // 循环打印
     while (theNumber > 0) {
       let uuid = uuidv4().slice(0, 8);
       theNumber--;
-      res += preHtml;
+      res += (printFormat == 3 ? '' : preHtml);
       // let qrCodeData = '123456';
-      uuidList.push({
-        id: uuid,
-        qrCodeData: qrCodeData
-      })
-      res += `<div style="width: 100%;display: flex;justify-content: center;margin:5px 0;">
+
+      if (printFormat == 3) {//打印英文版
+        uuidList.push({
+          id: uuid,
+          qrCodeData: qrCodeData,
+          size: 150,
+        })
+        res = printEN(uuid, item, res)
+      } else {//打印中文版
+        uuidList.push({
+          id: uuid,
+          qrCodeData: qrCodeData,
+          size: 120,
+        })
+        res = printCN(uuid, item, res) + endHtml;
+      }
+    }
+  }
+  var printWindow = window.open('', '_blank', 'height=500,width=800');
+  printWindow.document.write('<html><head><title>Print Element</title>');
+  printWindow.document.write('</head><body >');
+  printWindow.document.write(res);
+  printWindow.document.write('</body></html>');
+  // printWindow.document.close();
+  // printWindow.document.body.innerHTML = document.getElementById(domId).innerHTML = res;
+  console.log(res);
+  console.log(printWindow.document);
+  for (var i = 0; i < uuidList.length; i++) {
+    let data = uuidList[i]
+    console.log(data.id);
+    new QRCode(printWindow.document.getElementById("" + data.id), {
+      text: sleep(2) + data.qrCodeData,
+      width: data.size,
+      height: data.size,
+      colorDark: "#000000",
+      colorLight: "#ffffff",
+      correctLevel: QRCode.CorrectLevel.H,
+    });
+  }
+  printWindow.print();//打印
+  // window.location.reload();
+  return false;
+}
+// 延迟
+function sleep(ms) {
+  var unixtime_ms = new Date().getTime();
+  while (new Date().getTime() < unixtime_ms + ms) { }
+  return "";
+}
+
+// 打印中文版
+function printCN(uuid, item, res) {
+  let {
+    qrCode,//序号
+    machineTool,//机台
+    boxWeight,//箱重-车重
+    canisterweight,//筒重
+    canisterNum,//筒数
+    grossWeight,//毛重
+    suttle,//净重
+    workShifts,//班次
+    tubeColor,//管色
+    boxOrderNum, //生成的随机码
+    myNO,//箱号
+    productionDate, //日期
+    printFormat, //格式
+    productName, //产品名
+    productSpecifications, //规格
+    productColor, //色泽
+    lotNum, //批次
+    levels,//等级
+    directionOfTwist,//捻向
+    qrCodeData,
+    boxNumber,//箱号
+    packaging
+  } = item
+  res += `<div style="width: 100%;display: flex;justify-content: center;margin:5px 0;">
       <div id="${uuid}" style="width: 120px;height: 120px;"></div>
     </div>
     <table style="width: 100%;border-collapse:collapse;" cellpadding="10" border="1">
@@ -77,7 +153,7 @@ function codeListPrint(data, domId) {
       </tr>
       <tr style="text-align: center;">
         <td style="width: 100px;" colspan="1">筒数</td>
-        <td style="width: 300px;">${canisterNum}&ensp;&ensp;&ensp;${tubecolor}</td>
+        <td style="width: 300px;">${canisterNum}&ensp;&ensp;&ensp;${tubeColor}</td>
         <td style="width: 100px;" colspan="1">捻向</td>
         <td style="width: 300px;" colspan="2">${directionOfTwist}</td>
       </tr>
@@ -94,30 +170,75 @@ function codeListPrint(data, domId) {
         <td style="width: 300px;font-size: 20px;font-weight: 500;" colspan="2">${suttle}</td>
       </tr>
     </table>`
-      res += endHtml;
-    }
-  }
-  document.body.innerHTML = document.getElementById(domId).innerHTML = res;
-  for (var i = 0; i < uuidList.length; i++) {
-    let data = uuidList[i]
-    new QRCode(document.getElementById("" + data.id), {
-      text: sleep(1) + data.qrCodeData,
-      width: 120,
-      height: 120,
-      colorDark: "#000000",
-      colorLight: "#ffffff",
-      correctLevel: QRCode.CorrectLevel.H,
-    });
-  }
-  window.print();//打印
-  // window.location.reload();
-  return false;
+
+  return res;
 }
-// 延迟
-function sleep(ms) {
-  var unixtime_ms = new Date().getTime();
-  while (new Date().getTime() < unixtime_ms + ms) { }
-  return "";
+function printEN(uuid, item, res) {
+  let {
+    qrCode,//序号
+    machineTool,//机台
+    boxWeight,//箱重-车重
+    canisterweight,//筒重
+    canisterNum,//筒数
+    grossWeight,//毛重
+    suttle,//净重
+    workShifts,//班次
+    tubeColor,//管色
+    boxOrderNum, //生成的随机码
+    myNO,//箱号
+    productionDate, //日期
+    printFormat, //格式
+    productName, //产品名
+    productSpecifications, //规格
+    productColor, //色泽
+    lotNum, //批次
+    levels,//等级
+    directionOfTwist,//捻向
+    qrCodeData,
+    boxNumber,//箱号
+    packaging
+  } = item
+  res += `<div style="width: 800px;position: relative;">
+    <table style="width: 100%;border-collapse:collapse;" cellpadding="10" border="1">
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">GRADE:</td>
+        <td style="width: 700px; font-size: 20px;font-weight: 600;" colspan="2">${levels}&ensp;&ensp;&ensp;${productSpecifications}</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">LOT NO.:</td>
+        <td style="width: 700px;" colspan="2">${qrCode}YL</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">COLOR NO.:</td>
+        <td style="width: 700px;font-size: 20px;font-weight: 600;" colspan="2">${productColor}&ensp;&ensp;&ensp;${lotNum}</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">CONE NO.:</td>
+        <td style="width: 550px;">${canisterNum}</td>
+        <td style="width: 150px;" rowspan="3">
+          <div style="width: 100%;display: flex;justify-content: center;margin:5px 0;">
+            <div id="${uuid}" style="width: 150px;height: 150px;background-color: aqua;"></div>
+          </div>
+        </td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">NET WEIGHT:</td>
+        <td style="width: 550px;font-size: 20px;font-weight: 600;">${suttle}</td>
+        <!-- <td style="width: 150px;"></td> -->
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">GROSS WEIGHT:</td>
+        <td style="width: 550px;font-size: 20px;font-weight: 600;">${grossWeight}</td>
+        <!-- <td style="width: 150px;"></td> -->
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">CARTON NO:</td>
+        <td style="width: 700px;" colspan="2">${boxNumber}</td>
+      </tr>
+    </table>
+  </div>`
+
+  return res;
 }
 
 export default codeListPrint

+ 49 - 45
zkqy-ui/src/views/login.vue

@@ -14,11 +14,11 @@
         <el-col :span="12" class="comlogo"></el-col>
         <el-col :span="12">
           <div class="grid-content bg-purple-dark title">
-            工业应用操作系统
+            <!-- 工业应用操作系统 -->
+            生产协同管理系统
             <!-- 智能制造平台 -->
           </div>
-        </el-col
-        >
+        </el-col>
       </el-row>
       <el-row class="rowww">
         <el-col :span="12" class="text" prop="username">用户名</el-col>
@@ -60,7 +60,7 @@
           </el-col>
           <el-col :span="4" :offset="1">
             <div class="login-code">
-              <img :src="codeUrl" @click="getCode" class="login-code-img"/>
+              <img :src="codeUrl" @click="getCode" class="login-code-img" />
             </div>
           </el-col>
         </el-row>
@@ -71,9 +71,8 @@
           <img :src="codeUrl" @click="getCode" class="login-code-img" />
         </div> -->
         <el-checkbox v-model="loginForm.rememberMe" class="aaa"
-        >在这个设备上记住我
-        </el-checkbox
-        >
+          >在这个设备上记住我
+        </el-checkbox>
       </el-row>
 
       <el-row>
@@ -81,19 +80,18 @@
           class="logg"
           :loading="loading"
           @click.native.prevent="handleLogin"
-        >登录
-        </el-col
-        >
+          >登录
+        </el-col>
       </el-row>
     </el-form>
   </div>
 </template>
 
 <script>
-import {getCodeImg, isTenantExist} from "@/api/login";
-import {changeDatasource} from "@/api/dataEngine";
+import { getCodeImg, isTenantExist } from "@/api/login";
+import { changeDatasource } from "@/api/dataEngine";
 import Cookies from "js-cookie";
-import {encrypt, decrypt} from "@/utils/jsencrypt";
+import { encrypt, decrypt } from "@/utils/jsencrypt";
 
 export default {
   name: "Login",
@@ -110,16 +108,16 @@ export default {
         rememberMe: false,
         code: "",
         uuid: "",
-        tenantID: ""
+        tenantID: "",
       },
       loginRules: {
         username: [
-          {required: true, trigger: "blur", message: "请输入您的账号"},
+          { required: true, trigger: "blur", message: "请输入您的账号" },
         ],
         password: [
-          {required: true, trigger: "blur", message: "请输入您的密码"},
+          { required: true, trigger: "blur", message: "请输入您的密码" },
         ],
-        code: [{required: true, trigger: "blur", message: "请输入验证码"}],
+        code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
       },
       loading: true,
       // 验证码开关
@@ -140,35 +138,36 @@ export default {
     },
   },
   created() {
-    this.validateTenantId()
+    this.validateTenantId();
   },
   methods: {
     // 校验url
     validateTenantId() {
-      let tenantCode = this.$route.query['tenantCode']
+      let tenantCode = this.$route.query["tenantCode"];
       if (tenantCode != null) {
         // 得到tenantId 查询裤中是否存在该租户
-        isTenantExist({tenantCode: tenantCode}).then(res => {
+        isTenantExist({ tenantCode: tenantCode }).then((res) => {
           if (res == undefined) {
-            this.$message.warning("请访问正确地址!")
-            this.$router.push({path: "/401"})
-          } else if (res.data?.tenantId) { // 判断当前编号是否存在库中
+            this.$message.warning("请访问正确地址!");
+            this.$router.push({ path: "/401" });
+          } else if (res.data?.tenantId) {
+            // 判断当前编号是否存在库中
             this.tenantId = res.data.tenantId;
             this.loginForm.tenantID = this.tenantId;
             if (res.data.loginPageConfiguration != null) {
               // 得到租户的信息
-              this.config = res.data.loginPageConfiguration
+              this.config = res.data.loginPageConfiguration;
               this.setConfig();
             }
             this.getCode();
             this.getCookie();
           } else {
             // 当前访问链接中的租户编号不存在
-            this.$router.push({path: "/401"})
+            this.$router.push({ path: "/401" });
           }
-        })
+        });
       } else {
-        this.$router.push({path: "/401"})
+        this.$router.push({ path: "/401" });
       }
     },
     setConfig() {
@@ -188,9 +187,12 @@ export default {
             process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
           })`;
 
-          console.log("" + `url(${
-            process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
-          })`)
+          console.log(
+            "" +
+              `url(${
+                process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
+              })`
+          );
         }
       }
 
@@ -265,7 +267,7 @@ export default {
         if (valid) {
           this.loading = true;
           if (this.loginForm.rememberMe) {
-            Cookies.set("username", this.loginForm.username, {expires: 30});
+            Cookies.set("username", this.loginForm.username, { expires: 30 });
             Cookies.set("password", encrypt(this.loginForm.password), {
               expires: 30,
             });
@@ -279,18 +281,20 @@ export default {
           }
           let form = {
             ...this.loginForm,
-            tenantID: this.tenantId
-          }
-          this.$store.dispatch("Login", form).then(() => {
-            changeDatasource(); //切换数据源
-            this.$router.push({path: this.redirect || "/"}).catch(() => {
+            tenantID: this.tenantId,
+          };
+          this.$store
+            .dispatch("Login", form)
+            .then(() => {
+              changeDatasource(); //切换数据源
+              this.$router.push({ path: this.redirect || "/" }).catch(() => {});
+            })
+            .catch(() => {
+              this.loading = false;
+              if (this.captchaEnabled) {
+                this.getCode();
+              }
             });
-          }).catch(() => {
-            this.loading = false;
-            if (this.captchaEnabled) {
-              this.getCode();
-            }
-          });
         }
       });
     },
@@ -348,9 +352,9 @@ export default {
   opacity: 1;
   border-radius: 27px;
   background: linear-gradient(
-      135deg,
-      rgba(79, 138, 255, 1) 0%,
-      rgba(75, 94, 255, 1) 100%
+    135deg,
+    rgba(79, 138, 255, 1) 0%,
+    rgba(75, 94, 255, 1) 100%
   );
   box-shadow: 0px 4px 16px rgba(179, 192, 231, 1);
   color: #fff;

+ 195 - 22
zkqy-ui/src/views/orderMange/codeListManage/index.vue

@@ -125,9 +125,9 @@
       <el-table-column label="色泽" align="center" prop="productColor" />
       <!-- <el-table-column label="货品编号" align="center" prop="productId" /> -->
       <el-table-column label="等级" align="center" prop="levels" />
-      <el-table-column label="筒数" align="center" prop="canisterNum" />
-      <el-table-column label="箱数" align="center" prop="boxNum" />
-      <el-table-column label="净重" align="center" prop="suttle" />
+      <el-table-column label="筒数" align="center" prop="totalCanisterNum" />
+      <el-table-column label="箱数" align="center" prop="totalBoxNum" />
+      <el-table-column label="净重" align="center" prop="totalSuttle" />
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column
         label="操作"
@@ -297,12 +297,28 @@
                 >打印</el-button
               > -->
               <el-button
+                v-if="!isDisabled"
                 :disabled="tableData.length != 1"
                 type="primary"
                 size="mini"
                 @click="getOrderData"
                 >{{ excuteType == 1 ? "箱单" : "保存修改" }}</el-button
               >
+              <el-button
+                :disabled="tableData.length < 2"
+                type="primary"
+                size="mini"
+                @click="chooseOneToPrint"
+                >{{ chooseState ? "退出批箱单" : "批箱单" }}</el-button
+              >
+              <el-button
+                :disabled="tableData.length != 1"
+                type="primary"
+                size="mini"
+                v-if="excuteType == 3"
+                @click="supplementCodeHandler"
+                >补码</el-button
+              >
             </div>
             <div class="msg" v-if="orderData.boxNo">
               <div class="msg-item">
@@ -318,6 +334,7 @@
             border
             stripe
             style="width: 100%; margin-bottom: 5px"
+            @cell-click="handlePrintOneChange"
           >
             <el-table-column
               type="index"
@@ -341,7 +358,9 @@
             <el-table-column prop="grossWeight" label="毛重">
               <template slot-scope="scope">
                 <el-input
+                  :disabled="isDisabled"
                   v-model="scope.row.grossWeight"
+                  @input="changeGrossWeight(scope.row)"
                   size="mini"
                   clearable
                 ></el-input>
@@ -356,6 +375,7 @@
                 <el-button
                   type="danger"
                   size="mini"
+                  :disabled="chooseState"
                   @click="handleDeleteOne(scope.$index)"
                   >删除</el-button
                 >
@@ -406,6 +426,7 @@
               label-width="80px"
               :inline="false"
               size="normal"
+              :disabled="isDisabled"
             >
               <el-col :span="8">
                 <el-form-item prop="packaging" label="包装">
@@ -627,14 +648,15 @@
               placeholder="请输入批号"
               size="mini"
               clearable
-              @change="batchNumChange"
+              @input="batchNumChange"
               @keyup.enter.native="batchNumChange"
+              :disabled="isDisabled"
             ></el-input>
             <el-button
               class="ml10"
               type="primary"
               size="mini"
-              :disabled="!currentRow.lotNum"
+              :disabled="!currentRow.lotNum || isDisabled"
               @click="addProductHandler"
               >添加</el-button
             >
@@ -682,15 +704,18 @@ import {
   productCodeList,
   getPrintData,
   updateProductCodeList,
+  getQrCode,
 } from "@/api/codeListManage/productCodeList";
 import codeListPrint from "@/utils/print/codeListPrint";
-import { async } from "@/components/updateModule/k-form-design/lib/k-form-design.common";
+
 export default {
   name: "ProductCodeList",
   dicts: ["packaging_type", "port", "coding_list_format"],
   data() {
     return {
       // 自定义数据 start
+      printTableData: [], //需要打印的数据
+      chooseState: false, //批箱单打印状态
       excuteType: false, //1:新增   2:编辑   3:补码
       lineOptions: [], //机台选项数据
       orderData: {
@@ -860,7 +885,23 @@ export default {
       immediate: true,
     },
   },
+  computed: {
+    isDisabled() {
+      return this.excuteType == 3;
+    },
+  },
   methods: {
+    // 毛重改变回调
+    changeGrossWeight(row) {
+      console.log(row);
+      let { boxWeight, grossWeight, canisterWeight, canisterNum } = row;
+      if (!Number(grossWeight)) return;
+      row.suttle = (
+        Number(grossWeight) -
+        Number(boxWeight) -
+        Number(canisterWeight) * Number(canisterNum)
+      ).toFixed(2);
+    },
     // 删除表格一条数据回调
     handleDeleteOne(index) {
       this.tableData.splice(index, 1);
@@ -872,11 +913,11 @@ export default {
         return;
       }
 
-      console.log("打印", this.tableData);
-      this.tableData.forEach((item) => {
+      console.log("打印", this.printTableData);
+      this.printTableData.forEach((item) => {
         item.qrCodeData = printData + "-" + item.boxNumber;
       });
-      codeListPrint(this.tableData, "printDom");
+      codeListPrint(this.printTableData, "printDom");
     },
     // 获取机台选项数据
     async getLineOptionLsit() {
@@ -913,18 +954,23 @@ export default {
           try {
             let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
               this.count;
-            let rowData = this.tableData[0];
+            let rowData = JSON.parse(JSON.stringify(this.tableData[0]));
+            this.printTableData = [rowData];
             let payLoad = {
               ...this.form,
               qrCode: rowData.qrCode,
               lotNum: rowData.lotNum,
-              boxNum: sumBoxNum,
+              // boxNum: sumBoxNum,
+              boxNum: rowData.boxNumber,
               productId: rowData.productId,
-              cartonNumber: sumCanisterNum,
-              suttle: sumSuttle,
-              grossWeight: sumGrossWeight,
+              // cartonNumber: rowData.canisterWeight,
+              suttle: rowData.suttle,
+              grossWeight: rowData.grossWeight,
               productCodeListInfoList: this.tableData,
             };
+            if (rowData.id) {
+              payLoad.id = rowData.id;
+            }
             let tempApiFun = productCodeList;
             if (this.excuteType == 1) {
               tempApiFun = productCodeList;
@@ -937,8 +983,10 @@ export default {
               this.$message.success(`${msg}箱单成功`);
               if (this.excuteType != 1) {
                 this.printShow = false;
+                this.getList();
                 return;
               }
+              this.tableData[0].id = res.data;
               this.printConfirmHandler(res.data);
             } else {
               console.log(res);
@@ -950,6 +998,19 @@ export default {
         }
       });
     },
+    // 选择一个打印
+    chooseOneToPrint() {
+      this.chooseState = !this.chooseState; //开启选择状态
+      if (this.chooseState) {
+        this.$message.info("请选择打印的箱单");
+      } else {
+        this.$message.info("退出批箱单状态");
+      }
+    },
+    supplementCodeHandler() {
+      console.log(this.form.id);
+      this.printConfirmHandler(this.form.id);
+    },
     // 箱单号生成函数
     getBoxOrderNum() {
       let year = (new Date().getFullYear() + "").slice(-2);
@@ -975,10 +1036,11 @@ export default {
     },
     // 添加按钮回调
     addProductHandler() {
-      this.$refs.form.validate((valid) => {
+      this.$refs.form.validate(async (valid) => {
         if (valid) {
           let {
             machineTool,
+            packaging,
             boxWeight,
             canisterWeight,
             canisterNum,
@@ -1000,8 +1062,17 @@ export default {
             directionOfTwist,
             productId,
           } = this.currentRow;
+          let res = await getQrCode();
+          let qrCode = "";
+          if (res.code == 200) {
+            qrCode = res.msg;
+          } else {
+            this.$message.error(res.msg);
+          }
           this.tableData.push({
-            qrCode: this.getBoxOrderNum(), //箱单号
+            // qrCode: this.getBoxOrderNum(), //箱单号
+            packaging, //包装方式 1:车丝 2:小包装  3:大包装
+            qrCode, //箱单号
             levels,
             machineTool,
             boxWeight,
@@ -1010,7 +1081,8 @@ export default {
             workShifts,
             tubeColor,
             grossWeight: 0, //毛重
-            suttle: this.getSuttle(), //净重
+            // suttle: this.getSuttle(), //净重
+            suttle: 0, //净重
             boxNumber: this.tableData.length + 1, //序号
             productionDate, //日期
             printFormat, //格式
@@ -1034,10 +1106,70 @@ export default {
       return (Number(boxWeight) - canisterWeight * canisterNum).toFixed(2);
     },
     // 表格点击回调
-    handleCurrentChange(val) {
+    async handleCurrentChange(val) {
       console.log("row", val);
       this.currentRow = JSON.parse(JSON.stringify(val));
     },
+    // 选择打印数据回调
+    handlePrintOneChange(row) {
+      console.log(row);
+      if (!this.chooseState) return;
+      this.$alert("是否确定打印该数据", "确认打印", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        callback: (action) => {
+          if (action === "confirm") {
+            this.$refs.form.validate(async (valid) => {
+              if (valid) {
+                try {
+                  let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
+                    this.count;
+                  let rowData = JSON.parse(JSON.stringify(row));
+                  this.printTableData = [rowData];
+                  let payLoad = {
+                    ...this.form,
+                    qrCode: rowData.qrCode,
+                    lotNum: rowData.lotNum,
+                    boxNum: rowData.boxNumber,
+                    productId: rowData.productId,
+                    // cartonNumber: rowData.canisterWeight,
+                    suttle: rowData.suttle,
+                    grossWeight: rowData.grossWeight,
+                    productCodeListInfoList: this.tableData,
+                  };
+                  if (rowData.id) {
+                    payLoad.id = rowData.id;
+                  }
+                  let tempApiFun = productCodeList;
+                  if (this.excuteType == 1) {
+                    tempApiFun = productCodeList;
+                  } else if (this.excuteType == 2) {
+                    tempApiFun = updateProductCodeList;
+                  }
+                  let res = await tempApiFun(payLoad);
+                  let msg = this.isEdit ? "编辑" : "新增";
+                  if (res.code == 200) {
+                    // this.$message.success(`${msg}箱单成功`);
+                    if (this.excuteType != 1) {
+                      this.printShow = false;
+                      this.getList();
+                      return;
+                    }
+                    row.id = res.data;
+                    this.printConfirmHandler(res.data);
+                  } else {
+                    console.log(res);
+                    this.$message.error(`${msg}箱单失败`);
+                  }
+                } catch (error) {
+                  console.error(error);
+                }
+              }
+            });
+          }
+        },
+      });
+    },
     // 获取所有批次数据
     async getAllBatchData() {
       try {
@@ -1157,10 +1289,9 @@ export default {
       this.reset();
       const id = row.id || this.ids;
       getPrintData(id).then(async (response) => {
-        console.log(response);
-        this.isEdit = 2;
+        this.excuteType = 2;
         this.form = response.data;
-        this.tableData = response.data.productCodeListInfoList;
+        this.tableData = response.data.productCodeListInfoList || [];
         await this.getAllBatchData(); //获取所有产品数据
         await this.getLineOptionLsit(); //获取机台选项数据
         await this.getSelectOptions();
@@ -1168,7 +1299,49 @@ export default {
       });
     },
     // 补码回调
-    supplementCode() {},
+    supplementCode(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      getPrintData(id).then(async (response) => {
+        this.excuteType = 3; //补码
+        this.form = response.data;
+        this.tableData = response.data.productCodeListInfoList;
+        await this.getAllBatchData(); //获取所有产品数据
+        await this.getLineOptionLsit(); //获取机台选项数据
+        await this.getSelectOptions();
+        this.initProductData();
+        this.printShow = true;
+      });
+    },
+    // 初始化产品相关数据
+    initProductData() {
+      this.batchNum = this.form.lotNum;
+      this.batchNumChange();
+      if (Object.keys(this.currentRow).length) {
+        let {
+          machineTool,
+          boxWeight,
+          canisterWeight,
+          canisterNum,
+          grossWeight,
+          suttle, //净重
+          workShifts, //班次
+          tubeColor,
+          productionDate,
+          printFormat,
+          levels,
+          remark,
+        } = this.form;
+        let {
+          productName,
+          productSpecifications,
+          productColor,
+          lotNum,
+          directionOfTwist,
+          productId,
+        } = this.currentRow;
+      }
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate((valid) => {

+ 52 - 0
zkqy-ui/src/views/orderMange/codeListManage/testEnglish.html

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>Document</title>
+</head>
+
+<body>
+  <div style="width: 800px;position: relative;">
+    <table style="width: 100%;border-collapse:collapse;" cellpadding="10" border="1">
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">GRADE:</td>
+        <td style="width: 700px; font-size: 20px;font-weight: 600;" colspan="2">AA&ensp;&ensp;&ensp;100D</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">LOT NO.:</td>
+        <td style="width: 700px;" colspan="2">20230310YL</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">COLOR NO.:</td>
+        <td style="width: 700px;font-size: 20px;font-weight: 600;" colspan="2">003&ensp;&ensp;&ensp;22-0</td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">CONE NO.:</td>
+        <td style="width: 550px;">20</td>
+        <td style="width: 150px;" rowspan="3">
+          <div style="width: 100%;display: flex;justify-content: center;margin:5px 0;">
+            <div style="width: 150px;height: 150px;background-color: aqua;"></div>
+          </div>
+        </td>
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">NET WEIGHT:</td>
+        <td style="width: 550px;font-size: 20px;font-weight: 600;">16.40</td>
+        <!-- <td style="width: 150px;"></td> -->
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">GROSS WEIGHT:</td>
+        <td style="width: 550px;font-size: 20px;font-weight: 600;">20.00</td>
+        <!-- <td style="width: 150px;"></td> -->
+      </tr>
+      <tr style="text-align: center;">
+        <td style="width: 100px;" colspan="1">CARTON NO:</td>
+        <td style="width: 700px;" colspan="2">3</td>
+      </tr>
+    </table>
+  </div>
+</body>
+
+</html>