hutongqing
2024-12-28 f4e01fb44b5428e61780e63d272df1d03f7281f3
´úÂë¹ÜÀí/»´°²PDA/pages/raworderboxing/raworderboxing.vue
@@ -16,15 +16,15 @@
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="focus"
                        v-model="materSn" @input="snInput" />
                  </uni-forms-item>
                  <uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
                  <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode">
                  <!-- <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
@@ -33,7 +33,7 @@
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
                  </uni-list-item> -->
                  <uni-list-item direction="column" v-for="(item,index) in matInfos" :key="item.sn">
                     <template v-slot:body>
                        <view class="uni-list-box">
@@ -41,9 +41,12 @@
                              @click="deleteList(item.sn)">
                           </uni-icons>
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2">订单号:{{item.orderNo}}</view>
                              <view class="uni-note">物料编码:{{item.matCode}}</view>
                              <view class="uni-note">数量:{{item.matQty}}</view>
                              <view class="uni-title-sub uni-ellipsis-2">采购单号:{{item.purchaseOrderNo}}</view>
                              <view class="uni-note">物料编码:{{item.materielCode}}</view>
                              <view class="uni-note">批次号:{{item.lotNo}}</view>
                              <view class="uni-note">数量:{{item.quantity}}</view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有效期:{{item.effectiveDate}}</view>
                           </view>
                        </view>
                     </template>
@@ -150,7 +153,7 @@
   export default {
      data() {
         return {
            items: ['组盘', '入库', '单据信息'],//, '解盘'
            items: ['组盘', '入库', '单据信息'], //, '解盘'
            current: 0,
            matTotal: [],
            matInfos: [],
@@ -168,7 +171,8 @@
            value: "",
            matInfo: [],
            value2: "",
            matTotals:[]
            matTotals: [],
            warehouseId:""
         }
      },
      onShow() {},
@@ -176,6 +180,7 @@
         this.focus = false;
         this.addressFocus = false;
         this.orderNo = res.orderNo;
         this.warehouseId=res.warehouseId;
         this.label = "单据编号:" + this.orderNo;
         this.getData();
      },
@@ -185,7 +190,7 @@
            innerAudioContext.play();
         },
         //解盘
         releasebox(){
         releasebox() {
            if (this.value.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫码",
@@ -223,7 +228,7 @@
               }
            })
         },
         releaseboxInput(){
         releaseboxInput() {
            this.$nextTick(() => {
               if (this.value.length == 0) {
                  return;
@@ -267,7 +272,7 @@
               }
            })
         },
         updateFocus() {
            this.$nextTick(() => {
               this.materSn = '';
@@ -311,7 +316,7 @@
            this.$nextTick(function(x) {
               if (this.barcode.length > 0) {
                  // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') {
                     this.focus = true;
                  this.focus = true;
                  // } else {
                  //    this.$refs.uToast.show({
                  //       title: "扫码错误,请扫描托盘码",
@@ -329,53 +334,93 @@
                  setTimeout(() => {
                     this.materSn = "";
                  }, 10);
                  var matInfo = matSn.split('|');
                  if (matInfo.length == 7) {
                     var matObj = {
                        matCode: matInfo[1],
                        matProductionDate: matInfo[3],
                        matQty: matInfo[5],
                        orderNo: matInfo[6],
                        sn: matSn
                     }
                     var temp = this.matInfos.find(x => x.orderNo == matObj.orderNo);
                     if (!temp) {
                        var tmp = this.matTotal.find(x => x.matCode == matObj.matCode);
                        if (!tmp) {
                           this.matTotal.push({
                              matCode: matObj.matCode,
                              matQuantity: parseInt(matObj.matQty)
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     if (res.status) {
                        // debugger
                        // this.matTotal.push({
                        //    matCode: res.data.materielCode,
                        //    matQuantity: parseInt(res.data.quantity)
                        // });
                        // this.sns.push(res.data.serialNumber);
                        this.matInfos.splice(0, this.matInfos.length);
                        this.matInfos.push(res.data);
                        if (res.message) {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                        } else {
                           tmp.matQuantity += parseInt(matObj.matQty);
                           // setTimeout(this.updateFocus,200);
                           setTimeout(() => {
                              this.voiceSpeech('../../static/fail.mp3');
                           }, 100);
                           return;
                        }
                        this.sns.push(matSn);
                        this.matInfos.push(matObj);
                        setTimeout(this.updateFocus, 200);
                        // setTimeout(this.updateFocus,200);
                        setTimeout(() => {
                           this.voiceSpeech('../../static/success.mp3');
                        }, 100);
                     } else {
                        // this.innerCode = "";
                        this.$refs.uToast.show({
                           title: "扫码重复",
                           title: res.message,
                           type: "error"
                        })
                        setTimeout(this.updateFocus, 200);
                        // setTimeout(this.updateFocus,200);
                        setTimeout(() => {
                           this.voiceSpeech('../../static/fail.mp3');
                        }, 100);
                     }
                  } else {
                     this.$refs.uToast.show({
                        title: "扫码错误,请扫描正确内箱码",
                        type: "error"
                     })
                     setTimeout(this.updateFocus, 200);
                     setTimeout(() => {
                        this.voiceSpeech('../../static/fail.mp3');
                     }, 100);
                  }
                  })
                  // var matInfo = matSn.split('|');
                  // if (matInfo.length == 7) {
                  //    var matObj = {
                  //       matCode: matInfo[1],
                  //       matProductionDate: matInfo[3],
                  //       matQty: matInfo[5],
                  //       orderNo: matInfo[6],
                  //       sn: matSn
                  //    }
                  //    var temp = this.matInfos.find(x => x.orderNo == matObj.orderNo);
                  //    if (!temp) {
                  //       var tmp = this.matTotal.find(x => x.matCode == matObj.matCode);
                  //       if (!tmp) {
                  //          this.matTotal.push({
                  //             matCode: matObj.matCode,
                  //             matQuantity: parseInt(matObj.matQty)
                  //          })
                  //       } else {
                  //          tmp.matQuantity += parseInt(matObj.matQty);
                  //       }
                  //       this.sns.push(matSn);
                  //       this.matInfos.push(matObj);
                  //       setTimeout(this.updateFocus, 200);
                  //       setTimeout(() => {
                  //          this.voiceSpeech('../../static/success.mp3');
                  //       }, 100);
                  //    } else {
                  //       this.$refs.uToast.show({
                  //          title: "扫码重复",
                  //          type: "error"
                  //       })
                  //       setTimeout(this.updateFocus, 200);
                  //       setTimeout(() => {
                  //          this.voiceSpeech('../../static/fail.mp3');
                  //       }, 100);
                  //    }
                  // } else {
                  //    this.$refs.uToast.show({
                  //       title: "扫码错误,请扫描正确内箱码",
                  //       type: "error"
                  //    })
                  //    setTimeout(this.updateFocus, 200);
                  //    setTimeout(() => {
                  //       this.voiceSpeech('../../static/fail.mp3');
                  //    }, 100);
                  // }
               }
            })
         },
@@ -383,17 +428,18 @@
            var postData = {
               MainData: {
                  "barcode": this.inboundBarcode,
                  "startPoint": this.address
                  "startPoint": this.address,
                  "warehouseId":this.warehouseId
               }
            }
            this.$u.post('/api/Inbound/RequestInbound', postData).then(res => {
            this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
               if (res.status) {
                  uni.$showMsg(res.message);
                  this.inboundBarcode = "";
                  this.address = "";
                  setTimeout(()=>{
                  setTimeout(() => {
                     this.addressFocus = false;
                  },200);
                  }, 200);
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
@@ -423,7 +469,7 @@
                  sn = item.sn;
                  var tmp = this.matTotal.find(x => x.matCode == item.matCode);
                  if (tmp) {
                     tmp.matQuantity -= parseInt(item.matQty);
                     tmp.matQuantity -= parseInt(item.quantity);
                  } else {
                  }
@@ -443,7 +489,7 @@
               })
               return;
            }
            if (this.sns.length == 0) {
            if (this.matInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
@@ -452,9 +498,10 @@
            }
            this.$u.post('/api/InboundOrder/MaterielGroup', {
               MainData: {
                  "pallet_barcode": this.barcode,
                  "palletCode": this.barcode,
                  "orderNo": this.orderNo,
                  "isFull": this.check
                  // "isFull": this.check
                  "warehouseId":this.warehouseId
               },
               DelKeys: this.sns
            }).then(res => {