From d78a337df4af502f6e886dd4cb1533f2ec02843c Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期三, 04 十月 2023 22:59:44 +0800 Subject: [PATCH] # --- pages/AGV/AGVPakinOn.vue | 211 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 164 insertions(+), 47 deletions(-) diff --git a/pages/AGV/AGVPakinOn.vue b/pages/AGV/AGVPakinOn.vue index 4efadb4..33c2652 100644 --- a/pages/AGV/AGVPakinOn.vue +++ b/pages/AGV/AGVPakinOn.vue @@ -2,6 +2,11 @@ <view> <view class="code"> <view class="item"> + <view class="code-decs">璁㈠崟鍙�:</view> + <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="orderNo" :focus="orderNoFocus" + @input="orderNoInput()"> + </view> + <view class="item"> <view class="code-decs">鎵樼洏鐮�:</view> <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus" @input="barcodeInput()"> @@ -52,12 +57,6 @@ </view> </view> <view class="list-left-item"> - <view class="desc">閲嶉噺锛�</view> - <view class="left-item"> - <uni-tag :text="item.weight" type="warning"></uni-tag> - </view> - </view> - <view class="list-left-item"> <view class="desc">鏁伴噺锛�</view> <view class="left-item">{{item.anfme}}</view> </view> @@ -71,6 +70,7 @@ <!-- 搴曢儴鎿嶄綔鎸夐挳 --> <view class="buttom"> <button size="mini" @click="reset('warn')">閲嶇疆</button> + <button size="mini" type="primary" @click="agvStart('warn')">鍚姩鍏ュ簱</button> <button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button> </view> <!-- 寮圭獥 --> @@ -87,13 +87,9 @@ style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;"> </view> </view> - <!-- <view class="popup-item"> + <view class="popup-item"> <view class="popup-item-left">鎵瑰彿:</view> <view class="popup-item-right"><input type="text" v-model="batch"></view> - </view> --> - <view class="popup-item"> - <view class="popup-item-left">閲嶉噺:</view> - <view class="popup-item-right"><input type="text" v-model="weight"></view> </view> <view class="popup-item"> <view class="popup-item-left">鏁伴噺:</view> @@ -126,7 +122,7 @@ <view> <uni-popup ref="combConfirm" type="dialog"> <uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content" - @confirm="comb" @close="combClose"></uni-popup-dialog> + @confirm="comb(1)" @close="combClose"></uni-popup-dialog> </uni-popup> </view> <!-- 纭閲嶇疆 --> @@ -134,6 +130,13 @@ <uni-popup ref="resetConfirm" type="dialog"> <uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content" @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog> + </uni-popup> + </view> + <!-- 鍚姩鍏ュ簱 --> + <view> + <uni-popup ref="agvStartConfirm" type="dialog"> + <uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content" + @confirm="agvStartConfirm" @close="resetClose"></uni-popup-dialog> </uni-popup> </view> </view> @@ -146,6 +149,7 @@ baseUrl: '', token: '', barcode: '', + orderNo: '', stationCode: '', dataList: [], count: 0, @@ -161,8 +165,11 @@ barcodeFocus: true, stationCodeFocus: false, matFocus: false, + orderNoFocus: false, matData: '', removeNum: 0, + devNo: [], + flag: 0 } }, onLoad() { @@ -177,25 +184,57 @@ this.msgType1 = type this.$refs.message.open() }, - // barcode input 浜嬩欢 + stationCodeInput() { + setTimeout(() => { + var len = this.stationCode.length + if (len != 15) { + this.stationCode = '' + this.stationCodeFocus = true + uni.showToast({ + title: '鏆傚瓨鐮佹湁璇閲嶈瘯', + icon: "none", + position: 'top' + }); + return; + } + this.focuss() + }, 200) + }, + // 绗﹀悎鏉′欢鐨勮烦杞埌涓嬩竴鏍忕洰 + orderNoInput() { + // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏� + setTimeout(() => { + var len = this.orderNo.length + this.barcodeFocuss() + }, 200) + }, barcodeInput() { // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏� setTimeout(() => { var len = this.barcode.length - if (len != 8) { + if (len != 10) { + this.barcode = '' + this.barcodeFocus = true uni.showToast({ title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top' }); - this.stationCodeFocuss() return; } this.stationCodeFocuss() - // this.focuss() }, 200) }, // 鎵樼洏鐮佹湁璇噸缃� + barcodeFocuss() { + let that = this; + that.barcodeFocus = false; + setTimeout(() => { + that.barcode = ''; + that.barcodeFocus = true; + }, 100); + }, + // 鏆傚瓨浣嶆湁璇噸缃� stationCodeFocuss() { let that = this; that.barcodeFocus = false; @@ -214,6 +253,12 @@ // 鎼滅储鐗╂枡 findMat() { let that = this + if (that.dataList.length >= 1) { + this.messageText = "鍙兘娣诲姞涓�绉嶇墿鏂�" + this.messageToggle('warn') + that.matnr = '' + return + } uni.request({ url: that.baseUrl + '/mat/auth', data: { @@ -367,6 +412,9 @@ this.count = value }, combConfirm(type) { + if (this.dataList.length < 1) { + return + } this.msgType = type this.title = '璀﹀憡' this.content = '鏄惁鐜板湪缁勬墭!' @@ -375,7 +423,7 @@ combClose() { this.$refs.combConfirm.close() }, - comb() { + comb(e) { uni.vibrateShort(); let that = this; if (that.barcode === '') { @@ -396,10 +444,11 @@ } } uni.request({ - url: that.baseUrl + '/mobile/comb/auth', + url: that.baseUrl + '/agvMobile/comb/auth', data: JSON.stringify({ + orderNo: that.orderNo, barcode: that.barcode, - stationCode: that.stationCode, + locno: that.stationCode, combMats: that.dataList }), method: 'POST', @@ -409,12 +458,99 @@ success(result) { var res = result.data if (res.code === 200) { + that.flag = 1 + if (e == 1) { + that.resst(); + that.messageText = "缁勬墭鎴愬姛" + that.messageToggle('success') + const innerAudioContext = uni.createInnerAudioContext(); + innerAudioContext.src = '/static/music/pakinOk.mp3'; + innerAudioContext.play() + } + } else if (res.code == 403) { + that.messageText = res.msg + that.messageToggle('error') + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + that.flag = 0 + } else { + that.messageText = res.msg + that.messageToggle('error') + that.flag = 0 + } + } + }); + }, + reset(type) { + this.msgType = type + this.title = '璀﹀憡' + this.content = '鏄惁閲嶇疆!' + this.$refs.resetConfirm.open() + }, + // 纭閲嶇疆 + resetConfirm() { + this.dataList = [] + this.barcode = '' + this.stationCode = '' + this.messageText = "閲嶇疆瀹屾垚" + this.messageToggle('success') + }, + // 鍙栨秷閲嶇疆 + resetClose() { + + }, + // 娓呯┖ + resst() { + this.dataList = [] + this.barcode = '' + this.stationCode = '' + this.barcodeFocus = true + }, + // 鍚姩鍏ュ簱 + agvStart(type) { + if (this.dataList.length < 1) { + return + } + this.msgType = type + this.title = '璀﹀憡' + this.content = '鏄惁鐜板湪鍚姩鍏ュ簱!' + this.$refs.agvStartConfirm.open() + }, + agvStartConfirm() { + uni.showLoading() + this.devNo = [] + this.devNo.push(this.stationCode) + this.comb(2) + setTimeout(()=>{ + if (this.flag != 1) { + uni.hideLoading() + return + } + this.start() + uni.hideLoading() + },500) + + }, + start() { + let that = this + uni.request({ + url: that.baseUrl + '/agvMobile/pakin/auth', + data: JSON.stringify({ + devNo: that.devNo + }), + method: 'POST', + header: { + 'token': uni.getStorageSync('token') + }, + success(result) { + var res = result.data + if (res.code === 200) { that.resst(); - that.messageText = "缁勬墭鎴愬姛" + that.messageText = "鍚姩鎴愬姛" that.messageToggle('success') - const innerAudioContext = uni.createInnerAudioContext(); - innerAudioContext.src = '/static/music/pakinOk.mp3'; - innerAudioContext.play() } else if (res.code == 403) { that.messageText = res.msg that.messageToggle('error') @@ -430,35 +566,16 @@ } }); }, - reset(type) { - this.msgType = type - this.title = '璀﹀憡' - this.content = '鏄惁閲嶇疆!' - this.$refs.resetConfirm.open() - }, - // 纭閲嶇疆 - resetConfirm() { - this.dataList = [] - this.messageText = "閲嶇疆瀹屾垚" - this.messageToggle('success') - }, - // 鍙栨秷閲嶇疆 - resetClose() { - - }, - // 娓呯┖ - resst() { - this.dataList = [] - this.barcode = '' - this.barcodeFocuss() - }, + } } </script> <style> @import url('../../static/css/wms.css/wms.css'); - + .list:first-child { + margin-top: 540rpx; + } .code { width: 100%; position: fixed; @@ -502,7 +619,7 @@ width: 100%; background-color: white; position: fixed; - margin-top: 200rpx; + margin-top: 400rpx; z-index: 9; /* border-top: 1px solid #DCDFE6; */ text-align: center; -- Gitblit v1.9.1