1
yangpeixing
2026-04-01 f1bf3ef09713182d434e22dfd8623ea73e02d6d3
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
<template>
    <view>
        <view class="itemstyle">
            <uni-forms label-width="180">
                <uni-forms-item label="原始托盘条码:">
                    <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="sourceFocus"
                        v-model="soussAddress" @input="barcodeInput" />
                </uni-forms-item>
                <uni-forms-item label="目标托盘条码:">
                    <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="targetFocus"
                        v-model="targetAddress" @input="barcodeInput" />
                </uni-forms-item>
                <uni-forms-item>
                    <button @click="AGVTasks" type="primary" size="default" style="margin-top: 2%;">确认完成</button>
                </uni-forms-item>
            </uni-forms>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                sourceFocus: true, // 默认原始托盘输入框获得焦点
                targetFocus: false, // 目标托盘输入框不获得焦点
                soussAddress: "",
                targetAddress: "",
                warehouseId: "",
            }
        },
        onLoad(res) {
            this.warehouseId = res.warehouseId;
        },
        methods: {
            barcodeInput(type) {
                if (type != '') {
                    if (this.soussAddress == "") {
                        setTimeout(() => {
                            this.sourceFocus = false;
                            this.targetFocus = true;
                        }, 100);
                    }
                }
            },
            AGVTasks() {
                if (this.soussAddress == "") {
                    this.$refs.uToast.show({
                        title: "请扫描原始托盘条码",
                        type: 'error'
                    })
                    this.sourceFocus = true;
                    this.targetFocus = false;
                    return;
                }
                if (this.targetAddress == "") {
                    this.$refs.uToast.show({
                        title: "请扫描目标托盘条码",
                        type: 'error'
                    })
                    this.sourceFocus = false;
                    this.targetFocus = true;
                    return;
                }
 
                var postDate = {
                    MainData: {
                        soussAddress: this.soussAddress,
                        targetAddress: this.targetAddress,
                        warehouseId: this.warehouseId,
                    }
                }
                this.$u.post('/api/InboundOrder/SYMaterielGroup', postDate).then(
                    res => {
                        if (res.status) {
                            this.$refs.uToast.show({
                                title: "合托成功",
                                type: "success"
                            })
                            this.soussAddress = "";
                            this.targetAddress = "";
                            this.sourceFocus = true;
                            this.targetFocus = false;
                        } else {
                            this.$refs.uToast.show({
                                title: res.message,
                                type: "error"
                            })
                            
                            this.sourceFocus = true;
                            this.targetFocus = false;
                        }
                    })
            },
        }
    }
</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>