|
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
|
layui.config({
base: "/js/"
}).use(['form', 'element', 'vue', 'layer', 'laydate', 'jquery', 'table', 'hhweb', 'utils', 'Universal'], function () {
var form = layui.form,
layer = layui.layer,
element = layui.element,
laydate = layui.laydate,
$ = layui.jquery,
table = layui.table,
hhweb = layui.hhweb,
Universal = layui.Universal;
var AreaName = 'inventory';
var TableName = 'Inventory';
var vm = new Vue({
el: '#modifyForm'
});
var vmq = new Vue({
el: '#panelSearch',
data: {
}
});
var mainList = {
NoData: function () {
return "<div id='background' style='width:100%;height:100%;background-image:url(../../images/NoData.png);background-repeat:no-repeat;background-size:cover;'>.</div>"
},
mainList: function () {
table.reload('mainList', {
url: "/" + AreaName + "/" + TableName + "/Load"
, method: "post"
, text: { none: this.NoData() }
});
}
};
//编辑
var EditInfo = function (tabledata) {
data = tabledata;
vm.$set('$data', data);
//表单修改时填充需修改的数据
var list = {};
$('.ClearSelector_' + TableName).each(function () {
var selDom = ($(this));
if ($(selDom)[0].name.search("q") == -1) {
list[$(selDom)[0].name] = data[$(selDom)[0].name] + "";
}
});
//表单修改时填充需修改的数据
form.val('modifyForm', list);
};
var selfbtn = {
//自定义按钮
|
|
57
|
//直接出库
|
|
58
59
60
|
GoodsOut: function (index) {
var checkStatus = table.checkStatus('mainList');
var count = checkStatus.data.length;//选中的行数
|
|
61
|
var data1 = checkStatus.data;
|
|
62
|
if (count < 1) {
|
|
63
|
layer.alert("请至少选择一条数据", { icon: 5, shade: 0.4});
|
|
64
65
|
return;
}
|
|
66
|
$("#selectLoad").empty();
|
|
67
|
var list;
|
|
68
|
var IsOne = true;
|
|
69
|
$.ajax({
|
|
70
71
72
|
async: true,
type: "post",
url: "/receipt/ReceiptHeader/LoadStation",
|
|
73
|
data: { list: data1},
|
|
74
|
dataType: "json",
|
|
75
76
77
|
success: function (result) {
if (result.code == 200) {
list = result.data;
|
|
78
|
var html ;
|
|
79
|
var IsExistence = 0;
|
|
80
|
for (var i = 0; i < list.length; i++) {
|
|
81
|
var a = list[i].Code;
|
|
82
|
if (a == "ExitStationD01(P1000)" || a == "EntranceStationD01(P1000)" || a == "InStationB06(P3316)" || a == "OutStationB07(P3300)") {
|
|
83
84
85
86
87
|
continue;
}
else {
html += "<option class='select_Station' value='" + list[i].Code + "'>" + list[i].Name + "</option>";
}
|
|
88
89
90
91
92
93
94
95
96
97
98
99
100
|
}
$("#selectLoad").append(html);
layer.open({
type: 1,
// skin: 'layui-layer-molv',
btnAlign: 'c',
moveType: 1, //拖拽模式,0或者1
title: "选择站台并出库", //不显示标题
area: ['600px', '400px'], //宽高
content: $('#tanchuang'), //捕获的元素
scrollbar: true,
btn: ['出库', '关闭'],
yes: function (index, layero) {
|
|
101
102
|
if (IsOne) {
IsOne = false;
|
|
103
104
105
|
$.ajax({
url: "/" + AreaName + "/" + TableName + "/" + "GoodsOut",
type: "POST",
|
|
106
|
data: { Table_entitys: data1, Station: $("#selectLoad").val() },
|
|
107
108
|
dataType: "json",
success: function (result) {
|
|
109
|
layer.close(index);
|
|
110
111
112
113
|
if (result.Code == 200) {
layer.msg("出库任务创建成功!", { icon: 6, shade: 0.4, time: 1000 });
mainList.mainList();
} else {
|
|
114
|
layer.alert("失败:" + result.Message, { icon: 5, shadeClose: true, title: "错误信息" });
|
|
115
116
117
118
119
120
|
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
});
|
|
121
|
}
|
|
122
|
},
|
|
123
124
|
cancel: function (index) {
layer.close(index);
|
|
125
126
|
}
});
|
|
127
|
} else {
|
|
128
|
layer.alert("请选择相同仓库类型的库存出库", { icon: 5, shadeClose: true, title: "错误信息" });
|
|
129
130
|
}
},
|
|
131
132
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
|
|
133
134
|
}
});
|
|
135
|
|
|
136
|
|
|
137
|
},
|
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
//盘点出库
InventoryOut: function () {
var checkStatus = table.checkStatus('mainList');
var count = checkStatus.data.length;//选中的行数
var data1 = checkStatus.data;
if (count < 1) {
layer.alert("请至少选择一条数据", { icon: 5, shade: 0.4, time: 1000 });
return;
}
$("#selectLoad").empty();
var list;
$.ajax({
async: true,
type: "post",
url: "/receipt/ReceiptHeader/LoadStation",
data: { list: data1 },
dataType: "json",
success: function (result) {
|
|
156
157
|
if (result.code == 200) {
list = result.data;
|
|
158
|
var html ;
|
|
159
160
|
for (var i = 0; i < list.length; i++) {
var a = list[i].Code;
|
|
161
|
if (a == "ExitStationY01" || a == "EntranceStationB01" || a == "EntranceStationB02" || a == "EntranceStationD01" ) {
|
|
162
|
html += "<option class='select_Station' value='" + list[i].Code + "'>" + list[i].Name + "</option>";
|
|
163
|
}
|
|
164
|
else {
|
|
165
|
continue;
|
|
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
|
}
}
$("#selectLoad").append(html);
layer.open({
type: 1,
btnAlign: 'c',
moveType: 1, //拖拽模式,0或者1
title: "选择站台并出库", //不显示标题
area: ['600px', '400px'], //宽高
content: $('#tanchuang'), //捕获的元素
scrollbar: true,
btn: ['出库', '关闭'],
yes: function (index, layero) {
$.ajax({
url: "/" + AreaName + "/" + TableName + "/" + "CYCOutNoBack",
type: "POST",
data: { entitys: data1, Station: $("#selectLoad").val() },
dataType: "json",
success: function (result) {
if (result.Code == 200) {
layer.msg("盘点任务创建成功!", { icon: 6, shade: 0.4, time: 1000 });
layer.close(index);
mainList.mainList();
} else {
layer.alert(result.Message, { icon: 5, shadeClose: true, title: "错误信息" });
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
});
//}
},
cancel: function (index) {
layer.close(index);
}
});
} else {
layer.alert("请选择相同库位的库存出库", { icon: 5, shadeClose: true, title: "错误信息" });
}
|
|
206
207
208
209
210
211
|
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
});
|
|
212
|
|
|
213
214
215
|
},
//关闭盘点
InventoryClose: function () {
|
|
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
|
//layer.alert("确定关闭盘点模式?", { shadeClose: true, title: "提示信息" }, function (index) {
layer.open({
type: 1,
btnAlign: 'c',
moveType: 1, //拖拽模式,0或者1
title: "选择结束盘点仓库", //不显示标题
area: ['600px', '400px'], //宽高
content: $('#region'), //捕获的元素
scrollbar: true,
btn: ['关闭', '关闭'],
yes: function (index, layero) {
$.ajax({
async: true,
type: "post",
url: "/inventory/Inventory/CloseCYC",
data: { region: $('[name = "region"]').val()},
dataType: "json",
success: function (result) {
if (result.Code == 200) {
layer.msg("盘点任务关闭成功!", { icon: 6, shade: 0.4, time: 1000 });
mainList.mainList();
layer.close(index);
ContainerIdFocus();
}
else {
layer.alert("错误:" + result.msg, { icon: 5, shadeClose: true, title: "错误信息" });
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
|
|
246
|
}
|
|
247
248
249
250
251
|
});
},
cancel: function (index) {
layer.close(index);
}
|
|
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
|
//删除库存
DelInv: function (index) {
var checkStatus = table.checkStatus('mainList');
var count = checkStatus.data.length;//选中的行数
var data1 = checkStatus.data;
if (count < 1) {
layer.alert("请至少选择一条数据", { icon: 5, shade: 0.4 });
return;
}
$("[name = 'DelName']").val("");
layer.open({
title: '请输入删除人姓名或姓名首字母',
area: ["300px", "350px"],
type: 1,
content: $('#DeleteName'),
btn: ['确认'],
yes: function (index) {
var name = $("[name = 'DelName']").val();
if (name == "") {
layer.alert("请输入删除人姓名或姓名首字母!", { icon: 2, title: '提示' });
} else {
layer.close(index);
layer.alert("确定删除当前所选的库存数据吗?", { icon: 3, shadeClose: true, title: "信息确认" }, function (index) {
$.ajax({
async: false,
type: "post",
url: "/" + AreaName + "/" + TableName + "/" + "DelInv",
data: { Invs: data1, Name: name },
dataType: "json",
success: function (result) {
console.log(result)
if (result.Code == 200) {
layer.msg("库存删除成功", { icon: 6, shade: 0.4, time: 1000 });
layer.close(index);
mainList.mainList();
}
else {
layer.alert("失败:" + result.Message, { icon: 5, shadeClose: true, title: "错误信息" }, function (index) { InEnd(); layer.close(index); });
}
},
error: function (errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
})
});
}
}
});
},
|
|
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
|
DomConfig: function (AddOrUpdate) {
if (AddOrUpdate) {
hhweb.DomEnable($("#modifyForm [name='MaterialCode']"));
hhweb.DomEnable($("#modifyForm [name='Status']"));
hhweb.DomEnable($("#modifyForm [name='Qty']"));
}
else {
hhweb.DomDisable($("#modifyForm [name='WirePart']"));
hhweb.DomDisable($("#modifyForm [name='Status']"));
hhweb.DomDisable($("#modifyForm [name='Qty']"));
}
},
SaveBefore: function (AddOrEditOrDelete) {
if (AddOrEditOrDelete in { Add: null, Edit: null }) {
var rtn = hhweb.CheckRequired("#modifyForm", AddOrEditOrDelete);
return rtn;
}
}
};
var selector = {
'Status': {
SelType: "FromDict",
SelFrom: "inventoryStatus",
SelModel: "Status",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='Status']"), $("[name='qStatus']")]
},
'ContainerStatus': {
SelType: "FromDict",
SelFrom: "containerStatus",
SelModel: "ContainerStatus",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='ContainerStatus']"), $("[name='qContainerStatus']")]
},
|
|
345
346
347
348
349
350
351
352
|
'TaskStatus': {
SelType: "FromDict",
SelFrom: "IsCyclecountStatus",
SelModel: "TaskStatus",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='TaskStatus']"), $("[name='qTaskStatus']")]
},
|
|
353
|
'LocationCode': {
|
|
354
355
|
SelType: "FromUrl",
SelFrom: "/general/Station/Load",
|
|
356
|
SelModel: "LocationCode",
|
|
357
358
359
|
SelLabel: "Name",
SelValue: "Code",
Dom: [$("[name='LocationCode']"), $("[name='qLocationCode']")]
|
|
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
},
'IsPack': {
SelType: "FromDict",
SelFrom: "IsPack",
SelModel: "IsPack",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='IsPack']"), $("[name='qIsPack']")]
},
'IsFold': {
SelType: "FromDict",
SelFrom: "IsFold",
SelModel: "IsFold",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='IsFold']"), $("[name='qIsFold']")]
|
|
376
|
},
|
|
377
378
|
'TaskStatus': {
SelType: "FromDict",
|
|
379
|
SelFrom: "IsCyclecountStatus",
|
|
380
381
382
383
|
SelModel: "TaskStatus",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='TaskStatus']"), $("[name='qTaskStatus']")]
|
|
384
385
386
387
388
389
390
391
|
},
'WarehouseType': {
SelType: "FromDict",
SelFrom: "WarehouseType",
SelModel: "WarehouseType",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='WarehouseType']"), $("[name='qWarehouseType']")]
|
|
392
|
}
|
|
393
394
395
396
397
398
399
400
401
402
|
};
var vml = new Array({
vm: vm,
vmq: vmq,
});
Universal.BindSelector($, form, vml, selector);
Universal.mmain(AreaName, TableName, table, layer, element, laydate, $, vm, vmq, EditInfo, selfbtn, mainList, form);
});
|