From 986f2bdc1ef38691cee1b70da9277b759d4e3708 Mon Sep 17 00:00:00 2001
From: yhj <1836460075@qq.com>
Date: 星期五, 19 十二月 2025 15:41:14 +0800
Subject: [PATCH] 111

---
 夏蒙注塑报工/pages/scbg/scbg.vue |  707 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 612 insertions(+), 95 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..177a4c3 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">
@@ -174,6 +178,8 @@
 
 				<view class="history-record">
 					<button @click="viewHistory" class="lsjl">鍘嗗彶璁板綍</button <!-- 寮瑰嚭绐楀彛鏄剧ず鍘嗗彶璁板綍 -->
+					<button @click="fetchDrawingNumber" class="lsjl">璋冨彇PLM鍥剧焊</button <!-- 寮瑰嚭绐楀彛鏄剧ずplm鍥剧焊璁板綍 -->
+
 					<view v-if="showHistoryPopup" class="history-popup">
 						<!-- 寮圭獥澶撮儴 -->
 						<view class="popup-header">
@@ -189,22 +195,73 @@
 								<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>
 							</scroll-view>
 						</view>
+
 					</view>
 
-					<button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
+					<view v-if="drawingShow" class="history-popup">
+						<!-- 寮圭獥瀹瑰櫒 -->
+						<view class="popup-container">
+							<!-- 鍐呭鍖哄煙 -->
+							<view class="popup-content">
+								<!-- 琛ㄥご -->
+								<view class="history-header">
+									<view class="header-item" id="tm">鐩稿叧鏂囨。</view>
+									<view class="header-item" id="sl">鏈夋棤鍏宠仈PDF鏂囦欢</view>
+									<view class="header-item" id="sj">鑳藉惁鎵撳紑鏂囦欢</view>
+									<view class="header-item" id="ry">鎿嶄綔锛堢偣鍑伙級</view>
+								</view>
+
+								<!-- 琛ㄦ牸鍐呭鍖哄煙 -->
+								<scroll-view scroll-y="true" class="history-scroll">
+									<!-- 鏁版嵁涓虹┖鏃剁殑鎻愮ず -->
+									<view v-if="(!drawing || drawing.length === 0)" class="empty-text">
+										鏆傛棤鏇村鏁版嵁
+									</view>
+
+									<!-- 鏈夋暟鎹椂鏄剧ず鐨勫垪琛� -->
+									<view v-for="(item, index) in (drawing || [])" :key="index" class="history-record">
+										<view class="record-item">{{ item.fName }}</view>
+										<view class="record-item" style="font-size:25px;">
+											<div v-if="item.fRelevantObject==' '" style="color: #E47470;">脳</div>
+											<div style="color: #90BA87;" v-else>鈭�</div>
+										</view>
+										<view class="record-item" style="font-size:25px;">
+											<div v-if="item.isSupported || item.fRelevantObject!=' '"
+												style="color: #90BA87;">鈭�</div>
+											<div style="color: #E47470;" v-else>脳</div>
+										</view>
+										<view class="record-item click-wd" @click="openDrawings(item)">
+											鎵撳紑鏂囨。
+										</view>
+									</view>
+								</scroll-view>
+							</view>
+
+							<!-- 鍥哄畾鍦ㄦ渶搴曢儴鐨勬寜閽尯鍩� -->
+							<view class="popup-footer">
+								<view class="popup-buttons">
+									<button class="popup-button cancel-button" @click="drawingCancel">鍙栨秷</button>
+									<button class="popup-button confirm-button" @click="drawingConfirm">纭畾</button>
+								</view>
+							</view>
+						</view>
+					</view>
+
+					<!-- 	<button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '璇风◢鍚�...' : '琛ユ墦涓婁竴寮�' }}</button>
+				 -->
 				</view>
 			</view>
 
@@ -226,9 +283,14 @@
 							{{ 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 +301,7 @@
 				<button @click="sendForFirstInspection" class="round-btn">棣栨閫佹</button>
 			</view>
 		</view>
-		<view class="version" v-if="version">
-		  鐗堟湰鍙凤細{{ version }}
-		</view>
+
 	</view>
 </template>
 
@@ -261,6 +321,9 @@
 		data() {
 			return {
 				showHistoryPopup: false, // 鎺у埗寮瑰嚭妗嗘樉绀�
+				drawing: [],
+				drawingShow: false,
+				itemShow: false,
 				selectedPerson: '',
 				selectedLine: '',
 				selectedOrder: '',
@@ -282,6 +345,7 @@
 					orderQuantity: '', // 璁㈠崟鏁伴噺
 					producedQuantity: '', // 宸茬敓浜ф暟
 					bzsl: '', // 鎺ㄨ崘鍖呰鏁�
+					gdzt: '',
 					itemId: '', // 鐗╂枡ID
 					itemNo: '', // 鐗╂枡缂栫爜
 					itemname: '', // 鐗╂枡鍚嶇О
@@ -322,8 +386,8 @@
 				networkState: "妫�娴嬩腑...",
 				deviceState: "妫�娴嬩腑...",
 				networkModalVisible: false, // 鎺у埗缃戠粶寮圭獥鏄惁宸叉樉绀�
-				usbModalVisible: false ,// 鎺у埗 USB 寮圭獥鏄惁宸叉樉绀�
-				 updateChecked: false,
+				usbModalVisible: false, // 鎺у埗 USB 寮圭獥鏄惁宸叉樉绀�
+				updateChecked: false,
 			};
 		},
 		// components:{
@@ -343,9 +407,9 @@
 			console.log("椤甸潰鍔犺浇锛屽紑濮嬫娴� USB 鍜岀綉缁�...");
 			console.log("UsbModule:", UsbModule); // 鎵撳嵃 UsbModule 鏄惁鍙敤
 			console.log("UsbModule.isUsbConnect:", UsbModule?.isUsbConnect); // 鎵撳嵃鏂规硶鏄惁瀛樺湪
- if (typeof plus !== 'undefined') {
-    this.version = plus.runtime.version;
-  }
+			if (typeof plus !== 'undefined') {
+				this.version = plus.runtime.version;
+			}
 
 			this.checkForUpdate(); // 鍚姩鏃舵鏌ョ増鏈洿鏂�
 			//this.startAutoUpdateCheck(); // 寮�濮嬪畾鏃舵鏌ョ増鏈洿鏂�
@@ -369,7 +433,7 @@
 				this.stopAutoUpdateCheck(); // 椤甸潰閿�姣佹椂鍋滄瀹氭椂鍣紝闃叉鍐呭瓨娉勬紡
 			},
 			checkForUpdate() {
-				  if (this.updateChecked) return; 
+				if (this.updateChecked) return;
 				uni.request({
 					url: "http://192.168.0.107:10086/update.json", // 浣犵殑鏈嶅姟鍣� JSON 鏂囦欢鍦板潃
 					success: (res) => {
@@ -388,9 +452,9 @@
 							// 	}
 							// });
 							this.downloadNewApk(res.data.apkUrl);
-							 this.updateChecked = true; // 鏍囪鏇存柊宸叉鏌ヨ繃
+							this.updateChecked = true; // 鏍囪鏇存柊宸叉鏌ヨ繃
 							//      // 濡傛灉鏈夋柊鐗堟湰锛屽紑濮嬩笅杞�
-						  //download(res.data.apkUrl);
+							//download(res.data.apkUrl);
 						}
 					},
 					fail: (err) => {
@@ -398,7 +462,7 @@
 					}
 				});
 			},
- 
+
 
 			downloadNewApk(apkUrl) {
 				uni.showToast({
@@ -416,7 +480,7 @@
 							}, function() {
 								console.log("瀹夎鎴愬姛锛岄噸鍚簲鐢�");
 								//plus.runtime.restart();
-								   //plus.runtime.quit();
+								//plus.runtime.quit();
 								// uni.navigateBack()
 							}, function(e) {
 								console.error("瀹夎澶辫触:", e);
@@ -496,9 +560,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 +584,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 +654,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 +815,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 +975,7 @@
 					productionOrder: '', // 鐢熶骇璁㈠崟
 					orderQuantity: '', // 璁㈠崟鏁伴噺
 					bzsl: '', // 鎺ㄨ崘鍖呰鏁�
+					gdzt: '',
 					producedQuantity: '', // 宸茬敓浜ф暟
 					itemId: '', // 鐗╂枡ID
 					itemNo: '', // 鐗╂枡缂栫爜
@@ -939,6 +1004,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 +1107,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) {
@@ -1181,19 +1302,19 @@
 			// 鎻愪氦鎶ュ伐淇℃伅鐨勬柟娉�
 			printBarcode() {
 				// **鍏堟鏌� USB 杩炴帴鐘舵��**
-				if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
-					uni.showModal({
-						title: ` ${this.networkState}`,
-						content: "璇锋鏌SB杩炴帴",
-						showCancel: false,
-						success: () => {
-							this.modalVisible = false;
+				/*	if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
+						uni.showModal({
+							title: ` ${this.networkState}`,
+							content: "璇锋鏌ユ墦鍗版満杩炴帴",
+							showCancel: false,
+							success: () => {
+								this.modalVisible = false;
 
-						}
-					});
-					return; // **USB 杩炴帴澶辫触锛岀洿鎺ヨ繑鍥烇紝闃叉鎵ц鎵撳嵃**
-				}
-				
+							}
+						});
+						return; // **USB 杩炴帴澶辫触锛岀洿鎺ヨ繑鍥烇紝闃叉鎵ц鎵撳嵃**
+					}*/
+
 				uni.request({
 					url: `http://192.168.0.107:44380/api/persons/${encodeURIComponent(this.personCode)}`, // 淇敼鍚庣殑璇锋眰璺緞
 					method: 'GET',
@@ -1238,7 +1359,7 @@
 
 					return;
 				}
-					   
+
 				// 鏍煎紡鍖栧綋鍓嶆椂闂翠负"骞存湀鏃ユ椂鍒嗙"鏍煎紡
 				const currentTime = new Date();
 				const formattedTime = this.formatDate(currentTime);
@@ -1253,8 +1374,8 @@
 					//itemSpec: '瑙勬牸鍨嬪彿', // 杩欓噷鍙敼鎴愬疄闄呮暟鎹�
 					quantity: Number(this.reportedQuantity) // 纭繚鏄暣鏁�
 
-				}; 
-				this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃鏉$爜鍓�",requestData.uniqueValue);
+				};
+				this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃鏉$爜鍓�", requestData.uniqueValue);
 				// 灏� requestData 淇濆瓨鍒� lastRequestData 涓�
 				this.lastRequestData = requestData;
 				console.log(requestData);
@@ -1304,8 +1425,8 @@
 								//鎵撳嵃鏉$爜
 								return;
 							}
-		 // **鍏堣褰� "鎵撳嵃鍓�" 浜嬩欢**
-		                    this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃", requestData.uniqueValue);
+							// **鍏堣褰� "鎵撳嵃鍓�" 浜嬩欢**
+							this.logPrintEvent("鎵撳嵃鍓�", "鎵撳嵃", requestData.uniqueValue);
 							//鎵撳嵃鏉$爜
 							console.log('tiaoma', requestData.uniqueValue);
 							console.log('gd', this.orderDetails.productionOrder);
@@ -1330,7 +1451,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 +1477,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,15 +1500,27 @@
 							// command.setFeed(30);
 							this.sendData = command.getData();
 
-							// 鍙戦�佹暟鎹�
-							this.senUSBData();
-				 // **鍏堣褰� "鎵撳嵃鍚�" 浜嬩欢**
-				                    this.logPrintEvent("鎵撳嵃鍚�", "鎵撳嵃", requestData.uniqueValue);
-									this.oldbgs =  this.reportedQuantity;
-							//浠庢柊鍒锋柊宸ュ崟淇℃伅
-							loadOrderDetails();
+							// 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();
 							//浠庢柊鍒锋柊鍘嗗彶璁板綍
-					
+
 							this.fetchHistoryRecords(this.orderNo);
 
 						},
@@ -1410,10 +1543,179 @@
 			//   lines.push(text); // 鏈�鍚庝竴琛�
 			//   return lines;
 			// },
-			
+
+			drawingConfirm() {
+				this.drawingShow = false
+				// this.imageShow = false
+				// this.productionShow = false
+				// this.itemShow = false
+			},
+			drawingCancel() {
+				this.drawingShow = false
+				// this.imageShow = false
+				// this.productionShow = false
+				// this.itemShow = false
+			},
+
+			fetchDrawingNumber() {
+				// const item = 'BC.XM.001.006.009.0002'
+				const item = this.orderDetails.itemNo;
+				console.log(this.orderDetails.itemNo)
+				// console.log(item)
+				// const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item
+
+				// const item = '5.06.04.4002';
+				const url = "http://192.168.0.107:10054/api/PLM/RetrieveDrawings?ItemNo=" + item
+
+				let _this = this;
+
+				uni.request({
+					url: url,
+					method: 'POST',
+					success: (response) => {
+						console.log(response)
+						if (response.data.data == '杩斿洖缁撴灉涓虹┖') {
+							_this.drawing = []
+						} else {
+							_this.drawing = response.data.data
+							// 閬嶅巻鏁版嵁锛屽垽鏂枃浠跺悗缂�骞舵坊鍔犲瓧娈�
+							_this.drawing.forEach((file) => {
+								// 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑
+								const fileExtension = file.fName.split('.').pop()
+									.toLowerCase();
+
+								// 瀹氫箟鏀寔鐨勬枃浠剁被鍨�
+								const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc',
+									'docx',
+									'xls'
+								];
+
+								// 鍒ゆ柇鏄惁鏀寔璇ユ枃浠剁被鍨�
+								file.isSupported = supportedExtensions.includes(fileExtension);
+							});
+						}
+					},
+					fail: (error) => {
+						uni.showToast({
+							title: '璇锋眰鍥剧焊閾炬帴澶辫触',
+							icon: 'none'
+						});
+					}
+				});
+				this.drawingShow = true
+			},
+
+
+			//鍥剧焊鐩稿叧鏂囨。
+			openDrawings(item) {
+				console.log("jkjoi", item.fRelevantObject)
+				if (item.fRelevantObject.length > 2) {
+					// 鐢熸垚璇锋眰URL锛堢畝鍖栫紪鐮侀�昏緫锛�
+					const encodedName = encodeURIComponent(item.fName);
+					const url = `http://192.168.0.107:10054/api/PLM/OpenDrawingsGet?fileId=${item.fRelevantObject}&fName=${encodedName}`;
+					console.log('璇锋眰URL:', url);
+
+					const now = new Date();
+					const timestamp = [
+						now.getFullYear(),
+						String(now.getMonth() + 1).padStart(2, '0'),
+						String(now.getDate()).padStart(2, '0'),
+						String(now.getHours()).padStart(2, '0'),
+						String(now.getMinutes()).padStart(2, '0'),
+						String(now.getSeconds()).padStart(2, '0')
+					].join('');
+
+					// 鐢熸垚鏂版枃浠跺悕锛堝熀纭�鍚峗鏃堕棿鎴�.鍚庣紑锛�
+					this.fileName = `${item.fName}_${timestamp}.pdf`;
+					console.log('鏂版枃浠跺悕:', this.fileName);
+
+					uni.downloadFile({
+						url: url,
+						success: (res) => {
+							console.log(res);
+							let fileName = this.fileName;
+							let fileExt = fileName.split('.').pop();
+							// let newFilePath = "_doc/uniapp_temp_1742877118745/download" + "/" + fileName;
+							// console.log('newFilePath', newFilePath)
+							if (fileExt === 'xls' || fileExt === 'xlsx' || fileExt === 'pdf' || fileExt ===
+								'jpg' || fileExt === 'png') {
+								plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => {
+									// 鑾峰彇鏂囦欢鎵�鍦ㄧ殑鐩綍
+									entry.getParent((parentEntry) => {
+										let newFileName = this.fileName; // 鏂扮殑鏂囦欢鍚�
+
+										// 绉诲姩骞堕噸鍛藉悕鏂囦欢
+										entry.moveTo(
+											parentEntry,
+											newFileName,
+											(newEntry) => {
+												console.log('閲嶅懡鍚嶆垚鍔�:', newEntry.fullPath);
+
+												// 鎵撳紑 Excel 鏂囦欢
+												plus.runtime.openFile(newEntry
+													.fullPath, {}, (e) => {
+														console.error('鏃犳硶鎵撳紑 Excel 鏂囦欢:',
+															e);
+													});
+
+												// let pages = getCurrentPages();
+												// let beforePage = pages[pages.length - 2];
+												// uni.navigateBack({
+												//     delta: 1, //杩斿洖鐨勯〉闈㈡暟锛屽鏋滀负1琛ㄧず杩斿洖涓婁竴椤�
+												//     success: (event) => {
+												//         beforePage.$vm.reload()
+												//     }
+												// });
+
+											},
+											(err) => {
+												console.error('閲嶅懡鍚嶅け璐�:', err);
+											}
+										);
+									}, (err) => {
+										console.error('鑾峰彇鐖剁洰褰曞け璐�:', err);
+									});
+								}, (err) => {
+									console.error('鑾峰彇鏂囦欢澶辫触:', err);
+								});
+							} else {
+								console.error('鏂囦欢鏍煎紡涓嶅尮閰�:', fileExt);
+								uni.showToast({
+									title: '鏂囦欢鏍煎紡涓嶆敮鎸�',
+									icon: 'none'
+								});
+							}
+						}
+					})
+
+					uni.request({
+						url: url,
+						method: 'POST',
+						responseType: 'arraybuffer',
+						success: (response) => {
+							console.log(response.data)
+							if (!response) {
+								uni.showToast({
+									title: "鍗忚棰勮澶辫触",
+									duration: 2000
+								});
+							}
+
+						},
+						fail: (error) => {
+							console.log(error)
+							uni.showToast({
+								title: '璇锋眰棰勮閾炬帴澶辫触',
+								icon: 'none'
+							});
+						}
+					});
+				}
+			},
+
 			// 琛ユ墦涓婁竴寮犺褰�
 			reprintLast() {
-				
+
 				// 绂佺敤鎸夐挳5绉�
 				this.isButtonDisabled2 = true;
 				setTimeout(() => {
@@ -1423,7 +1725,7 @@
 				if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
 					uni.showModal({
 						title: ` ${this.networkState}`,
-						content: "璇锋鏌SB杩炴帴",
+						content: "璇锋鏌ユ墦鍗版満杩炴帴",
 						showCancel: false,
 						success: () => {
 							this.modalVisible = false;
@@ -1454,7 +1756,7 @@
 						});
 					}
 				});
-
+				this.selectedPerson = this.lastRequestData.printedBy;
 				// 琛ユ墦涓婁竴寮犺褰�
 				this.fetchHistoryRecords(this.orderNo);
 				if (!this.lastRequestData) {
@@ -1465,6 +1767,8 @@
 					});
 					return;
 				}
+				//20250507 鏂板姞璧嬪�煎巻鍙叉潯鐮佹姤宸ヤ汉
+				this.selectedPerson = this.lastRequestData.printedBy;
 				console.log("鑰佹潯鐮�", this.oldbgs);
 				// 閲嶆柊鎵撳嵃涓婁竴寮犺褰�
 				// async reprintLast() {
@@ -1484,8 +1788,8 @@
 				//         });
 				//         return;  // 閫�鍑猴紝閬垮厤缁х画鎵ц鎵撳嵃
 				//     }
-			  // **璁板綍 "琛ユ墦鍓�" 浜嬩欢**
-			    this.logPrintEvent("鎵撳嵃鍓�", "琛ユ墦", this.lastRequestData);
+				// **璁板綍 "琛ユ墦鍓�" 浜嬩欢**
+				this.logPrintEvent("鎵撳嵃鍓�", "琛ユ墦", this.lastRequestData);
 				// 鎵撳嵃鍐呭鏍峰紡璁剧疆
 				const command = tsc.jpPrinter.createNew();
 
@@ -1498,7 +1802,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,45 +1848,58 @@
 				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) {
+
+
+				const requestData = {
+					barcode: barcodeValue, // 鏉$爜
+					worker: this.personCode, // 鎶ュ伐浜�
+					eventType: eventType, // "鎵撳嵃鍓�" 鎴� "鎵撳嵃鍚�"
+					printType: printType, // "鎵撳嵃" 鎴� "琛ユ墦"
+					orderNo: this.selectedOrder, // 宸ュ崟鍙�
+					line: this.selectedLine,
+					version: this.version // 绾夸綋
+				};
+				console.log(requestData);
+				uni.request({
+					url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
+					method: 'POST',
+					header: {
+						'Content-Type': 'application/json'
+					},
+					data: requestData,
+					success: (response) => {
+						if (response.statusCode === 200) {
+							console.log(`${eventType} - ${printType} 璁板綍鎴愬姛`);
+						} else {
+							console.error(`${eventType} - ${printType} 璁板綍澶辫触:`, response);
+						}
+					},
+					fail: (err) => {
+						console.error("璇锋眰澶辫触:", err);
+					}
+				});
 			}
-		,
-	logPrintEvent(eventType, printType, barcodeValue) {
-		  
-			 
-	    const requestData = {
-	        barcode: barcodeValue,  // 鏉$爜
-	        worker: this.personCode,  // 鎶ュ伐浜�
-	        eventType: eventType, // "鎵撳嵃鍓�" 鎴� "鎵撳嵃鍚�"
-	        printType: printType,  // "鎵撳嵃" 鎴� "琛ユ墦"
-	        orderNo: this.selectedOrder, // 宸ュ崟鍙�
-	        line: this.selectedLine ,
-			version:this.version// 绾夸綋
-	    };
-		console.log(requestData);
-	    uni.request({
-	        url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
-	        method: 'POST',
-	        header: {
-	            'Content-Type': 'application/json'
-	        },
-	        data: requestData,
-	        success: (response) => {
-	            if (response.statusCode === 200) {
-	                console.log(`${eventType} - ${printType} 璁板綍鎴愬姛`);
-	            } else {
-	                console.error(`${eventType} - ${printType} 璁板綍澶辫触:`, response);
-	            }
-	        },
-	        fail: (err) => {
-	            console.error("璇锋眰澶辫触:", err);
-	        }
-	    });
-	}
 		}
 	};
 </script>
@@ -2277,4 +2594,204 @@
 		box-sizing: border-box;
 		/* 纭繚鍐呰竟璺濆拰杈规鍖呭惈鍦ㄥ搴﹀唴 */
 	}
+
+	/* 濡傛灉闇�瑕佹寜閽瓑瀹藉苟闈犺竟 */
+	.popup-buttons {
+		display: flex;
+		justify-content: space-between;
+		/* 宸﹀彸鍒嗗竷 */
+		gap: 20px;
+		/* 鎸夐挳涔嬮棿鐨勯棿璺� */
+	}
+
+	.popup-button {
+		flex: 1;
+		/* 璁╀袱涓寜閽瓑瀹� */
+		min-width: 100px;
+		padding: 12px 0;
+		border-radius: 6px;
+		font-size: 8px;
+		font-weight: 500;
+	}
+
+	/* 鎴栬�呬繚鎸佸師瀹藉害浣嗗浐瀹氬湪涓よ竟 */
+	.popup-buttons.fixed-sides {
+		display: flex;
+		justify-content: space-between;
+	}
+
+	.popup-buttons.fixed-sides .popup-button {
+		flex: 0 0 auto;
+		/* 涓嶄几缂╋紝淇濇寔鍘熷ぇ灏� */
+	}
+
+	/* 寮圭獥鏁翠綋鏍峰紡淇濇寔涓嶅彉锛屽鍔犻珮搴︽帶鍒� */
+	.history-popup {
+		position: fixed;
+		top: 50%;
+		left: 50%;
+		transform: translate(-50%, -50%);
+		width: 80%;
+		height: 70%;
+		background-color: #fff;
+		border-radius: 8px;
+		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+		z-index: 1000;
+		display: flex;
+		flex-direction: column;
+	}
+
+	/* 寮圭獥澶撮儴 */
+	.popup-header {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		padding: 10px;
+		border-bottom: 1px solid #ccc;
+		flex-shrink: 0;
+		/* 闃叉澶撮儴琚帇缂� */
+	}
+
+	.popup-title {
+		font-size: 18px;
+		font-weight: bold;
+	}
+
+	/* 鍐呭鍖呰鍣� - 鍥哄畾楂樺害锛屽彲婊氬姩 */
+	.popup-content-wrapper {
+		flex: 1;
+		/* 鍗犳嵁鍓╀綑绌洪棿 */
+		display: flex;
+		flex-direction: column;
+		overflow: hidden;
+		/* 闅愯棌婧㈠嚭鍐呭 */
+	}
+
+	/* 琛ㄥご鍥哄畾 */
+	.history-header {
+		display: flex;
+		justify-content: space-between;
+		font-weight: bold;
+		border-bottom: 1px solid #ccc;
+		padding: 10px 5px;
+		background-color: #fff;
+		flex-shrink: 0;
+		/* 闃叉琛ㄥご琚帇缂� */
+		z-index: 1;
+		/* 纭繚琛ㄥご鍦ㄦ渶涓婂眰 */
+	}
+
+	/* 婊氬姩鍖哄煙 - 鑷�傚簲楂樺害 */
+	.history-scroll {
+		flex: 1;
+		/* 鍗犳嵁鍓╀綑绌洪棿 */
+		overflow-y: auto;
+		padding: 0 5px;
+	}
+
+	/* 绌烘暟鎹彁绀� */
+	.empty-text {
+		text-align: center;
+		padding: 40px 0;
+		color: #999;
+		font-size: 16px;
+	}
+
+	/* 鍥哄畾鍦ㄥ脊绐楀簳閮ㄧ殑鎸夐挳鍖哄煙 */
+	.popup-footer {
+		padding: 15px 20px;
+		border-top: 1px solid #eee;
+		background-color: #fff;
+		flex-shrink: 0;
+		/* 闃叉搴曢儴琚帇缂� */
+		box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
+	}
+
+	/* 鎸夐挳鍖哄煙 */
+	.popup-buttons {
+		display: flex;
+		justify-content: space-between;
+		gap: 20px;
+	}
+
+	.popup-button {
+		flex: 1;
+		min-width: 100px;
+		padding: 12px 0;
+		border-radius: 6px;
+		font-size: 16px;
+		font-weight: 500;
+		border: none;
+		outline: none;
+		cursor: pointer;
+	}
+
+	.cancel-button {
+		background-color: #f8f9fa;
+		color: #6c757d;
+		border: 1px solid #dee2e6;
+	}
+
+	.cancel-button:hover {
+		background-color: #e9ecef;
+		color: #495057;
+	}
+
+	.confirm-button {
+		background-color: #1890ff;
+		color: white;
+	}
+
+	.confirm-button:hover {
+		background-color: #40a9ff;
+	}
+
+	/* 琛ㄦ牸鍐呭琛屾牱寮� */
+	.history-record {
+		display: flex;
+		justify-content: space-between;
+		border-bottom: 1px solid #eee;
+		padding: 10px 0;
+		font-size: 14px;
+	}
+
+	/* 琛ㄥご鍜岃〃鏍煎唴瀹圭殑姣忓垪鏍峰紡 */
+	.header-item,
+	.record-item {
+		flex: 1;
+		text-align: center;
+		padding: 0 5px;
+		word-wrap: break-word;
+		overflow: hidden;
+		text-overflow: ellipsis;
+	}
+
+	/* 鎵撳紑鏂囨。鏍峰紡 */
+	.click-wd {
+		color: #1890ff;
+		cursor: pointer;
+		text-decoration: underline;
+	}
+
+	.click-wd:hover {
+		color: #40a9ff;
+	}
+
+	/* 绉诲姩绔�傞厤 */
+	@media (max-width: 768px) {
+		.history-popup {
+			width: 95%;
+			height: 85%;
+		}
+
+		.popup-button {
+			min-width: 80px;
+			padding: 10px 0;
+			font-size: 14px;
+		}
+
+		.popup-buttons {
+			gap: 10px;
+		}
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3