自动化立体仓库 - WCS系统
#
Junjie
2023-08-04 9101ad488486cd57be5f27ca4ad6071c07ab9557
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
<!DOCTYPE html>
<html lang="en">
 
    <head>
        <meta charset="UTF-8">
        <title>任务管理</title>
        <link rel="stylesheet" href="../../static/wcs/css/element.css">
        <script type="text/javascript" src="../../static/wcs/js/jquery/jquery-3.3.1.min.js"></script>
        <script type="text/javascript" src="../../static/wms/layui/layui.js"></script>
        <script type="text/javascript" src="../../static/wcs/js/common.js"></script>
        <script type="text/javascript" src="../../static/wcs/js/vue.min.js"></script>
        <script type="text/javascript" src="../../static/wcs/js/element.js"></script>
    </head>
 
    <body>
        <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;">
            <div style="width: 100%;">
                <el-card class="box-card">
                    <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline">
                        <el-form-item label="">
                            <el-input v-model="tableSearchParam.task_no" placeholder="任务号"></el-input>
                        </el-form-item>
                        <el-form-item label="">
                            <el-select v-model="tableSearchParam.status" placeholder="任务状态">
                                <el-option label="接收" value="1"></el-option>
                                <el-option label="派发" value="2"></el-option>
                                <el-option label="完结" value="3"></el-option>
                                <el-option label="取消" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="">
                            <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="getTableData">查询</el-button>
                            <el-button type="primary" @click="resetParam">重置</el-button>
                        </el-form-item>
                    </el-form>
                    <el-table ref="singleTable" :data="tableData" style="width: 100%;">
                        <el-table-column label="操作" width="100">
                            <template slot-scope="scope">
                                <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
                                    <el-button icon="el-icon-more" size="mini" type="primary"></el-button>
                                    <el-dropdown-menu slot="dropdown">
                                        <el-dropdown-item command="showCommand">查看指令</el-dropdown-item>
                                        <el-dropdown-item command="assign">派发</el-dropdown-item>
                                        <el-dropdown-item command="complete">完结</el-dropdown-item>
                                        <el-dropdown-item command="cancel">取消</el-dropdown-item>
                                    </el-dropdown-menu>
                                </el-dropdown>
                            </template>
                        </el-table-column>
                        <el-table-column property="taskNo" label="任务号">
                        </el-table-column>
                        <el-table-column property="status$" label="任务状态">
                        </el-table-column>
                        <el-table-column property="wrkNo" label="工作号">
                        </el-table-column>
                        <el-table-column property="createTime$" label="任务时间">
                        </el-table-column>
                        <el-table-column property="durationTime" label="持续时长">
                        </el-table-column>
                        <el-table-column property="ioType$" label="任务类型">
                        </el-table-column>
                        <el-table-column property="startPoint" label="起点位置">
                        </el-table-column>
                        <el-table-column property="targetPoint" label="终点位置">
                        </el-table-column>
                        <el-table-column property="wrkSts$" label="工作状态">
                        </el-table-column>
                    </el-table>
 
                    <div style="margin-top: 10px;">
                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize"
                            layout="total, sizes, prev, pager, next, jumper" :total="pageTotal">
                        </el-pagination>
                    </div>
                </el-card>
            </div>
        </div>
        <script>
            var $layui = layui.config({
                base: baseUrl + "/static/wms/layui/lay/modules/"
            }).use(['layer', 'form'], function() {})
 
            var app = new Vue({
                el: '#app',
                data: {
                    tableData: [],
                    currentPage: 1,
                    pageSizes: [16, 30, 50, 100, 150, 200],
                    pageSize: 16,
                    pageTotal: 0,
                    tableSearchParam: {
                        task_no: null,
                        status: null,
                        wrk_no: null
                    }
                },
                created() {
                    this.init()
                },
                watch: {
 
                },
                methods: {
                    init() {
                        let taskNo = getQueryVariable('taskNo')
                        let wrkNo = getQueryVariable('wrkNo')
                        if (taskNo != false) {
                            this.tableSearchParam.task_no = taskNo
                        }
                        if (wrkNo != false) {
                            this.tableSearchParam.wrk_no = wrkNo
                        }
 
                        this.getTableData()
                    },
                    getTableData() {
                        let that = this;
                        let data = this.tableSearchParam
                        data.curr = this.currentPage
                        data.limit = this.pageSize
                        $.ajax({
                            url: baseUrl + "/taskWrk/list/auth",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: data,
                            dataType: 'json',
                            contentType: 'application/json;charset=UTF-8',
                            method: 'GET',
                            success: function(res) {
                                if (res.code == 200) {
                                    that.tableData = res.data.records
                                    that.pageTotal = res.data.total
                                } else if (res.code === 403) {
                                    top.location.href = baseUrl + "/";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    },
                    handleSizeChange(val) {
                        console.log(`每页 ${val} 条`);
                        this.pageSize = val
                        this.getTableData()
                    },
                    handleCurrentChange(val) {
                        console.log(`当前页: ${val}`);
                        this.currentPage = val
                        this.getTableData()
                    },
                    resetParam() {
                        this.tableSearchParam = {
                            task_no: null,
                            status: null,
                            wrk_no: null
                        }
                        this.getTableData()
                    },
                    handleCommand(command, row) {
                        switch (command) {
                            case "showCommand":
                                //查看指令
                                this.showCommand(row)
                                break;
                            case "assign":
                                //派发任务
                                this.assginWrk(row)
                                break;
                            case "complete":
                                //完结任务
                                this.completeWrk(row)
                                break;
                            case "cancel":
                                //取消任务
                                this.cancelWrk(row)
                                break;
                        }
                    },
                    showCommand(row) {
                        let wrkNo = row.wrkNo == null ? "" : row.wrkNo
                        //查看指令
                        $layui.layer.open({
                            type: 2,
                            title: '指令管理',
                            maxmin: true,
                            area: [top.detailWidth, top.detailHeight],
                            shadeClose: true,
                            content: '../commandManage/commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo,
                            success: function(layero, index) {}
                        });
                    },
                    assginWrk(row){
                        //派发任务
                        let that = this
                        $.ajax({
                            url: baseUrl + "/taskWrk/distribute/auth",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: {
                                taskNo: row.taskNo
                            },
                            method: 'POST',
                            success: function(res) {
                                if (res.code == 200) {
                                    that.$message({
                                        message: "派发成功",
                                        type: 'success'
                                    });
                                    that.getTableData()
                                } else if (res.code === 403) {
                                    top.location.href = baseUrl + "/";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    },
                    completeWrk(row){
                        //派发任务
                        let that = this
                        $.ajax({
                            url: baseUrl + "/taskWrk/complete/auth",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: {
                                taskNo: row.taskNo
                            },
                            method: 'POST',
                            success: function(res) {
                                if (res.code == 200) {
                                    that.$message({
                                        message: "完结成功",
                                        type: 'success'
                                    });
                                    that.getTableData()
                                } else if (res.code === 403) {
                                    top.location.href = baseUrl + "/";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    },
                    cancelWrk(row){
                        //取消任务
                        let that = this
                        $.ajax({
                            url: baseUrl + "/taskWrk/cancel/auth",
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: {
                                taskNo: row.taskNo
                            },
                            method: 'POST',
                            success: function(res) {
                                if (res.code == 200) {
                                    that.$message({
                                        message: "取消成功",
                                        type: 'success'
                                    });
                                    that.getTableData()
                                } else if (res.code === 403) {
                                    top.location.href = baseUrl + "/";
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        });
                    }
                }
            })
        </script>
    </body>
 
</html>