From fb0d024283a24042e55c70019dffbcd104792135 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期二, 21 四月 2026 16:53:50 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 pages/ZLGL/QualityReportStep/QualityReportStepBill.vue |  345 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 327 insertions(+), 18 deletions(-)

diff --git a/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue b/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
index fceac15..98fd4bf 100644
--- a/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
+++ b/pages/ZLGL/QualityReportStep/QualityReportStepBill.vue
@@ -4,10 +4,16 @@
 		<view class="bill-main-area">
 			<!-- 涓昏〃椤电 -->
 			<view class="bill-main-tabs">
-				<view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">鍩烘湰淇℃伅</view>
-				<view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">鎵弿淇℃伅</view>
-				<view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">鍒跺崟淇℃伅</view>
-				<view :class="mainTabSelected == 4 ? 'selected' : ''" @tap="mainTabSelected = 4">鍏朵粬淇℃伅</view>
+				<view class="tabs-left">
+					<view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">鍩烘湰淇℃伅</view>
+					<view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">鎵弿淇℃伅</view>
+					<view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">鍒跺崟淇℃伅</view>
+					<view :class="mainTabSelected == 4 ? 'selected' : ''" @tap="mainTabSelected = 4">鍏朵粬淇℃伅</view>
+				</view>
+				<view class="mode-switch-right">
+					<text class="mode-text">{{ directInputMode ? '鐩存帴杈撳叆' : '鍙屽嚮绱姞' }}</text>
+					<switch :checked="directInputMode" @change="onModeSwitchChange" color="#3a78ff" style="transform: scale(0.7);" />
+				</view>
 			</view>
 			<!-- 涓昏〃鍐呭 -->
 			<view class="bill-main-contents">
@@ -292,6 +298,32 @@
 		
 		<BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType"
 			:HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue>
+
+		<!-- 鐩存帴杈撳叆鏁伴噺寮圭獥 -->
+		<uni-popup ref="inputQtyPopup" type="center">
+			<view class="input-qty-popup">
+				<view class="popup-title">杈撳叆涓嶈壇鏁伴噺</view>
+				<view class="popup-content">
+					<view class="popup-info">
+						<text class="popup-label">涓嶈壇鍘熷洜锛�</text>
+						<text class="popup-value">{{ currentItem && currentItem.涓嶈壇鍘熷洜鍚嶇О || '' }}</text>
+					</view>
+					<view class="popup-info">
+						<text class="popup-label">褰撳墠鏁伴噺锛�</text>
+						<text class="popup-value">{{ currentItem && currentItem.num || 0 }}</text>
+					</view>
+					<view class="popup-input-row">
+						<text class="popup-label">杈撳叆鏁伴噺锛�</text>
+						<input class="popup-input" type="number" v-model="inputQtyValue" placeholder="璇疯緭鍏ユ暟閲�" />
+					</view>
+				</view>
+				<view class="popup-buttons">
+					<button class="btn-c" size="mini" @tap="cancelInputQty">鍙栨秷</button>
+					<view style="flex: 1;"></view>
+					<button class="btn-a" size="mini" @tap="confirmInputQty">纭</button>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
@@ -326,7 +358,12 @@
 				//涓婁竴娆$偣鍑绘椂闂�
 				lastClickTime: 0,
 				operationType: 1,
-				
+				// 鐩存帴杈撳叆妯″紡寮�鍏�
+				directInputMode: true,
+				// 寮圭獥鐩稿叧
+				currentItem: null,
+				inputQtyValue: '',
+
 				mainTabSelected: 1,
 				subTabSelected: 0,
 
@@ -435,6 +472,11 @@
 			},
 			//涓嶈壇鍘熷洜鍗曞嚮
 			reasonClick(item) {
+				// 鐩存帴杈撳叆妯″紡涓嬶紝鍗曞嚮鐩存帴寮瑰嚭杈撳叆妗�
+				if (this.directInputMode) {
+					this.showDirectInputDialog(item);
+					return;
+				}
 			    const now = Date.now();
 			    if (now - this.lastClickTime < 300) {
 			      // 鍙屽嚮閫昏緫
@@ -445,6 +487,37 @@
 			      this.handleSingleClick(item);
 			      this.lastClickTime = now;
 			    }
+			},
+			// 妯″紡鍒囨崲
+			onModeSwitchChange(e) {
+				this.directInputMode = e.detail.value;
+			},
+			// 鏄剧ず鐩存帴杈撳叆鏁伴噺鐨勫脊绐�
+			showDirectInputDialog(item) {
+				this.currentItem = item;
+				this.inputQtyValue = String(item.num || 0);
+				this.$refs.inputQtyPopup.open();
+			},
+			// 鍙栨秷杈撳叆
+			cancelInputQty() {
+				this.$refs.inputQtyPopup.close();
+				this.currentItem = null;
+				this.inputQtyValue = '';
+			},
+			// 纭杈撳叆
+			confirmInputQty() {
+				const inputQty = parseInt(this.inputQtyValue);
+				if (isNaN(inputQty) || inputQty < 0) {
+					uni.showToast({
+						title: '璇疯緭鍏ユ湁鏁堟暟閲�',
+						icon: 'none'
+					});
+					return;
+				}
+				this.submitBarCodeWithQty(this.currentItem, inputQty);
+				this.$refs.inputQtyPopup.close();
+				this.currentItem = null;
+				this.inputQtyValue = '';
 			},
 			handleSingleClick(item) {
 				console.log('鍗曞嚮:', item.涓嶈壇鍘熷洜鍚嶇О);
@@ -532,7 +605,7 @@
 						}		
 					})
 					this.HBadReasonList = data;
-					
+					this.getHisReportList();//鑾峰彇鍘嗗彶璁板綍
 				} else {
 					CommonUtils.showTips({
 						title: '娓╅Θ鎻愮ず',
@@ -594,6 +667,7 @@
 					this.hform.HProcName= data[0].褰撳墠宸ュ簭
 					this.hform.HDeptID= data[0].HWorkShopID
 					this.getGy_BadReasonList();
+					
 				} else {
 					CommonUtils.showTips({
 						title: '娓╅Θ鎻愮ず',
@@ -688,22 +762,25 @@
 						url: "/Sc_QualityReportBill/get_BarCodeDetail",
 						data: {
 							HInterID: this.hform.HInterID,
-							
+
 						},
 					});
-			
+
 					let {
 						data,
 						Message,
 						count
 					} = res.data;
-			
+
 					if (count == 1) {
 						console.log("data: ", data);
 						this.HisReportList = data;
-						
+						// 缁熻鍚勪笉鑹師鍥犵殑鏁伴噺骞舵洿鏂板埌 HBadReasonList
+						this.updateBadReasonNumFromHisReport();
+
 					} else {
 						this.HisReportList = [];
+						this.clearBadReasonNum();
 						CommonUtils.showTips({
 							title: "娓╅Θ鎻愮ず",
 							message: `鑾峰彇鍘嗗彶鎵爜璁板綍澶辫触: ${Message}`,
@@ -715,6 +792,33 @@
 						message: `鑾峰彇鍘嗗彶鎵爜璁板綍澶辫触: ${err}`,
 					});
 				}
+			},
+			// 浠� HisReportList 缁熻鏇存柊 HBadReasonList 鐨� num
+			updateBadReasonNumFromHisReport() {
+				// 鍏堟竻绌烘墍鏈� num
+				this.HBadReasonList.forEach(item => {
+					this.$set(item, 'num', 0);
+				});
+
+				// 缁熻 HisReportList 涓悇涓嶈壇鍘熷洜鐨勬暟閲�
+				if (this.HisReportList && this.HisReportList.length > 0) {
+					this.HisReportList.forEach(hisItem => {
+						// 鏍规嵁 HBadReasonID 鍖归厤
+						const matchedItem = this.HBadReasonList.find(
+							badItem => badItem.涓嶈壇鍘熷洜浠g爜 == hisItem.HBadReasonNumber
+						);
+						if (matchedItem) {
+							const currentNum = matchedItem.num || 0;
+							this.$set(matchedItem, 'num', currentNum + hisItem.HBadReasonHQty||1);
+						}
+					});
+				}
+			},
+			// 娓呯┖ HBadReasonList 鐨� num
+			clearBadReasonNum() {
+				this.HBadReasonList.forEach(item => {
+					this.$set(item, 'num', 0);
+				});
 			},
 			//鍒犻櫎鍘嗗彶璁板綍
 			delReason(item) {
@@ -948,15 +1052,85 @@
 							title: "淇濆瓨鎴愬姛",
 							message: `淇濆瓨鎴愬姛`,
 						});
-						if(!item.num){
-							this.$set(item, 'num', 1);
-						}else{
-							this.$set(item, 'num', item.num+1);
-						}
-						console.log(item.num)
-						//this.$set(item, 'num', newValue);
+						// 鍒锋柊鍘嗗彶璁板綍锛宯um浼氳嚜鍔ㄤ粠HisReportList缁熻鏇存柊
 						this.getHisReportList();
 						this.hasCheckQty=true;
+					} else {
+						CommonUtils.showTips({
+							title: "娓╅Θ鎻愮ず",
+							message: `涓嶈壇鍘熷洜淇濆瓨閿欒: ${Message}`,
+						});
+					}
+				} catch (err) {
+					CommonUtils.showTips({
+						title: "娓╅Θ鎻愮ず",
+						message: `涓嶈壇鍘熷洜淇濆瓨閿欒: ${err}`,
+					});
+				}
+			},
+			//鎻愪氦涓嶈壇鍘熷洜鎵爜璁板綍缂撳瓨锛堢洿鎺ヨ緭鍏ユ暟閲忥級
+			async submitBarCodeWithQty(item, qty){
+				if(!this.checkSubmitValidate()){
+					return
+				}
+				try {
+					let oMainObject = {
+						HInterID:this.hform.HInterID
+						,HBillNo:this.hform.HBillNo
+						,HBillType:this.hform.HBillType
+						,HDate:new Date()
+						,HICMOBillNo:this.hform.HICMOBillNo
+						,HICMOInterID:this.hform.HICMOInterID
+						,HICMOEntryID:this.hform.HICMOEntryID
+						,HProcExchBillNo:this.hform.HProcExchBillNo
+						,HProcExchInterID:this.hform.HProcExchInterID
+						,HProcExchEntryID:this.hform.HProcExchEntryID
+						,HProcID:this.hform.HProcID
+						,HMaterID:this.hform.HMaterID
+						,HSourceID:this.hform.HSourceID
+						,HGroupID:this.hform.HGroupID
+						,HDeptID:this.hform.HDeptID
+						,HCheckManID:this.hform.HEmpID
+						,HBadReasonID:item.HItemID
+						,HBarCode:item.涓嶈壇鍘熷洜浠g爜
+						,HMaker:this.hform.HMaker
+						,HMakeDate:this.hform.HMakeDate
+						,HReportType:1
+						,HSourceBillType:this.hform.HSourceBillType
+						,HSourceBillNo:this.hform.HSourceBillNo
+						,HSourceInterID:this.hform.HMainSourceInterID
+						,HSourceEntryID:this.hform.HMainSourceEntryID
+						,HBadReasonHQty:qty
+						,HQty:this.hform.HCheckQty
+					}
+					var sMainStr = JSON.stringify(oMainObject);
+					var oMain = sMainStr + ';' + this.operationType;
+
+					let res = await CommonUtils.doRequest2Sync({
+						url: "/Sc_QualityReportBill/set_SaveBarCode",
+						data: {
+							oMain: oMain,
+						},
+						method: "POST",
+					});
+
+					if (!res) {
+						return;
+					}
+
+					let {
+						count,
+						Message,
+						data
+					} = res.data;
+					if (count == 1) {
+						CommonUtils.showTips({
+							title: "淇濆瓨鎴愬姛",
+							message: `淇濆瓨鎴愬姛锛屾暟閲�: ${qty}`,
+						});
+						// 鍒锋柊鍘嗗彶璁板綍锛宯um浼氳嚜鍔ㄤ粠HisReportList缁熻鏇存柊
+						this.getHisReportList();
+						this.hasCheckQty = true;
 					} else {
 						CommonUtils.showTips({
 							title: "娓╅Θ鎻愮ず",
@@ -1119,7 +1293,55 @@
 		padding: 0;
 	}
 
-	.bill-main-tabs,
+	.bill-main-tabs {
+		box-sizing: border-box;
+		width: 100%;
+		display: flex;
+		flex-direction: row;
+		justify-content: space-between;
+		align-items: center;
+		border-bottom: 1px solid #ddd;
+		padding: 20rpx 10rpx;
+
+		.tabs-left {
+			display: flex;
+			flex-direction: row;
+			flex-wrap: nowrap;
+			gap: 20rpx;
+			flex-shrink: 0;
+			overflow-x: auto;
+			white-space: nowrap;
+
+			view {
+				width: auto;
+				font-size: 30rpx;
+				color: #555;
+				text-align: center;
+				padding: 16rpx 0;
+			}
+
+			.selected {
+				color: #3a78ff;
+				font-weight: bold;
+				border-bottom: 3px solid #3a78ff;
+			}
+		}
+
+		.mode-switch-right {
+			display: flex;
+			flex-direction: row;
+			align-items: center;
+			gap: 10rpx;
+			flex-shrink: 0;
+			padding-right: 10rpx;
+
+			.mode-text {
+				font-size: 24rpx;
+				color: #666;
+			}
+		}
+	}
+
 	.bill-sub-tabs {
 		box-sizing: border-box;
 		width: 100%;
@@ -1148,6 +1370,93 @@
 		}
 	}
 
+	/* 鐩存帴杈撳叆鏁伴噺寮圭獥鏍峰紡 */
+	.input-qty-popup {
+		background-color: #fff;
+		border-radius: 20rpx;
+		padding: 30rpx;
+		width: 600rpx;
+		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.15);
+
+		.popup-title {
+			font-size: 32rpx;
+			font-weight: bold;
+			color: #333;
+			text-align: center;
+			padding-bottom: 20rpx;
+			border-bottom: 1px solid #eee;
+		}
+
+		.popup-content {
+			padding: 20rpx 0;
+
+			.popup-info {
+				display: flex;
+				align-items: center;
+				padding: 10rpx 0;
+
+				.popup-label {
+					font-size: 28rpx;
+					color: #666;
+					width: 180rpx;
+				}
+
+				.popup-value {
+					font-size: 28rpx;
+					color: #333;
+				}
+			}
+
+			.popup-input-row {
+				display: flex;
+				align-items: center;
+				padding: 15rpx 0;
+				margin-top: 10rpx;
+
+				.popup-label {
+					font-size: 28rpx;
+					color: #666;
+					width: 180rpx;
+				}
+
+				.popup-input {
+					flex: 1;
+					height: 60rpx;
+					border: 1px solid #acacac;
+					border-radius: 10rpx;
+					padding: 0 15rpx;
+					font-size: 28rpx;
+				}
+			}
+		}
+
+		.popup-buttons {
+			display: flex;
+			flex-direction: row;
+			gap: 10rpx;
+			padding-top: 20rpx;
+			border-top: 1px solid #eee;
+
+			button {
+				border-radius: 50rpx;
+				width: 150rpx;
+				height: 60rpx;
+				line-height: 60rpx;
+				font-size: 28rpx;
+			}
+
+			.btn-a {
+				background-color: #3a78ff;
+				color: #fff;
+			}
+
+			.btn-c {
+				background-color: #acacac;
+				color: #fff;
+			}
+		}
+	}
+
 	.bill-main-content,
 	.bill-sub-content {
 		box-sizing: border-box;

--
Gitblit v1.9.1