1
zhang
2025-09-26 4a01b5f1b111885aa0cadf3d5f96fee78413be16
pages/pakin/mergeStore.vue
@@ -2,22 +2,13 @@
   <view>
      <view class="code">
         <view class="item">
            <view class="code-decs">Bom号:</view>
            <view style="flex: 1;">
               <input type="text" placeholder=" --" disabled="true" v-model="orderNo" :focus="orderNoFocus">
            </view>
            <view style="height:100%;line-height:2;width:40rpx;margin-right: 20rpx;">
               <!-- <uni-icons type="clear" color="#c1c1c1" @click="clearOrderNo()"></uni-icons> -->
            </view>
         </view>
         <view class="item">
            <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="matnr" :focus="matFocus" @input="checkBom()">
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()">
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
@@ -50,7 +41,7 @@
                  <view class="left-item">{{item.specs}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">批号:</view>
                  <view class="desc" style="width: 38%;">批号:</view>
                  <view class="left-item">
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
@@ -62,9 +53,8 @@
                  </view>
               </view> -->
               <view class="list-left-item">
                  <view class="left-item">数量:{{item.anfme}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
            </view>
            <view class="list-right">
@@ -76,7 +66,7 @@
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">组托</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">并托</button>
      </view>
      <!-- 弹窗 -->
      <!-- 修改数量 -->
@@ -93,8 +83,8 @@
                  </view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right"><input type="text" v-model="batch"></view>
                  <view class="popup-item-left" style="width: 20vw;">备注:</view>
                  <view class="popup-item-right" style="width: 46vw;"><input type="text" v-model="memo"></view>
               </view>
               <!-- <view class="popup-item">
                  <view class="popup-item-left">重量:</view>
@@ -103,7 +93,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='1' :max="maxAn" color="#747474" @change="changeValue" />
                     <uni-number-box :value="count" :step='0.01' :max="9999999" color="#747474" @change="changeValue" />
                  </view>
               </view>
               <view class="btn">
@@ -127,7 +117,7 @@
            <uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
         </uni-popup>
      </view>
      <!-- 确认组托 -->
      <!-- 确认并托 -->
      <view>
         <uni-popup ref="combConfirm" type="dialog">
            <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
@@ -151,7 +141,7 @@
            baseUrl: '',
            token: '',
            barcode: '',
            orderNo: '',
            memo: '',
            dataList: [],
            count: 0,
            rowNum: '',
@@ -163,14 +153,10 @@
            messageText: '',
            title: '',
            content: '',
            orderNoFocus: false,
            barcodeFocus: true,
            matFocus: false,
            matData: '',
            removeNum: 0,
            enterCount: 0,
            maxAnfme: 0,
            maxAn: 0
         }
      },
      onLoad() {
@@ -185,46 +171,23 @@
            this.msgType1 = type
            this.$refs.message.open()
         },
         clearOrderNo() {
            this.orderNo = ''
            let that = this;
            that.orderNoFocus = false;
            setTimeout(() => {
               that.orderNo = '';
               that.orderNoFocus = true;
            }, 100);
         },
         orderNoInput() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.orderNo.length
               this.barcodeFocuss()
            }, 200)
         },
         // barcode input 事件
         barcodeInput() {
            let _this = this
            uni.request({
               url: _this.baseUrl + '/mobile/check/mergeStore/barcode',
               data: {barcode: _this.barcode},
               header: { 'token':uni.getStorageSync('token') },
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.focuss()
                     _this.orderNo = res.data
                     uni.showToast({ title: '操作成功', icon: "none", position: 'top' })
                  } else if (res.code === 403) {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                     setTimeout(() => {
                        uni.reLaunch({ url: '../login/login' });
                     }, 1000);
                  } else {
                     _this.barcodeFocuss()
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                  }
            this.barcode = this.barcode.replace(/^\{|\}$/g, '')
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  this.barcodeFocuss()
                  return;
               }
            })
               this.focuss()
            }, 200)
         },
         // 托盘码有误重置
         barcodeFocuss() {
@@ -237,63 +200,29 @@
         },
         // 商品光标清空重置
         focuss() {
            this.focus = false;
            this.barcodeFocus = false;
            this.matFocus = false;
            setTimeout(() => {
               this.matnr = '';
               this.matFocus = true;
            }, 100);
         },
         // 检验当前物料是否是在当前Bom表中
         checkBom() {
            let _this = this
            uni.request({
               url: _this.baseUrl + '/mobile/comb/checkBom',
               data: JSON.stringify({
                  bomCode: _this.orderNo,
                  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'
                     })
                  }
               }
            })
         },
         // 搜索物料
         findMat() {
            let that = this
            var mat = that.matnr
            let submitMat
            let newMatnr
            if (mat.includes(';')) {
               newMatnr = mat.split(';')
               submitMat = newMatnr[1]
            } else {
               submitMat = mat
            }
            uni.request({
               url: that.baseUrl + '/mat/auth',
               data: {
                  matnr: that.matnr
                  matnr: submitMat
               },
               header: {
                  'token': uni.getStorageSync('token')
@@ -304,11 +233,6 @@
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     if (that.maxAnfme > 0) {
                        that.matData['maxNum'] = that.maxAnfme
                     } else if (that.maxAnfme == 0){
                        that.matData['maxNum'] = 0
                     }
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
@@ -320,7 +244,6 @@
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              console.log(data);
                              that.checkMat(data.data)
                              that.focuss()
                           },
@@ -399,22 +322,17 @@
               }
            }
            if (add) {
               // if (this.maxAnfme) {
               //    mat['maxAnfme'] = this.maxAnfme
               //    mat.anfme = this.maxAnfme
               // }
               this.dataList.unshift(mat)
            }
            this.maxAnfme = ''
            this.$forceUpdate() // 强制刷新
         },
         // 修改批号
         revise(item, i) {
            this.matnr = this.dataList[i].matnr
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.memo = this.dataList[i].memo
            this.weight = this.dataList[i].weight
            this.maxAn = this.dataList[i].maxNum
            this.rowNum = i
            this.eject()
         },
@@ -458,7 +376,7 @@
         combConfirm(type) {
            this.msgType = type
            this.title = '警告'
            this.content = '是否现在组托!'
            this.content = '是否现在并托!'
            this.$refs.combConfirm.open()
         },
         combClose() {
@@ -467,11 +385,6 @@
         comb() {
            uni.vibrateShort();
            let that = this;
            if (that.orderNo === '') {
               this.messageText = "请输入订单条码"
               this.messageToggle('error')
               return;
            }
            if (that.barcode === '') {
               this.messageText = "请扫描托盘条码"
               this.messageToggle('error')
@@ -484,15 +397,14 @@
            }
            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.messageText = that.dataList[i].matnr + '并托数量不能为0'
                  this.messageToggle('error')
                  return;
               }
            }
            uni.request({
               url: that.baseUrl + '/mobile/merge/comb/auth',
               url: that.baseUrl + '/mobile/combMeger/auth',
               data: JSON.stringify({
                  bomCode: that.orderNo,
                  barcode: that.barcode,
                  combMats: that.dataList
               }),
@@ -504,7 +416,7 @@
                  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';
@@ -542,15 +454,9 @@
         },
         // 清空
         resst() {
            this.orderNo = ''
            this.dataList = []
            this.barcode = ''
            let that = this;
            that.orderNoFocus = false;
            setTimeout(() => {
               that.orderNo = '';
               that.orderNoFocus = true;
            }, 100);
            this.barcodeFocuss()
         },
      }
   }
@@ -562,7 +468,7 @@
   .code {
      width: 100%;
      position: fixed;
      min-height: 140rpx;
      min-height: 200rpx;
      background-color: #FFF;
      z-index: 10;
   }
@@ -570,7 +476,7 @@
   .item {
      display: flex;
      align-items: center;
      height: 70rpx;
      height: 100rpx;
      margin-left: 20rpx;
      border-bottom: 1px solid #DCDFE6;
   }
@@ -602,7 +508,7 @@
      width: 100%;
      background-color: white;
      position: fixed;
      margin-top: 210rpx;
      margin-top: 200rpx;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;