| <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="180"> | 
|                         <uni-forms-item :label="label"> | 
|                         </uni-forms-item> | 
|                         <uni-forms-item label="托盘条码:"> | 
|                             <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus" | 
|                                 v-model="barcode" @input="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> | 
|                         <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> | 
|                         </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="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.matQty}}</view> | 
|                                     </view> | 
|                                 </view> | 
|                             </template> | 
|                         </uni-list-item> | 
|                     </uni-list> | 
|                 </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="inputChangebarcode" /> | 
|                         </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 v-if="current === 2" class="headerstyle"> | 
|                 <view class="itemstyle"> | 
|                     <uni-list :border="true"> | 
|                         <uni-list-item direction="column" v-for="(item,index) in orderDetail" :key="index"> | 
|                             <template v-slot:body> | 
|                                 <view class="uni-list-box"> | 
|                                     <view class="uni-content"> | 
|                                         <view style="font-size: 18px;">单据号:{{orderNo}}</view> | 
|                                         <view style="font-size: 18px;">物料编码:{{item.materielCode}}</view> | 
|                                         <view style="font-size: 18px;">物料名称:{{item.materielName}}</view> | 
|                                         <view style="font-size: 18px;">数量:{{item.orderQuantity}}</view> | 
|                                         <view style="font-size: 18px;">上架数量:{{item.overInQuantity}}</view> | 
|                                         <view style="font-size: 18px;">组盘数量:{{item.receiptQuantity}}</view> | 
|                                     </view> | 
|                                 </view> | 
|                             </template> | 
|                         </uni-list-item> | 
|                     </uni-list> | 
|                 </view> | 
|             </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-item> | 
|                         <uni-forms-item> | 
|                             <button @click="releasebox" type="primary" size="default">解盘</button> | 
|                         </uni-forms-item> | 
|                     </uni-forms> | 
|                     <uni-list> | 
|                         <uni-list-item direction="column" v-if="value2"> | 
|                             <template v-slot:body> | 
|                                 <view class="uni-list-box"> | 
|                                     <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> | 
|                                 </view> | 
|                             </template> | 
|                         </uni-list-item> | 
|                     </uni-list> | 
|                 </view> | 
|             </view> | 
|         </view> | 
|         <u-toast ref="uToast" /> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     const innerAudioContext = uni.createInnerAudioContext(); | 
|     export default { | 
|         data() { | 
|             return { | 
|                 items: ['组盘', '入库', '单据信息', '解盘'], | 
|                 current: 0, | 
|                 matTotal: [], | 
|                 matInfos: [], | 
|                 orderNo: "", | 
|                 label: "", | 
|                 orderDetail: [], | 
|                 focus: false, | 
|                 barcode: "", | 
|                 materSn: "", | 
|                 sns: [], | 
|                 addressFocus: false, | 
|                 inboundBarcode: "", | 
|                 address: "", | 
|                 check: true, | 
|                 value: "", | 
|                 matInfo: [], | 
|                 value2: "", | 
|                 matTotals: [] | 
|             } | 
|         }, | 
|         onShow() {}, | 
|         onLoad(res) { | 
|             this.focus = false; | 
|             this.addressFocus = false; | 
|             this.orderNo = res.orderNo; | 
|             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" | 
|                                 }) | 
|                             } | 
|                         }) | 
|                     } | 
|                 }) | 
|             }, | 
|   | 
|             updateFocus() { | 
|                 this.$nextTick(() => { | 
|                     this.materSn = ''; | 
|                     if (!this.focus) { | 
|                         this.focus = true; | 
|                     } | 
|                 }); | 
|             }, | 
|             barcodeFocus() { | 
|                 this.barcode = ''; | 
|                 if (this.focus) { | 
|                     this.focus = false; | 
|                 } | 
|             }, | 
|             getData() { | 
|                 var postData = this.orderNo | 
|   | 
|                 this.$u.post('/api/InboundOrder/GetInboundOrderDetail', postData).then((res) => { | 
|                     if (res.status) { | 
|                         this.orderDetail = res.data; | 
|                         if (this.orderDetail.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) { | 
|                         this.focus = true; | 
|                     } | 
|                 }) | 
|             }, | 
|             snInput() { | 
|                 this.$nextTick(() => { | 
|                     if (this.materSn != "") { | 
|                         this.focus = false; | 
|                         var matSn = this.materSn; | 
|                         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) | 
|                                     }) | 
|                                 } 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); | 
|                         } | 
|                     } | 
|                 }) | 
|             }, | 
|             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 = ""; | 
|                         setTimeout(() => { | 
|                             this.addressFocus = false; | 
|                         }, 200); | 
|                     } else { | 
|                         this.$refs.uToast.show({ | 
|                             title: res.message, | 
|                             type: "error" | 
|                         }) | 
|                     } | 
|                 }).catch(err => { | 
|                     this.$refs.uToast.show({ | 
|                         title: err.message, | 
|                         type: "error" | 
|                     }) | 
|                 }) | 
|             }, | 
|             inputChangebarcode() { | 
|                 this.addressFocus = false; | 
|                 this.$nextTick(function(x) { | 
|                     if (this.inboundBarcode != '') { | 
|                         this.addressFocus = true; | 
|                     } | 
|                 }) | 
|             }, | 
|             deleteList(res) { | 
|                 var sn = ''; | 
|                 this.matInfos.map((item, index) => { | 
|                     if (item.sn == res) { | 
|                         this.matInfos.splice(index, 1); | 
|                         sn = item.sn; | 
|                         var tmp = this.matTotal.find(x => x.matCode == item.matCode); | 
|                         if (tmp) { | 
|                             tmp.matQuantity -= parseInt(item.matQty); | 
|                         } else { | 
|   | 
|                         } | 
|                     } | 
|                 }) | 
|                 this.sns.map((item, index) => { | 
|                     if (item == res) { | 
|                         this.sns.splice(index, 1); | 
|                     } | 
|                 }) | 
|             }, | 
|             submit() { | 
|                 if (this.barcode == "") { | 
|                     this.$refs.uToast.show({ | 
|                         title: "请扫描托盘条码", | 
|                         type: 'error' | 
|                     }) | 
|                     return; | 
|                 } | 
|                 if (this.sns.length == 0) { | 
|                     this.$refs.uToast.show({ | 
|                         title: "请扫描内箱标签", | 
|                         type: 'error' | 
|                     }) | 
|                     return; | 
|                 } | 
|                 this.$u.post('/api/Bill_group_stock/PDA_ScanInStock', { | 
|                     MainData: { | 
|                         "pallet_barcode": this.barcode, | 
|                         "orderNo": this.orderNo, | 
|                         "isFull": this.check | 
|                     }, | 
|                     DelKeys: this.sns | 
|                 }).then(res => { | 
|                     if (res.status) { | 
|                         this.$refs.uToast.show({ | 
|                             title: "组盘成功", | 
|                             type: "success" | 
|                         }) | 
|                         this.focus = false; | 
|                         this.barcode = ""; | 
|                         this.matInfos = []; | 
|                         this.sns = []; | 
|                         this.matTotal = []; | 
|                     } else { | 
|                         this.$refs.uToast.show({ | 
|                             title: res.message, | 
|                             type: "error" | 
|                         }) | 
|                     } | 
|                 }) | 
|             } | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style lang="scss"> | 
|     @import '@/common/uni-ui.scss'; | 
|   | 
|     .content { | 
|         display: flex; | 
|         height: 150px; | 
|     } | 
|   | 
|     .content-text { | 
|         font-size: 14px; | 
|         color: #666; | 
|     } | 
|   | 
|     .itemstyle { | 
|         margin-top: 30px; | 
|         margin-left: 5%; | 
|     } | 
|   | 
|     .headerstyle { | 
|         width: 90%; | 
|     } | 
| </style> |