#
zwl
17 小时以前 b5390b1f1254d1a286a78c3d22da0366b3a27096
pages/AGV/AGVStart-return.vue
@@ -2,12 +2,13 @@
   <view>
      <view class="code">         
         <view class="item">
            <view class="code-decs">源站点:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="stationCode" :focus="stationCodeFocus">
            <view class="code-decs">托盘码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus"
            @input="barcodeInput()">
         </view>
         <view class="item">
            <view class="code-decs">托盘码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="sta" :focus="stationCodeFocus">
            <view class="code-decs">源站点:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="stationCode" :focus="stationCodeFocus">
         </view>
      </view>
      
@@ -107,7 +108,7 @@
            token: '',
            barcode: '',
            stationCode: '',
            stationCodeFocus: true,
            stationCodeFocus: false,
            dataList: [],
            count: 0,
            rowNum: '',
@@ -238,165 +239,12 @@
         // 商品光标清空重置
         focuss() {
            this.focus = false;
            this.stationCodeFocus = false;
            this.barcodeFocus =false;
            setTimeout(() => {
               this.matnr = '';
               this.matFocus = true;
               this.sta = '';
               this.stationCodeFocus = true;
            }, 100);
         },
         // 搜索物料
         findMat() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
               data: {
                  matnr: that.matnr
               },
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              that.checkMat(data.data)
                              that.focuss()
                           },
                        },
                     });
                  } else if (res.code == 403) {
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            });
         },
         selectMat() {
            let that = this
            uni.navigateTo({
               url: "../mat/matQuery",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('commonUrl', {
                     commonUrl: ''
                  })
               },
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.findMat(that.matnr)
                  },
               },
            });
            that.matnr = ''
         },
         checkMat(mat) {
            var len = this.dataList.length
            var add = true ,sameItem = false
            for (var i = 0; i < len; i++) {
               if (mat.matnr == this.dataList[i].matnr) {
                  for (var j = 0; j < len; j++) {
                     if (mat.batch == this.dataList[j].batch) {
                        sameItem = true
                     }
                  }
                  // 相同物料 不同批号  新加列表
                  if (mat.batch != this.dataList[i].batch) {
                     this.$forceUpdate() // 强制刷新
                     if (sameItem) {
                        add = false
                     } else {
                        add = true
                     }
                  } else {
                     // 相同物料相同批号 数量累加
                     this.dataList[i].anfme += mat.anfme
                     this.$forceUpdate() // 强制刷新
                     add = false
                  }
               }
            }
            if (add) {
               this.dataList.unshift(mat)
            }
         },
         // 修改批号
         revise(item, i) {
            this.matnr = this.dataList[i].matnr
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
            this.rowNum = i
            this.eject()
         },
         eject(type) {
            this.type = type
            this.$refs.revise.open(type)
         },
         // 列表移除按钮
         remove(item, i, type) {
            this.removeNum  = i
            this.msgType = type
            this.title = '警告'
            this.content = '是否移除当前商品!'
            this.$refs.alertDialog.open(i)
         },
         // 确认移除
         removeConfirm() {
            this.messageText = "移除成功"
            this.messageToggle('success')
            this.dataList.splice(this.removeNum, 1)
         },
         // 取消移除
         removeClose() {
            this.$refs.alertDialog.close()
         },
         reviseConfirm() {
            this.dataList[this.rowNum].anfme = this.count
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].weight = this.weight
            this.matnr = ''
            this.messageText = "修改成功"
            this.messageToggle('success')
            this.$refs.revise.close()
         },
         reviseClose() {
            this.$refs.revise.close()
         },
         changeValue(value) {
            this.count = value
         },
         combConfirm(type) {
            this.msgType = type
@@ -409,15 +257,13 @@
         },
         comb() {            
            let that = this;
            if (that.stationCode === '') {
            if (that.barcode === '') {
               this.messageText = "请扫描暂存位条码"
               this.messageToggle('error')
               return;
            }
            let newSta =  that.sta.split("-")
            uni.request({
               url: that.baseUrl + '/mobile/AGVStartReturn?sourceStaNo='+that.stationCode+'&staNo='+newSta[0],
               url: that.baseUrl + '/mobile/AGVStartReturn?sourceStaNo='+that.stationCode+'&staNo='+that.barcode,
               header: {
                  'token': uni.getStorageSync('token')
               },
@@ -452,6 +298,9 @@
         resetConfirm() {
            this.dataList = []
            this.stationCode = ''
            this.barcode = ''
            this.stationCodeFocus =false
            this.barcodeFocus =true
            this.floor = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
@@ -465,8 +314,10 @@
            this.staList = []
            this.sta = ''
            this.stationCode = ''
            this.barcode = ''
            this.stationCodeFocus =false
            this.barcodeFocus =true
            this.floor = ''
            this.barcodeFocuss()
         },
      }
   }