| <template> | 
|     <view> | 
|         <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem"> | 
|         </uni-segmented-control> | 
|         <view class="content"> | 
|             <view v-if="current === 0" class="headerstyle"> | 
|                 <view class="itemstyle"> | 
|                     <uni-forms label-width="120"> | 
|                         <uni-forms-item label="托盘条码"> | 
|                             <uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="请扫描托盘条码" | 
|                                 ref='midInput' @input="inputChangebarcode()" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item label="内箱标签"> | 
|                             <uni-easyinput type="text" @input="inputChange()" v-model="materialsns" | 
|                                 placeholder="请扫描内箱标签" ref='midInput' :focus="istrue" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item label="出库数量"> | 
|                             <uni-easyinput type="number" v-model="num" placeholder="请输入出库数量" ref='midInput' /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <label style="margin-left: 0%;">总数量:{{totalNum}}</label> | 
|                             <label style="margin-left: 30%;">出库数量:{{pickNum}}</label> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <label style="margin-left: 0%;">工单总数量:{{orderTotalNum}}</label> | 
|                             <label style="margin-left: 21%;">累计出库数量:{{orderPickNum}}</label> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <label style="margin-left: 0%;">工单号:{{orderNo}}</label> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <checkbox :checked="isPicking" @click="checkedClick">是否拣选</checkbox> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <button @click="picking" type="primary" style="margin-left: 0px;">盘点完成</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 in boxBarcodes" :key="item.sn"> | 
|                             <template v-slot:body> | 
|                                 <view class="uni-list-box"> | 
|                                     <uni-icons type="trash" size="22" style="position: absolute;right: 5%;" | 
|                                         @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.matProductionDate}}</view> | 
|                                         <view class="uni-note">数量:{{item.matQty}}</view> | 
|                                         <view class="uni-note">是否拣选:{{item.isPicking}}</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="120"> | 
|                         <uni-forms-item label="托盘条码"> | 
|                             <uni-easyinput type="text" :focus="!istrue2" v-model="barcode2" placeholder="请扫描托盘条码" | 
|                                 ref='midInput' @input="inputChangebarcode2()" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item label="内箱标签"> | 
|                             <uni-easyinput type="text" @input="inputChange2()" v-model="innerboxcode" | 
|                                 placeholder="请扫描内箱标签" ref='midInput' :focus="istrue2" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button> | 
|                         </uni-forms-item> | 
|                     </uni-forms> | 
|                 </view> | 
|             </view> | 
|             <view v-if="current === 1" class="headerstyle"> | 
|                 <view class="itemstyle"> | 
|                     <uni-forms label-width="120"> | 
|                         <uni-forms-item label="托盘条码"> | 
|                             <uni-easyinput type="text" :focus="!addressFocus" v-model="inboundBarcode" | 
|                                 placeholder="请扫描托盘条码" ref='midInput' @input="inputChangebarcode3" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item label="地址条码"> | 
|                             <uni-easyinput type="text" v-model="address" placeholder="请扫描地址条码" ref='midInput' | 
|                                 :focus="addressFocus" /> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item> | 
|                             <button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button> | 
|                         </uni-forms-item> | 
|                     </uni-forms> | 
|                 </view> | 
|             </view> | 
|         </view> | 
|         <u-toast ref="uToast" /> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     // const SixUniTts = uni.requireNativePlugin("SmallSix-SixUniTts") | 
|     export default { | 
|         data() { | 
|             return { | 
|                 items: ['盘点',  '入库'],//'拣选组盘', | 
|                 current: 0, | 
|                 isPicking: false, | 
|                 istrue: false, | 
|                 barcode: '', | 
|                 materialsns: "", | 
|                 boxBarcodes: [], | 
|                 sns: [], | 
|                 barcodefocus: true, | 
|                 totalNum: 0, | 
|                 pickNum: 0, | 
|                 num: 0, | 
|                 orderTotalNum: 0, | 
|                 orderPickNum: 0, | 
|                 orderNo: "", | 
|                 matTotal: [], | 
|                 istrue2: false, | 
|                 barcode2: '', | 
|                 innerboxcode: "", | 
|                 sns2: [], | 
|                 barcodefocus: true, | 
|                 addressFocus: false, | 
|                 inboundBarcode: "", | 
|                 address: "", | 
|             } | 
|         }, | 
|         onLoad(res) { | 
|             this.barcodefocus = false; | 
|             this.istrue = false; | 
|         }, | 
|         methods: { | 
|             onClickItem(e) { | 
|                 this.barcodeFo = true; | 
|                 this.focus = false; | 
|                 this.addressFocus = false; | 
|                 if (this.current !== e.currentIndex) { | 
|                     this.current = e.currentIndex; | 
|                 } | 
|             }, | 
|             inbound() { | 
|                 var postData = { | 
|                     MainData: { | 
|                         "barcode": this.inboundBarcode, | 
|                         "startPoint": this.address | 
|                     } | 
|                 } | 
|                 this.$u.post('/api/Inbound/RequestInbound', postData).then(res => { | 
|                     if (res.status) { | 
|                         uni.$showMsg(res.message); | 
|                         this.inboundBarcode = ""; | 
|                         this.address = ""; | 
|                     } else { | 
|                         this.$refs.uToast.show({ | 
|                             title: res.message, | 
|                             type: "error" | 
|                         }) | 
|                     } | 
|                 }).catch(err => { | 
|                     this.$refs.uToast.show({ | 
|                         title: err.message, | 
|                         type: "error" | 
|                     }) | 
|                 }) | 
|             }, | 
|             inputChangebarcode3() { | 
|                 this.addressFocus = false; | 
|                 this.$nextTick(function(x) { | 
|                     if (this.inboundBarcode != '') { | 
|                         this.addressFocus = true; | 
|                     } | 
|                 }) | 
|             }, | 
|             picking() { | 
|                 if (this.barcode == "") { | 
|                     this.$refs.uToast.show({ | 
|                         title: "请扫描托盘条码", | 
|                         type: "error" | 
|                     }) | 
|                     return; | 
|                 } | 
|                 if (this.sns.length == 0) { | 
|                     this.$refs.uToast.show({ | 
|                         title: "请扫描内箱标签", | 
|                         type: "error" | 
|                     }) | 
|                     return; | 
|                 } | 
|                 var params = { | 
|                     MainData: { | 
|                         "barcode": this.barcode, | 
|                         "num": this.num, | 
|                         "pickNum": this.pickNum | 
|                     }, | 
|                     DetailData: this.sns | 
|                 } | 
|                 this.$u.post('/api/StockOperate/MatPicking', params).then(res => { | 
|                     if (res.status) { | 
|                         uni.$showMsg('盘点成功!') | 
|                         this.barcode = ""; | 
|                         this.boxBarcodes = []; | 
|                         this.sns = []; | 
|                         this.materialsns = ""; | 
|                     } else { | 
|                         this.$refs.uToast.show({ | 
|                             title: res.message, | 
|                             type: "error" | 
|                         }) | 
|                     } | 
|                 }) | 
|             }, | 
|             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.boxBarcodes = []; | 
|                 this.istrue = false; | 
|                 this.$nextTick(function(x) { | 
|                     if (this.barcode != '') { | 
|                         var postData = { | 
|                             MainData: { | 
|                                 "barcode": this.barcode | 
|                             } | 
|                         }; | 
|                         this.$u.post('/api/StockInfo/GetStockOutboundOrder', postData).then(res => { | 
|                             if (res.status) { | 
|                                 if (res.data.totalNum == res.data.pickNum) { | 
|                                     res.data.innerBoxCode.forEach(x => { | 
|                                         var matInfo = x.split('|'); | 
|                                         if (matInfo.length > 6) { | 
|                                             var matObj = { | 
|                                                 matCode: matInfo[1], | 
|                                                 matProductionDate: matInfo[3], | 
|                                                 matQty: matInfo[5], | 
|                                                 orderNo: matInfo[6], | 
|                                                 sn: this.materialsns, | 
|                                                 isPicking: this.isPicking | 
|                                             } | 
|                                             this.sns.push({ | 
|                                                 innerboxcode: this.materialsns, | 
|                                                 isSplit: this.isPicking | 
|                                             }); | 
|                                             if (!this.boxBarcodes.find(x => x.orderNo == matObj | 
|                                                     .orderNo)) { | 
|                                                 this.boxBarcodes.push(matObj); | 
|                                             } | 
|                                         } | 
|                                     }) | 
|                                 } | 
|                                 this.totalNum = res.data.totalNum; | 
|                                 this.pickNum = res.data.pickNum; | 
|                                 this.orderPickNum = res.data.orderPickNum; | 
|                                 this.orderTotalNum = res.data.orderTotalNum; | 
|                                 this.orderNo = res.data.orderNo; | 
|                             } | 
|                         }) | 
|                         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; | 
|                             } | 
|                         } | 
|                     } | 
|                 }) | 
|                 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> | 
|   | 
| <style lang="scss"> | 
|     @import '@/common/uni-ui.scss'; | 
|   | 
|     .content { | 
|         display: flex; | 
|         height: 150px; | 
|     } | 
|   | 
|     .content-text { | 
|         font-size: 14px; | 
|         color: #666; | 
|     } | 
|   | 
|     .itemstyle { | 
|         margin-top: 20px; | 
|         margin-left: 5%; | 
|     } | 
|   | 
|     .headerstyle { | 
|         width: 90%; | 
|     } | 
| </style> |