Blame view

src/main/resources/templates/inventory/inventoryHeader/conformContainer.html 23.8 KB
xumiao authored
1
<!DOCTYPE HTML>
xumiao authored
2
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
xumiao authored
3
4
5
6
7
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-task-emptyIn">
xumiao authored
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
        <div class="col-sm-12 select-info">
            <div class="form-group">
                <label class="col-sm-1 control-label"></label>
                <span style="color:red;">*请勾选虚拟库存明细,并转移到指定容器上</span>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label"></label>
                <span style="font-size: 12px;font-weight:bolder;">货主:</span>
                <select id="companyCode" name="companyCode"
                        th:with="companyList=${@companyService.selectCompanyByCurrentUserId()}" style="padding: 5px; font-size: 12px;
                font-weight:bolder;">
                    <option th:each="company : ${companyList}" th:text="${company['name']}"
                            th:value="${company['code']}" th:attr=" code = ${company['code']}"></option>
                </select>
                <span style="font-size: 12px;font-weight:bolder;">u8仓:</span>
                <select name="uWarehouseCode" id="uWarehouseCode" th:with="warehouse=${@warehouseWu.selectList()}"
                        style="padding: 5px;font-size: 12px;
                font-weight:bolder;">
                    <option value="">所有</option>
                    <option th:each="e : ${warehouse}" th:text="${e['uWarehouseName']}"
                            th:value="${e['uWarehouseCode']}" th:attr=" code = ${e['uWarehouseCode']}"></option>
                </select>
                <span style="font-size: 12px;font-weight:bolder;">物料号:</span>
                <input type="text" id="materialCode" name="materialCode"/>
<!--                <span style="font-size: 12px;font-weight:bolder;">托盘:</span>-->
<!--                <input type="text" id="containerCode" name="containerCode"/>-->
                <button type="button" class="btn btn-primary" onclick="selectMaterial()">查询明细</button>
                <button type="button" class="btn btn-primary" onclick="clearSelect()">清空明细</button>
                <span style="font-size: 12px;font-weight:bolder;color: red;margin-left: 157px;">目的托盘:</span>
                <input id="destContainerCode" name="destContainerCode" type="text">
                <button type="submit" class="btn btn-primary">转移</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
xumiao authored
41
        </div>
xumiao authored
42
        <div class="col-sm-12 select-info" id="selecttable">
xumiao authored
43
44
45
46
47
            <div class="btn-group hidden-xs" id="toolbar1" role="group">
                <span style="color:red;">*下面只查询出虚拟库存</span>
            </div>
            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
        </div>
xumiao authored
48
49
50
51
52
53
54
        <div class="col-sm-12 select-info table-striped-bottom">
            <div id="toolbar4" style="color: rgb(28,132,198)">本物料交易</div>
            <table id="bootstrap-table3" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
            <div id="toolbar3" style="color: rgb(28,132,198)">地面储位</div>
            <table id="bootstrap-table2" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
            <div id="toolbar2" style="color: rgb(28,132,198)">本物料库存</div>
            <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
xumiao authored
55
        </div>
xumiao authored
56
57
58
59
60
61
<!--        <div class="form-group">-->
<!--            <div class="form-control-static col-sm-offset-9">-->
<!--                <button type="submit" class="btn btn-primary">转移</button>-->
<!--                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>-->
<!--            </div>-->
<!--        </div>-->
xumiao authored
62
63
64
65
66
67
68
69
    </form>
</div>
<div th:include="include::footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "inventory/inventoryDetail";
    var prefix_header = ctx + "inventory/inventoryHeader";
    var inventoryStatus = [[${@dict.getType('inventorySts')}]];
    var inventoryLock = [[${@dict.getType('inventoryLock')}]];
xumiao authored
70
71
72
73
74
    var uWarehouseNames = [[${@warehouseWu.getName()}]];
    var company = [[${@companyService.getCode()}]];
    var resubmit = new Date().getTime();

    function clearSelect() {
xumiao authored
75
        $("#bootstrap-table").bootstrapTable('removeAll');
xumiao authored
76
77
78
        $("#bootstrap-table1").bootstrapTable('removeAll');
        $("#bootstrap-table2").bootstrapTable('removeAll');
        $("#bootstrap-table3").bootstrapTable('removeAll');
xumiao authored
79
    }
xumiao authored
80
81
82
83
84
85
86
87
88
89
90
91
92
93

    function selectMaterial() {
        var companyCode = $("#companyCode").val();
        var uWarehouseCode = $("#uWarehouseCode").val();
        var materialCode = $("#materialCode").val();
        var containerCode = $("#containerCode").val();
        if (companyCode == '') {
            $.modal.msgError("请选择货主")
            return;
        }
        if (uWarehouseCode == '') {
            $.modal.msgError("请选择u8仓库")
            return;
        }
xumiao authored
94
        $.ajax({
xumiao authored
95
96
97
98
99
100
101
102
103
104
            url: prefix + '/inventoryDetailLook',
            type: "post",
            data: {
                "companyCode": companyCode,
                "uWarehouseCode": uWarehouseCode,
                "materialCode": materialCode,
                "containerCode": containerCode,
                "zoneCode": "XN"
            },
            success: function (value) {
xumiao authored
105
                console.log(value)
xumiao authored
106
107
108
109
110
111
                if (value.data != "") {
                    $("#bootstrap-table").bootstrapTable('load', value.data);
                    $("#bootstrap-table1").bootstrapTable('removeAll');
                    $("#bootstrap-table2").bootstrapTable('removeAll');
                    $("#bootstrap-table3").bootstrapTable('removeAll');
                } else {
xumiao authored
112
                    $("#bootstrap-table").bootstrapTable('removeAll');
xumiao authored
113
114
115
                    $("#bootstrap-table1").bootstrapTable('removeAll');
                    $("#bootstrap-table2").bootstrapTable('removeAll');
                    $("#bootstrap-table3").bootstrapTable('removeAll');
xumiao authored
116
117
118
119
120
121
                    $.modal.msgError("没查询出来库存哦!");
                }

            }
        });
    }
xumiao authored
122
xumiao authored
123
124
125
126
127
    $("#bootstrap-table").bootstrapTable({
        // url: detailPrefix + "/list",
        // search: true, //搜索
        sortable: true, //排序
        showRefresh: true, //刷新
xumiao authored
128
        showToggle: true, //视图切换
xumiao authored
129
        clickToSelect: true,
xumiao authored
130
        showColumns: true, //列选择
xumiao authored
131
132
133
134
135
136
137
138
139
140
141
142
143
        // detailView:true,
        showExport: true, //导出
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库明细",
        sortName: "lastUpdated",
        sortOrder: "desc",
        iconSize: "outline",
        toolbar: "#toolbar1",
        contentType: "application/x-www-form-urlencoded",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 10,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],                             // 可供选择的每页的行数(*)
xumiao authored
144
        onRefresh: function () {
xumiao authored
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
            loadDetail();
        },
        columns: [{
            checkbox: true
        },
            {
                field: 'id',
                title: '明细ID',
                sortable: false
            },
            {
                field: 'inventoryHeaderId',
                title: '库存头ID',
                sortable: true
            },
            {
                field: 'companyCode',
                title: '货主',
                align: 'center',
xumiao authored
164
                formatter: function (value, row, index) {
xumiao authored
165
                    var actions = [];
xumiao authored
166
                    $.each(company, function (index, dict) {
xumiao authored
167
168
169
170
171
172
173
174
                        if (dict.code == value) {
                            actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
xumiao authored
175
176
177
178
179
180
181
182
183
184
185
186
187
188
            {
                field: 'uWarehouseCode',
                title: 'U8仓库',
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(uWarehouseNames, function (index, dict) {
                        if (dict.uWarehouseCode == value) {
                            actions.push("<span class='badge badge-info'>" + dict.uWarehouseName + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
xumiao authored
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
            {
                field: 'locationCode',
                title: '库位编号'
            },
            {
                field: 'containerCode',
                title: '容器编号'
            },
            {
                field: 'materialCode',
                title: '物料编码'
            },

            {
                field: 'materialName',
                title: '物料名称'
            },
            {
                field: 'qty',
                title: '库存数量'
            },
            {
                field: 'taskQty',
                title: '预定执行数量'
            },
            {
                field: 'materialSpec',
                title: '物料规格'
            },
            {
                field: 'materialUnit',
                title: '物料单位'
            },
            {
                field: 'inventorySts',
                title: '库存状态',
                align: 'center',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(inventoryStatus, value);
                }
xumiao authored
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
            }],
        onClickCell: function (field, value, row, $element) {
            if ((new Date().getTime() - resubmit) > 1500) {
                resubmit = new Date().getTime();
                var materialCode = row.materialCode;
                var companyCode = row.companyCode;
                var uWarehouseCode = row.uWarehouseCode;
                selectSomething(materialCode, companyCode, uWarehouseCode);
            }
        }
    });

    function selectSomething(materialCode, companyCode, uWarehouseCode) {
        $.ajax({
            url: ctx + "receipt/receiving/getSelectSomething",
            type: 'post',
            data: {
                materialCode: materialCode,
                companyCode: companyCode,
                uWarehouseCode: uWarehouseCode
            },
            success: res => {
                $("#bootstrap-table1").bootstrapTable('load', res.data.list);
                $("#bootstrap-table2").bootstrapTable('load', res.data.containers);
                $("#bootstrap-table3").bootstrapTable('load', res.data.transactionList);
            }
        })
    }

    $("#bootstrap-table1").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 5,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],
        toolbar: '#toolbar2',
        contentType: "application/x-www-form-urlencoded",
        columns: [
            {
                title: '操作',
                align: 'center',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    let actions = [];
                    actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="selectContainer(\'' + row.containerCode +'\')"><i class="fa fa-edit"></i>选择托盘</a> ');
                    return actions.join('');
                }
            },
            // {
            //     field : 'id',
            //     title : 'id'
            // },
            {
                field: 'companyCode',
                title: '货主',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(company, function (index, dict) {
                        if (dict.code == value) {
                            actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            {
                field: 'uWarehouseCode',
                title: 'U8仓库',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(uWarehouseNames, function (index, dict) {
                        if (dict.uWarehouseCode == value) {
                            actions.push("<span class='badge badge-info'>" + dict.uWarehouseName + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            {
                field: 'containerCode',
                title: '容器编号'
            },
            {
                field: 'materialCode',
                title: '存货编码'
            },
            {
                field: 'materialOldCode',
                title: '存货代码'
            },
            {
                field: 'materialName',
                title: '物料名称'
            },
            {
                field: 'materialSpec',
                title: '物料规格'
            },
            {
                field: 'qty',
                title: '数量'
            },
            {
                field: 'locationCode',
                title: '库位编号'
            },
            {
                field: 'moCode',
                title: '工作令号',
                sortable: true
            },
            {
                field: 'supplierCode',
                title: '供应商编码',
                visible: false
            },
            {
                field: 'status',
                title: '库存状态',
                align: 'center',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(inventoryStatus, value);
                }
            },
        ]
xumiao authored
365
366
    });
xumiao authored
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
    $("#bootstrap-table2").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 5,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],
        toolbar: '#toolbar3',
        contentType: "application/x-www-form-urlencoded",
        columns: [
            {
                title: '操作',
                align: 'center',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    let actions = [];
                    actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="selectContainer(\'' + row.code +'\')"><i class="fa fa-edit"></i>选择托盘</a> ');
                    return actions.join('');
                }
            },
            {
                field: 'uWarehouseCode',
                title: 'U8仓库',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(uWarehouseNames, function (index, dict) {
                        if (dict.uWarehouseCode == value) {
                            actions.push("<span class='badge badge-info'>" + dict.uWarehouseName + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            {
                field: 'code',
                title: '容器编号'
            },
            {
                field: 'locationCode',
                title: '库位编号'
            }
        ]
    });

    $("#bootstrap-table3").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        toolbar: "#toolbar4",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 5,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],
        contentType: "application/x-www-form-urlencoded",
        columns: [
            {
                title: '操作',
                align: 'center',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    let actions = [];
                    actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="selectContainer(\'' + row.containerCode +'\')"><i class="fa fa-edit"></i>选择托盘</a> ');
                    return actions.join('');
                }
            },
            {
                field: 'containerCode',
                title: '容器编号'
            },
            {
                field: 'materialCode',
                title: '存货编码'
            },
            {
                field: 'materialOldCode',
                title: '存货代码'
            },
            {
                field: 'materialName',
                title: '物料名称'
            },
            {
                field: 'materialSpec',
                title: '物料规格'
            },
            {
                field: 'taskQty',
                title: '数量'
            },
            {
                field: 'companyCode',
                title: '货主',
                align: 'center',
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(company, function (index, dict) {
                        if (dict.code == value) {
                            actions.push("<span class='badge badge-info'>" + dict.name + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            {
                field: 'uWarehouseCode',
                title: 'U8仓库',
                formatter: function (value, row, index) {
                    var actions = [];
                    $.each(uWarehouseNames, function (index, dict) {
                        if (dict.uWarehouseCode == value) {
                            actions.push("<span class='badge badge-info'>" + dict.uWarehouseName + "</span>");
                            return false;
                        }
                    });
                    return actions.join('');
                }
            },
            {
                field: 'created',
                title: '创建时间',
                sortable: true,
                formatter: function (value, row, index) {
                    let time = value.slice(5, 10);
                    return `<span>${time}</span>`
                }
            },
            {
                field: 'moCode',
                title: '工作令号',
                sortable: true
            },
        ]
    });

    function selectContainer(containerCode){
        $("#destContainerCode").val(containerCode);
    }
    var flag=true;
xumiao authored
517
    $("#form-task-emptyIn").validate({
xumiao authored
518
519
520
521
        submitHandler: function (form) {
            var destContainerCode = $("#destContainerCode").val();
            if (destContainerCode == '') {
                $.modal.alertError("请填写或选择目的托盘编号");
xumiao authored
522
523
                return;
            }
xumiao authored
524
            let rows = $("#bootstrap-table").bootstrapTable('getSelections');
xumiao authored
525
            //console.log(rows);
xumiao authored
526
            if (rows == '' || rows == undefined) {
xumiao authored
527
528
529
                $.modal.alertError("还是选择明细吧!!!");
                return;
            }
xumiao authored
530
            var ids = "";
xumiao authored
531
            for (var i = 0; i < rows.length; i++) {
xumiao authored
532
533
534
                ids += rows[i].id;
                ids += ",";
            }
xumiao authored
535
536
537
538
539
540
541
            ids = ids.substring(0, ids.length - 1);
            if(!flag){
                console.log("出去")
                return;
            }
            console.log("进来")
            flag=false;
xumiao authored
542
            $.ajax({
xumiao authored
543
544
545
546
547
                url: prefix_header + "/conformContainerSave",
                type: "post",
                data: {
                    "destContainerCode": destContainerCode,
                    "detailIdList": ids,
xumiao authored
548
                },
xumiao authored
549
                success: function (result) {
xumiao authored
550
551
552
553
554
555
                    console.log(result)
                    if (result.code == web_status.SUCCESS) {
                        //layer.close()
                        //layer.close(index);
                        $.modal.close();
                        $.modal.alertSuccess(result.msg);
xumiao authored
556
                        flag=true;
xumiao authored
557
558
559
560
                    } else if (result.code == web_status.WARNING) {
                        //layer.close(index);
                        $.modal.enable();
                        $.modal.alertWarning(result.msg)
xumiao authored
561
                        flag=true;
xumiao authored
562
563
564
565
                    } else {
                        //layer.close(index);
                        $.modal.enable();
                        $.modal.alertError(result.msg);
xumiao authored
566
                        flag=true;
xumiao authored
567
568
569
570
571
572
                    }
                }
            });
        }
    });
xumiao authored
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
    $(function () {
        $("select[name='companyCode']").change(function (e) {
            let companyCode = $("select[name='companyCode'] option:selected").attr('code');
            $.ajax({
                url: ctx + "receipt/receiptHeader/getwarehouse",
                type: 'post',
                data: {code: companyCode},
                success: function (response) {
                    if (response.code === 200) {
                        $("select[name='uWarehouseCode']").children().remove();
                        $("select[name='uWarehouseCode']").append(`<option value="">所有</option>`);
                        for (let item of response.data) {
                            let option = `<option value="${item.uWarehouseCode}">${item.uWarehouseName}</option>`;
                            $("select[name='uWarehouseCode']").append(option);
                        }
                    } else {
                        $.modal.msgError(response.msg)
                    }
                }
            })
        })
    })
xumiao authored
597
598
599
</script>
</body>
</html>