shipmentICSmomOrder.html
14.8 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
<!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">生产订单展示</a></li>
<li><a href="#tabDetail" data-toggle="tab">产生品入库选择</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>
生产订单主表ID:<input name="MoId" type="text"/>
</li>
<li>
生产订单号:<input type="text" name="MoCode"/>
</li>
<li>
备注:<input type="text" name="cMemo"/>
</li>
<li>
制单人:<input type="text" name="cMaker"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="workOrderSearch()">
<i class="fa fa-search"></i> 搜索</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('inventorySts')}]];
var rossDoccking = [[${@permission.hasPermi('shipment:bill:rossDoccking')}]];
var shipmentId = "";
var shipmentCode="";
function workOrderSearch(){
var MoId = $("input[name='MoId']").val();
var MoCode = $("input[name='MoCode']").val();
var cMemo = $("input[name='cMemo']").val();
var cMaker = $("input[name='cMaker']").val();
$.ajax({
url:ctx + 'shipment/shipmentICSmomOrder/getICSmomOrder',
type: 'post',
data:{
"MoId":MoId,
"MoCode":MoCode,
"cMemo":cMemo,
"cMaker":cMaker
},
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');
}
}
});
}
$("#bootstrap-table").bootstrapTable({
modalName: "生产单",
sortName: "created",
sortOrder: "desc",
search: false,
pageSize: 10,
pagination:true,
columns: [
{
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="detail(\'' + row.moId + '\',\'' + row.moCode + '\')"><i class="fa fa-print"></i>成品入库选择</a> ');
return actions.join('');
}
},
{
field: 'moId',
title: '生产订单主表ID',
sortable:true
},
{
field: 'moCode',
title: '生产订单号',
},
{
field: 'dDate',
title: '订单日期',
},
{
field: 'cPersonCode',
title: '人员代码',
},
{
field: 'cPersonName',
title: '人员名称',
},
{
field : 'cMemo',
title : '备注',
},
{
field: 'cMaker',
title: '制单人',
},
{
field : 'companyCode',
title : '公司代码(账套代码)',
},
{
field: 'cModifyDate',
title: '维护日期',
}
]
});
$("#bootstrap-table-detail").bootstrapTable(
{
sortable: true, //排序
modalName: "生产单明细",
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.moId + '\',\'' + row.moCode + '\',\'' + row.moDId + '\',\'' + index + '\',\'' + row.iQuantity + '\')"><i class="fa fa-print"></i>入库选择</a> ');
return actions.join('');
}
},
{
field: 'dosage',
title: '入库数量',
valign:'middle',
align:"center",
clear:false,
formatter : function(value, row, index) {
var qty1 = row.iQuantity;
var html = '<input id="dosage'+index+'" onblur="numCheck('+index+')" value="'+qty1+'" width="10" >';
return html;
}
},
{
field: 'moId',
title: '生产订单主表ID',
visible: true
},
{
field: 'moCode',
title: '生产订单号',
visible: true
},
{
field: 'moDId',
title: '生产订单明细资料ID',
visible: true
},
{
field: 'cItemName',
title: '项目号'
},
{
field: 'sortSeq',
title: '行号',
visible: true
},
{
field: 'cInvCode',
title: '存货编码'
},
{
field : 'cInvName',
title : '存货名称',
sortable:true
},
{
field : 'cInvStd',
title : '规格型号',
sortable:true
},
{
field: 'iQuantity',
title: '数量',
visible: true
},
{
field: 'cComUnitName',
title: '计量单位',
visible: false
},
{
field: 'cMemo',
title: '订单行备注',
},
{
field : 'startDate',
title : '计划开工日期',
sortable:true
},
{
field: 'dueDate',
title: '计划完工日期',
sortable:true
},
]
}
);
function numCheck(index){
$('input[id=dosage'+index+']').val($('input[id=dosage'+index+']').val().replace(/[^0-9.]/g,''));
}
/**
* 批量出库
*/
function outStockAll(){
debugger
var rows = $("#bootstrap-table-detail").bootstrapTable('getSelections');
if (rows.length == 0){
$.modal.msg("请选择明细数据!");
return
}
var list = [];
for (const i in rows) {
debugger
var dosage = $('input[id=dosage'+parseInt(i)+']').val()
if (dosage == 0){
$.modal.msg("请输入出库数量!");
return;
}
var moId=rows[i].moId;
var moCode=rows[i].moCode;
var modID = rows[i].MoDId;
if (moId && moCode && modID){
var material = {
"qty":dosage,
"MoId":moId,
"MoCode":moCode,
"modID":modID
};
list.push(material);
}
}
var data = {
"list":list
};
workOrderOutAll(data);
}
function workOrderOutAll(data){
debugger
data = JSON.stringify(data);
$.ajax({
url:ctx + 'shipment/shipmentICSmomOrder/inStorage',
type: 'get',
datatype: "json",
data:{
"parameters":data
},
success : function (value) {
debugger;
if (value.code == 200){
$.modal.msgSuccess(value.msg);
}else {
$.modal.msgError(value.msg);
}
}
});
}
/**
* 出库
*/
function outStock(MoId,MoCode,modID,index,kqty){
debugger;
var qty = $('input[id=dosage'+index+']').val();
if (!qty || qty == 0){
$.modal.msg("请输入出库数量!");
return
}
if (parseInt(qty) > parseInt(kqty)){
$.modal.msg("入庫数量不能大于单据数量!");
return
}
if (MoId && MoCode && modID && qty){
var data = {
"MoId":MoId,
"MoCode":MoCode,
"modID":modID,
"qty":qty
}
data = JSON.stringify(data);
debugger;
$.ajax({
url:ctx + 'shipment/shipmentICSmomOrder/inStorage',
type: 'get',
datatype: "json",
data:{
"parameters":data
},
success : function (value) {
debugger;
if (value.code == 200){
$.modal.msgSuccess(value.msg);
}else {
$.modal.alertError(value.msg);
}
}
});
}
}
/*入库单列表-详细*/
function detail(MoId,MoCode) {
if (!MoCode){
$.modal.msg("请从生产单据界面进入!");
return
}
loadDetail(MoId,MoCode);
}
/** 载入明细 */
function loadDetail(MoId,MoCode) {
debugger;
$.ajax({
url:ctx + 'shipment/shipmentICSmomOrder/getICSmomOrderDetail',
type: 'post',
data:{
"MoId":MoId,
"MoCode":MoCode
},
success : function (value) {
debugger
if (value.code == 200){
if (value.data.length == 0){
$.modal.msgError("无明细哈哈哈啊哈哈哈哈哈!");
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.alertError(value.msg);
}
}
});
}
</script>
</body>
</html>