|  |  |  | 
|---|
|  |  |  | <!-- 标题 --> | 
|---|
|  |  |  | <view class="title">拣料数量</view> | 
|---|
|  |  |  | <view class="popup-item"> | 
|---|
|  |  |  | <uni-number-box :value="count" :step='1' :max="maxCount" color="#747474" @change="changeValue" /> | 
|---|
|  |  |  | <uni-number-box :value="count" :step='0.01' :max="maxCount" color="#747474" @change="changeValue" /> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="btn"> | 
|---|
|  |  |  | <view class="btn-left" @click="addClose">取消</view> | 
|---|
|  |  |  | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <!-- 底部操作按钮 --> | 
|---|
|  |  |  | <view class="buttom"> | 
|---|
|  |  |  | <button size="mini" type="primary" @click="confirmPick('warn')">确认拣料</button> | 
|---|
|  |  |  | <button size="mini" type="primary" @click="confirmPick('warn')" :disabled="pickAgaDis">确认拣料</button> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | maxCount: 0, | 
|---|
|  |  |  | wrkNo: '', | 
|---|
|  |  |  | locNo: '', | 
|---|
|  |  |  | pickedAnfme: 0 | 
|---|
|  |  |  | pickedAnfme: 0, | 
|---|
|  |  |  | pickAgaDis: false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onShow() { | 
|---|
|  |  |  | 
|---|
|  |  |  | const eventChannel = this.getOpenerEventChannel(); | 
|---|
|  |  |  | // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | 
|---|
|  |  |  | eventChannel.on('item', function(data) { | 
|---|
|  |  |  | console.log(data); | 
|---|
|  |  |  | // console.log(data); | 
|---|
|  |  |  | _this.pickList = data.wrkDetls | 
|---|
|  |  |  | _this.wrkNo = data.wrkDetls[0].wrkNo | 
|---|
|  |  |  | _this.locNo = data.item.sourceLocNo | 
|---|
|  |  |  | _this.getLocDetl(data.item.sourceLocNo) | 
|---|
|  |  |  | _this.getWrkDetl(data.wrkDetls[0].wrkNo) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | // console.log(res); | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | _this.chosed(_this.pickList,res.data.records) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 获取工作明细 | 
|---|
|  |  |  | getWrkDetl(wrkNo) { | 
|---|
|  |  |  | let _this = this | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: `${_this.baseUrl}/agv/wrkDetl/list/auth`, | 
|---|
|  |  |  | header: {'token': uni.getStorageSync('token')}, | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | curr: 1, | 
|---|
|  |  |  | limit: 1000, | 
|---|
|  |  |  | wrk_no: wrkNo | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | _this.pickList = res.data.records | 
|---|
|  |  |  | _this.getLocDetl(_this.locNo) | 
|---|
|  |  |  | } else if (res.code == 403) { | 
|---|
|  |  |  | uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
|---|
|  |  |  | setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 已选拣料列表 | 
|---|
|  |  |  | chosed(wrkDetls,locDetls) { | 
|---|
|  |  |  | console.log(wrkDetls,locDetls); | 
|---|
|  |  |  | let isfl = false, enbleList = [] | 
|---|
|  |  |  | for (let locDetl of locDetls) { | 
|---|
|  |  |  | locDetl['color'] = 'order-sts-start' | 
|---|
|  |  |  | locDetl['pickedAnfme'] = 0 | 
|---|
|  |  |  | locDetl['count'] = 0 | 
|---|
|  |  |  | for (let wrkDetl of wrkDetls) { | 
|---|
|  |  |  | if (wrkDetl.threeCode == locDetl.threeCode && wrkDetl.matnr == locDetl.matnr) { | 
|---|
|  |  |  | console.log(wrkDetl); | 
|---|
|  |  |  | if (wrkDetl.threeCode.replace(/\s/g, "") == locDetl.threeCode.replace(/\s/g, "") && wrkDetl.matnr == locDetl.matnr) { | 
|---|
|  |  |  | console.log(wrkDetl); | 
|---|
|  |  |  | locDetl['pickedAnfme'] = wrkDetl.anfme | 
|---|
|  |  |  | if (locDetl.stock == -1) { | 
|---|
|  |  |  | locDetl.stock = 0 | 
|---|
|  |  |  | 
|---|
|  |  |  | // 判断添加的商品是否和已经添加的重复 | 
|---|
|  |  |  | let dataList = this.dataList | 
|---|
|  |  |  | this.index = index | 
|---|
|  |  |  | let orderCount = this.dataList[index].stock | 
|---|
|  |  |  | let locCount = this.dataList[index].anfme | 
|---|
|  |  |  | let pickedAnfme = this.dataList[index].pickedAnfme | 
|---|
|  |  |  | // 预计最大要出库 | 
|---|
|  |  |  | let ftCount = pickedAnfme + orderCount | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (this.dataList[index].stock > this.dataList[index].anfme) { | 
|---|
|  |  |  | this.maxCount = this.dataList[index].anfme - this.dataList[index].pickedAnfme | 
|---|
|  |  |  | if (orderCount > locCount) { | 
|---|
|  |  |  | this.maxCount = locCount - pickedAnfme | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.maxCount = this.dataList[index].stock | 
|---|
|  |  |  | if (ftCount > locCount) { | 
|---|
|  |  |  | this.maxCount = locCount -pickedAnfme | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.maxCount = orderCount | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.$refs.addItem.open() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | addClose() { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 确认再次拣料 | 
|---|
|  |  |  | confirmPick() { | 
|---|
|  |  |  | this.pickAgaDis = true | 
|---|
|  |  |  | let _this = this | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: `${_this.baseUrl}/agvMobile/pick/again/auth`, | 
|---|
|  |  |  | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | _this.pickAgaDis = false | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | if  (res.code === 200) { | 
|---|
|  |  |  | _this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: 1}); | 
|---|
|  |  |  | setTimeout(()=>{ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | fail(res) { | 
|---|
|  |  |  | _this.pickAgaDis = false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|