skyouc
2025-07-14 4616cff3a14b81c4d488697f43fc7aad3cf3f10f
pages/pakin/pakin.vue
@@ -14,19 +14,25 @@
               <text style="text-align: right;color: #409EFF;" @click="findMat()">提取+</text>
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
         </view>
         </view>
         <uni-section title="商品列表" type="line" class="mat-list-title"></uni-section>
      </view>
      <view class="mat-list-title">
         <div>商品列表</div>
      <view class="list-view">
         <scroll-view>
            <view class="list" v-for="(item,i) in dataList" :key="i">
               <view class="list-left">
                  <view class="list-left-item">
                     <view class="desc">No:</view>
                     <view class="left-item">{{i + 1}}</view>
                  </view>
                  <view class="list-left-item">
                     <view class="desc">订单号:</view>
                     <view class="left-item">
                        <uni-tag :text="item.orderNo" type="normal"></uni-tag>
                     </view>
                  </view>
                  <view class="list-left-item">
                     <view class="desc">编码:</view>
                     <view class="desc">物料码:</view>
                     <view class="left-item">
                        <uni-tag :text="item.matnr" type="primary"></uni-tag>
                     </view>
@@ -120,6 +126,12 @@
            <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="recommend" type="dialog">
            <uni-popup-dialog :type="msgType"  mode="base"  :cancelText="null"  confirmText="确认" title="推荐库位" :content="recomLoc"></uni-popup-dialog>
         </uni-popup>
      </view>
   </view>
</template>
@@ -137,7 +149,8 @@
            msgType1: 'success',
            msgType: 'success',
            messageText: '',
            title: '',
            title: '',
            recomLoc: '',
            content: '',
            barcodeFocus: true,
            matFocus: false,
@@ -169,15 +182,15 @@
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({
                     title: '托盘码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  // this.barcodeFocuss()
                  return;
               }
               // if (len != 8) {
               //    uni.showToast({
               //       title: '托盘码有误请重试',
               //       icon: "none",
               //       position: 'top'
               //    });
               //    // this.barcodeFocuss()
               //    return;
               // }
               // this.focuss()
            }, 200)
         },
@@ -215,7 +228,8 @@
            }
         },
      
         checkMat(mat) {
         checkMat(mat) {
            console.log(mat)
            var len = this.dataList.length
            var add = true ,sameItem = false
            for (var i = 0; i < len; i++) {
@@ -224,7 +238,8 @@
                     if (mat.batch == this.dataList[j].batch) {
                        sameItem = true
                     }
                  }
                  }
                  // 相同物料 不同批号  新加列表
                  if (mat.batch != this.dataList[i].batch) {
                     this.$forceUpdate() // 强制刷新
@@ -234,11 +249,17 @@
                        add = true
                     }
                     
                  } else {
                     // 相同物料相同批号 数量累加
                     this.dataList[i].mergeNum += mat.mergeNum
                     this.$forceUpdate() // 强制刷新
                     add = false
                  } else {
                     // 相同物料,相同批号,不同订单号
                     if (mat.orderNo != this.dataList[i].orderNo) {
                        this.$forceUpdate()
                        add = true
                     } else {
                        // 相同物料相同批号 数量累加
                        this.dataList[i].mergeNum += mat.mergeNum
                        this.$forceUpdate() // 强制刷新
                        add = false
                     }
                  }
               }
            }
@@ -326,7 +347,8 @@
                  this.messageToggle('error')
                  return;
               }
            }
            }
            uni.request({
               url: that.baseUrl + '/pda/comb/auth',
               data: JSON.stringify({
@@ -341,12 +363,15 @@
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     that.resst();
                     that.messageText = "组托成功"
                     that.messageToggle('success')
                     const innerAudioContext = uni.createInnerAudioContext();
                     innerAudioContext.src = '/static/music/pakinOk.mp3';
                     innerAudioContext.play()
                     innerAudioContext.play()
                     if (that.barcode.indexOf('PK') >= 0) {
                        that.recommendLocs(that)
                     }
                     that.resst();
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
@@ -361,7 +386,38 @@
                  }
               }
            });
         },
         },
         recommendLocs(that) {
            uni.request({
               url: that.baseUrl + '/pda/recommend/locs',
               method: 'GET',
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     if (res.data != null && res.data != undefined ) {
                        that.recomLoc = '系统推荐将货物放至:' + res.data.locNo
                        that.$refs.recommend.open()
                     }
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     that.messageText = res.msg
                     that.messageToggle('error')
                  }
               }
            });
         },
         reset(type) {
            this.msgType = type
            this.title = '警告'
@@ -382,6 +438,7 @@
         resst() {
            this.dataList = []
            this.barcode = ''
            this.matnr = ''
            this.barcodeFocuss()
         },
      }
@@ -389,17 +446,30 @@
</script>
<style>
   @import url('../../static/css/wms.css/wms.css');
   @import url('../../static/css/wms.css/wms.css');
   .uni-section {
      margin-top: 0rpx;
      .uni-section__content-title {
         font-size: 16px !important;
      }
   }
   .list {
      border-radius: unset;
      margin: auto;
      margin-top: 20rpx;
      padding: 10rpx;
   }
   .list-view {
      width: 100%;
      position: relative;
   }
   .list:first-child {
      margin-top: 20rpx;
      margin-top: 320rpx;
   }
   .code {
      width: 100%;
@@ -443,11 +513,8 @@
      line-height: 80rpx;
      width: 100%;
      background-color: white;
      position: fixed;
      margin-top: 200rpx;
      position: relative;
      font-weight: 500;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;
      /* box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2); */
   }
</style>