wanshenmean
2025-04-08 ef0a08b828d021bdc7978406e72bbde000097f5e
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
<template>
    <view class="example">
        <!-- <u-tabs :list="list" :is-Scroll="false" :current="current2" @change="change"></u-tabs> -->
        <uni-segmented-control :current="current2" :values="list" @clickItem="change" styleType="button"
            activeColor="#4cd964"></uni-segmented-control>
        <view v-show="current2===0">
            <uni-section title="扫描分切缓存架,选择1F冲叠缓存架" type="line" padding style="height: calc(100vh - 100px);">
                <uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
                    <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
                        <uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描分切缓存架条码" @input="input" />
                    </uni-forms-item>
                    <uni-forms-item label-width="120" label="物流线" name="sexs2" required>
                        <uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="checkbox" />
                    </uni-forms-item>
                    <uni-forms-item label="1F冲叠条码" label-width="120" required name="classes">
                        <uni-data-picker placeholder="请选择1F冲叠缓存架条码" popup-title="请选择1F冲叠缓存架条码" :localdata="dataTree"
                            v-model="baseFormData.classes">
                        </uni-data-picker>
                    </uni-forms-item>
                </uni-forms>
                <u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
                    @click="submit()">
                    添加任务
                </u-button>
            </uni-section>
        </view>
        <view v-show="current2===1">
            <uni-section title="扫描分切缓存架,选择2F冲叠缓存架" type="line" padding style="height: calc(100vh - 100px);">
                <uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
                    <uni-forms-item label="缓存架条码" label-width="120" required name="HCJInput">
                        <uni-easyinput v-model="baseFormData.HCJInput" placeholder="请扫描分切缓存架条码" @input="input1" />
                    </uni-forms-item>
                    <uni-forms-item label-width="120" label="物流线" name="sexs2" required>
                        <uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="checkbox" />
                    </uni-forms-item>
                    <uni-forms-item label="2F冲叠条码" label-width="120" required name="classes">
                        <uni-data-picker placeholder="请选择2F冲叠缓存架条码" popup-title="请选择2F冲叠缓存架条码" :localdata="dataTree"
                            v-model="baseFormData.classes">
                        </uni-data-picker>
                    </uni-forms-item>
                </uni-forms>
                <u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
                    @click="submit()">
                    添加任务
                </u-button>
            </uni-section>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                baseFormData: {
                    HCJInput: '',
                    classes: '',
                    sex2: '1'
                },
                list: ['一楼冲叠', '二楼冲叠'],
                dataTree: [],
                sexs2: [{
                    text: '一线',
                    value: '1'
                }, {
                    text: '二线',
                    value: '2'
                }],
                formRules: {
                    classes: {
                        rules: [{
                            required: true,
                            errorMessage: '设备编号不能为空'
                        }]
                    },
                    HCJInput: {
                        rules: [{
                            required: true,
                            errorMessage: '缓存架不能为空'
                        }]
                    }
                },
                current2: 0,
                flag: false
            }
        },
        methods: {
            change(index) {
                if (this.current2 != index.currentIndex) {
                    this.current2 = index.currentIndex;
                    if (this.current2 === 2) {
                        this.flag = true
                    } else {
                        this.flag = false
                    }
                }
                this.baseFormData.HCJInput='';
                this.baseFormData.classes='';
                this.baseFormData.sex2='1';
                this.dataTree=[];
            },
            input(e) {
                
                if(!e.includes('XL-FQHCJ')){
                return this.$t.message.toast("条码错误")
                }
                let formDataParam = {
                    UpperCode: e,
                    Type: "1-CDHCJ",
                    LocationState: "LocationState_Empty",
                        RunLine:this.baseFormData.sex2
                }
                this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
                    if (res != undefined) {
                    
                        this.dataTree = res;
                    }else{
                            this.dataTree =[];
                            this.$t.message.toast("暂无有货缓存架")
                        }
                })
            },
            input1(e) {
            
            if(!e.includes('XL-FQHCJ')){
            return this.$t.message.toast("条码错误")
            }
                let formDataParam = {
                    UpperCode: e,
                    Type: "2-CDHCJ",
                    LocationState: "LocationState_Empty",
                        RunLine:this.baseFormData.sex2
                }
                this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
                    if (res != undefined) {
                        this.dataTree = res;
                    }else{
                            this.dataTree =[];
                            this.$t.message.toast("暂无有货缓存架")
                        }
                })
            },
            submit() {
                this.$refs.form.validate().then((res) => {
                    this.$t.message.loading()
                    console.log(this.baseFormData.HCJInput)
                    console.log(this.baseFormData.classes)
                    let AgvCode = "中段1号AGV"
                    let formDataParam = {}
                    formDataParam = {
                        AgvCode: AgvCode,
                        AgvFromAddress: this.baseFormData.HCJInput,
                        AgvToAddress: this.baseFormData.classes,
                        AgvBarcode: '',
                        AgvGrade: "1",
                        AgvTaskQty: '1',
                        AgvTaskState: "Create",
                        AgvTaskType: 'TaskType_Outbound',
                        AgvWorkType: '1',
                        AgvLine:this.baseFormData.sex2
                    }
                    this.$u.post('/api/PDA/CreatePDATask', formDataParam).then(res => {
                        this.$t.message.closeLoading()
                        if (res.status) {
                            this.$t.message.toast(res.message)
                            setTimeout(() => {
                                this.baseFormData.HCJInput = ''
                                this.baseFormData.classes = ''
                                this.baseFormData.sex2='1'
                            }, 100);
                        } else
                            this.$t.message.toast(res.message)
 
                    }).catch((err) => {
                        this.$t.message.toast(res.message)
                    })
                })
            }
        }
    }
</script>
 
<style>
    .example {
        padding: 15px;
        background-color: #fff;
    }
</style>