1
zhang
9 天以前 4f004573e398c7f5b3823e417766772f501c44fe
pages/AGV/AGVPakin.vue
@@ -2,6 +2,11 @@
   <view>
      <view class="code">
         <view class="item">
            <view class="code-decs">站点号:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="rsta" :focus="rstaFocus"
               @input="rstaInput()">
         </view>
         <view class="item">
            <view class="code-decs">托盘码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus"
               @input="barcodeInput()">
@@ -15,6 +20,21 @@
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
         </view>
         <view class="item">
            <view class="code-decs">仓库:</view>
            <uni-combox :candidates="floorList" placeholder="请选择仓库" v-model="floor"></uni-combox>
         </view>
         <view class="item">
         <view class="code-decs" style="width: 25vw;">大小托盘:</view>
         <radio-group @change="isFullPlt">
            <label>
               <radio :checked="ck1" style="transform: scale(0.7)"/><text>小托盘</text>
            </label>
            <label>
               <radio :checked="ck2" style="margin-left: 50rpx;transform: scale(0.7);"/><text>大托盘</text>
            </label>
         </radio-group>
         </view>
      </view>
      <view class="mat-list-title">
         商品列表
@@ -27,7 +47,7 @@
                  <view class="left-item">{{i + 1}}</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>
@@ -46,12 +66,12 @@
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
               </view>
               <view class="list-left-item">
               <!-- <view class="list-left-item">
                  <view class="desc">重量:</view>
                  <view class="left-item">
                     <uni-tag :text="item.weight" type="warning"></uni-tag>
                  </view>
               </view>
               </view> -->
               <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
@@ -64,9 +84,10 @@
         </view>
      </scroll-view>
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
      <view class="buttom">、
         <button size="mini" type="primary" @click="combConfirm('warn')">组托</button>
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirmAndFillEmptyPallets('warn')">组托并补空托盘</button>
      </view>
      <!-- 弹窗 -->
      <!-- 修改数量 -->
@@ -76,20 +97,20 @@
               <!-- 标题 -->
               <view class="title">修改</view>
               <view class="popup-item">
                  <view class="popup-item-left">编码:</view>
                  <view class="popup-item-left">料号:</view>
                  <view class="popup-item-right">
                     <input type="text" v-model="matnr" disabled="true"
                        style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;">
                  </view>
               </view>
               <!-- <view class="popup-item">
               <view class="popup-item">
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right"><input type="text" v-model="batch"></view>
               </view> -->
               <view class="popup-item">
               </view>
               <!-- <view class="popup-item">
                  <view class="popup-item-left">重量:</view>
                  <view class="popup-item-right"><input type="text" v-model="weight"></view>
               </view>
               </view> -->
               <view class="popup-item">
                  <view class="popup-item-left">数量:</view>
                  <view class="popup-item-right" style="border: none;justify-content: center;">
@@ -124,6 +145,13 @@
               @confirm="comb" @close="combClose"></uni-popup-dialog>
         </uni-popup>
      </view>
      <view>
         <uni-popup ref="combConfirmAndFillEmptyPallets" type="dialog">
            <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
               @confirm="combAndFillEmptyPallets" @close="combClose"></uni-popup-dialog>
         </uni-popup>
      </view>
      <!-- 确认重置 -->
      <view>
         <uni-popup ref="resetConfirm" type="dialog">
@@ -141,6 +169,7 @@
            baseUrl: '',
            token: '',
            barcode: '',
            rsta: '',
            dataList: [],
            count: 0,
            rowNum: '',
@@ -154,8 +183,15 @@
            content: '',
            barcodeFocus: true,
            matFocus: false,
            rstaFocus: false,
            matData: '',
            removeNum: 0,
            ck1: true,
            ck2: false,
            fullPlt: '1',
            ck : '',
            floorList: [],
            floor: '',
         }
      },
      onLoad() {
@@ -164,13 +200,59 @@
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         this.getSite();
      },
      methods: {
         // 大小托盘
         isFullPlt() {
            var temp = this.ck1
            this.ck1 = this.ck2
            this.ck2 = temp
            if (this.ck1) {
               this.fullPlt = '1'
            } else {
               this.fullPlt = '2'
            }
         },
         //获取仓库
         getSite() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mobile/ck',
               header: { 'token': uni.getStorageSync('token') },
               method: 'POST',
               success(res) {
                  res = res.data
                  console.log(res)
                  if (res.code === 200) {
                     that.floorList = res.data
                  } 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')
                  }
               }
            })
         },
         messageToggle(type) {
            this.msgType1 = type
            this.$refs.message.open()
         },
         // barcode input 事件
         rstaInput() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               var len = this.rsta.length
               this.barcodeFocuss()
            }, 200)
         },
         barcodeInput() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
@@ -205,7 +287,7 @@
            }, 100);
         },
         // 搜索物料
         findMat() {
            findMat() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
@@ -226,8 +308,10 @@
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                           })
                           console.log(res);
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
@@ -301,12 +385,13 @@
                        add = true
                     }
                     
                  } else {
                     // 相同物料相同批号 数量累加
                     this.dataList[i].anfme += mat.anfme
                     this.$forceUpdate() // 强制刷新
                     add = false
                  }
                  }
                  // else {
                  //    // 相同物料相同批号 数量累加
                  //    this.dataList[i].anfme += mat.anfme
                  //    this.$forceUpdate() // 强制刷新
                  //    add = false
                  // }
               }
            }
            if (add) {
@@ -365,10 +450,81 @@
            this.content = '是否现在组托!'
            this.$refs.combConfirm.open()
         },
         combConfirmAndFillEmptyPallets(type) {
            this.msgType = type
            this.title = '警告'
            this.content = '是否现在组托并补空板!'
            this.$refs.combConfirmAndFillEmptyPallets.open()
         },
         combClose() {
            this.$refs.combConfirm.close()
         },
         comb() {
            console.log("普通组托")
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
               this.messageText = "请扫描托盘条码"
               this.messageToggle('error')
               return;
            }
            if (that.dataList.length === 0) {
               this.messageText = "请添加商品列表"
               this.messageToggle('error')
               return;
            }
            if(that.floor===''){
               this.messageText = "仓库不能为空"
               this.messageToggle('error')
               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')
                  return;
               }
            }
            uni.request({
               url: that.baseUrl + '/mobile/comb/auth',
               data: JSON.stringify({
                  beBatch : 1,
                  barcodeSize: '0',
                  rsta: that.rsta,
                  barcode: that.barcode,
                  combMats: that.dataList,
                  ck : that.floor,
               }),
               method: 'POST',
               header: {
                  'token': uni.getStorageSync('token')
               },
               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()
                  } 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')
                  }
               }
            });
         },
         //组托并补空托盘
         combAndFillEmptyPallets() {
            uni.vibrateShort();
            let that = this;
            if (that.barcode === '') {
@@ -389,8 +545,11 @@
               }
            }
            uni.request({
               url: that.baseUrl + '/agvMobile/comb/auth',
               url: that.baseUrl + '/mobile/comb/auth',
               data: JSON.stringify({
                  beBatch : 1,
                  barcodeSize : this.fullPlt,
                  rsta: that.rsta,
                  barcode: that.barcode,
                  combMats: that.dataList
               }),
@@ -431,6 +590,7 @@
         // 确认重置
         resetConfirm() {
            this.dataList = []
            this.barcode = ''
            this.messageText = "重置完成"
            this.messageToggle('success')
         },
@@ -451,6 +611,9 @@
<style>
   @import url('../../static/css/wms.css/wms.css');
   .list:first-child {
      margin-top: 530rpx;
   }
   .code {
      width: 100%;
      position: fixed;
@@ -494,7 +657,7 @@
      width: 100%;
      background-color: white;
      position: fixed;
      margin-top: 200rpx;
      margin-top: 300rpx;
      z-index: 9;
      /* border-top: 1px solid #DCDFE6; */
      text-align: center;