Blame view

src/main/resources/templates/receipt/receiving/receiving-new.html 16.9 KB
1
2
3
4
5
<!DOCTYPE HTML>
<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>
<style>
xumiao authored
6
7
8
9
10
11
12
13
14
	/*.table-striped-left{*/
	/*	width: 41%;*/
	/*	!*margin-right: 4px;*!*/
	/*}*/
	/*.table-striped-right{*/
	/*	!*right: -10px;*!*/
	/*	width: 58%;*/
	/*	float: right;*/
	/*}*/
15
16
17
18
19
20
21
22
23
24
25
	.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);
	}
xumiao authored
26
27
28
	.select-list{
		font-weight: bold;
	}
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</style>
<body class="gray-bg">
<div class="container-div">

	<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>
xumiao authored
45
46
47
48
49
					<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>
xumiao authored
50
							<button class="btn btn-sm btn-success" type="button" onclick="receipt()">组盘</button>
xumiao authored
51
52
53
						</li>
					</ul>
					<ul class="info_text" style="display: none">
54
55
56
57
58
59
60
61
						<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>
xumiao authored
62
		<div class="col-sm-12 select-info">
63
64
			<table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover text-nowrap"></table>
		</div>
周鸿 authored
65
		<div class="col-sm-12 select-info table-striped-bottom">
xumiao authored
66
67
68
69
70
71
			<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>
72
73
74
75
76
77
78
79
80
81
82
		</div>
	</div>
</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')}]];
    var Status=[[${@dict.getType('receiptContainerHeaderStatus')}]];
	var inventoryStatus =[[${@dict.getType('inventoryStatus')}]];
xumiao authored
83
84
85
	var uWarehouseNames = [[${@warehouseWu.getName()}]];
	var company = [[${@companyService.getCode()}]];
	var customer = [[${@CustomerService.getCode()}]];
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154


    function list_select(code) {
        $.ajax({
            url: prefix + "/scanBill",
            type: 'post',
            datatype: 'json',
            data: {
                code: code
            },
            error:function (response) {
                console.log(response);
            },
            success: function (value) {
                var qty_show=0;
                var qtyCompleted_show=0;
                $("#bootstrap-table").bootstrapTable('removeAll');
                if(value.data){
					// $("#bootstrap-table").bootstrapTable('load',value.data);
                    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: {
                                    projectNo:value.data[i].project,
                                    id: value.data[i].id,
									materialName: value.data[i].materialName,
                                    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,
									materialUnit: value.data[i].materialUnit
                                }
                            });
                        }
						qty_show=value.data[i].qty + qty_show;
                        qtyCompleted_show=value.data[i].taskQty + qtyCompleted_show;
                    }
                    $("#material_length").text(value.data.length);
                    $("#qty_length").text(qty_show);
                    $("#qtyCompleted_length").text(qtyCompleted_show);
                }
                else    {
                    console.log("收货单不存在!")
                }
            }
        })
    }

    $("#list-btn").click(initTable);

    $("body").bind("keypress",function(e){
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            e.preventDefault();
            //回车执行查询
            initTable();
           // list_select($("#code").val());
        }
    });

    function initTable(){
        var receiptCode=$("#code").val();
        list_select(receiptCode);
		$("#bootstrap-table1").bootstrapTable('removeAll');
		$("#bootstrap-table2").bootstrapTable('removeAll');
xumiao authored
155
		$("#bootstrap-table3").bootstrapTable('removeAll');
156
157
	}
xumiao authored
158
159
160
161
162
	$("#bootstrap-table").bootstrapTable({
		createUrl: prefix + "/add",
		updateUrl: prefix + "/edit/{id}",
		removeUrl: prefix + "/remove",
		clickToSelect: true,
163
		pagination: true,   // 是否显示分页(*)
xumiao authored
164
		pageNumber: 1,                                      // 初始化加载第一页,默认第一页
xumiao authored
165
		pageSize: 4,                                       // 每页的记录行数(*)
xumiao authored
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
		pageList: [10, 25, 50,100],
		modalName: "收货",
		contentType: "application/x-www-form-urlencoded",
		onClickRow:function(row,ele,field){
			let code=$("#code").val();
			$("#detailId").val(row.id);
			$("#receiveNum").val(row.qty-row.taskQty);
			$.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);
184
				}
xumiao authored
185
186
187
			})
		},
		columns: [
188
			{
xumiao authored
189
190
191
				checkbox: true
			},
			{
xumiao authored
192
				field : 'materialCode',
xumiao authored
193
194
				title : '物料编码',
				width:'20px'
195
			},
xumiao authored
196
197
			{
				field : 'materialName',
xumiao authored
198
199
				title : "物料名称",
				width:'20px'
xumiao authored
200
201
202
			},
			{
				field : 'qty',
xumiao authored
203
204
				title : '单据数量',
				width:'10px'
xumiao authored
205
206
207
			},
			{
				field : 'taskQty',
xumiao authored
208
209
				title : '已入数量',
				width:'10px'
xumiao authored
210
211
212
			},
			{
				field : 'inventorySts',
xumiao authored
213
214
				title : '库存状态',
				width:'20px'
xumiao authored
215
216
			},
			{
xumiao authored
217
218
219
				field : 'lot',
				title : '批号',
				width:'20px'
xumiao authored
220
221
			},
			{
xumiao authored
222
223
224
				field : 'moCode',
				title : '工作令号',
				width:'120px'
xumiao authored
225
			},
xumiao authored
226
227
228
229
230
231

			{
				field : 'id',
				title : '明细id',
				sortable:true
			}
xumiao authored
232
233
		]
	});
234
xumiao authored
235
	$("#bootstrap-table1").bootstrapTable({
236
237
238
239
240
241
242
243
244
245
246
247
		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],
xumiao authored
248
		toolbar: '#toolbar1',
249
250
251
252
253
254
255
		contentType: "application/x-www-form-urlencoded",
		columns: [
			{
				title: '操作',
				align: 'center',
				events:'operateEvents',
				formatter: function(value, row, index) {
xumiao authored
256
257
258
259
260
261
262
					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> ');
					}
263
264
265
					return actions.join('');
				}
			},
xumiao authored
266
267
268
269
			// {
			//     field : 'id',
			//     title : 'id'
			// },
xumiao authored
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
			{
				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('');
				}
			},
302
303
304
305
306
307
308
309
310
			{
				field : 'containerCode',
				title : '容器编号'
			},
			{
				field : 'materialCode',
				title : '存货编码'
			},
			{
xumiao authored
311
312
313
314
				field : 'materialOldCode',
				title : '存货代码'
			},
			{
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
				field : 'materialName',
				title : '物料名称'
			},
			{
				field : 'materialSpec',
				title : '物料规格'
			},
			{
				field : 'qty',
				title : '数量'
			},
			{
				field : 'locationCode',
				title : '库位编号'
			},
			{
xumiao authored
331
332
333
334
335
336
337
338
339
340
				field : 'moCode',
				title : '工作令号' ,
				sortable:true
			},
			{
				field : 'supplierCode',
				title : '供应商编码',
				visible:false
			},
			{
341
342
343
344
345
346
347
348
349
				field : 'status',
				title : '库存状态' ,
				align: 'center',
				formatter: function(value, row, index) {
					return $.table.selectDictLabel(inventoryStatus, value);
				}
			},
		]
	});
xumiao authored
350
351
352
353
354
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

	$("#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('');
				}
			},
			{
xumiao authored
383
384
385
386
387
388
389
390
391
392
393
394
395
396
				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('');
				}
xumiao authored
397
398
399
400
401
			},
			{
				field : 'code',
				title : '容器编号'
			},
xumiao authored
402
403
404
405
			{
				field : 'locationCode',
				title : '库位编号'
			}
xumiao authored
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
		]
	});

	$("#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'
			// },

			{
				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
			},
		]
	});
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
    window.operateEvents = {
        'click #qty': function (e, value, row, index) {
            var url = prefix + '/add?';
            jQuery.each(row, function(key, val) {
                url = url + key + "=" + encodeURI(val) + "&";
            });
            var modalName="入库组盘";
            $.modal.open("添加"+modalName,url);
        }
    };

    function receiving_refresh() {
        var receiving_code = localStorage.getItem("receiving_code");
        $("#code").val(receiving_code);
        if (receiving_code) {
            initTable();
		}
        localStorage.removeItem("receiving_code");
    }

    receiving_refresh();
xumiao authored
518
    //组盘
519
520
521
522
    function receipt() {
		let num=$("#receiveNum").val();
        let containerCode = $("#containerCode").val();
        let locationCode = '';
xumiao authored
523
        debugger;
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
        if(num==0){
			receiptSelect(containerCode);
		}else {
			Receiving(locationCode, containerCode);
		}
    }
	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(',') ;

		$.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);
				}
			}
		})
	}

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


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