自动化立体仓库 - WMS系统
*
lsh
2025-11-25 17d50c60a34213016047028148418f3c906f889e
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
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <title>RGV设备</title>
    <link rel="stylesheet" href="../../static/css/element.css">
    <link rel="stylesheet" href="../../static/css/element-ui.css">
    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../../static/js/common.js"></script>
    <script type="text/javascript" src="../../static/js/vue.min.js"></script>
    <script type="text/javascript" src="../../static/js/element.js"></script>
</head>
 
<body>
<div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;">
    <div style="width: 100%;">
        <el-table ref="singleTable" :data="tableData" highlight-current-row @row-click="handleRowClick"
                  max-height="450" style="width: 100%">
            <el-table-column property="rgvNo" label="小车号">
            </el-table-column>
            <el-table-column property="taskNo" label="工作号">
            </el-table-column>
            <el-table-column property="mode" label="作业模式">
            </el-table-column>
            <el-table-column property="status" label="状态">
            </el-table-column>
            <el-table-column property="rgvPos" label="当前定位值">
            </el-table-column>
            <el-table-column property="rgvPosDestination" label="目标定位置">
            </el-table-column>
            <el-table-column property="loaded" label="探物">
            </el-table-column>
            <el-table-column property="errorRgv" label="提示">
            </el-table-column>
        </el-table>
    </div>
 
    <div style="width: 100%;display: flex;justify-content: center;margin-top: 10px;">
        <div style="width: 55%;margin-right: 10px;">
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>设备调试</span>
                </div>
                <div>
                    <el-form :model="formParam" label-position="top" :inline="true" class="demo-form-inline">
                        <el-form-item label="目标定位置">
                            <el-input v-model="formParam.rgvPosDestination" placeholder="目标定位置"></el-input>
                        </el-form-item>
                        <el-form-item label="取货站点">
                            <el-input v-model="formParam.rgvStaNoTake" placeholder="目标站点"></el-input>
                        </el-form-item>
                        <el-form-item label="目标站点">
                            <el-input v-model="formParam.rgvStaNoPut" placeholder="目标站点"></el-input>
                        </el-form-item>
                    </el-form>
                    <div>
                        <el-button @click="requestOperate('take')" type="primary">取货</el-button>
                        <el-button @click="requestOperate('put')" type="primary">放货</el-button>
                        <el-button @click="requestOperate('TakeAndPut')" type="primary">取放货</el-button>
                        <el-button @click="requestOperate('walk')" type="warning">行走</el-button>
                    </div>
                    <div style="margin-top: 10px">
                        <el-button @click="requestOperate('del')" type="warning">任务清空</el-button>
                        <el-button @click="requestOperate('del2')" type="warning">作业启动中状态复位</el-button>
                    </div>
                    <div style="margin-top: 10px">
                        <el-button @click="requestOperate('delRgvTask')" type="warning">清空wcs下发数据(运行数据需要硬件复位9S)</el-button>
                    </div>
                </div>
            </el-card>
        </div>
        <div style="width: 45%;">
            <el-card class="box-card">
                <div slot="header" class="clearfix">
                    <span>设备当前任务</span>
                </div>
                <div>
                    <div v-if="currentIndex == null">
                        <el-empty description="请选择设备"></el-empty>
                    </div>
                    <div v-else>
                        <el-table ref="singleTable" :data="taskAllData" highlight-current-row @row-click="handleRowClick"
                                  max-height="450" style="width: 100%">
                            <el-table-column property="rgvNo" label="小车号">
                            </el-table-column>
                            <el-table-column property="taskNo" label="工作号">
                            </el-table-column>
                            <el-table-column property="taskStatus" label="作业模式">
                            </el-table-column>
                            <el-table-column property="isRunning" label="状态">
                            </el-table-column>
                            <el-table-column property="targetPosition" label="目标定位置">
                            </el-table-column>
                            <el-table-column property="direction" label="方向">
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
            </el-card>
        </div>
    </div>
</div>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            tableData: [],
            taskAllData: [],
            currentRow: null,
            currentTitle: "未选择设备",
            currentIndex: null,
            formParam: {
                rgvNo: 0,
                rgvStaNoTake: 0,
                rgvStaNoPut: 0,
                rgvPosDestination: 0
            }
        },
        created() {
            this.init()
        },
        watch: {
 
        },
        methods: {
            init() {
                this.getTableData()
 
                setInterval(() => {
                    this.getTableData()
                }, 1000)
            },
            handleRowClick(row, col, event) {
                const index = this.tableData.indexOf(row)
                this.currentRow = row;
                this.currentIndex = index
                this.currentTitle = row.rgvNo + "小车"
 
                this.formParam.rgvNo = row.rgvNo
                this.formParam.rgvStaNoTake = row.rgvStaNoTake
                this.formParam.rgvStaNoPut = row.rgvStaNoPut
                this.formParam.rgvPosDestination = row.rgvPosDestination
 
                this.getTaskAllData(index+1)
            },
            getTaskAllData(index) {
                let that = this;
                var baseUrl = 'http://127.0.0.1:9090/zzgtwcs';
                $.ajax({
                    url: baseUrl + "/rgv/task/cache/all",
                    headers: {
                        'token': localStorage.getItem('token')
                    },
                    data: {rgvNo: index},
                    method: 'POST',
                    success: function (res) {
                        that.taskAllData = res.data
                    }
                });
            },
            getTableData() {
                let that = this;
                // console.log("✅ 准备请求:");
                $.ajax({
                    url: "http://127.0.0.1:9090/zzgtwcs/rgv/status/all",
                    headers: {
                        'token': localStorage.getItem('token') || '' // 确保token不为null
                    },
                    method: 'GET',
                    success: function (res) {
                        // console.log("✅ 请求成功,响应数据:", res);
                        if (res.code === 200) {
                            that.tableData = res.data;
                        } else {
                            // console.error("请求成功但返回错误:", res);
                            // 显示错误提示
                            that.$message({
                                message: '操作失败: ' + (res.msg || '未知错误'),
                                type: 'error'
                            });
                        }
                    },
                    error: function(xhr, status, error) {
                        // 详细的错误处理
                        console.log("❌ 请求失败,响应数据:", xhr);
                        console.error("AJAX请求失败:", {
                            status: xhr.status,
                            statusText: xhr.statusText,
                            error: error,
                            response: xhr.responseText
                        });
 
                        // 用户友好的错误提示
                        let errorMsg = "请求失败: ";
                        if (xhr.status === 0) {
                            errorMsg += "网络连接失败";
                        } else if (xhr.status === 401) {
                            errorMsg += "未授权,请重新登录";
                        } else if (xhr.status === 403) {
                            errorMsg += "权限不足";
                        } else if (xhr.status === 404) {
                            errorMsg += "接口不存在";
                        } else {
                            errorMsg += `错误代码: ${xhr.status}`;
                        }
 
                        that.$message({
                            message: errorMsg,
                            type: 'error',
                            duration: 5000
                        });
                    }
                });
            },
            requestOperate(method) {
                let that = this
                var baseUrl = 'http://127.0.0.1:9090/zzgtwcs';
                that.$confirm('此操作存在风险,是否继续','提示',{
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(()=>{
                    $.ajax({
                        url: baseUrl + "/rgv/run/"+method,
                        headers: {
                            'token': localStorage.getItem('token')
                        },
                        data: this.formParam,
                        method: 'POST',
                        success: function (res) {
                            if (res.code == 200) {
                                that.$message({
                                    message: res.msg,
                                    type: 'success'
                                });
                            } else {
                                that.$message({
                                    message: res.msg,
                                    type: 'error'
                                });
                            }
                        }
                    });
                })
 
            }
        }
    })
</script>
</body>
 
</html>