From cd0ccf788c9d94708c70c75210135db344f68083 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期二, 13 五月 2025 15:21:57 +0800
Subject: [PATCH] 1.采购入库按单走实现

---
 pages/wlgl/cgrk2.vue |    7 -
 pages/wlgl/cgrk4.vue |  278 +++++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 217 insertions(+), 68 deletions(-)

diff --git a/pages/wlgl/cgrk2.vue b/pages/wlgl/cgrk2.vue
index 63e059a..8e7c341 100644
--- a/pages/wlgl/cgrk2.vue
+++ b/pages/wlgl/cgrk2.vue
@@ -37,13 +37,6 @@
 		</view>
 
 
-		<view v-if="purchorderArrAll.length===0">
-			<div class="sacnBody">
-				<div class="boxImg"></div>
-				<div class="scanText">鏆傛棤閲囪喘鍒拌揣</div>
-			</div>
-		</view>
-
 	</view>
 </template>
 
diff --git a/pages/wlgl/cgrk4.vue b/pages/wlgl/cgrk4.vue
index a7f2664..7e861fc 100644
--- a/pages/wlgl/cgrk4.vue
+++ b/pages/wlgl/cgrk4.vue
@@ -45,12 +45,11 @@
 												<view>鐗╂枡鍚嶇О锛�</view>
 												<view>鐗╂枡瑙勬牸锛�</view>
 												<view>閲囪喘璁㈠崟锛�</view>
+												<view v-show='item.children.length===0'>鍏ュ簱鏁伴噺锛�</view>
+
+												<view>鍏ュ簱杩涘害锛�</view>
+												<view>浠诲姟鏁伴噺锛�</view>
 												<view>鍒拌揣杩涘害锛�</view>
-												<!-- <view>鐗╂枡鏍囩锛�</view> -->
-												<view v-show="!item.arrowType">鐗╂枡鏁伴噺锛�</view>
-												<view v-show="!item.arrowType">渚涙柟淇℃伅锛�</view>
-												<view v-show="!item.arrowType">閲囪喘鎵规锛�</view>
-												<view v-show="!item.arrowType">璐ㄩ噺鐘舵�侊細</view>
 											</view>
 											<view class="flex_column contentFont">
 												<view>{{item.partcode}}</view>
@@ -58,48 +57,32 @@
 												<view class="ellipsis" style="width: 460rpx;">
 													{{item.partspec?item.partspec:'/'}}
 												</view>
-												<view>{{item.ordercode}}</view>
+												<view>{{ordercode}}</view>
+
+												<view v-show='item.children.length===0'>
+													<u--input placeholder="璇疯緭鍏�" border="surround" min='1'
+														v-model="item.countInquantity2"></u--input>
+												</view>
+
+
 												<view style="height: 50rpx;display: flex;align-items: center;">
-													<u-line-progress :percentage="(item.hqty/item.hplanqty)*100"
+													{{parseFloat(item.countInquantity)}}
+												</view>
+
+												<view>{{ parseFloat(item.quantity)}}</view>
+
+												<view style="height: 50rpx;display: flex;align-items: center;">
+													<u-line-progress
+														:percentage="(item.countarrivalquantity/item.quantity)*100"
 														height="12" :showText='false'></u-line-progress>
 													<view style="margin-left: 6rpx; color:#2979FF">
-														{{item.hqty}}
+														{{parseFloat(item.countarrivalquantity)}}
 													</view>
 													<view>
 														/
 													</view>
 													<view>
-														{{item.hplanqty}} PCS
-													</view>
-												</view>
-												<!-- <view>杩樺儚杩樻病杩斿洖</view> -->
-												<view v-show="!item.arrowType">{{item.hqty}}</view>
-												<view v-show="!item.arrowType">{{item.customername}}</view>
-												<view v-show="!item.arrowType">/</view>
-												<view v-show="!item.arrowType">
-													<view v-if="!item.qualitystatus">/</view>
-													<view v-else style="display: flex;align-items: center;">
-
-														<u-icon name="tags-fill" color="green" size="20"
-															v-if="item.qualitystatus==='CS'"></u-icon>
-														<view style="margin-left: 10rpx;"
-															v-if="item.qualitystatus==='CS'">鍏嶆</view>
-
-														<u-icon name="checkmark-circle-fill" color="#55ff00" size="20"
-															v-if="item.qualitystatus==='OK'"></u-icon>
-														<view style="margin-left: 10rpx;"
-															v-if="item.qualitystatus==='OK'">鍚堟牸</view>
-
-														<u-icon name="close-circle-fill" color="#FF0000" size="20"
-															v-if="item.qualitystatus==='NG'"></u-icon>
-														<view style="margin-left: 10rpx;"
-															v-if="item.qualitystatus==='NG'">涓嶅悎鏍�</view>
-
-														<u-icon name="more-circle-fill" color="#55aaff" size="20"
-															v-if="item.qualitystatus==='TS'"></u-icon>
-														<view style="margin-left: 10rpx;"
-															v-if="item.qualitystatus==='TS'">寰呮</view>
-
+														{{parseFloat(item.quantity)}} PCS
 													</view>
 												</view>
 
@@ -110,7 +93,7 @@
 									</view>
 
 
-									<view class="head_block" v-show="!item.arrowType">
+									<view class="head_block">
 										<view class="head_left">
 											<view class="head_bar"></view>
 											<view class="head_title" style="font-weight: bold;">
@@ -123,8 +106,7 @@
 										</view>
 									</view>
 
-									<view class="flex_between marginBottom20 marginLeft20 marginTop20"
-										v-show="!item.arrowType">
+									<view class="flex_between marginBottom20 marginLeft20 marginTop20">
 										<view style="display: flex;">
 											<view class="flex_column titleFont">
 												<view>搴撲綅淇℃伅锛�</view>
@@ -141,7 +123,99 @@
 									</view>
 
 
-									<view style="display: flex;justify-content: center;margin : 10rpx; 0">
+
+
+
+									<view class="flex_column borderSet" v-if='item.children.length>0'
+										:style="{'borderBottom':ind===item.children.length-1?' 1px blue dotted':'none'}"
+										v-for="(it,ind) in item.children" :key="item.hbarcode" v-show="!item.arrowType">
+
+										<!-- <u-gap height="2" style="width: 90%;margin: auto;" bgColor="#eff0f1"></u-gap> -->
+
+										<view class="head_block" style="position: absolute;margin: 38rpx 0 0 0;">
+											<view class="head_left">
+												<view class="head_bar"></view>
+												<view class="head_title" style="font-weight: bold;">
+													鏍囩淇℃伅
+												</view>
+											</view>
+										</view>
+
+
+										<view class="orderNumber" style="width: 80rpx;margin-left:0" :key="it.hbarcode">
+											{{(index+1).toString().padStart(2,0)}}-{{ind+1}}
+										</view>
+
+										<!-- v-show="item.children.length>1" -->
+										<view class="trash" @click="trashChildrenClick(index,ind)">
+											<u-icon name="trash" size='20'></u-icon>
+										</view>
+
+										<view v-show="item.children.length===1" style="width: 48rpx;height: 48rpx;">
+										</view>
+
+
+
+										<view class="flex_between marginBottom20 marginLeft20 marginTop20">
+											<view style="display: flex;">
+												<view class="flex_column titleFont">
+
+													<view>鐗╂枡鏍囩锛�</view>
+													<view>鍒拌揣鍗曞彿锛�</view>
+													<view>鐗╂枡鏁伴噺锛�</view>
+													<view>渚涙柟淇℃伅锛�</view>
+													<view>閲囪喘鎵规锛�</view>
+													<view>璐ㄩ噺鐘舵�侊細</view>
+												</view>
+												<view class="flex_column contentFont">
+
+													<view>{{it.hbarcode?it.hbarcode:'/'}}</view>
+													<view>{{it.hbillno?it.hbillno:'/'}}</view>
+													<view>{{it.hqty}}</view>
+													<view>{{it.hcustomername}}</view>
+													<view>/</view>
+													<view>
+														<view v-if="!it.qstatus">/</view>
+														<view v-else style="display: flex;align-items: center;">
+
+															<u-icon name="tags-fill" color="green" size="20"
+																v-if="it.qstatus==='CS'"></u-icon>
+															<view style="margin-left: 10rpx;" v-if="it.qstatus==='CS'">
+																鍏嶆</view>
+
+															<u-icon name="checkmark-circle-fill" color="#55ff00"
+																size="20" v-if="it.qstatus==='OK'"></u-icon>
+															<view style="margin-left: 10rpx;" v-if="it.qstatus==='OK'">
+																鍚堟牸</view>
+
+															<u-icon name="close-circle-fill" color="#FF0000" size="20"
+																v-if="it.qstatus==='NG'"></u-icon>
+															<view style="margin-left: 10rpx;" v-if="it.qstatus==='NG'">
+																涓嶅悎鏍�</view>
+
+															<u-icon name="more-circle-fill" color="#55aaff" size="20"
+																v-if="it.qstatus==='TS'"></u-icon>
+															<view style="margin-left: 10rpx;" v-if="it.qstatus==='TS'">
+																寰呮</view>
+
+														</view>
+													</view>
+
+												</view>
+											</view>
+
+										</view>
+
+									</view>
+
+
+
+
+
+
+
+									<view v-show='item.children.length>0'
+										style="display: flex;justify-content: center;margin : 10rpx; 0">
 										<view class="arrowClass"
 											@click="item.arrowType?arrowDownClick(item):arrowUpClick(item)">
 											<u-icon :name="item.arrowType?'arrow-down':'arrow-up'" color="#c8c8c8"
@@ -150,6 +224,7 @@
 									</view>
 
 									<u-gap height="10" v-if="index!==purchorderArr.length-1" bgColor="#eff0f1"></u-gap>
+
 
 
 								</view>
@@ -196,6 +271,7 @@
 
 		onLoad(option) {
 			this.getMesAppPurchInStorSelectCGOrderPart(option.ordercode)
+			this.ordercode = option.ordercode
 		},
 
 		onPullDownRefresh() {
@@ -216,7 +292,8 @@
 				columns: [],
 				columnsData: [],
 				wareHouseLocationArr: [], //浠撳簱搴撲綅鏁扮粍
-				isDisabledSubmitButton: false
+				isDisabledSubmitButton: false,
+				ordercode: '', //閲囪喘璁㈠崟
 			}
 		},
 		created() {
@@ -314,6 +391,10 @@
 						i.arrowType = ind !== 0
 						i.lcationcode = '' //搴撲綅
 						i.stockcode = '' //浠撳簱
+						i.countInquantity2 = parseFloat(i.quantity) - parseFloat(i.countInquantity) +
+							parseFloat(i.countreturnquantity)
+
+						console.log(i.countInquantity)
 					})
 					this.purchorderArr = res.data
 					this.purchorderObj = this.purchorderArr[0]
@@ -359,6 +440,16 @@
 				val.arrowType = true
 				this.$forceUpdate()
 			},
+			trashChildrenClick(index, ind) {
+				this.purchorderArr[index].children.splice(ind, 1)
+				if (this.purchorderArr[index].children.length > 0) {
+					let sum = 0
+					this.purchorderArr[index].children.forEach(i => {
+						sum += parseFloat(i.hqty)
+					})
+					this.purchorderArr[index].countInquantity2 = sum
+				}
+			},
 			async submit() {
 				const data1 = {
 					username: uni.getStorageSync("username")
@@ -369,26 +460,71 @@
 				if (ind > -1) { //璇存槑鏈夋湭濉啓鐨勫簱浣嶄俊鎭�
 					return this.$u.toast('绗�' + (ind + 1) + '涓殑搴撲綅淇℃伅鏈~鍐�')
 				}
-				console.log(this.wareHouseLocationArr.flat())
 
-				this.purchorderArr.forEach(i => {
+
+				let count = 0
+
+				this.purchorderArr.forEach((i, index) => {
+
+					if (parseFloat(i.countInquantity2) <= 0) {
+						return count = index + 1
+					}
+					if (parseFloat(i.countInquantity2) > parseFloat(i.quantity) - parseFloat(i
+							.countInquantity) +
+						parseFloat(i.countreturnquantity)) {
+						return count = index + 1
+					}
+
+
+					if (i.children) {
+						i.children.forEach(j => {
+							j.lactioncode = this.purchorderObj.lcationname2
+							j.housecode = this.purchorderObj.stockname2
+							j.harcodelocation = 'IN'
+						})
+					}
+
 					data2.push({
-						"hbarcode": "",
-						"hbillno": "",
-						"hqty": i.hqty,
-						"hcustomercode": i.customercode,
-						"hdeptcode": i.departmentcode,
+						"hsourceid": i.hsourceid,
+						"hsourcebillno": i.hsourcebillno,
+						"sbid": i.sbid,
 						"partcode": i.partcode,
+						"partname": i.partname,
+						"partspec": i.partspec,
 						"unitcode": i.unitcode,
-						"hsourceid": i.orderid,
-						"hsourcebillno": i.ordercode,
+						"unitname": i.unitname,
+						"quantity": i.quantity,
+						"countarrivalquantity": i.countarrivalquantity,
+						"countInquantity": i.countInquantity2,
+						"countreturnquantity": i.countreturnquantity,
+						"lactioncode": this.purchorderObj.lcationname2,
+						"lactionname": this.purchorderObj.lcationcode,
+						"housecode": this.purchorderObj.stockname2,
+						"housename": this.purchorderObj.stockcode,
+						"deptcode": i.deptcode,
+						"deptname": i.deptname,
+						children: i.children
 
-						"stockcode": this.purchorderObj.stockname2,
-						"lcationcode": this.purchorderObj.lcationname2
+						// "hbarcode": "",
+						// "hbillno": "",
+						// "hqty": i.hqty,
+						// "hcustomercode": i.customercode,
+						// "hdeptcode": i.departmentcode,
+						// "partcode": i.partcode,
+						// "unitcode": i.unitcode,
+						// "hsourceid": i.orderid,
+						// "hsourcebillno": i.ordercode,
+
+						// "stockcode": this.purchorderObj.stockname2,
+						// "lcationcode": this.purchorderObj.lcationname2
 					})
 				})
 
-				// console.log(JSON.stringify(data2))
+				if (count > 0) {
+					return this.$u.toast('绗�' + count + '涓墿鏂欑殑鍏ュ簱鏁伴噺閿欒锛�')
+				}
+
+				console.log(JSON.stringify(data2))
 
 				const res = await MesAppPurchInStorSave(this.global.formatData(
 					data1), data2)
@@ -417,23 +553,36 @@
 		display: block;
 	}
 
+	.borderSet {
+		width: 100%;
+		border-top: 1px blue dotted;
+		border-left: 1px blue dotted;
+		border-right: 1px blue dotted;
+	}
+
+
+
 
 
 	.orderNumber {
 		width: 60rpx;
 		height: 40rpx;
 		// margin: -22rpx 0 0 -30rpx;
-		background-color: #d3daf9;
-		color: #2979FF;
+		// background-color: #d3daf9;
+		background-color: #2979FF;
+		color: #fff;
 		font-size: 26rpx;
-		padding: 4rpx 0 0 10rpx;
-		border-radius: 0 0 90% 0;
+		// padding: 4rpx 0 0 10rpx;
+		border-radius: 8rpx;
+		margin-left: calc(100% - 60rpx);
+		display: flex;
+		justify-content: center;
 	}
 
 	.trash {
 		width: 48rpx;
 		height: 48rpx;
-		margin: -26rpx 0 0 646rpx;
+		margin: 20rpx 0rpx -40rpx 646rpx;
 		background-color: #d3daf9;
 		font-size: 26rpx;
 		padding: 6rpx 0 0 10rpx;
@@ -457,4 +606,11 @@
 		// border-radius: 10rpx;
 		height: 56rpx;
 	}
+
+
+
+	::v-deep .u-input--radius {
+		padding: 0 !important;
+		border-bottom: 2rpx #ccc solid;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3