Blame view

src/main/resources/templates/receipt/receiptContainerHeader/receiptContainerHeader.html 16.5 KB
tangying authored
1
<!DOCTYPE HTML>
2
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
tangying authored
3
4
5
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
6
7
8
9
10
11
12
13
14
15
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
            <ul id="myTab" class="nav nav-tabs">
                <li class="active"><a href="#tabHeader" data-toggle="tab">主表</a></li>
                <li><a href="#tabDetail" data-toggle="tab">明细</a></li>
            </ul>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade in active" id="tabHeader">
                    <div class="col-sm-12 select-info">
16
                        <form id="receiptContainerHeader-form" autocomplete="off">
17
18
19
                            <div class="select-list">
                                <ul>
                                    <li>
20
21
22
23
                                        <label>入库单编码:</label>
                                        <input name="receiptCode" placeholder="请输入入库单编码" type="text"/>
                                    </li>
                                    <li>
pengyongcheng authored
24
25
                                        <label>载具编码:</label>
                                        <input name="containerCode" placeholder="请输入载具编码" type="text"/>
26
27
                                    </li>
                                    <li>
28
29
30
31
                                        <label>盛具编码:</label>
                                        <input name="vehicleCode" placeholder="请输入盛具编码" type="text"/>
                                    </li>
                                    <li>
32
                                        <label>库位编号:</label>
pengyongcheng authored
33
                                        <input name="toLocation" placeholder="请输入库位编码" type="text"/>
34
35
                                    </li>
                                    <li>
36
37
38
39
                                        <label>入库站台:</label>
                                        <input name="port" placeholder="请输入入库站台" type="text"/>
                                    </li>
                                    <li>
40
41
42
43
44
45
46
47
48
                                        <label>任务类型:</label>
                                        <select name="taskType" th:with="type=${@dict.getType('receiptTaskType')}">
                                            <option value="">所有</option>
                                            <option th:each="e : ${type}" th:text="${e['dictLabel']}"
                                                    th:value="${e['dictValue']}">
                                            </option>
                                        </select>
                                    </li>
                                    <li>
49
                                        <label>任务状态:</label>
50
51
52
53
54
55
56
57
                                        <select name="Status"
                                                th:with="firstStatus=${@dict.getType('receiptContainerHeaderStatus')}">
                                            <option value="">所有</option>
                                            <option th:each="e : ${firstStatus}" th:text="${e['dictLabel']}"
                                                    th:value="${e['dictValue']}">
                                            </option>
                                        </select>
                                    </li>
58
                                    <li class="select-time">
59
60
61
62
63
64
65
                                        <label>创建时间: </label>
                                        <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                               name="createdBegin"/>
                                        <span>-</span>
                                        <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                               name="createdEnd"/>
                                    </li>
66
67
68
69
                                    <li style="float: right; margin-right: 45px">
                                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
                                            <i class="fa fa-search"></i>&nbsp;搜索
                                        </a>
70
                                        <a class="btn btn-warning btn-rounded btn-sm"
71
72
73
                                           onclick="$.form.reset('receiptContainerHeader-form')">
                                            <i class="fa fa-refresh"></i>&nbsp;重置
                                        </a>
74
75
76
77
78
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
pengyongcheng authored
79
80
81
82
83
                    <div class="col-sm-12 select-table">
                        <table id="bootstrap-table" data-mobile-responsive="true"
                               class="table table-bordered table-hover">
                        </table>
                    </div>
84
85
86
                </div>
                <div class="tab-pane fade" id="tabDetail">
                    <table id="bootstrap-table1" data-mobile-responsive="true"
87
88
                           class="table table-bordered table-hover">
                    </table>
89
90
91
                </div>
            </div>
        </div>
tangying authored
92
    </div>
93
94
95
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
pengyongcheng authored
96
97
98
99
100
101
102
103
    let createTaskFlag = [[${@permission.hasPermi('receipt:receiptContainer:add')}]];
    let removeFlag = [[${@permission.hasPermi('receipt:receiptContainer:remove')}]];
    let prefix = ctx + "receipt/receiptContainerHeader";
    let detailPrefix = ctx + "receipt/receiptContainerDetail";
    let taskType = [[${@dict.getType('taskType')}]];
    let receiptContainerHeaderStatus = [[${@dict.getType('receiptContainerHeaderStatus')}]]
    let inventoryStatus = [[${@dict.getType('inventorySts')}]];
    let supplier = [[${@SupplierService.getCode()}]];
104
    let yesOrNo = [[${@dict.getType('yes_or_no')}]];
105
    let station = [[${@stationService.getCode()}]];
pengyongcheng authored
106
    let S_headerId;
107
    $(function () {
108
        let options = {
109
110
111
112
113
114
115
116
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            sortName: "created",
            sortOrder: "desc",
            modalName: "入库组盘头",
            search: false,
117
            columns: [
118
                {
119
                    checkbox: true
120
121
                },
                {
122
123
124
125
                    field: 'receiptCode',
                    title: '入库单编码'
                },
                {
126
                    field: 'containerCode',
127
                    title: '载具编码'
128
129
                },
                {
130
131
                    field: 'vehicleCode',
                    title: '盛具编码'
132
133
134
                },
                {
                    field: 'toLocation',
135
                    title: '库位编码'
136
137
138
139
                },
                {
                    field: 'taskType',
                    title: '任务类型',
tangying authored
140
                    align: 'center',
141
                    formatter: function (value, row, index) {
142
                        return $.table.selectDictLabel(taskType, value);
143
                    },
144
145
146
                },
                {
                    field: 'status',
147
                    title: '任务状态',
148
                    formatter: function (value, row, index) {
tangying authored
149
                        return $.table.selectDictLabel(receiptContainerHeaderStatus, value);
150
151
152
                    },
                },
                {
153
                    field: 'port',
154
155
156
157
158
159
160
161
162
163
164
                    title: '来源站台',
                    formatter: function (value, row, index) {
                        let actions = [];
                        $.each(station, function (index, dict) {
                            if (dict.code === value) {
                                actions.push(dict.name);
                                return false;
                            }
                        });
                        return actions.join('');
                    }
165
166
                },
                {
pengyongcheng authored
167
168
169
170
171
172
173
174
175
176
177
178
                    field: 'orderCode',
                    title: '所属工单号',
                },
                {
                    field: 'orderNumber',
                    title: '所属生产令号',
                },
                {
                    field: 'batchNumber',
                    title: '所属生产批号',
                },
                {
179
180
181
182
183
                    field: 'created',
                    title: '创建时间',
                },
                {
                    field: 'createdBy',
184
                    title: '创建人'
185
186
187
188
189
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
190
                        let actions = [];
tangying authored
191
                        actions.push('<a class="btn btn-info btn-xs " href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>明细</a> ');
192
                        if (row.status < 10) {
pengyongcheng authored
193
194
195
196
197
198
199
                            // if (row.taskType === 200) {
                            //     actions.push('<a class="btn btn-success btn-xs ' + createTaskFlag + '" href="#" onclick="chooseStation(\'' + row.id + '\')"><i class="fa fa-edit"></i>生成任务</a> ');
                            // } else {
                            // JSON.stringify()将对象转化成JSON字符串;.replace(/""/g,"’")将JSON字符串中的双引号转化成单引号
                            let rowStr = JSON.stringify(row).replace(/""/g, "'")
                            actions.push(`<a class='btn btn-success btn-xs ${createTaskFlag}' href='#' onclick='createTask(${rowStr})'><i class='fa fa-edit'></i>生成任务</a> `);
                            // }
200
                        }
201
                        if (row.status === 0) {
202
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>取消组盘</a> ');
203
204
205
206
207
208
209
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
tangying authored
210
211
212
    $("#bootstrap-table1").bootstrapTable({
        sortable: true, //排序
pengyongcheng authored
213
214
        showRefresh: false, //刷新
        showToggle: false, //视图切换
215
        clickToSelect: true,
pengyongcheng authored
216
217
        showColumns: false, //列选择
        showExport: false, //导出
218
219
220
221
222
223
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库明细",
        iconSize: "outline",
        toolbar: "#toolbar1",
        contentType: "application/x-www-form-urlencoded",
        columns: [
tangying authored
224
            {
225
                field: 'receiptCode',
226
                title: '入库单编码'
227
228
229
            },
            {
                field: 'materialCode',
230
                title: '物料编码'
231
232
233
            },
            {
                field: 'materialName',
234
                title: '物料名称'
235
236
            },
            {
237
238
239
240
                field: 'flowCode',
                title: '工序号'
            },
            {
241
                field: 'materialSpec',
242
                title: '物料规格'
tangying authored
243
            },
244
245
246
247
            {
                field: 'materialUnit',
                title: '物料单位'
            },
pengyongcheng authored
248
            {
pengyongcheng authored
249
250
251
252
                field: 'description',
                title: '物料描述'
            },
            /*{
253
                field: 'weight',
pengyongcheng authored
254
                title: '药量(g)',
255
                align: 'center',
256
257
            },
            {
258
                field: 'high',
pengyongcheng authored
259
260
                title: '高度(cm)'
            },*/
tangying authored
261
            {
262
                field: 'solidifyTime',
pengyongcheng authored
263
                title: '固化时间(h)'
264
265
            },
            {
266
267
                field: 'tracingNo',
                title: '追溯码'
268
            },
tangying authored
269
            {
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
                field: 'supplierCode',
                title: '供应商',
                visible: true,
                formatter: function (value, row, index) {
                    let actions = [];
                    $.each(supplier, function (index, item) {
                        if (item.code === value) {
                            actions.push("<span class='badge badge-info'>" + item.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                },
            },
            {
pengyongcheng authored
285
286
287
288
                field: 'supplierBatch',
                title: '供应商批次码'
            },
            {
289
                field: 'supplierTracingNo',
pengyongcheng authored
290
                title: '供应商SN码',
291
292
293
            },
            {
                field: 'inventorySts',
294
                title: '物料状态',
295
296
297
298
299
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(inventoryStatus, value);
                }
            },
            {
300
301
302
303
304
305
306
307
                field: 'locationNoX',
                title: 'x'
            },
            {
                field: 'locationNoY',
                title: 'y'
            },
            {
308
309
310
311
312
313
314
                field: 'firstFlag',
                title: '是否首件/批',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(yesOrNo, value);
                }
            },
            {
315
316
                field: 'qty',
                title: '组盘数量'
tangying authored
317
318
            },
            {
319
                field: 'created',
320
                title: '创建时间'
321
322
323
            },
            {
                field: 'createdBy',
324
                title: '创建用户'
tangying authored
325
            },
326
327
        ]
    });
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
    function createtable(url, headerId) {
        $("#myTab li").removeClass("active");
        $(".tab-pane").removeClass("in active");
        $("#myTab li:eq(1)").addClass("active");
        $("#tabDetail").addClass("in active");
        $.ajax({
            url: url,
            type: 'post',
            data: {
                headerId: headerId
            },
            success: function (value) {
                $("#bootstrap-table1").bootstrapTable('load', value.data);
            }
        })
    }
tangying authored
345
346
347
    /*入库单列表-详细*/
    function detail(headerId) {
348
        let url = detailPrefix + "/list/" + headerId;
349
350
351
352
        // createMenuItem(url, "入库组盘明细");
        S_headerId = headerId;
        createtable(url, S_headerId);
    }
tangying authored
353
354
355
356
    /* 单个删除组盘明细 */
    function remove(id) {
        $.modal.confirm("确定删除该条明细信息吗?", function () {
357
358
            let url = detailPrefix + "/remove";
            let data = {"id": id};
359
360
361
362
            $.operate.post(url, data);
            createtable(url, S_headerId);
        });
    }
tangying authored
363
364
365
    /* 批量删除组盘 */
    function batchRemoveHead() {
366
367
        let rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length === 0) {
368
369
370
371
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要撤销选中的" + rows.length + "条组盘吗?", function () {
372
373
374
            let url = prefix + "/remove";
            let ids = "";
            for (let i = 0; i < rows.length; i++) {
375
                ids = ids + rows[i].id + ","
tangying authored
376
            }
377
            let data = {"ids": ids.substring(0, ids.length - 1)};
378
379
380
381
            $.operate.post(url, data);
            // submit(url, "post", "json", data);
        });
    }
382
pengyongcheng authored
383
    /*function chooseStation(id) {
384
        let url = ctx + "receipt/receiptContainerHeader/chooseStation" + "/" + id;
385
        $.modal.open("选择站台", url);
pengyongcheng authored
386
    }*/
387
388
389
390
391
    function createTaskNew(receiptContainerHeaderId) {
        let url = ctx + "receipt/receiptContainerHeader/createTaskNew" + "/" + receiptContainerHeaderId;
        $.modal.open("创建入库任务", url);
    }
tangying authored
392
393
    /* 单个生成任务 */
394
    function createTask(row) {
395
        if (row.containerCode.substring(0, 5) === "ZJ-02") {
396
397
398
            createTaskNew(row.id)
        } else {
            let url = prefix + "/createTask";
pengyongcheng authored
399
            let data = {"ids": row.id};
400
401
            $.operate.post(url, data);
        }
402
    }
403
404
    function position(id) {
405
406
        let url = prefix + "/position/";
        let data = {"ids": id};
407
408
409
        $.operate.post(url, data);
    }
</script>
tangying authored
410
411
</body>
</html>