647556386
2025-10-18 d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb
¼ª°²PDA/pages/stash/TakeStock.vue
@@ -8,7 +8,7 @@
               <uni-forms label-width="120">
                  <uni-forms-item label="托盘条码">
                     <uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="请扫描托盘条码"
                        ref='midInput' @confirm="inputChangebarcode()" />
                ref='midInput' @confirm="inputChangebarcode" />
                  </uni-forms-item>
                  <uni-forms-item label="实盘数量">
                     <uni-easyinput type="number" v-model="num" placeholder="请输入实盘数量" ref='midInput' />
@@ -77,47 +77,29 @@
</template>
<script>
   // const SixUniTts = uni.requireNativePlugin("SmallSix-SixUniTts")
   export default {
      data() {
         return {
            items: ['盘点',  '入库'],//'拣选组盘',
      items: ['盘点'],
            current: 0,
            isPicking: false,
            istrue: false,
            barcode: '',
            materialsns: "",
            boxBarcodes: [],
            sns: [],
            barcodefocus: true,
            totalNum: 0,
            pickNum: 0,
            num: null,
            orderTotalNum: 0,
            orderPickNum: 0,
            orderNo: "",
            matTotal: [],
            istrue2: false,
            barcode2: '',
            Summmary:0,
            innerboxcode: "",
            takeStockObj:null,
            sns2: [],
            barcodefocus: true,
            addressFocus: false,
            inboundBarcode: "",
            address: "",
            addressdisabled: false,
            warehouseId:"",
      Summmary: 0,
            stockInfoDetail:[]
         }
      },
      onLoad(res) {
         this.barcodefocus = false;
         this.istrue = false;
         this.warehouseId = res.warehouseId;
         this.orderNo=res.orderNo;
         if (this.warehouseId == 3) { //板料仓库区ID
    if (this.warehouseId == 3) {
            this.address = "1011";
            this.addressdisabled = true;
         }
@@ -141,8 +123,7 @@
            this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
               if (res.status) {
                  this.inboundBarcode = "";
                  if (this.warehouseId !== 3) //板料仓库区ID
                  {
          if (this.warehouseId !== 3) {
                     this.address = "";
                  }
                  this.Summmary=0;
@@ -166,13 +147,9 @@
         },
         inputChangebarcode3() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
               if (this.inboundBarcode != '') {
      setTimeout(() => {
        if (this.inboundBarcode) {
                  this.addressFocus = true;
               }
            })
            this.$nextTick(function(x) {
                           if (this.inboundBarcode != '') {
                              var postData = {
                                 MainData: {
                                    "barcode": this.inboundBarcode,
@@ -180,29 +157,25 @@
                                 }
                              };
                              this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
                                 // this.stockInfo = [];
                                 this.stockInfoDetail = [];
                                 this.Summmary=0;
                                 if (res.status) {
                                    // this.stockInfo = res.data,
                                    this.stockInfoDetail = res.data.details
                                    //获取总数量
                                    this.stockInfoDetail.forEach(item => {
                                       this.Summmary += item.stockQuantity;
                                    });
                                 } else {
                                    this.$refs.uToast.show({
                                       // title: "未找到托盘信息",
                                       title: res.message,
                                       type: "error"
                                    })
                                 }
                              })
                           }
                        })
      }, 1000);
         },
         picking() {
            if (this.barcode == "") {
      if (!this.barcode) {
               this.$refs.uToast.show({
                  title: "请扫描托盘条码",
                  type: "error"
@@ -216,7 +189,7 @@
               })
               return;
            }
            if(this.takeStockObj==null){
      if (!this.takeStockObj) {
               this.$refs.uToast.show({
                  title: "盘点信息为空",
                  type: "error"
@@ -246,72 +219,11 @@
               }
            })
         },
         inputChange(e) {
            this.$nextTick(() => {
               this.istrue = false;
               var matInfo = this.materialsns.split('|');
               if (matInfo.length == 7) {
                  var matObj = {
                     matCode: matInfo[1],
                     matProductionDate: matInfo[3],
                     matQty: matInfo[5],
                     orderNo: matInfo[6],
                     sn: this.materialsns,
                     isPicking: this.isPicking
                  }
                  var temp = this.boxBarcodes.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({
                        innerboxcode: this.materialsns,
                        isSplit: this.isPicking
                     });
                     this.boxBarcodes.push(matObj);
                     this.isPicking = false;
                     setTimeout(this.updateFocus, 100);
                  } else {
                     this.$refs.uToast.show({
                        title: "扫码重复",
                        type: "error"
                     })
                     setTimeout(this.updateFocus, 100);
                  }
               } else {
                  this.$refs.uToast.show({
                     title: "扫码错误,请扫描正确内箱码",
                     type: "error"
                  })
                  setTimeout(this.updateFocus, 100);
               }
            })
         },
         checkedClick() {
            this.isPicking = !this.isPicking;
            this.istrue = false;
            this.$nextTick(function(x) {
               if (this.barcode != '') {
                  this.istrue = true;
               }
            })
         },
         updateFocus() {
            this.materialsns = '';
            if (!this.istrue) {
               this.istrue = true;
            }
         },
         inputChangebarcode() {
            this.istrue = false;
            this.$nextTick(function(x) {
               if (this.barcode != '') {
      setTimeout(() => {
        if (this.barcode) {
          this.istrue = true;
                  var postData = {
                     MainData: {
                        "orderNo": this.orderNo,
@@ -320,7 +232,6 @@
                  };
                  this.$u.post('/api/TakeStockOrder/GetTakeDetailInfo', postData).then(res => {
                     if (res.status) {
                        this.takeStockObj=null;
                        this.takeStockObj= res.data;
                     } else {
                        this.barcode="";
@@ -330,85 +241,9 @@
                        })
                     }
                  })
                  this.istrue = true;
               }
            })
         },
         deleteList(res) {
            this.matTotal.map((item, index) => {
               var temp = this.boxBarcodes.find(x => x.sn == res);
               if (temp) {
                  if (item.matCode == temp.matCode) {
                     if (item.matQuantity - temp.matQty == 0) {
                        this.matTotal.splice(index, 1);
                     } else {
                        item.matQuantity -= temp.matQty;
      }, 1000);
                     }
                  }
               }
            })
            this.sns.map((item, index) => {
               if (item.innerboxcode == res) {
                  this.sns.splice(index, 1);
               }
            })
            this.boxBarcodes.map((item, index) => {
               if (item.sn == res) {
                  this.boxBarcodes.splice(index, 1);
               }
            })
         },
         submit() {
            if (this.barcode2 == "") {
               this.$refs.uToast.show({
                  title: "请扫描托盘条码",
                  type: "error"
               })
               return;
            }
            if (this.innerboxcode == "") {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: "error"
               })
               return;
            }
            this.$u.post('/api/StockOperate/PickingBoxing', {
               MainData: {
                  "barcode": this.barcode2,
                  "innerboxcode": this.innerboxcode
               },
               DelKeys: this.sns2
            }).then(res => {
               if (res.status) {
                  uni.$showMsg('组盘成功!')
                  this.barcode2 = "";
                  this.innerboxcode = "";
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            }).catch(err => {
               this.$refs.uToast.show({
                  title: err.message,
                  type: "error"
               })
            })
         },
         inputChange2(e) {
         },
         inputChangebarcode2() {
            this.istrue2 = false;
            this.$nextTick(function(x) {
               if (this.barcode2 != '') {
                  this.istrue2 = true;
               }
            })
         },
      }
   }
</script>