helongyang
17 小时以前 dc06f58d8ed537555fd529551180f43a0586ec3f
´úÂë¹ÜÀí/»´°²PDA/pages/stash/raworderboxing.vue
@@ -10,23 +10,27 @@
                  </uni-forms-item>
                  <uni-forms-item label="托盘条码:">
                     <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
                        v-model="barcode" @input="barcodeInput" />
                        v-model="barcode" @confirm="barcodeInput" />
                  </uni-forms-item>
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="focus"
                        v-model="materSn" @input="snInput" />
                        v-model="materSn" @confirm="snInput" />
                  </uni-forms-item>
                  <uni-forms-item :label="Testlabel" v-if="Test">
                     <uni-easyinput type="text" :placeholder="Testplaceholder" ref='midInput'
                        v-model="Initiallife" />
                  </uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item>
                     <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
                     <view style="display: flex;justify-content: space-around;margin-top: 2%;">
                        <button @click="reset" type="default" size="default"
                           style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">重置</button>
                        <button @click="submit" type="primary" size="default" style="width: 160rpx;">组盘</button>
                     </view>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
@@ -65,11 +69,11 @@
               <uni-forms label-width="120">
                  <uni-forms-item label="托盘条码">
                     <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode"
                        placeholder="请扫描托盘条码" ref='midInput' @input="inputChangebarcode" />
                        placeholder="请扫描托盘条码" ref='midInput' @confirm="inputChangebarcode" />
                  </uni-forms-item>
                  <uni-forms-item label="地址条码">
                     <uni-easyinput type="text" v-model="address" placeholder="请扫描地址条码" ref='midInput'
                        :focus="addressFocus" />
                     <uni-easyinput type="text" v-model="address" :disabled="addressdisabled"
                        placeholder="请扫描地址条码" ref='midInput' :focus="addressFocus" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
@@ -86,9 +90,10 @@
                           <view class="uni-content">
                              <view style="font-size: 18px;">单据号:{{orderNo}}</view>
                              <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
                              <view>物料名称:{{item.materielName}}</view>
                              <view>物料规格:{{item.materielSpec}}</view>
                              <!-- <view style="font-size: 18px;">物料名称:{{item.matName}}</view> -->
                              <view style="font-size: 18px;">数量:{{item.orderQuantity}}</view>
                              <view style="font-size: 18px;">单位:{{item.unit}}</view>
                              <view style="font-size: 18px;">数量:{{item.orderQuantity+item.unit}}</view>
                              <view style="font-size: 18px;">组盘数量:{{item.receiptQuantity}}</view>
                           </view>
                        </view>
@@ -99,49 +104,36 @@
         </view>
         <view v-if="current === 3" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="120">
                  <uni-forms-item>
                     <uni-easyinput type="text" @input="releaseboxInput" v-model="value" placeholder="请扫码"
                        ref='midInput' :focus="true" />
               <uni-forms label-width="180">
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="!pkfocus"
                        v-model="pkmaterSn" @confirm="pksnInput" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="releasebox" type="primary" size="default">解盘</button>
                     <view style="display: flex;justify-content: space-around;margin-top: 2%;">
                        <button @click="resetInPk" type="default" size="default"
                           style="width: 160rpx;border: 1rpx solid #007aff;color: #007aff;">重置</button>
                        <button @click="pksubmit" type="primary" size="default"
                           style="margin-top: 2%;">入平库</button>
                     </view>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
                  <uni-list-item direction="column" v-if="value2">
                  <uni-list-item direction="column" v-for="(item,index) in pkmatInfos" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
                              @click="pkdeleteList(index)">
                           </uni-icons>
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2">托盘号:{{value2}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
                  <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">
                              <view class="uni-title-sub uni-ellipsis-2">物料编码:{{item.matCode}}</view>
                              <view class="uni-title-sub uni-ellipsis-2">数量:{{item.matQuantity}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
                  <uni-list-item direction="column" v-for="(item,index) in matInfo" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
                                 ç‰©æ–™ç¼–码:{{item.matCode}}
                              </view>
                              <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
                                 ç‰©æ–™åç§°ï¼š{{item.matName}}
                              </view>
                              <view class="uni-title-sub uni-ellipsis-2" style="font-size: 1.1em;">
                                 æ•°é‡ï¼š{{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>
@@ -167,10 +159,12 @@
            label: "",
            orderInfo: [],
            focus: false,
            pkfocus: false,
            barcode: "",
            materSn: "",
            Initiallife: 1000,
            sns: [],
            pksns: [],
            addressFocus: false,
            inboundBarcode: "",
            address: "",
@@ -184,6 +178,9 @@
            Testlabel: "",
            Testplaceholder: "",
            Testcheck: false,
            pkmaterSn: "",
            pkmatInfos: [],
            addressdisabled: false
         }
      },
      onShow() {},
@@ -201,99 +198,22 @@
            this.Testlabel = "数量:";
            this.Testplaceholder = "请输入数量";
            this.Initiallife = 16;
         } else if (this.warehouseId == 5) { //辅料
            this.items.push("入平库");
            this.items[1] = "入立库";
            this.address = "8005";
         } else if (this.warehouseId == 3) { //辅料
            this.address = "1011";
            this.addressdisabled = true;
         }
         this.label = "单据编号:" + this.orderNo;
         this.getData();
      },
      methods: {
         voiceSpeech(src) {
            innerAudioContext.src = src; // '../../static/success.mp3';
            innerAudioContext.play();
         },
         //解盘
         releasebox() {
            if (this.value.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫码",
                  type: "error"
               })
               return;
            }
            var param;
            var matInfo = this.value.split('|');
            if (matInfo.length == 7) {
               param = {
                  MainData: {
                     "innerCode": this.value
                  }
               }
            } else {
               param = {
                  MainData: {
                     "barcode": this.value
                  }
               }
            }
            this.$u.post('/api/StockOperate/ReleaseAllBox', param).then(resdt => {
               if (resdt.status) {
                  uni.$showMsg('解盘成功!')
                  this.value = "";
                  this.matInfo = [];
                  this.matTotals = [];
                  this.value2 = "";
               } else {
                  this.$refs.uToast.show({
                     title: resdt.message,
                     type: "error"
                  })
               }
            })
         },
         releaseboxInput() {
            this.$nextTick(() => {
               if (this.value.length == 0) {
                  return;
               }
               var matInfo = this.value.split('|');
               this.matInfo = [];
               if (matInfo.length == 7) {
                  this.$u.post('/api/StockOperate/GetStockInfoByInnerCode', {
                     MainData: {
                        "innerCode": this.value
                     }
                  }).then(res => {
                     if (res.status) {
                        this.matInfo = res.data.stockInfo;
                        this.matTotals = res.data.stockTotal;
                        this.value2 = res.data.barcode;
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                     }
                  })
               } else {
                  this.$u.post('/api/StockOperate/GetStockInfoByBarcode', {
                     MainData: {
                        "barcode": this.value
                     }
                  }).then(res => {
                     if (res.status) {
                        this.matInfo = res.data.stockInfo;
                        this.matTotals = res.data.stockTotal;
                        this.value2 = res.data.barcode;
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                     }
                  })
               }
            })
         },
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         updateFocus() {
            debugger
            this.$nextTick(() => {
@@ -354,97 +274,86 @@
               if (this.materSn != "") {
                  this.focus = false;
                  var matSn = this.materSn;
                  setTimeout(() => {
                     this.materSn = "";
                  }, 10);
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     this.Testcheck = false;
                     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) {
                  if (this.warehouseId == 11) {
                     matSn = matSn.replace(/,SC.*/, '');
                  }
                  //查询matSn是否存在字符
                  if(matSn.indexOf("POHA")>0){
                     this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                        this.Testcheck = false;
                        if (res.status) {
                           this.sns.push(res.data.serialNumber);
                           this.matInfos.push(res.data);
                           if (res.message) {
                              this.$refs.uToast.show({
                                 title: res.message,
                                 type: "error"
                              })
                              // setTimeout(() => {
                              //    this.voiceSpeech('../../static/fail.mp3');
                              // }, 100);
                              return;
                           }
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/success.mp3');
                           // }, 100);
                        } else {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                           // setTimeout(this.updateFocus,200);
                           setTimeout(() => {
                              this.voiceSpeech('../../static/fail.mp3');
                           }, 100);
                           return;
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                        }
                        // setTimeout(this.updateFocus,200);
                        setTimeout(() => {
                           this.voiceSpeech('../../static/success.mp3');
                        }, 100);
                     } else {
                        // this.innerCode = "";
                        this.$refs.uToast.show({
                           title: res.message,
                           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);
                  // }
                     })
                  }
                  setTimeout(() => {
                     this.materSn = "";
                  }, 100);
               }
            })
         },
         pksnInput() {
            this.$nextTick(() => {
               if (this.pkmaterSn != "") {
                  var matSn = this.pkmaterSn;
                  if(matSn.indexOf("POHA")>0){
                     this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                        if (res.status) {
                           this.pksns.push(res.data.serialNumber);
                           this.pkmatInfos.push(res.data);
                           if (!res.status) {
                              this.$refs.uToast.show({
                                 title: res.message,
                                 type: "error"
                              })
                              // setTimeout(() => {
                              //    this.voiceSpeech('../../static/fail.mp3');
                              // }, 100);
                              return;
                           }
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/success.mp3');
                           // }, 100);
                           return;
                        } else {
                           this.$refs.uToast.show({
                              title: res.message,
                              type: "error"
                           })
                           // setTimeout(() => {
                           //    this.voiceSpeech('../../static/fail.mp3');
                           // }, 100);
                        }
                     })
                  }
                  setTimeout(() => {
                     this.pkmaterSn = "";
                  }, 100);
               }
            })
         },
@@ -472,11 +381,14 @@
            }
            this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
               if (res.status) {
                  uni.$showMsg(res.message);
                  this.inboundBarcode = "";
                  this.address = "";
                  if (this.warehouseId != 5) this.address = "";
                  setTimeout(() => {
                     this.addressFocus = false;
                     this.$refs.uToast.show({
                        title: "成功",
                        type: "success"
                     })
                  }, 200);
               } else {
                  this.$refs.uToast.show({
@@ -503,6 +415,51 @@
            this.matInfos.splice(res, 1);
            this.sns.splice(res, 1);
         },
         pkdeleteList(res) {
            this.pkmatInfos.splice(res, 1);
            this.pksns.splice(res, 1);
         },
         reset() {
            this.barcode = "";
            this.matInfos = [];
            this.sns = [];
            this.materSn = "";
            if (this.warehouseId = !6) {
               this.Initiallife = 0;
            }
         },
         resetInPk() {
            this.pkmaterSn = "";
            this.pkfocus = false;
            this.pkmatInfos = [];
            this.pksns = [];
         },
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
               })
               return;
            }
            this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this
               .pksns).then(res => {
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "入库成功",
                     type: "success"
                  })
                  this.pkfocus = false;
                  this.pkmatInfos = [];
                  this.pksns = [];
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            })
         },
         submit() {
            if (this.barcode == "") {
               this.$refs.uToast.show({
@@ -521,11 +478,24 @@
            if (this.Test) {
               if (!this.Testcheck) {
                  this.Testcheck = true;
                  this.$refs.uToast.show({
                     title: "请确认初始寿命",
                     type: 'error'
                  })
                  if (this.warehouseId == 2) {
                     this.$refs.uToast.show({
                        title: "请确认数量",
                        type: 'error'
                     })
                  } else if (this.warehouseId == 6) {
                     this.$refs.uToast.show({
                        title: "请确认初始寿命",
                        type: 'error'
                     })
                  }
                  return;
               }
            }
            if (this.warehouseId == 2) { //油墨仓库区ID
               this.sn = this.sns[0];
               for (var i = 0; i < this.Initiallife - 1; i++) {
                  this.sns.push(this.sn);
               }
            }
            this.$u.post('/api/InboundOrder/MaterielGroup', {
@@ -549,6 +519,9 @@
                  this.matInfos = [];
                  this.sns = [];
                  this.matTotal = [];
                  if (this.warehouseId != 6) { //测试架仓库区ID
                     this.Initiallife = "";
                  }
               } else {
                  this.$refs.uToast.show({
                     title: res.message,