whycq
2024-11-19 fe8fb74ce94e7bee23ed47b7175236248ac93b98
pages/order/zlOrderPakin.vue
@@ -28,6 +28,7 @@
         <view class="item">
            <view class="code-decs">物料码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="checkBom()">
            <uni-icons type="close" color="#c1c1c1" @click="clearMatnr"></uni-icons>
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
@@ -207,7 +208,10 @@
         }
      },
      onLoad() {
         // this.dataList = uni.getStorageSync('zlPakinDataList')
         // if (this.dataList === '') {
         //    this.dataList = []
         // }
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
@@ -222,6 +226,10 @@
      },
      methods: {
         back() { uni.navigateBack({}) },
         clearMatnr() {
            // this.matnr = ''
            this.focuss()
         },
         // 是否满板
         isFullPlt() {
            var temp = this.ck1
@@ -256,11 +264,7 @@
            setTimeout(() => {
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  uni.showToast({ title: '托盘码有误请重试', icon: "none", position: 'top' });
                  this.barcodeFocuss()
                  return;
               }
@@ -286,7 +290,7 @@
            }, 100);
         },
         // 检验当前物料是否是在当前Bom表中
         checkBom() {
         checkBom(mat) {
            let _this = this
            uni.request({
               url: _this.baseUrl + '/mobile/pda/decrees/check',
@@ -294,7 +298,7 @@
               method: 'POST',
               header: { 
                  'token': uni.getStorageSync('token'),
                   'content-type' : 'application/x-www-form-urlencoded'
                  'content-type' : 'application/x-www-form-urlencoded'
               },
               success(res) {
                  // console.log(res);
@@ -302,7 +306,8 @@
                  if (res.code === 200) {
                     switch(res.data.status) {
                        case 1:
                           _this.findMat()
                           // _this.findMat()
                           _this.checkMat(mat)
                           break;
                        case 2:
                           // 相同制令货物补货
@@ -347,12 +352,8 @@
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
               data: {
                  matnr: that.matnr
               },
               header: {
                  'token': uni.getStorageSync('token')
               },
               data: { matnr: that.matnr },
               header: { 'token': uni.getStorageSync('token') },
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
@@ -381,22 +382,12 @@
                        },
                     });
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                     uni.showToast({ title: result.msg, icon: "none", position: 'top' })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                        uni.reLaunch({ url: '../login/login' });
                     }, 1000);
                  } else {
                     uni.showToast({
                        title: result.msg,
                        icon: "none",
                        position: 'top'
                     })
                     uni.showToast({ title: result.msg, icon: "none", position: 'top' })
                  }
               }
@@ -406,7 +397,7 @@
         selectMat() {
            let that = this
            uni.navigateTo({
               url: "../mat/matQuery",
               url: "../mat/matQueryByOrder",
               success: function(res) {
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('commonUrl', {
@@ -416,12 +407,10 @@
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     that.matnr = data.data
                     that.checkBom(that.matnr)
                     that.matnr = data.data.matnr
                     that.checkBom(data.data)
                  },
               },
            });
            that.matnr = ''
         },
@@ -466,6 +455,7 @@
            }
            this.$forceUpdate() // 强制刷新
            this.maxAnfme = ''
            uni.setStorageSync('zlPakinDataList', this.dataList);
         },
         // 修改批号
         revise(item, i) {
@@ -491,8 +481,7 @@
         },
         // 确认移除
         removeConfirm() {
            this.messageText = "移除成功"
            this.messageToggle('success')
            uni.showToast({ title: "移除成功", icon: "success", position: 'top' })
            this.dataList.splice(this.removeNum, 1)
         },
         // 取消移除
@@ -504,8 +493,7 @@
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].weight = this.weight
            this.matnr = ''
            this.messageText = "修改成功"
            this.messageToggle('success')
            uni.showToast({ title: "修改成功", icon: "success", position: 'top' })
            this.$refs.revise.close()
         },
         reviseClose() {
@@ -534,19 +522,16 @@
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
               this.messageText = "请扫描托盘条码"
               this.messageToggle('error')
               uni.showToast({ title: "请扫描托盘条码", icon: "error", position: 'top' })
               return;
            }
            if (that.dataList.length === 0) {
               this.messageText = "请添加商品列表"
               this.messageToggle('error')
               uni.showToast({ title: "请添加商品列表", icon: "error", position: 'top' })
               return;
            }
            for (var i = 0; i < that.dataList.length; i++) {
               if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
                  this.messageText = that.dataList[i].matnr + '组托数量不能为0'
                  this.messageToggle('error')
                  uni.showToast({ title: "组托数量不能为0", icon: "error", position: 'top' })
                  return;
               }
            }
@@ -571,17 +556,16 @@
                     const innerAudioContext = uni.createInnerAudioContext();
                     innerAudioContext.src = '/static/music/pakinOk.mp3';
                     innerAudioContext.play()
                     that.dataList = []
                     uni.setStorageSync('zlPakinDataList', that.dataList);
                     uni.showToast({ title: '组托成功', icon: "success", position: 'top' })
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                        uni.reLaunch({ url: '../login/login' });
                     }, 1000);
                  } else {
                     that.messageText = res.msg
                     that.messageToggle('error')
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            });
@@ -597,8 +581,7 @@
            this.dataList = []
            this.barcode = ''
            this.bomCode = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
            uni.showToast({ title: "重置完成", icon: "success", position: 'top' })
            this.bomFocuss()
         },
         // 取消重置