Blame view

src/main/resources/templates/receipt/receiving/receiving-new.html 21.2 KB
1
<!DOCTYPE HTML>
2
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
3
4
5
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
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
    /*.table-striped-left{*/
    /*	width: 41%;*/
    /*	!*margin-right: 4px;*!*/
    /*}*/
    /*.table-striped-right{*/
    /*	!*right: -10px;*!*/
    /*	width: 58%;*/
    /*	float: right;*/
    /*}*/
    .info_text {
        float: right;
    }

    .info_text li {
        font-size: 16px;
    }

    .info_text li span {
        font-size: 20px;
        font-weight: bold;
        color: rgb(28, 132, 198);
    }

    .select-list {
        font-weight: bold;
    }
32
33
34
35
</style>
<body class="gray-bg">
<div class="container-div">
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
    <div class="row">
        <div class="col-sm-12 select-info">
            <form id="dept-form">
                <div class="select-list">
                    <ul>
                        <li>
                            收货单号:<input type="text" id="code" name="deptName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" id="list-btn"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        </li>
                    </ul>
                    <ul>
                        <li style="display: none">id:<input type="text" id="detailId"/></li>
                        <li style="margin-left: 120px">收货数量:<input type="text" id="receiveNum"/></li>
                        <li>容器编号:<input type="text" id="containerCode"/></li>
                        <li>
                            <button class="btn btn-sm btn-success" type="button" onclick="receipt()">组盘</button>
                        </li>
                    </ul>
                    <ul class="info_text" style="display: none">
                        <li>物料总数:<span id="material_length"></span></li>
                        <li>总单据数量:<span id="qty_length"></span></li>
                        <li>已收货数量:<span id="qtyCompleted_length"></span></li>
                    </ul>
                </div>
            </form>
        </div>
64
65
66
67
68
69
70
71
72
73
74
75
76
77
        <div class="col-sm-12 select-info">
            <table id="bootstrap-table" data-mobile-responsive="true"
                   class="table table-bordered table-hover text-nowrap"></table>
        </div>
        <div class="col-sm-12 select-info table-striped-bottom">
            <div id="toolbar1" style="color: rgb(28,132,198)">本物料库存</div>
            <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
            <div id="toolbar2" style="color: rgb(28,132,198)">地面储位</div>
            <table id="bootstrap-table2" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
            <div id="toolbar3" style="color: rgb(28,132,198)">本物料交易</div>
            <table id="bootstrap-table3" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
        </div>
    </div>
78
79
80
81
82
83
84
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var addFlag = [[${@permission.hasPermi('receipt:receiving:add')}]];
    var removeFlag = [[${@permission.hasPermi('receipt:receiving:remove')}]];
    var prefix = ctx + "receipt/receiving";
    var Types = [[${@dict.getType('taskType')}]];
85
86
87
88
89
    var Status = [[${@dict.getType('receiptContainerHeaderStatus')}]];
    var inventoryStatus = [[${@dict.getType('inventoryStatus')}]];
    var uWarehouseNames = [[${@warehouseWu.getName()}]];
    var company = [[${@companyService.getCode()}]];
    var customer = [[${@CustomerService.getCode()}]];
90
91
92
93
94
95
96
97
98
99


    function list_select(code) {
        $.ajax({
            url: prefix + "/scanBill",
            type: 'post',
            datatype: 'json',
            data: {
                code: code
            },
100
            error: function (response) {
101
102
103
                console.log(response);
            },
            success: function (value) {
104
105
                var qty_show = 0;
                var qtyCompleted_show = 0;
106
                $("#bootstrap-table").bootstrapTable('removeAll');
107
108
                if (value.data) {
                    // $("#bootstrap-table").bootstrapTable('load',value.data);
109
110
111
112
                    for (var i = 0; i < value.data.length; i++) {
                        if (value.data[i].qty > value.data[i].taskQty) {
                            $("#bootstrap-table").bootstrapTable('insertRow', {
                                index: 0, row: {
113
                                    projectNo: value.data[i].project,
114
                                    id: value.data[i].id,
115
                                    materialName: value.data[i].materialName,
116
117
118
119
120
121
                                    receiptId: value.data[i].receiptId,
                                    receiptCode: value.data[i].receiptCode,
                                    materialCode: value.data[i].materialCode,
                                    qty: value.data[i].qty,
                                    taskQty: value.data[i].taskQty,
                                    inventorySts: value.data[i].inventorySts,
122
                                    materialUnit: value.data[i].materialUnit
123
124
125
                                }
                            });
                        }
126
127
                        qty_show = value.data[i].qty + qty_show;
                        qtyCompleted_show = value.data[i].taskQty + qtyCompleted_show;
128
129
130
131
                    }
                    $("#material_length").text(value.data.length);
                    $("#qty_length").text(qty_show);
                    $("#qtyCompleted_length").text(qtyCompleted_show);
132
                } else {
133
134
135
136
137
138
139
140
                    console.log("收货单不存在!")
                }
            }
        })
    }

    $("#list-btn").click(initTable);
141
    $("body").bind("keypress", function (e) {
142
143
144
145
146
147
148
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            e.preventDefault();
            //回车执行查询
            initTable();
149
            // list_select($("#code").val());
150
151
152
        }
    });
153
154
    function initTable() {
        var receiptCode = $("#code").val();
155
        list_select(receiptCode);
156
157
158
159
        $("#bootstrap-table1").bootstrapTable('removeAll');
        $("#bootstrap-table2").bootstrapTable('removeAll');
        $("#bootstrap-table3").bootstrapTable('removeAll');
    }
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
    $("#bootstrap-table").bootstrapTable({
        createUrl: prefix + "/add",
        updateUrl: prefix + "/edit/{id}",
        removeUrl: prefix + "/remove",
        clickToSelect: true,
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 5,                                       // 每页的记录行数(*)
        pageList: [5, 10, 25, 50, 100],
        modalName: "收货",
        contentType: "application/x-www-form-urlencoded",
        onClickRow: function (row, ele, field) {
            let code = $("#code").val();
            $("#detailId").val(row.id);
175
176
            var receiveNum = row.qty - row.taskQty;
            $("#receiveNum").val(receiveNum.toFixed(3));
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
            $.ajax({
                url: prefix + '/getReceiptInfoByBillKS',
                type: 'post',
                data: {
                    code: code,
                    id: row.id
                },
                success: res => {
                    $("#bootstrap-table1").bootstrapTable('load', res.data.list);
                    $("#bootstrap-table2").bootstrapTable('load', res.data.containers);
                    $("#bootstrap-table3").bootstrapTable('load', res.data.transactionList);
                }
            })
        },
        columns: [
            {
                checkbox: true
            },
            {
                field: 'materialCode',
                title: '物料编码',
                width: '20px'
            },
            {
                field: 'materialName',
                title: "物料名称",
                width: '20px'
            },
            {
                field: 'qty',
                title: '单据数量',
                width: '10px'
            },
            {
                field: 'taskQty',
                title: '已入数量',
                width: '10px'
            },
            {
                field: 'inventorySts',
                title: '库存状态',
                width: '20px'
            },
            {
                field: 'lot',
                title: '批号',
                width: '20px'
            },
            {
                field: 'moCode',
                title: '工作令号',
                width: '120px'
            },
xumiao authored
230
231
232
233
234
235
236
237
            {
                field: 'id',
                title: '明细id',
                sortable: true
            }
        ]
    });
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
    $("#bootstrap-table1").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        toolbar: "#toolbar",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘",
        pagination: true,   // 是否显示分页(*)
        pageNumber: 1,                                      // 初始化加载第一页,默认第一页
        pageSize: 5,                                       // 每页的记录行数(*)
        pageList: [10, 25, 50],
        toolbar: '#toolbar1',
        contentType: "application/x-www-form-urlencoded",
        columns: [
            {
                title: '操作',
                align: 'center',
                events: 'operateEvents',
                formatter: function (value, row, index) {
                    let actions = [];
                    if (row.zoneCode === 'PK') {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs" style="background-color: #ac2925" href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + row.containerCode + '\')"><i class="fa fa-edit"></i>组盘</a> ');
                    } else {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + 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 = [];
296
                    var companyName = ''
297
298
299
                    for (let item of uWarehouseNames) {
                        if (item.companyCode == row.companyCode && item.uWarehouseCode == value) {
                            return item.uWarehouseName;
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
                    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
355
356
357
358
359
360
361
362
363
364
365
366
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
    $("#bootstrap-table2").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        toolbar: "#toolbar",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘",
        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 = [];
                    if (row.zoneCode === 'PK') {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs" style="background-color: #ac2925" href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + row.code + '\')"><i class="fa fa-edit"></i>组盘</a> ');
                    } else {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + 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 = [];
393
                    var companyName = ''
394
395
396
                    for (let item of uWarehouseNames) {
                        if (item.companyCode == row.companyCode && item.uWarehouseCode == value) {
                            return item.uWarehouseName;
397
                        }
398
399
                    }
400
401
402
403
404
405
406
407
408
409
410
411
412
                    return actions.join('');
                }
            },
            {
                field: 'code',
                title: '容器编号'
            },
            {
                field: 'locationCode',
                title: '库位编号'
            }
        ]
    });
xumiao authored
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
    $("#bootstrap-table3").bootstrapTable({
        removeUrl: ctx + "receipt/receiptContainerDetail/remove",
        clickToSelect: true,
        showColumns: true, //列选择
        showExport: true, //导出
        iconSize: "outline",
        toolbar: "#toolbar",
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库组盘",
        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 = [];
                    if (row.zoneCode === 'PK') {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs" style="background-color: #ac2925" href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + row.containerCode + '\')"><i class="fa fa-edit"></i>组盘</a> ');
                    } else {
                        actions.push('<a id="cancel" class="btn btn-success btn-xs " href="#" onclick="Receiving(\'' + row.locationCode + '\',\'' + row.containerCode + '\')"><i class="fa fa-edit"></i>组盘</a> ');
                    }
                    return actions.join('');
                }
            },
            // {
            //     field : 'id',
            //     title : 'id'
            // },
xumiao authored
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
            {
                field: 'containerCode',
                title: '容器编号'
            },
            {
                field: 'materialCode',
                title: '存货编码'
            },
            {
                field: 'materialOldCode',
                title: '存货代码'
            },
            {
                field: 'materialName',
                title: '物料名称'
            },
            {
                field: 'materialSpec',
                title: '物料规格'
            },
            {
                field: 'qty',
                title: '数量'
            },
            {
                field: 'uWarehouseName',
                title: 'U8仓库'
            },
            {
                field: 'companyName',
                title: '货主'
            },
            {
                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
            },
        ]
    });
xumiao authored
497
498
499
500
    window.operateEvents = {
        'click #qty': function (e, value, row, index) {
            var url = prefix + '/add?';
501
            jQuery.each(row, function (key, val) {
502
503
                url = url + key + "=" + encodeURI(val) + "&";
            });
504
505
            var modalName = "入库组盘";
            $.modal.open("添加" + modalName, url);
506
507
508
509
510
511
512
513
        }
    };

    function receiving_refresh() {
        var receiving_code = localStorage.getItem("receiving_code");
        $("#code").val(receiving_code);
        if (receiving_code) {
            initTable();
514
        }
515
516
517
518
519
520
        localStorage.removeItem("receiving_code");
    }

    receiving_refresh();
xumiao authored
521
    //组盘
522
    function receipt() {
523
        let num = $("#receiveNum").val();
524
525
        let containerCode = $("#containerCode").val();
        let locationCode = '';
xumiao authored
526
        debugger;
527
528
529
530
531
        if (num == 0) {
            receiptSelect(containerCode);
        } else {
            Receiving(locationCode, containerCode);
        }
532
533
    }
534
535
536
537
538
539
540
541
542
543
    function receiptSelect(containerCode) {

        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var ids = rows.map(function (v) {
            return v.id;
        }).join(',');
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
        $.ajax({
            url: ctx + "receipt/receiving/saveAll",
            type: 'post',
            data: {
                ids: ids,
                receiptContainerCode: containerCode
            },
            success: function (data) {
                if (data.code === 200) {
                    $.modal.msgSuccess('成功');
                    initTable();
                } else {
                    $.modal.msg(data.msg);
                }
            }
        })
    }
562
563
564
565
566
567

    /**
     * 组盘
     * @param locationCode
     * @param containerCode
     */
568
569
570
571
    function Receiving(locationCode, containerCode) {
        let receiptCode = $("#code").val();
        let num = $("#receiveNum").val();
        let receiptDetailId = $("#detailId").val();
572
        $.ajax({
573
574
575
576
            url: ctx + "receipt/receiving/save",
            type: 'post',
            data: {
                receiptCode: receiptCode,
577
                qty: num,
578
579
580
                receiptDetailId: receiptDetailId,
                locationCode: locationCode,
                containerCode: containerCode
581
            },
582
583
584
            success: function (data) {
                if (data.code === 200) {
                    debugger;
585
586
                    $.modal.msgSuccess('成功');
                    initTable();
587
588
                } else {
                    $.modal.alertError(data.msg);
589
590
                }
            }
xumiao authored
591
592
593
594
595
596
597
        })
    }

</script>
</body>
</html>