#
whycq
2023-07-13 5c8951e28e9f2fbdbe730ddf264eeba313647ea9
pages/AGV/AGVPakinOn.vue
@@ -52,12 +52,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 +65,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 +82,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 +117,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 +125,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>
@@ -163,6 +161,8 @@
            matFocus: false,
            matData: '',
            removeNum: 0,
            devNo: [],
            flag: 0
         }
      },
      onLoad() {
@@ -178,27 +178,40 @@
            this.$refs.message.open()
         },
         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)
         },
         // barcode input 事件
         // 符合条件的跳转到下一栏目
         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)
         },
         // 托盘码有误重置
         // 暂存位有误重置
         stationCodeFocuss() {
            let that = this;
            that.barcodeFocus = false;
@@ -384,7 +397,7 @@
         combClose() {
            this.$refs.combConfirm.close()
         },
         comb() {
         comb(e) {
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
@@ -418,12 +431,96 @@
               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) {
            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')
@@ -439,30 +536,7 @@
               }
            });
         },
         reset(type) {
            this.msgType = type
            this.title = '警告'
            this.content = '是否重置!'
            this.$refs.resetConfirm.open()
         },
         // 确认重置
         resetConfirm() {
            this.dataList = []
            this.stationCode = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
         },
         // 取消重置
         resetClose() {
         },
         // 清空
         resst() {
            this.dataList = []
            this.barcode = ''
            this.stationCode = ''
            this.barcodeFocuss()
         },
      }
   }
</script>