wangxinhui
昨天 67348f250a1b7970059698002949a5e0a5f3c52f
ÏîÄ¿´úÂë/ÁúÀûµÃPDA/pages/stash/boxing.vue
@@ -6,57 +6,30 @@
         <view v-if="current === 0" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="180">
                  <uni-forms-item label="托盘条码:">
                  <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" />
                  <uni-forms-item label="物料:">
                     <uni-easyinput type="text" placeholder="请输入物料" ref='midInput' v-model="materSn" />
                  </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 label="直径:">
                     <uni-easyinput type="text" placeholder="请输入直径(mm)" ref='midInput' v-model="thickness" />
                  </uni-forms-item>
                  <!-- <uni-forms-item>
                     <checkbox checked="check">是否满盘</checkbox>
                  </uni-forms-item> -->
                  <uni-forms-item label="幅宽:">
                     <uni-easyinput type="text" placeholder="请输入幅宽(mm)" ref='midInput' v-model="wide" />
                  </uni-forms-item>
                  <uni-forms-item label="重量:">
                     <uni-easyinput type="text" trim="all" placeholder="请输入重量(kg)" ref='midInput'
                        v-model="weight" />
                  </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">
                     <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 matInfos" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
                              @click="deleteList(index)">
                           </uni-icons>
                           <view class="uni-content">
                              <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>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
         <view v-if="current === 1" class="headerstyle">
         <view v-if="current === 1" class="headerstyle" >
            <view class="itemstyle">
               <uni-forms label-width="120">
                  <uni-forms-item label="托盘条码">
@@ -72,65 +45,6 @@
                  </uni-forms-item>
               </uni-forms>
            </view>
            <view>
               <uni-list>
                  <uni-list-item direction="column" v-if="inboundBarcode">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2">组盘总数量:{{Summmary}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
                  <uni-list-item direction="column" v-for="(item,index) in stockInfoDetail" :key="index">
                     <template v-slot:body>
                        <view class="uni-list-box">
                           <view class="uni-content">
                              <view class="uni-title-sub uni-ellipsis-2">物料编号:{{item.materielCode}}</view>
                              <view class="uni-note">物料名称:{{item.materielName}}</view>
                              <view class="uni-note">物料批次:{{item.batchNo}}</view>
                              <view class="uni-note">组盘数量:{{item.stockQuantity}}</view>
                              <view class="uni-note">生产日期:{{item.productionDate}}</view>
                              <view class="uni-note">有 æ•ˆ æœŸï¼š{{item.effectiveDate}}</view>
                           </view>
                        </view>
                     </template>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
         <view v-if="current === 2" class="headerstyle">
            <view class="itemstyle">
               <uni-forms label-width="180">
                  <uni-forms-item label="内箱标签:">
                     <uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="pkfocus"
                        v-model="pkmaterSn" @input="pksnInput" />
                  </uni-forms-item>
                  <uni-forms-item>
                     <button @click="pksubmit" type="primary" size="default" style="margin-top: 2%;">入平库</button>
                  </uni-forms-item>
               </uni-forms>
               <uni-list>
                  <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">采购单号:{{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>
                  </uni-list-item>
               </uni-list>
            </view>
         </view>
      </view>
      <u-toast ref="uToast" />
@@ -143,332 +57,36 @@
      data() {
         return {
            items: ['组盘', '入库'], //, '单据信息', '解盘'
            current: 0,
            matTotal: [],
            matInfos: [],
            orderNo: "",
            label: "",
            orderInfo: [],
            focus: false,
            pkfocus: false,
            materSn:"",
            wide:"",
            weight:"",
            thickness:"",
            barcode: "",
            materSn: "",
            Initiallife: 1000,
            sns: [],
            sn: "",
            addressFocus: false,
            focus:false,
            inboundBarcode: "",
            address: "",
            check: true,
            value: "",
            matInfo: [],
            value2: "",
            matTotals: [],
            addressdisabled: true,
            addressFocus: false,
            current: 0,
            orderNo: "",
            warehouseId: "",
            Test: false,
            Testlabel: "",
            Testplaceholder: "",
            Testcheck: false,
            Summmary: 0,
            stockInfoDetail: [],
            addressdisabled: false,
            pksns: [],
            pkmaterSn: "",
            pkmatInfos: []
         }
      },
      onShow() {},
      onLoad(res) {
         this.focus = false;
         this.addressFocus = false;
         this.orderNo = res.orderNo;
         this.warehouseId = res.warehouseId;
         if (this.warehouseId == 6) { //测试架仓库区ID
            this.Test = true;
            this.Testlabel = "初始寿命:";
            this.Testplaceholder = "请输入初始寿命";
         } else if (this.warehouseId == 2) { //油墨仓库区ID
            this.Test = true;
            this.Testlabel = "数量:";
            this.Testplaceholder = "请输入数量";
            this.Initiallife = 16;
         } else if (this.warehouseId == 5) { //辅料仓库区ID
            this.address = "8005";
            this.items.push("入平库");
            this.items[1] = "入立库";
            this.address = "8005";
         } else if (this.warehouseId == 3) { //辅料仓库区ID
            this.address = "1011";
            this.addressdisabled = true;
         if (this.warehouseId == 1) {
            this.items=['组盘'];
         }
         this.label = "单据编号:" + this.orderNo;
         this.getData();
      },
      methods: {
         // voiceSpeech(src) {
         //    innerAudioContext.src = src; // '../../static/success.mp3';
         //    innerAudioContext.play();
         // },
         //wms入平库
         pksubmit() {
            if (this.pkmatInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
               })
               return;
            }
            this.$u.post('/api/InboundOrder/WMSInPinKu?warehouseId=' + this.warehouseId, this
               .pksns).then(res => {
               debugger
               if (res.status) {
                  this.$refs.uToast.show({
                     title: "入库成功",
                     type: "success"
                  })
                  this.focus = false;
                  this.pkmatInfos = [];
                  this.pksns = [];
               } else {
                  this.$refs.uToast.show({
                     title: res.message,
                     type: "error"
                  })
               }
            })
         },
         pksnInput() {
            this.$nextTick(() => {
               if (this.pkmaterSn != "") {
                  this.focus = false;
                  var matSn = this.pkmaterSn;
                  setTimeout(() => {
                     this.pkmaterSn = "";
                  }, 10);
                  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);
                     }
                  })
               }
            })
         },
         //解盘
         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"
                        })
                     }
                  })
               }
            })
         },
         updateFocus() {
            debugger
            this.$nextTick(() => {
               this.materSn = '';
               if (!this.focus) {
                  this.focus = true;
               }
            });
         },
         barcodeFocus() {
            debugger
            this.barcode = '';
            if (this.focus) {
               this.focus = false;
            }
         },
         getData() {
            var postData = {
               MainData: {
                  orderNo: this.orderNo
               },
            }
            this.$u.post('/api/InboundOrderDetail/GetInboundOrderDetails', postData).then((res) => {
               if (res.status) {
                  this.orderInfo = res.data;
                  if (this.orderInfo.length > 3) {
                     this.loadVisible = true;
                  }
               }
            })
         },
         onClickItem(e) {
            this.focus = false;
            this.addressFocus = false;
            if (this.current !== e.currentIndex) {
               this.current = e.currentIndex;
               if (this.current == 2) {
                  this.getData();
               }
            }
         },
         barcodeInput() {
            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;
                  // } else {
                  //    this.$refs.uToast.show({
                  //       title: "扫码错误,请扫描托盘码",
                  //       type: "error"
                  //    })
                  // }
               }
            })
         },
         snInput() {
            this.$nextTick(() => {
               if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId == 3) {
                  if (this.sns.length > 0) {
                     this.sns = [];
                  }
               }
               if (this.materSn != "") {
                  this.focus = false;
                  if(this.warehouseId==11){
                     this.materSn=this.materSn.replace(/,SC.*/, '');
                  }
                  if (this.materSn.split(',').length != 6) {
                     this.materSn = "";
                     return;
                  }
                  var matSn = this.materSn;
                  //setTimeout(() => {
                  this.materSn = "";
                  //}, 10);
                  this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
                     this.Testcheck = false;
                     if (res.status) {
                        this.sns.push(res.data.serialNumber);
                        if (this.warehouseId == 6 || this.warehouseId == 2 || this.warehouseId ==
                           3) {
                           if (this.matInfos.length > 0) {
                              this.matInfos = [];
                           }
                        }
                        this.matInfos.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);
                     } else {
                        this.$refs.uToast.show({
                           title: res.message,
                           type: "error"
                        })
                        // setTimeout(() => {
                        //    this.voiceSpeech('../../static/fail.mp3');
                        // }, 100);
                     }
                  })
               }
            })
         },
@@ -521,88 +139,25 @@
               })
            })
         },
         inputChangebarcode() {
            this.addressFocus = false;
            this.$nextTick(function(x) {
               if (this.inboundBarcode != '') {
                  this.addressFocus = true;
               }
            })
            this.$nextTick(function(x) {
               if (this.inboundBarcode != '') {
                  var postData = {
                     MainData: {
                        "barcode": this.inboundBarcode,
                        "warehouseId": this.warehouseId,
                     }
                  };
                  this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
                     // this.stockInfo = [];
                     this.stockInfoDetail = [];
                     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"
                        })
                     }
                  })
               }
            })
         },
         deleteList(res) {
            this.matInfos.splice(res, 1);
            this.sns.splice(res, 1);
         },
         submit() {
            if (this.barcode == "") {
               this.$refs.uToast.show({
                  title: "请扫描托盘条码",
                  title: "请扫描条码",
                  type: 'error'
               })
               return;
            }
            if (this.matInfos.length == 0) {
               this.$refs.uToast.show({
                  title: "请扫描内箱标签",
                  type: 'error'
               })
               return;
            }
            if (this.Test) {
               if (!this.Testcheck) {
                  this.Testcheck = true;
                  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);
               }
            }
            let url = 'palletCode=' + this.barcode + '&initiallife=' + this.Initiallife + '&warehouseId=' + this
               .warehouseId;
            this.$u.post('/api/InboundOrder/ManualMaterielGroup?' + url, this.sns).then(res => {
            this.$u.post('/api/StockInfo/ManualMaterielGroup' ,{
               MainData: {
                  "palletCode": this.barcode,
                  "thickness": this.thickness,
                  "weight": this.weight,
                  "wide": this.wide,
                  "materSn": this.materSn,
                  // "isFull": this.check
                  "warehouseId": this.warehouseId
               },
            }).then(res => {
               this.Testcheck = false;
               if (res.status) {
                  this.$refs.uToast.show({