#
whycq
2024-06-12 2dbb3a82f3e10218a7743a8dc318882dc888eef4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<template>
    <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" :class="item.style" v-if="stations" v-for="item in stations">
            <view class="list-left">
                <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>工作状态:{{wrkMast.wrkSts$}}</view>
                <view>入出库类型:{{wrkMast.ioType$}}</view>
                <view>源库位:{{wrkMast.sourceLocNo}}</view>
                <view>目标库位:{{wrkMast.locNo}}</view>
                <view>料箱码:{{wrkMast.barcode}}</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: #fda800;color: #fff;" v-for="wrkMast in wrkDetls">
            <view class="list-left">
                <view>物料号:{{wrkMast.matnr}}</view>
                <view>物料名称:{{wrkMast.maktx}}</view>
                <view>批号:{{wrkMast.batch}}</view>
                <view>规格:{{wrkMast.specs}}</view>
                <view>数量:{{wrkMast.anfme}}</view>
            </view>
        </view>
        
        <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>
                <view>批号:{{wrkMast.batch}}</view>
                <view>规格:{{wrkMast.specs}}</view>
                <view>数量:{{wrkMast.anfme}}</view>
            </view>
        </view>
        
        <view style="height: 100rpx;"></view>
        
        <!-- 空板入库弹窗 -->
        <view>
            <uni-popup ref="revise" type="dialog">
                <view class="popup">
                    <!-- 标题 -->
                    <view class="title">请录入货架码</view>
                    <view class="popup-item">
                        <view class="popup-item-left">货架码:</view>
                        <view class="popup-item-right"><input type="text" v-model="barcode"></view>
                    </view>
                    <view class="btn">
                        <view class="btn-left" @click="reviseClose">取消</view>
                        <view class="btn-right" @click="reviseConfirm()">入库</view>
                    </view>
                </view>
            </uni-popup>
        </view>
        
        <!-- 底部操作按钮 -->
        <view class="buttom" v-if="waitPakins.length > 0">
            <button size="mini" type="primary" @click="startPakin(searchValue)" v-if="waitPakins">启动入库</button>
        </view>
        
        <!-- 底部操作按钮 -->
        <view class="buttom" v-if="station.locSts == 'O'">
            <button size="mini" type="primary" @click="emptyPakin()">空板入库</button>
        </view>
        
        <!-- 底部操作按钮 -->
        <view class="buttom" v-if="wrkMast">
            <button size="mini" type="primary" @click="containerMoveOut(searchValue)" v-if="wrkMast.ioType == 101">确认出库</button>
            <button size="mini" type="primary" @click="pickIn(searchValue)" v-if="wrkMast.ioType == 103">已拣料回库</button>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseUrl: '',
                token: '',
                searchValueFocus: true,
                searchValue: '',
                station: '',
                stations: [],
                wrkMast: '',
                wrkDetls: [],
                waitPakins: [],
                barcode: '',
                option: 'pick'
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            this.getBasDevp('all')
            this.searchValueFocus = true
        },
        methods: {
            searchValueInput() {
                if (this.searchValue == '') {
                    this.station = ''
                    this.stations = []
                    this.wrkMast = ''
                    this.wrkDetls = []
                } else if (this.searchValue.length == 7) {
                    this.getBasDevp('one')
                }
            },
            clear() {
                this.waitPakins = []
                this.wrkDetls = []
            },
            // 获取暂存位
            getBasDevp(type) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/agv/basDevp/list/auth`,
                    header: {'token': uni.getStorageSync('token')},
                    data: {
                        curr: 1,
                        limit: 1000,
                        dev_no: _this.searchValue
                    },
                    method: 'GET',
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            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' })
                        }
                    }
                })
            },
            // 获取组托档
            getWaitPakin(barcode) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/agv/waitPakin/list/auth`,
                    header: {'token': uni.getStorageSync('token')},
                    data: {
                        curr: 1,
                        limit: 1000,
                        supp_code: barcode
                    },
                    method: 'GET',
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            for (let item of res.data.records) {
                                _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' })
                        }
                    }
                })
            },
            // 获取工作档
            getWrkMast(barcode) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/agv/wrkMast/list/auth`,
                    header: {'token': uni.getStorageSync('token')},
                    data: {
                        curr: 1,
                        limit: 1000,
                        condition: barcode
                    },
                    method: 'GET',
                    success(res) {
                        res = res.data
                        if (res.code === 200) {
                            for (let item of res.data.records) {
                                _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' })
                        }
                    }
                })
            },
            // 获取工作明细
            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.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' })
                        }
                    }
                })
            },
            // 拣料回库
            pickIn(e) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/agv/basDevp/visualized/container/pickIn`,
                    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' })
                        }
                    }
                })
            },
            // 容器离场
            containerMoveOut(e) {
                let _this = this
                let devNo = {devNo:[e]}
                // console.log(JSON.stringify(devNo));
                uni.request({
                    url: `${_this.baseUrl}/agv/basDevp/visualized/container/moveOut`,
                    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' })
                        }
                    }
                })
            },
            // 启动入库
            startPakin(type) {
                let that = this
                let params = []
                let param = {}
                if (type == 'empty') {
                    param = {
                        devNo: this.searchValue,
                        containerCode: this.barcode,
                    }
                } else {
                    param = {
                        devNo: this.searchValue,
                        containerCode: this.station.barcode,
                    }
                }
                params.push(param)
                uni.request({
                    url: that.baseUrl + '/agvMobile/pakin/empty/auth',
                    data: {pad: params},
                    method: 'POST',
                    header: {'token': uni.getStorageSync('token')},
                    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) {
                            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' })
                        }
                    }
                });
            },
            
            // 空板入库
            emptyPakin() {
                let _this = this
                this.$refs.revise.open()
            },
            // 取消空板入库
            reviseClose() {
                this.$refs.revise.close()
            },
            // 确认空板入库
            reviseConfirm() {
                this.startPakin('empty')
                this.$refs.revise.close()
            },
            // 前往站点明细页面
            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
                        }
                    },
                });
            }
        }
    }
</script>
 
<style>
    @import url('../../../static/css/common/order.css');
    .list-anfme {
        color: #0082ff;
        font-weight: bold;
    }
    .list-qty-1 {
        color: #33ba43;
        font-weight: bold;
    }
    .list-qty-2 {
        color: #e2231a;
        font-weight: bold;
    }
    
    .popup {
        width: 80vw;
        min-height: 100rpx;
        background-color: #FFF;
        border-radius: 25rpx;
    }
    .title {
        height: 100rpx;
        line-height: 100rpx;
        width: 100%;
        color: #606266;
        text-align: center;
        font-size: 16px;
    }
    .popup-item {
        height: 80rpx;
        line-height: 80rpx;
        display: flex;
        align-items: center;
        font-size: 14px;
    }
    .popup-item-left {
        width: 16vw;
        padding-right: 20rpx;
        text-align: right;
        color: #606266;
    }
    .popup-item-right {
        display: flex;
        align-items: center;
        width: 50vw;
        height: 50rpx;
        padding: 2px 5px;
        border: 1px solid #E4E7ED;
        border-radius: 5rpx;
    }
    .popup-item-right input{
        color: #606266;
    }
    .btn {
        display: flex;
        height: 90rpx;
        margin-top: 20rpx;
        border-top: 1px solid #DCDFE6;
        justify-content: center;
        align-items: center;
    }
    .btn-left {
        display: flex;
        flex: 1;
        height: 100%;
        justify-content: center;
        align-items: center;
        color: #606266;
        border-right: 1px solid #DCDFE6;
    }
    .btn-right {
        display: flex;
        flex: 1;
        justify-content: center;
        align-items: center;
        color: #409EFF;
    }
    .station-wrk {
        background-color: #ff7356;
        color: #fff;
    }
    .station-nowrk {
        background-color: #3eb689;
        color: #fff;
    }
</style>