shipmentU8ContainerHeader.html
27.2 KB
1
2
3
4
5
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
32
33
34
35
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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
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
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
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
517
518
519
520
521
522
523
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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!--<meta charset="utf-8" http-equiv="refresh" content="200">-->
<head th:include="include :: header"></head>
<style>
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc
}
.isShow{
display: none;
}
.bg-orange{
background: #BEBEBE;
}
.bg-blue{
}
</style>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-info">
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#tabHeader" data-toggle="tab">U8工单</a></li>
<li><a href="#tabDetail" data-toggle="tab">U8库存</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="tabHeader">
<div class="col-sm-12 select-info">
<form id="receiptHeader-form">
<div class="select-list">
<ul>
<li>
货主编码:<select name="companyCode" th:with="company=${@companyService.selectCompanyByCurrentUserId()}">
<option value="">所有</option>
<option th:each="e : ${company}" th:text="${e['name']}" th:value="${e['code']}"></option></select>
</li>
<li>
<select name="cCompanyCode">
<!-- <option th:each="e : ${warehouse}" th:text="${e['uWarehouseName']}" th:value="${e['uCompanyCode']}" th:name="${e['uWarehouseCode']}"></option>-->
</select>
</li>
<li>
工单号:<input type="text" name="Mocode"/>
</li>
<li>
工单行号:<input type="text" name="Moseq"/>
</li>
<li>
母件编码:<input type="text" name="CInvcode"/>
</li>
<li>
子件编码:<input type="text" name="MaterialCode"/>
</li>
<li>
<select name="ch">
<option selected="selected"></option>
<option>外协</option>
<option>外购</option>
<option>电气</option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="workOrderSearch(0)">
<i class="fa fa-search"></i> 搜索</a>
<a class="btn btn-primary btn-rounded btn-sm" onclick="workOrderSearch(1)">
<i class="fa fa-search"></i> 搜索全部</a>
<a class="btn btn-primary btn-rounded btn-sm" onclick="findStockAllClick()">
<i class="fa fa-search"></i> 批量查看库存</a>
<a class="btn btn-outline btn-info btn-rounded" onclick="importExcel()">
<i class="fa fa-upload"></i> excel导入
</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('receiptHeader-form')"><i class="fa fa-refresh"></i> 重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group hidden-xs" id="toolbar" role="group">
</div>
<table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
</div>
<div class="tab-pane fade" id="tabDetail">
<div class="btn-group hidden-xs" id="toolbar-detail" role="group" style="padding:20px 0;">
<a class="btn btn-outline btn-success btn-rounded" onclick="outStockAll()" >
<i class="fa fa-plus"></i> 出库
</a>
</div>
<table id="bootstrap-table-detail" data-row-style="rowStyle" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
</div>
</div>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var printFlag = [[${@permission.hasPermi('shipment:bill:report')}]]; //打印
var editFlag = [[${@permission.hasPermi('shipment:bill:edit')}]];
var removeFlag = [[${@permission.hasPermi('shipment:bill:remove')}]];
var prefix = ctx + "shipment/shipmentHeader";
var prefix1=ctx+"receipt/receiptHeader";
var prefix_detail = ctx + "shipment/shipmentDetail";
var datas = [[${@dict.getType('sys_normal_disable')}]];
var shipmentTypes=[[${@dict.getType('shipmentType')}]];
var shipmentHeaderStatus=[[${@dict.getType('shipmentHeaderStatus')}]];
var stations = [[${@dict.getType('station')}]];
var uploadStatus=[[${@dict.getType('uploadStatus')}]];
var inventoryStatus=[[${@dict.getType('inventoryStatus')}]];
var rossDoccking = [[${@permission.hasPermi('shipment:bill:rossDoccking')}]];
var shipmentId = "";
var shipmentCode="";
function findStockAllClick(){
var rows = $("#bootstrap-table").bootstrapTable('getSelections');
if (rows.length == 0){
$.modal.msg("请选择要查看的工单!");
return
}
var list = [];
debugger
var cCompanyCode = $("select[name='cCompanyCode']").val();
var cWHCode = $("select[name='cCompanyCode']").find("option:selected").attr("name");
if ((!cCompanyCode) || (!cWHCode)){
$.modal.msg("工单号不能为空!");
return;
}
for (const i in rows){
var materialCode = rows[i].materialCode;
var needQuantity = rows[i].needQuantity;
var receiveQuantity = rows[i].receiveQuantity;
var workOrderId = rows[i].workOrderId;
var workOrderSonId = rows[i].workOrderSonId;
var data= {
"cInvCode":materialCode,
"cCompanyCode":cCompanyCode,
"cWHCode":cWHCode,
"needQuantity":needQuantity,
"receiveQuantity":receiveQuantity,
"modID":workOrderId,
"AllocateId":workOrderSonId
}
list.push(data);
}
getU8StockDataAll(list);
}
function getU8StockDataAll(list){
var data = JSON.stringify(list);
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/getU8StockDataAll',
type: 'post',
datatype: "json",
data:{
"json":data
},
success : function (value) {
debugger
if (value.code == 200){
if (value.data.length == 0){
$.modal.msgError("WMS查询不到该物料!");
return
}
$("#myTab li").removeClass("active");
$("#tabHeader").removeClass("in active");
$("#myTab li:eq(1)").addClass("active");
$("#tabDetail").addClass("in active");
$("#bootstrap-table-detail").bootstrapTable('load',value.data);
}else{
$.modal.msgError(value.msg);
}
}
});
}
function workOrderSearch(type){
var cCompanyCode = $("select[name='cCompanyCode']").val();
var option = $("select[name='ch']").val();
var Mocode = $("input[name='Mocode']").val();
var Moseq = $("input[name='Moseq']").val();
var CInvcode = $("input[name='CInvcode']").val();
var MaterialCode = $("input[name='MaterialCode']").val();
if (cCompanyCode){
if (!Mocode){
$.modal.msg("工单号不能为空!");
return;
}
$.ajax({
url:ctx + 'config/warehouseWu/queryWorkOrders',
type: 'get',
data:{
"cCompanyCode":cCompanyCode,
"Mocode":Mocode,
"Moseq":Moseq,
"CInvcode":CInvcode,
"MaterialCode":MaterialCode,
"type":type,
"option":option
},
success:function (value) {
debugger;
if (value.code == 200){
if (value.data.length == 0){
$.modal.msg(value.msg);
$("#bootstrap-table").bootstrapTable('removeAll');
}
$("#bootstrap-table").bootstrapTable('load',value.data);
}else {
$.modal.msg(value.msg);
$("#bootstrap-table").bootstrapTable('removeAll');
}
}
});
}else {
$.modal.msg("仓库编码不能为空!");
}
}
$("#bootstrap-table").bootstrapTable({
modalName: "出库单",
sortName: "created",
sortOrder: "desc",
search: false,
pageSize: 10,
pagination:true,
columns: [
{
checkbox:true,
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a id="table_edit" class="btn btn-success btn-xs ' + removeFlag + '" href="#" onclick="detail(\'' + row.materialCode + '\',\'' + row.needQuantity + '\',\'' + row.receiveQuantity + '\',\'' + row.workOrderId + '\',\'' + row.workOrderSonId + '\')"><i class="fa fa-print"></i>库存选择</a> ');
return actions.join('');
}
},
{
field: 'materialCode',
title: '存货编码',
sortable:true
},
{
field: 'materialName',
title: '材料名称',
},
{
field: 'specification',
title: '材料规格',
},
{
field: 'needQuantity',
title: '应领数量',
},
{
field: 'receiveQuantity',
title: '已领数量',
},
{
field : 'orderBomCode',
title : '订单物料编码',
},
{
field: 'name',
title: '名称',
},
{
field : 'specification1',
title : '规格',
},
{
field: 'lineNumber',
title: '行号',
},
{
field : 'workOrderNumber',
title : '工单号',
visible: false
},
{
field : 'workOrderId',
title : '工单id',
},
{
field : 'workOrderSonId',
title : '工单子件id',
},
{
field: 'workOrderQuantity',
title: '工单数量',
visible: false
},
{
field : 'orderDate',
title : '订单日期'
},
]
});
$(function () {
$.table.init($("#bootstrap-table"));
// 绑定事件
$("select[name='cCompanyCode']").change(function (){
$("#bootstrap-table").bootstrapTable("removeAll");
});
$("select[name='companyCode']").change(function (){
$("#bootstrap-table").bootstrapTable("removeAll");
var companyCode = this.value;
debugger
$.ajax({
url:ctx + 'config/warehouseWu/getCompanyCodeList',
type: 'get',
data:{
"companyCode":companyCode,
},
success : function (value) {
debugger;
$("select[name='cCompanyCode']").empty();
if (value.code == 200){
value.data.forEach(function (item){
$("select[name='cCompanyCode']").append("<option value='"+item.uCompanyCode+"' name='"+item.uWarehouseCode+"'>"+item.uWarehouseName+"</option>");
});
}else {
$.modal.msgError(value.msg);
}
}
});
});
});
$("#bootstrap-table-detail").bootstrapTable(
{
sortable: true, //排序
modalName: "U8库存明细",
search: false,
clickToSelect: true,
sortName: "lastUpdated",
sortOrder: "desc",
pagination: true, // 是否显示分页(*)
pageNumber: 1, // 初始化加载第一页,默认第一页
pageSize: 50, // 每页的记录行数(*)
pageList: [10, 25, 50, 100], // 可供选择的每页的行数(*)
columns: [{
checkbox: true
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a id="table_edit" class="btn btn-success btn-xs ' + printFlag + '" href="#" onclick="outStock(\'' + row.allocateId + '\',\'' + row.modID + '\',\'' + row.ccompanyCode + '\',\'' + row.cwhcode + '\',\'' + index + '\',\'' + row.cinvCode + '\',\'' + row.inventoryId + '\',\'' + row.qty + '\')"><i class="fa fa-print"></i>出库</a> ');
return actions.join('');
}
},
{
field: 'SerialNumber',
title: '序号',
visible: false
},
{
field: 'ccompanyCode',
title: '公司代码',
visible: false
},
{
field: 'modID',
title: '工单行ID',
visible: false
},
{
field: 'allocateId',
title: '工单子件行ID',
visible: false
},
{
field: 'dosage',
title: '出库数量',
valign:'middle',
align:"center",
clear:false,
formatter : function(value, row, index) {
var needQuantity = row.needQuantity;
var receiveQuantity = row.receiveQuantity;
var qty = 0;
if (needQuantity > receiveQuantity){
qty = needQuantity - receiveQuantity;
}
var html = '<input id="dosage'+index+'" onblur="numCheck('+index+')" value="'+qty+'" width="10" >';
return html;
}
},
{
field: 'needQuantity',
title: '应领数量'
},
{
field: 'receiveQuantity',
title: '已领数量'
},
{
field : 'iQuantity',
title : 'U8库存数量',
sortable:true
},
{
field : 'qty',
title : 'WMS库存数量',
sortable:true
},
{
field: 'taskQty',
title: '执行预定数量',
visible: false
},
{
field: 'zoneCode',
title: '库区编码',
visible: false
},
{
field: 'inventoryId',
title: '库存ID',
visible: false
},
{
field : 'cComUnitName',
title : '计量单位',
sortable:true
},
{
field: 'cWHCode',
title: '仓库编码',
},
{
field : 'cInvCode',
title : '物料编码',
sortable:true
},
{
field: 'cWHName',
title: '仓库名称',
sortable:true
},
{
field: 'cInvStd',
title: '物料规格',
visible: false
},
{
field: 'cInvName',
title: '物料名称',
visible:false
},
]
}
);
function createOutboundDocuments(){
debugger;
var cCompanyCode = $("select[name='cCompanyCode']").val();
var cWHCode = $("select[name='cCompanyCode']").find("option:selected").attr("name");
if (cCompanyCode && cWHCode){
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/getU8StockDataAll',
type: 'get',
data:{
"cCompanyCode":cCompanyCode,
"cWHCode":cWHCode
},
success : function (value) {
debugger;
if (value.code == 200){
}else {
$.modal.msg(value.msg);
}
}
});
}else {
$.modal.msg("请先查询U8工单!");
}
}
function numCheck(index){
$('input[id=dosage'+index+']').val($('input[id=dosage'+index+']').val().replace(/[^0-9.]/g,''));
}
/**
* 批量出库
*/
function outStockAll(){
var rows = $("#bootstrap-table-detail").bootstrapTable('getSelections');
if (rows.length == 0){
$.modal.msg("请选择库存数据!");
return
}
var list = [];
for (const i in rows) {
debugger
var serialNumber = rows[i].serialNumber;
var dosage = $('input[id=dosage'+serialNumber+']').val()
if (dosage == 0){
$.modal.msg("请输入出库数量!");
return;
}
var allocateId = rows[i].allocateId;
var modID = rows[i].modID;
var companyCode = rows[i].cCompanyCode;
var WHCode = rows[i].cWHCode;
var itemCode = rows[i].cInvCode;
var inventoryId = rows[i].inventoryId;
if (allocateId && modID && companyCode && WHCode && itemCode){
var material = {
"Qty":dosage,
"itemcode":itemCode,
"AllocateId":allocateId,
"inventoryId":inventoryId
};
list.push(material);
}
}
var data = {
"ModID":rows[0].allocateId,
"Companycode":rows[0].cCmpanyCode,
"WHCode":rows[0].cWHCode,
"list":list
};
workOrderOutAll(data);
}
function workOrderOutAll(data){
debugger
data = JSON.stringify(data);
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/workOrderOut',
type: 'get',
datatype: "json",
data:{
"u8OutParameters":data
},
success : function (value) {
debugger;
if (value.code == web_status.SUCCESS){
$.modal.msgSuccess(value.msg);
}else {
$.modal.msgError(value.msg);
}
}
});
}
/**
* 出库
*/
function outStock(allocateId,modID,companyCode,WHCode,index,itemCode,inventoryId,kty){
debugger;
var qty = $('input[id=dosage'+index+']').val();
if (!qty || qty == 0){
$.modal.msg("请输入出库数量!");
return
}
if (parseInt(qty) > parseInt(kty)){
$.modal.msg("出库数量不能大于库存数量!");
return
}
if (allocateId && modID && companyCode && WHCode && qty && itemCode){
var list = []
var material = {
"Qty":qty,
"itemcode":itemCode,
"AllocateId":allocateId,
"inventoryId":inventoryId
};
list.push(material);
var data = {
"ModID":modID,
"Companycode":companyCode,
"WHCode":WHCode,
"list":list
}
data = JSON.stringify(data);
debugger;
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/workOrderOut',
type: 'get',
datatype: "json",
data:{
"u8OutParameters":data
},
success : function (value) {
debugger;
if (value.code == 200){
$.modal.msgSuccess(value.msg);
}else {
$.modal.msgError(value.msg);
}
}
});
}
}
/*入库单列表-详细*/
function detail(cInvCode,needQuantity,receiveQuantity,modID,AllocateId) {
if (!cInvCode){
$.modal.msg("请从U8工单界面进入!");
return
}
loadDetail(cInvCode,needQuantity,receiveQuantity,modID,AllocateId);
}
/** 载入明细 */
function loadDetail(cInvCode,needQuantity,receiveQuantity,modID,AllocateId) {
var cCompanyCode = $("select[name='cCompanyCode']").val();
var cWHCode = $("select[name='cCompanyCode']").find("option:selected").attr("name");
debugger;
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/getU8StockData',
type: 'post',
data:{
"cInvCode":cInvCode,
"cCompanyCode":cCompanyCode,
"cWHCode":cWHCode,
"needQuantity":needQuantity,
"receiveQuantity":receiveQuantity,
"modID":modID,
"AllocateId":AllocateId
},
success : function (value) {
debugger
if (value.code == 200){
if (value.data.length == 0){
$.modal.msgError("WMS查询不到该物料!");
return
}
$("#myTab li").removeClass("active");
$("#tabHeader").removeClass("in active");
$("#myTab li:eq(1)").addClass("active");
$("#tabDetail").addClass("in active");
$("#bootstrap-table-detail").bootstrapTable('load',value.data);
}else{
$.modal.msgError(value.msg);
}
}
});
}
function importExcel() {
var currentId = 'importTpl';
layer.open({
type: 1,
area: ['400px', '230px'],
fix: false,
//不固定
maxmin: true,
shade: 0.3,
title: '导入数据',
content: $('#' + currentId).html(),
btn: ['<i class="fa fa-check"></i> 导入', '<i class="fa fa-remove"></i> 取消'],
// 弹层外区域关闭
shadeClose: true,
btn1: function(index, layero){
var file = layero.find('#file').val();
if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){
$.modal.msgWarning("请选择后缀为“xlsx”的文件。");
return false;
}
var index = layer.load(2, {shade: false});
// $.modal.disable();
var formData = new FormData();
formData.append("file", $('#file')[0].files[0]);
formData.append("updateSupport", $("input[name='updateSupport']").is(':checked'));
$.ajax({
url:ctx + 'shipment/shipmentU8ContainerHeader/importData',
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function (result) {
if (result.code == web_status.SUCCESS) {
$.modal.msgSuccess(result.msg);
$.table.refresh();
$.modal.closeAll();
} else if (result.code == web_status.WARNING) {
$.modal.enable();
$.modal.alertWarning(result.msg)
} else {
layer.close(index);
$.modal.enable();
$.modal.alertError(result.msg);
}
}
});
}
});
}
</script>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10">
<div class="col-xs-offset-1">
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<font color="red" class="pull-left mt10">
提示:仅允许导入“xls”或“xlsx”格式文件!
</font>
</div>
</form>
</script>
</body>
</html>