|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <default-header-page-layout ref="page" title="出库执行"> | 
|---|
|  |  |  | <default-header-page-layout ref="page" title="入库执行"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight"> | 
|---|
|  |  |  | <action-user-row /> | 
|---|
|  |  |  | 
|---|
|  |  |  | <template v-slot:footer> | 
|---|
|  |  |  | <view class="bottom-btns-row"> | 
|---|
|  |  |  | <view class="btn-frame right-btn-frame"> | 
|---|
|  |  |  | <u-button :disabled="workPieceData.length<1" type="primary" text="确认出库" | 
|---|
|  |  |  | <u-button :disabled="workPieceData.length<1" type="primary" text="确认入库" | 
|---|
|  |  |  | @click="outBoundConfirm"></u-button> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | barHeight: '', | 
|---|
|  |  |  | ckNumToday: "0", //今天总出库数 | 
|---|
|  |  |  | ckNumToday: "0", //今天总入库数 | 
|---|
|  |  |  | baseTitile: '扫描成品码/工件二维码', //扫描成品码/工件二维码 | 
|---|
|  |  |  | title: '', | 
|---|
|  |  |  | pageBodyHeight: 0, | 
|---|
|  |  |  | 
|---|
|  |  |  | onLoad() { | 
|---|
|  |  |  | var _this = this; | 
|---|
|  |  |  | _this._getOutBoundWorkPieceInfoCount(); | 
|---|
|  |  |  | //不再循环读 | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | this.myInterval = setInterval(function() { | 
|---|
|  |  |  | _this._getOutBoundWorkPieceInfoCount(); | 
|---|
|  |  |  | }, 1000 * 10); | 
|---|
|  |  |  | //*/ | 
|---|
|  |  |  | //this.myInterval=setInterval(this.myFun(), 3000); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 获取工件信息 | 
|---|
|  |  |  | async onSearchContainter(OP80NewCode) { | 
|---|
|  |  |  | // if (OP80NewCode.length > 22) { | 
|---|
|  |  |  | //    this.initFocus(100); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    uni.showToast({ | 
|---|
|  |  |  | //       title: '工件码或成品码长度不正确', | 
|---|
|  |  |  | //       icon: 'error', | 
|---|
|  |  |  | //       duration: 2000, | 
|---|
|  |  |  | //       mask: true | 
|---|
|  |  |  | //    }); | 
|---|
|  |  |  | //    return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | //debugger | 
|---|
|  |  |  | if (OP80NewCode.length != 21) { | 
|---|
|  |  |  | this.initFocus(100); | 
|---|
|  |  |  | // uni.showToast({ | 
|---|
|  |  |  | //    title: '工件码或成品码长度不正确', | 
|---|
|  |  |  | //    icon: 'error', | 
|---|
|  |  |  | //    duration: 2000, | 
|---|
|  |  |  | //    mask: true | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.inputFocus = false | 
|---|
|  |  |  | const param = { | 
|---|
|  |  |  | OP80NewCode: OP80NewCode | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let { | 
|---|
|  |  |  | data | 
|---|
|  |  |  | } = await getWorkPieceByOP80NewCode(param) | 
|---|
|  |  |  | let data={}; | 
|---|
|  |  |  | data.addTime = new Date(); | 
|---|
|  |  |  | data.workPieceID=OP80NewCode; | 
|---|
|  |  |  | data.oP80NewCode=OP80NewCode; | 
|---|
|  |  |  | if (!this.workPieceData.some(item => item.workPieceID == data.workPieceID)) { | 
|---|
|  |  |  | data.addTime = new Date(); | 
|---|
|  |  |  | this.workPieceData.push(data) | 
|---|
|  |  |  | 
|---|
|  |  |  | //顺序调转,排序 | 
|---|
|  |  |  | this.workPieceData.sort((a, b) => b.addTime - a.addTime); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.OP80NewCode = ''; //每次刷完就清空输入框 【Editby shaocx,2024-06-12】 | 
|---|
|  |  |  | this.initFocus(100); | 
|---|
|  |  |  | //console.log(this.workPieceData,'dsts'); | 
|---|
|  |  |  | // setTimeout(()=>{ | 
|---|
|  |  |  | 
|---|
|  |  |  | //TODO handle the exception | 
|---|
|  |  |  | console.log(e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //this.msg = " 扫码数:"+this.workPieceData.length+"    今日出库数:"; | 
|---|
|  |  |  | //this.msg = " 扫码数:"+this.workPieceData.length+"    今日入库数:"; | 
|---|
|  |  |  | this.setMsg(); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | setMsg() { | 
|---|
|  |  |  | this.msg = " 扫码数:" + this.workPieceData.length + "    今日出库数:" + this.ckNumToday; | 
|---|
|  |  |  | this.msg = " 扫码数:" + this.workPieceData.length + "    今日入库数:" + this.ckNumToday; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | initFocus(num) { | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | 
|---|
|  |  |  | reflesh() { | 
|---|
|  |  |  | this.OP80NewCode = '' | 
|---|
|  |  |  | this.workPieceData = [] | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | this._getOutBoundWorkPieceInfoCount(); | 
|---|
|  |  |  | this.setMsg(); | 
|---|
|  |  |  | }, 1000) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | outBoundConfirm() { | 
|---|
|  |  |  | this.$refs.pwdRef.showModal(this.workPieceData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | // 存在非成品 | 
|---|
|  |  |  | const flag = this.workPieceData.some(item => item.workPieceState != 10) | 
|---|
|  |  |  | if (flag) { | 
|---|
|  |  |  | uni.showModal({ | 
|---|
|  |  |  | title: '提示', | 
|---|
|  |  |  | content: '当前工件存在非成品,确定强制出库吗?', | 
|---|
|  |  |  | content: '当前工件存在非成品,确定强制入库吗?', | 
|---|
|  |  |  | success: (value) => { | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | confirm, | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$refs.pwdRef.showModal(this.workPieceData) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //*/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | /* 页面初始化获取页面body高度的定时器 */ | 
|---|