From 2f068c5676bc618c5a49d4e6b468b95c5455abb0 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 13 十月 2026 14:33:10 +0800
Subject: [PATCH] 修改二维码样式

---
 common/http.api.js                                  |    4 ++
 pages/wareHouse/nuclearScale/nuclearscalerecord.vue |  110 ++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 96 insertions(+), 18 deletions(-)

diff --git a/common/http.api.js b/common/http.api.js
index 3967008..a280d81 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -575,6 +575,10 @@
 			queryPacking: (params = {}) => vm.$u.get('/mes/weighingVerification/queryPacking', params),
 			// 鏍哥鎵爜鏌ヨ瀹㈡埛鍚嶇О
 			queryCustomName: (params = {}) => vm.$u.get('/mes/weighingVerification/queryCustomName', params),
+			// 鍙戣揣閫氱煡鍗曞垎椤垫煡璇紙鎸夊彂璐ч�氱煡鍗曞彿锛�
+			queryDeliveryNotice: (params = {}) => vm.$u.get('/mes/deliveryNotice/page', params),
+			// 鍙戣揣閫氱煡鍗曡鎯咃紙鍚鍗曡鏄庣粏锛屽彇璁㈠崟琛岄渶姹傛暟閲� buyQtyDue锛�
+			getDeliveryNoticeById: (params = {}) => vm.$u.get('/mes/deliveryNotice/getDeliveryNoticeById', params),
 		},
 		// 鍙栨秷棰嗘枡
 		cancelMaterialRequisition: {
diff --git a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
index ed66e15..6d6c58e 100644
--- a/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
+++ b/pages/wareHouse/nuclearScale/nuclearscalerecord.vue
@@ -235,6 +235,8 @@
       errorMessage: "", // 閿欒淇℃伅
       verificationNo: "",
       failedPrintJobs: [],
+      demandQtyMap: {}, // 璁㈠崟琛岄渶姹傛暟閲忕紦瀛橈細鍙戣揣閫氱煡鍗曞彿|璁㈠崟鍙穦琛屽彿 -> buyQtyDue
+      loadedNoticeNos: [], // 宸插姞杞借繃鏄庣粏鐨勫彂璐ч�氱煡鍗曞彿
     };
   },
   computed: {
@@ -347,6 +349,52 @@
     },
     checkBluetoothConnection() {
       return bluetooth.isConnected();
+    },
+
+    // 鎷夊彇鍙戣揣閫氱煡鍗曟槑缁嗭紝缂撳瓨姣忎釜璁㈠崟琛岀殑闇�姹傛暟閲忥紙buyQtyDue锛�
+    async loadNoticeLineDemandQty(shippingNoticeNo) {
+      if (
+        !shippingNoticeNo ||
+        this.loadedNoticeNos.indexOf(shippingNoticeNo) > -1
+      ) {
+        return;
+      }
+      const noticeRes = await this.$u.api.NuclearScaleEntry.queryDeliveryNotice({
+        noticeNo: shippingNoticeNo,
+        current: 1,
+        size: 10,
+      });
+      const notices = (noticeRes && noticeRes.data && noticeRes.data.records) || [];
+      const notice =
+        notices.find((item) => item.noticeNo === shippingNoticeNo) || notices[0];
+      if (!notice) {
+        throw new Error(`鏈壘鍒板彂璐ч�氱煡鍗曪細${shippingNoticeNo}`);
+      }
+      const detailRes = await this.$u.api.NuclearScaleEntry.getDeliveryNoticeById({
+        id: notice.id,
+      });
+      const lines =
+        (detailRes && detailRes.data && detailRes.data.deliveryNoticeLineList) ||
+        [];
+      lines.forEach((line) => {
+        const key = `${shippingNoticeNo}|${line.orderNo}|${line.lineNo}`;
+        this.$set(this.demandQtyMap, key, Number(line.buyQtyDue) || 0);
+      });
+      this.loadedNoticeNos.push(shippingNoticeNo);
+    },
+
+    // 鍙栧綋鍓嶆槑缁嗗搴旇鍗曡鐨勯渶姹傛暟閲忥紙鍙栦笉鍒扮洿鎺ユ姤閿欙紝閬垮厤鎵撳嚭閿欒鐨勬爣绛撅級
+    async getOrderLineDemandQty(item) {
+      const key = `${item.shippingNoticeNo}|${item.salesOrderNo}|${item.lineNo}`;
+      if (this.demandQtyMap[key] === undefined) {
+        await this.loadNoticeLineDemandQty(item.shippingNoticeNo);
+      }
+      if (this.demandQtyMap[key] === undefined) {
+        throw new Error(
+          `鏈彇鍒拌鍗曡闇�姹傛暟閲忥紙璁㈠崟${item.salesOrderNo} 琛�${item.lineNo}锛塦
+        );
+      }
+      return this.demandQtyMap[key];
     },
 
     // 	// 鐩存帴浣跨敤宸茶褰曠殑杩炴帴鐘舵�侊紝閬垮厤涓嶅繀瑕佺殑杩炴帴妫�鏌�
@@ -477,12 +525,18 @@
           const ht = item.contractNo;
           const fh = item.newNetWeight;
           const scph = item.batchNo;
+          // UQ锛氳鍗曡闇�姹傛暟閲忥紙鍙戣揣閫氱煡鍗曟槑缁� buyQtyDue锛�
+          const uq = await this.getOrderLineDemandQty(item);
 
           // ===== 鏍囩绾告帓鐗堝弬鏁帮紙鍗曚綅锛歮m锛夛細40*70 鏍囩绾� =====
           const LABEL_W = 40; // 鏍囩瀹藉害
           const LABEL_H = 70; // 鏍囩闀垮害锛堣蛋绾告柟鍚戯級
-          const MARGIN = 1; // 鍥涘懆鐣欑櫧锛岄槻姝㈡墦鍗版埅鏂�
-          const QR_SIZE = LABEL_W - MARGIN * 2; // 浜岀淮鐮侀摵婊� 40mm 瀹斤紙38mm锛�
+          const QR_MARGIN = 0; // 浜岀淮鐮佷笌绾歌竟鐣欑櫧锛�0 = 浜岀淮鐮� 40mm锛岄摵婊$焊瀹斤級
+          const QR_SIZE = LABEL_W - QR_MARGIN * 2; // 浜岀淮鐮佸昂瀵革紙40mm锛�
+          const PAGE_MARGIN = 1; // 鏍囬/鏂囧瓧鐨勪笂銆佷笅鐣欑櫧
+          const TEXT_PADDING = 1; // 鏂囧瓧鐨勫乏鍙崇暀鐧�
+          const TITLE_HEIGHT = 6; // 鏍囬琛岄珮
+          const TITLE_FONT_SIZE = 3; // 鏍囬瀛楀彿
           const TEXT_FONT_SIZE = 3; // 瀛楁瀛楀彿
 
           // 鍒濆鍖栫敾鏉匡細瀹� 40銆侀暱 70锛屼笉鍋氭棆杞紙x 涓虹焊瀹芥柟鍚戯紝y 涓鸿蛋绾告柟鍚戯級
@@ -492,21 +546,41 @@
             rotate: 0,
           });
 
-          // 缁樺埗浜岀淮鐮�
+          // 鏍囬锛氫腑澶╃鎶�瑁呯娓呭崟锛堝眳涓�佸姞绮楋級
+          this.getDrawLabelText(
+            TEXT_PADDING,
+            PAGE_MARGIN,
+            LABEL_W - TEXT_PADDING * 2,
+            TITLE_HEIGHT,
+            "涓ぉ绉戞妧瑁呯娓呭崟",
+            TITLE_FONT_SIZE,
+            0,
+            LineModeType.AutoHeight,
+            0,
+            0,
+            1,
+            1,
+            1
+          );
+
+          // 缁樺埗浜岀淮鐮侊紙瀛楁涓庨『搴忔寜鏍囩瑙勮寖锛�
           const qrContent = {
-            company: item.customerNo,
-            line_no: item.lineNo,
-            lot_batch_no: item.batchNo,
-            order_no: item.contractNo,
-            part_no: item.partNo,
-            total_qty: item.newNetWeight,
-            qty_arrived: item.newNetWeight,
-            release_no: item.relNo,
+            order_no: ht, // 璁㈠崟鍙�
+            part_no: item.partNo, // 闆朵欢鍙�
+            line_no: item.lineNo, // 琛屽彿
+            UQ: uq, // 璁㈠崟琛岄渶姹傛暟閲�
+            lot_batch_no: scph, // 鐢熶骇鎵瑰彿
+            company: item.customerNo, // 瀹㈡埛缂栧彿
+            qty_arrived: Number(item.newNetWeight) || 0, // 鍙戣揣/瑁呯鏁�
+            release_no: item.relNo, // 浜よ揣鍙�
           };
 
+          // 浜岀淮鐮佺揣璺熷湪鏍囬涓嬫柟
+          const qrTop = PAGE_MARGIN + TITLE_HEIGHT;
+
           jcapi.drawLabelQrCode({
-            x: MARGIN,
-            y: MARGIN,
+            x: QR_MARGIN,
+            y: qrTop,
             width: QR_SIZE,
             height: QR_SIZE,
             value: qrContent,
@@ -514,9 +588,9 @@
             codeType: QrCodeType.QrCode,
           });
 
-          // 鍏ㄩ儴妗嗙嚎宸插幓鎺夛紱浜岀淮鐮佷笅鏂瑰墿浣欑┖闂存í鍚戝睍绀轰笁涓瓧娈�
-          const textTop = MARGIN + QR_SIZE + MARGIN;
-          const lineHeight = (LABEL_H - MARGIN - textTop) / 3;
+          // 鍏ㄩ儴妗嗙嚎宸插幓鎺夛紱浜岀淮鐮佷笅鏂瑰墿浣欑┖闂村睍绀轰笁涓瓧娈碉紙琛岃窛鏀剁揣锛�
+          const textTop = qrTop + QR_SIZE;
+          const lineHeight = (LABEL_H - PAGE_MARGIN - textTop) / 3;
           const fields = [
             { label: "鍚堝悓鍙�", value: ht },
             { label: "鍙戣揣/瑁呯鏁�", value: fh },
@@ -529,9 +603,9 @@
                 ? ""
                 : String(field.value);
             this.getDrawLabelText(
-              MARGIN,
+              TEXT_PADDING,
               textTop + index * lineHeight,
-              LABEL_W - MARGIN * 2,
+              LABEL_W - TEXT_PADDING * 2,
               lineHeight,
               `${field.label}: ${value}`,
               TEXT_FONT_SIZE,

--
Gitblit v1.9.3