#
whycq
2023-10-04 d78a337df4af502f6e886dd4cb1533f2ec02843c
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() {
@@ -178,27 +185,56 @@
            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 事件
         // 符合条件的跳转到下一栏目
         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;
@@ -376,6 +412,9 @@
            this.count = value
         },
         combConfirm(type) {
            if (this.dataList.length < 1) {
               return
            }
            this.msgType = type
            this.title = '警告'
            this.content = '是否现在组托!'
@@ -384,7 +423,7 @@
         combClose() {
            this.$refs.combConfirm.close()
         },
         comb() {
         comb(e) {
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
@@ -407,6 +446,7 @@
            uni.request({
               url: that.baseUrl + '/agvMobile/comb/auth',
               data: JSON.stringify({
                  orderNo: that.orderNo,
                  barcode: that.barcode,
                  locno: that.stationCode,
                  combMats: that.dataList
@@ -418,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')
@@ -439,37 +566,16 @@
               }
            });
         },
         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>
<style>
   @import url('../../static/css/wms.css/wms.css');
   .list:first-child {
      margin-top: 540rpx;
   }
   .code {
      width: 100%;
      position: fixed;
@@ -513,7 +619,7 @@
      width: 100%;
      background-color: white;
      position: fixed;
      margin-top: 300rpx;
      margin-top: 400rpx;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;