Blame view

src/main/resources/templates/inventory/adjustDetail/adjustDetail.html 21.2 KB
xqs authored
1
<!DOCTYPE HTML>
tangying authored
2
3
4
5
6
7
8
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="row">
    <div class="col-sm-12">
        <div class="col-sm-12 select-info">
xqs authored
9
            <div class="select-list">
10
                <form id="adjustDetail-form" autocomplete="off">
xqs authored
11
12
                    <ul>
                        <li>
13
14
15
                            <label>调整主单编码:</label>
                            <input type="text" id="adjustCode" name="adjustCode" th:value="${adjustCode}"
                                   readonly="readonly"/>
xqs authored
16
17
                        </li>
                        <li>
18
19
                            <label>调整单明细ID:</label>
                            <input id="id" type="text" name="id"/>
xqs authored
20
21
                        </li>
                        <li>
22
23
                            <label>货主编码:</label>
                            <input id="companyCode" type="text" name="companyCode"/>
xqs authored
24
25
                        </li>
                        <li>
26
27
                            <label>盘点单编码:</label>
                            <input id="cycleCountHeaderCode" type="text" name="cycleCountHeaderCode"/>
xqs authored
28
29
                        </li>
                        <li>
30
31
                            <label>盘点明细ID:</label>
                            <input id="cycleCountDetailId" type="text" name="cycleCountDetailId"/>
xqs authored
32
                        </li>
33
                       <!-- <li>
34
35
                            <label>质检单编码:</label>
                            <input id="checkCode" type="text" name="checkCode"/>
xqs authored
36
37
                        </li>
                        <li>
38
39
                            <label>属性号:</label>
                            <input id="attributeId" type="text" name="attributeId"/>
xqs authored
40
41
                        </li>
                        <li>
42
43
                            <label>质检单明细ID:</label>
                            <input id="checkDetailId" type="text" name="checkDetailId"/>
xqs authored
44
45
                        </li>
                        <li>
46
47
                            <label>关联单编码:</label>
                            <input id="referCode" type="text" name="referCode"/>
xqs authored
48
49
                        </li>
                        <li>
50
51
                            <label>关联明细行号:</label>
                            <input id="referDetailId" type="text" name="referDetailId"/>
52
                        </li>-->
xqs authored
53
                        <li>
54
55
                            <label>载具:</label>
                            <input id="containerCode" type="text" name="containerCode"/>
xqs authored
56
57
                        </li>
                        <li>
58
59
                            <label>库位:</label>
                            <input id="locationCode" type="text" name="locationCode"/>
xqs authored
60
61
                        </li>
                        <li>
62
63
                            <label>物料编码:</label>
                            <input id="materialCode" type="text" name="materialCode"/>
xqs authored
64
65
                        </li>
                        <li>
66
67
                            <label>物料名称:</label>
                            <input id="materialName" type="text" name="materialName"/>
xqs authored
68
69
                        </li>
                        <li>
70
71
                            <label>物料单位:</label>
                            <input id="materialUnit" type="text" name="materialUnit"/>
xqs authored
72
73
                        </li>
                        <li>
74
75
76
77
78
79
80
                            <label>调整类型:</label>
                            <select name="problemType"
                                    th:with="problemType=${@dict.getType('adjustType')}">
                                <option value="">所有</option>
                                <option th:each="e : ${problemType}" th:text="${e['dictLabel']}"
                                        th:value="${e['dictValue']}"></option>
                            </select>
xqs authored
81
82
                        </li>
                        <li>
83
84
85
86
87
88
89
                            <label>调整明细状态:</label>
                            <select name="status"
                                    th:with="status=${@dict.getType('cyclecountStatus')}">
                                <option value="">所有</option>
                                <option th:each="e : ${status}" th:text="${e['dictLabel']}"
                                        th:value="${e['dictValue']}"></option>
                            </select>
xqs authored
90
91
                        </li>
                        <li>
92
93
                            <label>创建人:</label>
                            <input id="createdBy" type="text" name="createdBy"/>
xqs authored
94
                        </li>
95
                        <li class="select-time">
xqs authored
96
97
98
99
100
101
102
                            <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>
103
104
105
106
107
108
109
                        <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>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('adjustDetail-form')">
                                <i class="fa fa-refresh"></i>&nbsp;重置
                            </a>
xqs authored
110
111
112
                        </li>
                    </ul>
                </form>
tangying authored
113
114
            </div>
        </div>
xqs authored
115
        <div class="btn-group hidden-xs" id="toolbar" role="group">
xqs authored
116
            <a class="btn btn-outline btn-success btn-rounded" onclick="add()"
117
               shiro:hasPermission="inventory:adjustDetail:add">
xqs authored
118
                <i class="fa fa-plus"></i> 新增
tangying authored
119
            </a>
xqs authored
120
            <a class="btn btn-outline btn-primary btn-rounded" onclick="agree()"
121
               shiro:hasPermission="inventory:adjustDetail:adjustAgree">
122
                <i class="fa fa-edit"></i> 审批
xqs authored
123
            </a>
xqs authored
124
            <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"
125
126
               shiro:hasPermission="inventory:adjustDetail:addAdjust">
                <i class="fa fa-vcard"></i>调整
xqs authored
127
            </a>
xqs authored
128
129
130
            <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.table.refresh()">
                <i class="fa fa-refresh"></i> 刷新
            </a>-->
tangying authored
131
132
133
134
135
136
        </div>
        <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
xqs authored
137
138
    var prefix = ctx + "inventory/adjustDetail";
    var prefix_head = ctx + "inventory/adjustHeader";
139
140
    var removes = [[${@permission.hasPermi('inventory:adjustDetail:remove')}]];
    var edits = [[${@permission.hasPermi('inventory:adjustDetail:add')}]];
xqs authored
141
142
    var type2 = [[${@dict.getType('adjustType')}]];
    var adjustStatus = [[${@dict.getType('adjustStatus')}]];
xqs authored
143
    var inventoryStatus = [[${@dict.getType('inventorySts')}]];
xqs authored
144
    var created;
tangying authored
145
146

    $(function () {
xqs authored
147
148
        let adjustHeaderCode = null;
        var options = {
149
            url: prefix + "/list",
xqs authored
150
            modalName: "调整单明细",
tangying authored
151
152
153
            sortName: "id",
            sortOrder: "desc",
            search: false,
xqs authored
154
            showRefresh: true,
155
            onRefresh: function () {
156
157
                update();
            },
tangying authored
158
159
            columns: [
                {
160
                    checkbox: true
xqs authored
161
                },
xqs authored
162
                /*{
xqs authored
163
164
165
166
                    title: '调整操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
xqs authored
167
                        actions.push('<a class="btn btn-warning btn-xs " href="#" onclick="addAdjust(\'' + row.id + '\')"><i class="fa fa-send"></i>&nbsp;调整</a> ');
xqs authored
168
169
                        return actions.join('');
                    }
xqs authored
170
                },*/
171
                /*{
tangying authored
172
                    field: 'id',
周鸿 authored
173
                    title: '明细id'
174
                },*/
xqs authored
175
                {
xqs authored
176
177
178
179
180
                    field: 'id',
                    title: '明细id',
                    visible: false
                },
                {
xqs authored
181
                    field: 'adjustCode',
xqs authored
182
183
                    title: '调整主单编码',
                    visible: true
tangying authored
184
185
                },
                {
xqs authored
186
                    field: 'inventoryDetailId',
xqs authored
187
                    title: '库存明细ID',
xqs authored
188
189
190
                    visible: true
                },
                {
xqs authored
191
192
                    field: 'warehouseCode',
                    title: '仓库',
tangying authored
193
194
                    visible: false
                },
195
                /*{
tangying authored
196
                    field: 'companyCode',
周鸿 authored
197
                    title: '货主编码',
xqs authored
198
                    visible: true
199
                },*/
tangying authored
200
                {
xqs authored
201
                    field: 'cycleCountHeaderCode',
tangying authored
202
                    title: '盘点单编码',
xqs authored
203
                    visible: true
tangying authored
204
205
                },
                {
xqs authored
206
                    field: 'cycleCountDetailId',
xqs authored
207
208
                    title: '盘点单明细ID',
                    visible: true
tangying authored
209
210
211
212
213
214
215
                },
                {
                    field: 'locationCode',
                    title: '库位编号',
                },
                {
                    field: 'containerCode',
216
                    title: '载具编号',
tangying authored
217
218
219
220
221
222
223
224
225
226
                },
                {
                    field: 'materialCode',
                    title: '物料编码',
                },
                {
                    field: 'materialName',
                    title: '物料名称',
                },
                {
227
228
229
230
                    field: 'materialSpec',
                    title: '物料规格'
                },
                {
231
232
233
234
235
236
237
238
239
240
241
                    field: 'materialUnit',
                    title: '物料单位',
                },
                {
                    field: 'fromInventorySts',
                    title: '库存状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(inventoryStatus, value);
                    }
                },
                {
周鸿 authored
242
243
244
245
246
247
248
249
250
251
252
253
                    field: 'locationNoX',
                    title: 'x',
                },
                {
                    field: 'locationNoY',
                    title: 'y',
                },
                {
                    field: 'tracingNo',
                    title: '追溯码',
                },
                {
xqs authored
254
255
                    field: 'checkCode',
                    title: '质检单号',
256
                    visible: false
tangying authored
257
258
                },
                {
xqs authored
259
260
                    field: 'checkDetailId',
                    title: '质检单明细行号',
261
                    visible: false
tangying authored
262
263
                },
                {
xqs authored
264
265
                    field: 'referCode',
                    title: '调整单关联单号',
266
                    visible: false
tangying authored
267
268
                },
                {
xqs authored
269
270
                    field: 'referDetailId',
                    title: '调整单关联明细ID',
271
                    visible: false
tangying authored
272
273
                },
                {
xqs authored
274
275
                    field: 'problemType',
                    title: '调整类型',
xqs authored
276
277
278
279
280
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(type2, value);
                    },
                    visible: true,
tangying authored
281
282
                },
                {
xqs authored
283
284
                    field: 'fromQty',
                    title: '调整前数量'
tangying authored
285
286
                },
                {
xqs authored
287
288
                    field: 'toQty',
                    title: '调整后数量'
tangying authored
289
290
                },
                {
xqs authored
291
292
                    field: 'gapQty',
                    title: '调整数量'
tangying authored
293
                },
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
                /* {
                     field: 'fromInventorySts',
                     title: '调整前状态',
                     formatter: function (value, row, index) {
                         return $.table.selectDictLabel(inventoryStatus, value);
                     },
                     visible: true
                 },
                 {
                     field: 'toInventorySts',
                     title: '调整后状态',
                     formatter: function (value, row, index) {
                         return $.table.selectDictLabel(inventoryStatus, value);
                     },
                     visible: true
                 },*/
tangying authored
310
                {
xqs authored
311
312
                    field: 'attributeId',
                    title: '属性号',
tangying authored
313
                    visible: false
xqs authored
314
tangying authored
315
316
                },
                {
xqs authored
317
318
                    field: 'supplierCode',
                    title: '供应商编码',
319
                    visible: false
tangying authored
320
321
                },
                {
xqs authored
322
323
                    field: 'agreeTime',
                    title: '审批时间',
tangying authored
324
325
                },
                {
xqs authored
326
327
                    field: 'agreeBy',
                    title: '审批人'
tangying authored
328
329
330
                },
                {
                    field: 'status',
xqs authored
331
                    title: '调整状态',
xqs authored
332
                    formatter: function (value, row, index) {
xqs authored
333
                        return $.table.selectDictLabel(adjustStatus, value);
tangying authored
334
                    },
xqs authored
335
336
                },
                {
xqs authored
337
338
                    field: 'batch',
                    title: '批次',
339
                    visible: false
xqs authored
340
341
342
343
                },
                {
                    field: 'lot',
                    title: '批号',
周鸿 authored
344
                    visible: false
xqs authored
345
346
347
348
                },
                {
                    field: 'projectNo',
                    title: '项目号',
周鸿 authored
349
                    visible: false
xqs authored
350
351
352
353
                },
                {
                    field: 'weight',
                    title: '重量',
354
                    visible: false
xqs authored
355
356
357
358
                },
                {
                    field: 'manufactureDate',
                    title: '生产日期',
xqs authored
359
                    visible: false
xqs authored
360
361
362
363
                },
                {
                    field: 'expirationDate',
                    title: '失效日期',
364
                    visible: false
xqs authored
365
366
367
368
369
370
371
372
373
374
                },
                {
                    field: 'created',
                    title: '创建时间',
                },
                {
                    field: 'createdBy',
                    title: '创建用户'
                },
                {
xqs authored
375
376
377
378
379
380
381
382
383
384
385
386
387
388
                    field: 'Remark',
                    title: '备注',
                    visible: true
                },
                {
                    field: 'version',
                    title: '数据版本',
                    visible: false
                },
                {
                    field: 'processStamp',
                    title: '处理标记',
                    visible: false
                },
xqs authored
389
390
391
392
393
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
394
                        actions.push('<a class="btn btn-success btn-xs ' + edits + ' " href="#" onclick="editAdjust(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>修改</a> ');
xqs authored
395
396
397
                        return actions.join('');
                    }
                }
xqs authored
398
tangying authored
399
400
            ]
        };
xqs authored
401
        let url = location.search; //获取url中"?"符后的字串
402
        if (url.indexOf("?") !== -1) {    //判断是否有参数
xqs authored
403
            let str = url.substr(1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
404
            let strs = url.substr(1).split("=");
xqs authored
405
            $("#adjustCode").val(strs[1]);
406
            options.queryParams = function (params) {
xqs authored
407
408
                return {
                    // 传递参数查询参数
409
410
411
412
413
414
                    adjustCode: strs[1],
                    pageSize: params.limit,
                    pageNum: params.offset / params.limit + 1,
                    searchValue: params.search,
                    orderByColumn: params.sort,
                    isAsc: params.order
xqs authored
415
416
                };
            };
xqs authored
417
            adjustCode = str.split("=")[1];
xqs authored
418
            $.table.init(options);
419
        } else {
xqs authored
420
            $.table.init(options);
tangying authored
421
        }
422
    });
tangying authored
423
xqs authored
424
425
    /*新增调整明细*/
    function add() {
xqs authored
426
        var adjustCode = $('#adjustCode').val();
427
        if (adjustCode != null && adjustCode !== "" && adjustCode !== undefined) {
428
            open("新增调整明细", prefix + "/add?adjustCode=" + adjustCode);
xqs authored
429
430
431
        }
    }
xqs authored
432
433
    /*修改调整明细*/
    function editAdjust(id) {
434
        if (id === '') {
435
436
            $.modal.open("未选择出库单", "404.html");
        } else {
lector authored
437
438
439
440
            var checkurl = prefix + "/check/" + id;
            $.ajax({
                url: checkurl,
                type: "get",
441
                success: function (reponse) {
442
                    if (reponse.code === 200) {
443
444
445
                        var url = prefix + "/edit/" + id;
                        $.modal.open("编辑明细", url);
                    } else {
lector authored
446
447
448
449
                        $.modal.alertError(reponse.msg)
                    }

                },
450
                error: function () {
lector authored
451
452
453
                    $.modal.alertError("服务出错")
                }
            })
xqs authored
454
455
456
        }
    }
457
    /*审批*/
458
    function agree() {
459
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
460
        if (rows.length === 0) {
461
462
463
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
xqs authored
464
        $.modal.confirm("审批请谨慎核对数据!"
465
466
            , function () {
                var url = prefix + "/adjustAgree";
xqs authored
467
                var ids = "";
468
                for (var i = 0; i < rows.length; i++) {
xqs authored
469
470
                    ids = ids + rows[i].id + ","
                }
471
472
473
                var data = {"ids": ids.substring(0, ids.length - 1)};
                postInner(url, data);
            });
474
    }
xqs authored
475
476
    /*调整*/
477
    function addAdjust() {
478
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
479
        if (rows.length === 0) {
480
481
482
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
483
484
        $.modal.confirm("注意:该操作将更改库存数量或属性,当实盘数量为0且库位上只剩空载具时,请手动执行空托出库任务,载具上有货则无需其他操作!"
            , function () {
485
                var url = prefix + "/adjustEdit";
xqs authored
486
                var ids = "";
487
                for (var i = 0; i < rows.length; i++) {
xqs authored
488
489
                    ids = ids + rows[i].id + ","
                }
490
                var data = {"ids": ids.substring(0, ids.length - 1)};
491
492
493
494
                postInner(url, data);
            });
    }
495
    function postInner(url, data) {
496
497
        $.modal.loading("正在处理中,请稍后...");
        $.ajax({
498
499
500
501
            url: url,
            type: "post",
            data: data,
            success: function (result) {
502
                if (result.code === web_status.SUCCESS) {
503
504
505
506
507
508
509
510
511
512
513
514
                    $.modal.msgSuccess(result.msg);
                    $.table.refresh();
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            }
        })
    }

    /*单条删除*/
    function remove(id) {
515
516
517
        $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function () {
            var url = prefix + "/remove";
            var data = {"id": id};
518
519
            $.ajax({
                url: url,
520
521
522
                type: "post",
                data: data,
                success: function (result) {
523
                    if (result.code === web_status.SUCCESS) {
524
525
526
527
528
529
530
531
                        $.modal.msgSuccess(result.msg);
                        $.table.refresh();
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                }
            })
532
        });
tangying authored
533
    }
xqs authored
534
tangying authored
535
    //
xqs authored
536
    function open(title, url, width, height) {
tangying authored
537
538
539
540
        if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
            width = 'auto';
            height = 'auto';
        }
xqs authored
541
        if (title == null) {
tangying authored
542
543
            title = false;
        }
xqs authored
544
545
        if (url == null) {
            url = "404.html";
tangying authored
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
        }
        if ($.common.isEmpty(width)) {
            width = 800;
            // width = ($(window).width() - 100);
        }
        if ($.common.isEmpty(height)) {
            height = ($(window).height() - 50);
        }
        layer.open({
            type: 2,
            area: [width + 'px', height + 'px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: title,
            content: url
            // shadeClose: true, //点击遮罩关闭层
        })
    }
</script>
</body>
</html>