From 28997825e47018a0d9b3b8e4c003b232f62d241f Mon Sep 17 00:00:00 2001 From: hao <1836460075@qq.com> Date: 星期二, 20 五月 2025 18:49:57 +0800 Subject: [PATCH] 1 --- 夏蒙注塑报工/pages/scbg/scbg.vue | 152 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 122 insertions(+), 30 deletions(-) diff --git "a/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue" "b/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue" index 683e82d..9d42411 100644 --- "a/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue" +++ "b/\345\244\217\350\222\231\346\263\250\345\241\221\346\212\245\345\267\245/pages/scbg/scbg.vue" @@ -66,9 +66,13 @@ <text>闇�姹傚崟鎹細</text> <text>{{ orderDetails.requirementDoc }}</text> </view> - <view class="order-details-column"> + <!-- <view class="order-details-column"> <text>鎺ㄨ崘鍖呰鏁帮細</text> <text>{{ orderDetails.bzsl }}</text> + </view> --> + <view class="order-details-column"> + <text>宸ュ崟鐘舵�侊細</text> + <text>{{ orderDetails.gdzt }}</text> </view> </view> <view class="order-details-row"> @@ -189,14 +193,14 @@ <view class="header-item" id="tm">鎵撳嵃鏉$爜</view> <view class="header-item" id="sl">鎵撳嵃鏁伴噺</view> <view class="header-item" id="sj">鎵撳嵃鏃堕棿</view> - <view class="header-item" id="ry">鎵撳嵃浜�</view> + <view class="header-item" id="ry">鎶ュ伐浜�</view> </view> <!-- 琛ㄦ牸鍐呭 --> <scroll-view scroll-y="true" class="history-scroll"> <view v-for="(record, index) in historyList" :key="index" class="history-record"> <view class="record-item">{{ record.itemBarcode }}</view> - <view class="record-item">{{ record.quantity || '鏈煡鏁伴噺' }}</view> + <view class="record-item">{{ record.quantity }}</view> <view class="record-item">{{ record.printDate }}</view> <view class="record-item">{{ record.printedBy }}</view> </view> @@ -204,8 +208,8 @@ </view> </view> - <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button> - </view> + <!-- <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button> + --></view> </view> </view> @@ -226,9 +230,13 @@ {{ deviceState }} </view> </view> - + <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button> + <!-- 鎸夐挳鏀惧湪鐘舵�佹枃鏈殑涓嬫柟 --> <!-- <button @click="manualCheck" class="check-button">鎵嬪姩妫�娴�</button> --> + <view class="version" v-if="version"> + 鐗堟湰鍙凤細{{ version }} + </view> </view> <!-- <button @click="createLabel()" class="dycs">鎵撳嵃娴嬭瘯</button> --> @@ -239,9 +247,7 @@ <button @click="sendForFirstInspection" class="round-btn">棣栨閫佹</button> </view> </view> - <view class="version" v-if="version"> - 鐗堟湰鍙凤細{{ version }} - </view> + </view> </template> @@ -282,6 +288,7 @@ orderQuantity: '', // 璁㈠崟鏁伴噺 producedQuantity: '', // 宸茬敓浜ф暟 bzsl: '', // 鎺ㄨ崘鍖呰鏁� + gdzt:'', itemId: '', // 鐗╂枡ID itemNo: '', // 鐗╂枡缂栫爜 itemname: '', // 鐗╂枡鍚嶇О @@ -496,9 +503,9 @@ } let res = UsbModule.isUsbConnect(); - this.deviceState = res ? "USB 杩炴帴姝e父" : "USB 杩炴帴澶辫触"; - console.log("USB 妫�娴嬬粨鏋�:", this.deviceState); - if (this.deviceState == "USB 杩炴帴澶辫触") { + this.deviceState = res ? "鎵撳嵃鏈� 杩炴帴姝e父" : "鎵撳嵃鏈� 杩炴帴澶辫触"; + console.log("鎵撳嵃鏈� 妫�娴嬬粨鏋�:", this.deviceState); + if (this.deviceState == "鎵撳嵃鏈� 杩炴帴澶辫触") { uni.showToast({ title: ` ${this.deviceState}`, @@ -520,10 +527,10 @@ } catch (error) { - console.error("USB 妫�娴嬮敊璇�:", error); - this.deviceState = "USB 妫�娴嬪け璐�"; + console.error("鎵撳嵃鏈� 妫�娴嬮敊璇�:", error); + this.deviceState = "鎵撳嵃鏈� 妫�娴嬪け璐�"; uni.showToast({ - title: "USB 妫�娴嬪け璐ワ紝璇锋鏌ユ彃浠�", + title: "鎵撳嵃鏈� 妫�娴嬪け璐ワ紝璇锋鏌ユ彃浠�", duration: 2000, icon: "none" }); @@ -590,9 +597,9 @@ console.log("111", UsbModule) let res = UsbModule.initUsbDevice(); if (res) { - this.deviceState = "USB 杩炴帴姝e父" + this.deviceState = "鎵撳嵃鏈� 杩炴帴姝e父" } else { - this.deviceState = "USB 杩炴帴澶辫触" + this.deviceState = "鎵撳嵃鏈� 杩炴帴澶辫触" } uni.showToast({ title: this.deviceState, @@ -751,7 +758,7 @@ itemBarcode: record.itemBarcode || '鏈煡鏉$爜', // 纭繚瑙f瀽瀛楁 quantity: record.quantity || '鏈煡鏁伴噺', // 鎵撳嵃鏁伴噺瀛楁 printDate: record.printDate || '鏈煡鏃堕棿', // 鎵撳嵃鏃堕棿 - printedBy: record.printedBy || '鏈煡鐢ㄦ埛' // 鎵撳嵃浜� + printedBy: record.printedBy || '' // 鎶ュ伐浜� })); console.log('History records loaded:', this.historyList); } else { @@ -911,6 +918,7 @@ productionOrder: '', // 鐢熶骇璁㈠崟 orderQuantity: '', // 璁㈠崟鏁伴噺 bzsl: '', // 鎺ㄨ崘鍖呰鏁� + gdzt:'', producedQuantity: '', // 宸茬敓浜ф暟 itemId: '', // 鐗╂枡ID itemNo: '', // 鐗╂枡缂栫爜 @@ -939,6 +947,7 @@ productionOrder: res.data.productionOrder, // 鐢熶骇璁㈠崟 orderQuantity: res.data.orderQuantity, // 璁㈠崟鏁伴噺 bzsl: res.data.bzsl, // 鎺ㄨ崘鍖呰鏁� + gdzt: res.data.gdzt, // 宸ュ崟鐘舵�� producedQuantity: res.data.producedQuantity, // 宸茬敓浜ф暟 itemId: res.data.itemId, // 鐗╂枡ID itemNo: res.data.itemNO, // 鐗╂枡缂栫爜 @@ -1041,6 +1050,61 @@ }); } }); + + // 璋冪敤 API 鑾峰彇宸ュ崟璇︽儏 + uni.request({ + url: `http://192.168.0.107:44380/api/orderDetails?orderNo=${encodeURIComponent(this.orderNo)}`, // 浣跨敤瀛樺偍鐨刼rderNo + method: 'GET', + header: { + 'Content-Type': 'application/json' + }, + success: (res) => { + console.log('gongdanxinx', res.data); + if (res.statusCode === 200) { + this.orderDetails = { + requirementDoc: res.data.requirementDoc, // 闇�姹傚崟鎹� + productionOrder: res.data.productionOrder, // 鐢熶骇璁㈠崟 + orderQuantity: res.data.orderQuantity, // 璁㈠崟鏁伴噺 + bzsl: res.data.bzsl, // 鎺ㄨ崘鍖呰鏁� + gdzt: res.data.gdzt, // 宸ュ崟鐘舵�� + producedQuantity: res.data.producedQuantity, // 宸茬敓浜ф暟 + itemId: res.data.itemId, // 鐗╂枡ID + itemNo: res.data.itemNO, // 鐗╂枡缂栫爜 + itemname: res.data.itemname, // 鐗╂枡鍚嶇О + itemmodel: res.data.itemmodel, // 瑙勬牸鍨嬪彿 + + + }; + // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵�� + // 鏍规嵁 sj 鍜� xj 鐨勫�兼潵璁剧疆棣栨鍜屽贰妫�鐘舵�� + if (res.data.sj === 1) { + this.checkFirstPass = true; // 棣栨鍚堟牸 + } else if (res.data.sj === 2) { + this.checkFirstPass = false; // 棣栨涓嶅悎鏍� + } else { + this.checkFirstPass = null; // 棣栨鏈仛 + } + + if (res.data.xj === 1) { + this.checkXJ = true; // 宸℃鍚堟牸 + } else if (res.data.xj === 2) { + this.checkXJ = false; // 宸℃涓嶅悎鏍� + } else { + this.checkXJ = null; // 宸℃鏈仛 + } + + + console.log('Order details loaded:', this.orderDetails); + + } else { + console.error('Failed to fetch order details:', res); + } + }, + fail: (err) => { + console.error('Error fetching order details:', err); + } + }); + }, mapStatus(status) { if (status === 3) { @@ -1184,7 +1248,7 @@ if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) { uni.showModal({ title: ` ${this.networkState}`, - content: "璇锋鏌SB杩炴帴", + content: "璇锋鏌ユ墦鍗版満杩炴帴", showCancel: false, success: () => { this.modalVisible = false; @@ -1330,7 +1394,7 @@ // 绗竴閮ㄥ垎锛氭潯鐮併�佸伐鍗曞彿銆佷緵搴斿晢淇℃伅 + 澶т簩缁寸爜 command.setBar(20, 40, "128", 100, 1, 0, 2, requestData.uniqueValue); // 鏉$爜 - command.setText(20, 40, "TSS24.BF2", 1, 1, "鏉$爜: "); + command.setText(20, 40, "TSS24.BF2", 1, 1, "鐗╂枡鏉$爜: "); command.setText(150, 40, "TSS24.BF2", 1, 1, requestData.uniqueValue); // 宸ュ崟鍙� @@ -1356,7 +1420,7 @@ // 绗洓閮ㄥ垎锛氭暟閲忎笌闇�姹傚崟鎹彿 command.setText(20, 340, "TSS24.BF2", 1, 1, "鏁伴噺: "); command.setText(120, 340, "TSS24.BF2", 1, 1, this.reportedQuantity); - command.setText(200, 340, "TSS24.BF2", 1, 1, "鎵撳嵃浜�: "); + command.setText(200, 340, "TSS24.BF2", 1, 1, "鎶ュ伐浜�: "); command.setText(290, 340, "TSS24.BF2", 1, 1, this.selectedPerson); @@ -1379,11 +1443,23 @@ // command.setFeed(30); this.sendData = command.getData(); - // 鍙戦�佹暟鎹� - this.senUSBData(); - // **鍏堣褰� "鎵撳嵃鍚�" 浜嬩欢** - this.logPrintEvent("鎵撳嵃鍚�", "鎵撳嵃", requestData.uniqueValue); + // 1. 鎵ц鍙戦�� + let printResult = this.senUSBData(); + + // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔� + if (printResult.success) { + // 鉁� 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織 + this.logPrintEvent("鎵撳嵃鍚�", "鎵撳嵃", requestData.uniqueValue); + } else { + // 鉂� 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織 + uni.showToast({ + title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織", + duration: 2000 + }); + } + this.oldbgs = this.reportedQuantity; + this.bgr= //浠庢柊鍒锋柊宸ュ崟淇℃伅 loadOrderDetails(); //浠庢柊鍒锋柊鍘嗗彶璁板綍 @@ -1423,7 +1499,7 @@ if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) { uni.showModal({ title: ` ${this.networkState}`, - content: "璇锋鏌SB杩炴帴", + content: "璇锋鏌ユ墦鍗版満杩炴帴", showCancel: false, success: () => { this.modalVisible = false; @@ -1454,7 +1530,7 @@ }); } }); - + this.selectedPerson = this.lastRequestData.printedBy; // 琛ユ墦涓婁竴寮犺褰� this.fetchHistoryRecords(this.orderNo); if (!this.lastRequestData) { @@ -1465,6 +1541,8 @@ }); return; } + //20250507 鏂板姞璧嬪�煎巻鍙叉潯鐮佹姤宸ヤ汉 + this.selectedPerson = this.lastRequestData.printedBy; console.log("鑰佹潯鐮�", this.oldbgs); // 閲嶆柊鎵撳嵃涓婁竴寮犺褰� // async reprintLast() { @@ -1498,7 +1576,7 @@ // 绗竴閮ㄥ垎锛氭潯鐮併�佸伐鍗曞彿銆佷緵搴斿晢淇℃伅 + 澶т簩缁寸爜 command.setBar(20, 40, "128", 100, 1, 0, 2, this.lastRequestData); // 鏉$爜 - command.setText(20, 40, "TSS24.BF2", 1, 1, "鏉$爜: "); + command.setText(20, 40, "TSS24.BF2", 1, 1, "鐗╂枡鏉$爜: "); command.setText(150, 40, "TSS24.BF2", 1, 1, this.lastRequestData); // 宸ュ崟鍙� @@ -1544,11 +1622,25 @@ command.setPagePrint(); command.setFeed(3); this.sendData = command.getData(); - + // 1. 鎵ц鍙戦�� + let printResult = this.senUSBData(); + + // 2. 鍒ゆ柇鍙戦�佹槸鍚︽垚鍔� + if (printResult.success) { + // 鍙戦�佹垚鍔燂紝璁板綍鎵撳嵃鏃ュ織 + this.logPrintEvent("鎵撳嵃鍚�", "琛ユ墦", this.lastRequestData); + } else { + // 鍙戦�佸け璐ワ紝鎻愮ず鐢ㄦ埛锛屼笉璁板綍鏃ュ織 + uni.showToast({ + title: "鎵撳嵃澶辫触锛屾湭璁板綍鏃ュ織", + duration: 2000 + }); + } +F // 鍙戦�佹暟鎹� this.senUSBData(); // **璁板綍 "琛ユ墦鍚�" 浜嬩欢** - this.logPrintEvent("鎵撳嵃鍚�", "琛ユ墦", this.lastRequestData); + } , logPrintEvent(eventType, printType, barcodeValue) { -- Gitblit v1.9.3