#
whycq
2024-06-27 2b937bcd3e418b29b321df06becac94c423ebaa4
pages/pakin/bomPakin.vue
@@ -4,7 +4,7 @@
         <view class="item">
            <view class="code-decs">bom号:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="bomCode" :focus="bomCodeFocus"
               @input="bomInput()">
               @confirm="bomInput()">
         </view>
         <view class="item">
            <view class="code-decs">托盘码:</view>
@@ -98,7 +98,7 @@
               <view class="popup-item">
                  <view class="popup-item-left">数量:</view>
                  <view class="popup-item-right" style="border: none;justify-content: center;">
                     <uni-number-box :value="count" :step='0.01' :max="9999999" color="#747474" @change="changeValue" />
                     <uni-number-box :value="count" :step='1' :max="maxAn" color="#747474" @change="changeValue" />
                  </view>
               </view>
               <view class="btn">
@@ -157,12 +157,13 @@
            messageText: '',
            title: '',
            content: '',
            barcodeFocus: true,
            barcodeFocus: false,
            matFocus: false,
            matData: '',
            removeNum: 0,
            bomCode: '',
            bomCodeFocus: false
            bomCodeFocus: true,
            maxAn: 0
         }
      },
      onLoad() {
@@ -178,7 +179,17 @@
            this.$refs.message.open()
         },
         bomInput() {
            setTimeout(() => {
               this.barcodeFocuss()
            }, 200)
         },
         bomFocuss() {
            let that = this;
            that.bomCodeFocus = false;
            setTimeout(() => {
               that.bomCode = '';
               that.bomCodeFocus = true;
            }, 100);
         },
         // barcode input 事件
         barcodeInput() {
@@ -219,15 +230,43 @@
         checkBom() {
            let _this = this
            uni.request({
               url: that.baseUrl + '/mobile/comb/checkBom',
               url: _this.baseUrl + '/mobile/comb/checkBom',
               data: JSON.stringify({
                  bomCode: that.bomCode,
                  matnr: that.matnr
                  bomCode: _this.bomCode,
                  matnr: _this.matnr
               }),
               method: 'POST',
               header: { 'token': uni.getStorageSync('token') },
               success(res) {
                  console.log(res);
                  res = res.data
                  if (res.code === 200) {
                     if (res.data) {
                        _this.maxAnfme = res.data.zpalletAnfme
                        _this.findMat()
                     } else {
                        _this.findMat()
                     }
                  } else if (res.code == 403) {
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     _this.matnr = ''
                     uni.showToast({
                        title: res.msg,
                        icon: "none",
                        position: 'top'
                     })
                  }
               }
            })
         },
@@ -248,6 +287,9 @@
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     if (that.maxAnfme) {
                        that.matData['maxNum'] = that.maxAnfme
                     }
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
@@ -330,16 +372,26 @@
                     
                  } else {
                     // 相同物料相同批号 数量累加
                     this.dataList[i].anfme += mat.anfme
                     if (this.maxAnfme) {
                        this.dataList[i].anfme = this.maxAnfme
                     } else {
                        this.dataList[i].anfme += mat.anfme
                     }
                     this.$forceUpdate() // 强制刷新
                     add = false
                  }
               }
            }
            if (add) {
               if (this.maxAnfme) {
                  mat['maxAnfme'] = this.maxAnfme
                  mat.anfme = this.maxAnfme
               }
               this.dataList.unshift(mat)
            }
            this.$forceUpdate() // 强制刷新
            this.maxAnfme = ''
         },
         // 修改批号
         revise(item, i) {
@@ -347,6 +399,7 @@
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
            this.maxAn = this.dataList[i].maxNum
            this.rowNum = i
            this.eject()
         },
@@ -459,8 +512,11 @@
         // 确认重置
         resetConfirm() {
            this.dataList = []
            this.barcode = ''
            this.bomCode = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
            this.bomFocuss()
         },
         // 取消重置
         resetClose() {
@@ -470,7 +526,8 @@
         resst() {
            this.dataList = []
            this.barcode = ''
            this.barcodeFocuss()
            this.bomCode = ''
            this.bomFocuss()
         },
      }
   }