|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <view> | 
|---|
|  |  |  | <view style="font-size: 14px;"> | 
|---|
|  |  |  | <view class="code"> | 
|---|
|  |  |  | <uni-search-bar :focus="searchValueFocus" v-model="searchValue"  @input="searchValueInput()" | 
|---|
|  |  |  | maxlength="500" ancel="cancel" @clear="clear" placeholder="输入 / 扫描 站点号"> | 
|---|
|  |  |  | </uni-search-bar> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="list" style="background-color: #3eb689;color: #fff;" v-if="station"> | 
|---|
|  |  |  | <view class="list" :class="item.style" v-if="stations" v-for="item in stations"> | 
|---|
|  |  |  | <view class="list-left"> | 
|---|
|  |  |  | <view>工位编号:{{station.devNo}}</view> | 
|---|
|  |  |  | <view>工位状态:{{station.locSts$}}</view> | 
|---|
|  |  |  | <view>条形码:{{station.barcode}}</view> | 
|---|
|  |  |  | <view>工位编号:{{item.devNo}}</view> | 
|---|
|  |  |  | <view>站点状态:{{item.locSts$}}</view> | 
|---|
|  |  |  | <view>货架码:{{item.barcode}}</view> | 
|---|
|  |  |  | <view>站点类型:{{item.locType1$}}</view> | 
|---|
|  |  |  | <!-- <view class="card-id">{{i + 1}}</view> --> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="list-right" @click="getOrderDetl(item)"> | 
|---|
|  |  |  | <uni-icons type="right" color="#fff"></uni-icons> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <!-- <view class="list" style="background-color: #3eb689;color: #fff;" v-if="station"> | 
|---|
|  |  |  | <view class="list-left"> | 
|---|
|  |  |  | <view>工位编号:{{station.devNo}}</view> | 
|---|
|  |  |  | <view>站点状态:{{station.locSts$}}</view> | 
|---|
|  |  |  | <view>条形码:{{station.barcode}}</view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="list-right" @click="getOrderDetl(item)"> | 
|---|
|  |  |  | <uni-icons type="right" color="#fff"></uni-icons> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> --> | 
|---|
|  |  |  | <view class="list" style="background-color: #019fe8;color: #fff;" v-if="wrkMast"> | 
|---|
|  |  |  | <view class="list-left"> | 
|---|
|  |  |  | <view>工作号:{{wrkMast.wrkNo}}</view> | 
|---|
|  |  |  | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <view class="list" style="background-color: #fda800;color: #fff;" v-for="wrkMast in waitPakins"> | 
|---|
|  |  |  | <view class="list" style="background-color: #fda800;color: #fff;" v-if="!wrkDetls" v-for="wrkMast in waitPakins"> | 
|---|
|  |  |  | <view class="list-left"> | 
|---|
|  |  |  | <view>物料号:{{wrkMast.matnr}}</view> | 
|---|
|  |  |  | <view>物料名称:{{wrkMast.maktx}}</view> | 
|---|
|  |  |  | 
|---|
|  |  |  | searchValueFocus: true, | 
|---|
|  |  |  | searchValue: '', | 
|---|
|  |  |  | station: '', | 
|---|
|  |  |  | stations: [], | 
|---|
|  |  |  | wrkMast: '', | 
|---|
|  |  |  | wrkDetls: [], | 
|---|
|  |  |  | waitPakins: [], | 
|---|
|  |  |  | barcode: '' | 
|---|
|  |  |  | barcode: '', | 
|---|
|  |  |  | option: 'pick' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onLoad() { | 
|---|
|  |  |  | onShow() { | 
|---|
|  |  |  | this.baseUrl = uni.getStorageSync('baseUrl'); | 
|---|
|  |  |  | this.token = uni.getStorageSync('token'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onShow() { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.getBasDevp('all') | 
|---|
|  |  |  | this.searchValueFocus = true | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | searchValueInput() { | 
|---|
|  |  |  | if (this.searchValue == '') { | 
|---|
|  |  |  | this.station = '' | 
|---|
|  |  |  | this.stations = [] | 
|---|
|  |  |  | this.wrkMast = '' | 
|---|
|  |  |  | this.wrkDetls = [] | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.getBasDevp() | 
|---|
|  |  |  | this.getBasDevp('one') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | clear() { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.wrkDetls = [] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 获取暂存位 | 
|---|
|  |  |  | getBasDevp() { | 
|---|
|  |  |  | getBasDevp(type) { | 
|---|
|  |  |  | let _this = this | 
|---|
|  |  |  | uni.request({ | 
|---|
|  |  |  | url: `${_this.baseUrl}/agv/basDevp/list/auth`, | 
|---|
|  |  |  | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | for (let item of res.data.records) { | 
|---|
|  |  |  | _this.station = item | 
|---|
|  |  |  | if (item.barcode) { | 
|---|
|  |  |  | _this.getWrkMast(item.barcode) | 
|---|
|  |  |  | _this.getWaitPakin(item.barcode) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (type == 'all') { | 
|---|
|  |  |  | for  (let k of res.data.records) { | 
|---|
|  |  |  | if (k.locSts != 'O') { | 
|---|
|  |  |  | k['style'] = 'station-wrk' | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | k['style'] = 'station-nowrk' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | _this.stations = res.data.records | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | res.data.records | 
|---|
|  |  |  | for (let item of res.data.records) { | 
|---|
|  |  |  | if (item.locSts != 'O') { | 
|---|
|  |  |  | item['style'] = 'station-wrk' | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | item['style'] = 'station-nowrk' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | _this.getOrderDetl(res.data.records[0]) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | _this.waitPakins = res.data.records | 
|---|
|  |  |  | // _this.getWrkDetl(item.wrkNo) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | _this.wrkMast = item | 
|---|
|  |  |  | _this.getWrkDetl(item.wrkNo) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | _this.wrkDetls = res.data.records | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | data: {devNo: e}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | _this.searchValue = '' | 
|---|
|  |  |  | setTimeout(()=> { | 
|---|
|  |  |  | _this.searchValue = '' | 
|---|
|  |  |  | _this.station = '' | 
|---|
|  |  |  | _this.wrkMast = '' | 
|---|
|  |  |  | _this.wrkDetls = [] | 
|---|
|  |  |  | _this.waitPakins = [] | 
|---|
|  |  |  | },100) | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | data: JSON.stringify(devNo), | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success(res) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | res = res.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | _this.searchValue = '' | 
|---|
|  |  |  | setTimeout(()=> { | 
|---|
|  |  |  | _this.searchValue = '' | 
|---|
|  |  |  | _this.station = '' | 
|---|
|  |  |  | _this.wrkMast = '' | 
|---|
|  |  |  | _this.wrkDetls = [] | 
|---|
|  |  |  | _this.waitPakins = [] | 
|---|
|  |  |  | },100) | 
|---|
|  |  |  | } 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' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | success(result) { | 
|---|
|  |  |  | var res = result.data | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | setTimeout(()=> { | 
|---|
|  |  |  | that.searchValue = '' | 
|---|
|  |  |  | that.station = '' | 
|---|
|  |  |  | that.wrkMast = '' | 
|---|
|  |  |  | that.wrkDetls = [] | 
|---|
|  |  |  | that.waitPakins = [] | 
|---|
|  |  |  | },300) | 
|---|
|  |  |  | uni.showToast({ | 
|---|
|  |  |  | title: res.msg, | 
|---|
|  |  |  | icon: "none", | 
|---|
|  |  |  | position: 'top' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } else if (res.code == 403) { | 
|---|
|  |  |  | that.messageText = res.msg | 
|---|
|  |  |  | that.messageToggle('error') | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | uni.reLaunch({ | 
|---|
|  |  |  | url: '../login/login' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, 1000); | 
|---|
|  |  |  | uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
|---|
|  |  |  | setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | that.messageText = res.msg | 
|---|
|  |  |  | that.messageToggle('error') | 
|---|
|  |  |  | uni.showToast({ title: res.msg, icon: "error", position: 'top' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | reviseConfirm() { | 
|---|
|  |  |  | this.startPakin('empty') | 
|---|
|  |  |  | this.$refs.revise.close() | 
|---|
|  |  |  | setTimeout(()=> { | 
|---|
|  |  |  | this.getBasDevp() | 
|---|
|  |  |  | },300) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 前往站点明细页面 | 
|---|
|  |  |  | getOrderDetl(e) { | 
|---|
|  |  |  | let _this = this | 
|---|
|  |  |  | uni.navigateTo({ | 
|---|
|  |  |  | url: "./stationDetl", | 
|---|
|  |  |  | success: function(res) { | 
|---|
|  |  |  | // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的 | 
|---|
|  |  |  | res.eventChannel.emit('item', { | 
|---|
|  |  |  | item: e | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | _this.searchValue = '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | events: { | 
|---|
|  |  |  | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的 | 
|---|
|  |  |  | acceptDataFromOpenedPage: function(data) { | 
|---|
|  |  |  | _this.searchValueFocus = true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | align-items: center; | 
|---|
|  |  |  | color: #409EFF; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .station-wrk { | 
|---|
|  |  |  | background-color: #ff7356; | 
|---|
|  |  |  | color: #fff; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .station-nowrk { | 
|---|
|  |  |  | background-color: #3eb689; | 
|---|
|  |  |  | color: #fff; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|