From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/wareHouse/jumpZTE/jumpZTE.vue |  285 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 285 insertions(+), 0 deletions(-)

diff --git a/pages/wareHouse/jumpZTE/jumpZTE.vue b/pages/wareHouse/jumpZTE/jumpZTE.vue
new file mode 100644
index 0000000..d0caabf
--- /dev/null
+++ b/pages/wareHouse/jumpZTE/jumpZTE.vue
@@ -0,0 +1,285 @@
+<template>
+	<view class="wrap">
+		<view class="top">
+			<u-form label-position="left">
+				<u-form-item label="搴撲綅鍙�" label-width="180">
+					<input v-model="tolocationNo" type="text" style="text-align: left!important;font-size: 12px;"
+						placeholder="璇烽�夋嫨" maxlength="64" :disabled="true" />
+					<u-button type="primary" size="medium" @click="seachLocationNo">閫夋嫨</u-button>
+				</u-form-item>
+			</u-form>
+			<view class="row3 flex-row">
+				<view class="switch">
+					<u-switch v-model="isAuto"/>
+					<view style="padding-left: 10rpx;">鑷姩鎻愪氦</view>
+				</view>
+			</view>
+		</view>
+		<u-cell-group class="list" :border="false" v-if="scanInfo.newMesCode || scanInfo.pkg || scanInfo.cusMaterialCode" >
+			<view class="content">
+				<view class="row-list" style="padding-top: 8px;">
+					<view class="_label">MES:</view>
+					<view class="_content">
+						<textarea disabled v-model="scanInfo.newMesCode"  auto-height />
+					</view>
+				</view>
+				<view class="row-list" style="padding-top: 8px;">
+					<view class="_label">涓叴:</view>
+					<view class="_content">
+						<textarea disabled v-model="scanInfo.pkg"  auto-height />
+					</view>
+				</view>
+				<view class="row-list">
+					<view class="_label">鐗╂枡缂栫爜:</view>
+					<view class="_content"><textarea disabled v-model="scanInfo.cusMaterialCode"  auto-height /></view>
+				</view>
+			</view>
+		</u-cell-group>
+		<scan></scan>
+		<view class="form-footer" v-if="scanInfo.newMesCode&&tolocationNo&&scanInfo.pkg&&scanInfo.cusMaterialCode">
+			<u-button class="btn" type="primary" @click="submit">鍒ゅ畾</u-button>
+		</view>
+	</view>
+</template>
+<script>
+	import scan from "@/components/scan/scan.vue";
+
+	export default {
+		components: {
+			scan
+		},
+		data() {
+			return {
+				isAuto:false,
+				list: [],
+				tolocationNo: "CPK01",
+				scanInfo:{
+					newMesCode:'',
+					pkg:'',
+					cusMaterialCode:'',
+					packagingCode:'',
+					pkgCode:''
+				},
+				
+			};
+		},
+		onLoad() {
+			// this.scanHandle('{"package_code":"TX0922101204332","unit_meas":"m","wdr":"TP09221250000002","lot_batch_no":"*","qty_arrived":"1.2","material_code":"052530100006"}');
+			// this.scanHandle('1HIU102211150010&052530100006&1200&GDVV 2G.657A2(Bow-type)+2脳1.5mm^2&CN&涓ぉ&2022-11-15&221115');
+			// this.scanHandle('052530100006');
+		},
+		onShow() {
+
+			let that = this
+
+			uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+			uni.$on('scan', function(data) {
+				console.log('onscan');
+				//鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
+				console.log('鎵爜缁撴灉锛�', data.code);
+				const result = data.code.replace(/[\r\n]/g, "")
+				that.scanHandle(result)
+			})
+		},
+		onNavigationBarButtonTap(e) {
+			uni.scanCode({
+				success: res => {
+					try {
+						const result = res.result
+
+					} catch (e) {}
+				}
+			});
+		},
+		methods: {
+			format(value,type){
+				this[type].forEach((obj) => {
+					if (obj.value === value) {
+						value = obj.label
+					}
+				})
+				return value
+			},
+			//鑷冲簱浣�
+			seachLocationNo() {
+				uni.navigateTo({
+					url: '/pages/wareHouse/finishProductIn/locNoList'
+				})
+			},
+			//鑷冲簱浣嶅彿璁剧疆
+			setNo(no) {
+				this.tolocationNo = no
+			},
+			scanHandle(result){
+				console.log(result)
+				if(!this.tolocationNo){
+					this.$u.toast('璇烽�夋嫨鑷冲簱浣嶅彿')
+					return
+				}
+				if (result.indexOf('{') >= 0) {
+					//鏂癿es鐮�
+					this.scanInfo.newMesCode = result
+				} else if (result.indexOf('&') >= 0) {
+					//pkg鐮�
+					this.scanInfo.pkg = result
+				} else {
+					//鐗╂枡缂栫爜
+					this.scanInfo.cusMaterialCode = result
+				}
+				//鑷姩鎻愪氦
+				if(this.isAuto && this.scanInfo.newMesCode && this.scanInfo.pkg && this.scanInfo.cusMaterialCode){
+					this.submit()
+				}
+			},
+			submit() {
+				if (!this.scanInfo.newMesCode) {
+					this.$u.toast('璇锋壂鎻忔柊MES鐮�')
+					return
+				}
+				if (!this.scanInfo.pkg) {
+					this.$u.toast('璇锋壂鎻忎腑鍏寸爜')
+					return
+				}
+				if (!this.scanInfo.cusMaterialCode) {
+					this.$u.toast('璇锋壂鎻忕墿鏂欑紪鐮�')
+					return
+				}
+				
+				let mesCodeJSON = JSON.parse(this.scanInfo.newMesCode)
+				let mes_materialCode = mesCodeJSON.material_code
+				let mes_qty = mesCodeJSON.qty_arrived
+				this.scanInfo.packagingCode = mesCodeJSON.package_code
+				
+				let pkg_sub = this.scanInfo.pkg.substring(this.scanInfo.pkg.indexOf('&')+1)
+				let pkg_sub2 = pkg_sub.substring(pkg_sub.indexOf('&')+1)
+				let pkg_materialCode = pkg_sub.substring(0,pkg_sub.indexOf('&'))
+				let pkg_qty = pkg_sub2.substring(0,pkg_sub2.indexOf('&')) -0 
+				this.scanInfo.pkgCode = this.scanInfo.pkg.substring(0, this.scanInfo.pkg.indexOf('&'))
+				// let pkg_materialCode = this.scanInfo.pkg.substring(this.scanInfo.pkg.indexOf('&')+1, this.scanInfo.pkg.indexOf('&',1))
+				// let pkg_qty = this.scanInfo.pkg.substring(this.scanInfo.pkg.indexOf('&',1)+1, this.scanInfo.pkg.indexOf('&',2)) - 0
+				
+				console.log(mes_qty+' ' + pkg_qty);
+				if (mes_materialCode != pkg_materialCode || mes_materialCode != this.scanInfo.cusMaterialCode) {
+					this.$u.toast('鐗╂枡缂栫爜涓嶄竴鑷�')
+					return
+				}
+				if (mes_qty*1000 != pkg_qty) {
+					this.$u.toast('鏁伴噺涓嶄竴鑷�')
+					return
+				}
+				
+				//1銆佹牎楠�
+				this.$u.api.finishZTE.validateJump({
+					packagingCode: this.scanInfo.packagingCode,
+					pkgCode: this.scanInfo.pkgCode
+				}).then(res => {
+					if (res.code == 0) {
+						// this.$u.toast('ok')
+						//2銆佸垽瀹�
+						this.$u.api.finishZTE.addJumpZTE({
+							packagingCode: this.scanInfo.packagingCode,
+							pkgCode: this.scanInfo.pkgCode,
+							inLocationNo : this.tolocationNo
+						}).then(res => {
+							if (res.code == 0) {
+								uni.showModal({
+									title: '鎻愮ず',
+									content: '鎴愬姛',
+									showCancel: false,
+									success: ()=> {
+										this.scanInfo={}
+									}
+								})
+							} else {
+								uni.showModal({
+									title: '鎻愮ず',
+									content: '澶辫触',
+									showCancel: false,
+									success: ()=> {
+										
+									}
+								})
+							}
+						}).catch(res => {
+							// this.scanInfo={}
+						})
+					} else {
+						uni.showModal({
+							title: '鎻愮ず',
+							content: '鏍¢獙澶辫触',
+							showCancel: false,
+							success: ()=> {
+								
+							}
+						})
+					}
+				})
+				
+			},
+		}
+	};
+</script>
+<style lang="scss" scoped>
+	.top{
+		padding:0 20rpx 25rpx;
+		border-bottom: 1px solid #eee;
+		.row3{
+			margin-top: 20rpx;
+			justify-content: space-between;
+			padding: 0 15rpx;
+			font-size: 30rpx;
+			.switch{
+				display: flex;
+				align-items: center;
+			}
+			.u-btn{
+				margin: initial;
+				background:#3281FF;
+			}
+		}
+	}
+	.list .content {
+		font-size: 14px;
+		// background-color: #efefef;
+		box-sizing: border-box;
+		border-radius: 14rpx;
+		margin: 8px;
+		padding: 5px 10px;
+		box-shadow: none;
+		position: relative;
+		border: 1px solid #dddddd;
+	}
+	.scroll-list{
+		height: calc(100vh - var(--window-top) - var(--window-bottom) - 300rpx);
+	}
+
+	.row-list {
+		display: flex;
+		flex-direction: column;
+	}
+
+	.row-list ._label {
+		flex: 0.8;
+		color: #909399;
+	}
+
+	.row-list ._content {
+		flex: 1.5;
+		// text-align: right;
+	}
+
+	.row-img {
+		position: absolute;
+		right: 2px;
+		top: 0px;
+	}
+
+	>>>.uni-input-input {
+		font-size: 12px;
+	}
+
+	::v-deep.u-input__input {
+		min-height: unset !important;
+		text-align: right;
+	}
+</style>

--
Gitblit v1.9.3