wankeda
2025-04-14 291f66df5621f0644ce9d15548eb6590045691f0
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
<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="120">
                        <uni-forms-item label="起点地址">
                            <!-- <uni-easyinput type="text" :focus="!addressFocus" v-model="sourceAddress"
                                placeholder="请扫瞄起点地址" ref='midInput' @input="inputChangebarcode" /> -->
                                    <uni-data-select v-model="value" :localdata="rangs"></uni-data-select>
                        </uni-forms-item>
                        <uni-forms-item label="终点地址">
                            <uni-easyinput type="text" :focus="!addressFocus" v-model="targetAddress"
                                placeholder="请扫描终点地址" ref='midInput' @input="inputChangebarcode" />
                        </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>
        <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,
                targetAddress: "",
                sourceAddress: "",
                address: "",
                check: true,
                value: "",
                matInfo: [],
                value2: "",
                matTotals: [],
                value: 0,
                rangs: [{
                        value: "FJXL-KPHLX001",
                        text: "FJXL-KPHLX001"
                    },
                    {
                        value: "ZJXL-KPHLX001",
                        text: "ZJXL-KPHLX001"
                    },
                ],
                // range: [],
            }
        },
        onShow() {},
        // onLoad(res) {
        //     this.focus = false;
        //     this.addressFocus = false;
        //     this.orderNo = res.orderNo;
        //     this.label = "单据编号:" + this.orderNo;
        //     this.getData();
        //     // this.getEndLocations();
        // },
        methods: {
            voiceSpeech(src) {
                innerAudioContext.src = src; // '../../static/success.mp3';
                innerAudioContext.play();
            },
 
            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;
                    }
                })
            },
            inbound() {
                var postData = {
                    MainData: {
                        "sourceAddress": this.value,
                        "targetAddress": this.targetAddress,
                    }
                }
 
                this.$u.post('/api/PDA/EmptyTask', postData).then(res => {
                    if (res.code == 200) {
                        uni.$showMsg("任务添加成功");
                        this.sourceAddress = "";
                        this.targetAddress = "";
                        setTimeout(() => {
                            // this.materialtype = 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.sourceAddress != '') {
                        this.addressFocus = true;
                    }
                })
            },
            // getEndLocations() {
            //     this.$u.post('/api/CachePoint/GetEndPoints', null).then(res => {
            //         if (res.status) {
            //             this.range = res.data;
            //         } 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>