PalletIn.js
6.79 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
layui.config({
base: "/js/"
}).use(['form', 'element', 'vue', 'layer', 'laydate', 'jquery','hhweb', 'table', 'utils', 'Universal'], function () {
var form = layui.form,
layer = layui.layer,
element = layui.element,
laydate = layui.laydate,
$ = layui.jquery,
table = layui.table,
Universal = layui.Universal;
var AreaName = 'task';
var TableName = 'TaskDetail';
var vm = new Vue({
el: '#PalletForm'
});
var PalletIn = new Vue({
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 (vm) {
console.log(vm);
table.reload('mainList', {
url: "/" + "task" + "/" + "Task" + "/StationToInventory"
, where: { stationCode: vm }
, method: "post"
, text: { none: "暂无数据,请扫码容器编号!" }
// , text: { none: this.NoData() }
});
}
};
var selector = {
'TaskType': {
SelType: "FromDict",
SelFrom: "taskType",
SelModel: "TaskType",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='TaskType']")]
},
'ContainerStatus': {
SelType: "FromDict",
SelFrom: "containerStatus",
SelModel: "ContainerStatus",
SelLabel: "DictLabel",
SelValue: "DictValue",
Dom: [$("[name='ContainerStatus']")]
}
};
var vml = new Array({
vm: vm,
});
Universal.BindSelector($, form, vml, selector);
//空栈板请求
$(document).on("click", "#btnEmpty", function () {
var a = $('[name = "IsShou"]:checked').val();
$.ajax({
async: false,
type:"post",
url: "/api/IEmptyPalletOut/EmptyPalletOut",
data: { station: a, type: "p_1" },
dataType: "json",
success: function (data) {
console.log("呼叫空板成功");
}
})
});
//物料添加
$(document).on("click", "#btnInventory", function () {
AddInventory();
});
//托盘入库
$(document).on("click", "#btnPalletIn", function () {
var b = $('[name = "IsShou"]:checked').val();
$.ajax({
async: false,
url: "/" + "task" + "/" + "Task" + "/HandTaskIn",
type: "post",
data: {containerCode: "",station: b },
dataType: "json",
success: function (result) {
if (result.code == 200) {
layer.msg("入库成功", { icon: 6, shade: 0.4, time: 1000 });
}
else {
layer.alert("失败:" + result.msg, { icon: 5, shadeClose: true, title: "错误信息" });
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
});
});
//打开页面聚焦“容器管理”
$(document).ready(function () {
$('[name = "ContainerId"]').focus();
});
//“容器编号”回车监听
$('[name = "ContainerId"]').bind("keydown", function (e) {
if (e.which == 13) {
AddInventory();
e.preventDefault(); //Skip default behavior of the enter key
//if ($(this).val() != "") {
// FindFirstTask();
// //改变焦点
// $('[name = "Num"]').focus();
//}
//else {
// $(this).focus();
//}
}
});
//根据站台请求物料信息
function AddInventory() {
var b = $('[name = "IsShou"]:checked').val();
var str = $('[name = "ContainerId"]').val();
var strs = str.split('%');
console.log(strs.length);
if (strs.length > 3) {
$('[name = "Num"]').val(strs[3]);
$('[name = "MaterialCode"]').val(strs[0]);
$('[name = "SourceCode"]').val(strs[1]);
$('[name = "Batch"]').val(strs[2]);
}
console.log($('[name = "MaterialCode"]').val());
$.ajax({
async: false,
url: "/" + "task" + "/" + "Task" + "/AddInventory",
type: "post",
data: { containerCode: '', material: $('[name = "MaterialCode"]').val(), batch: $('[name = "Batch"]').val(), station: b, num: $('[name = "Num"]').val(), sourceCode: $('[name = "SourceCode"]').val() },
dataType: "json",
success: function (result) {
if (result.code == 200) {
$('[name = "Num"]').val("");
$('[name = "MaterialCode"]').val("");
$('[name = "SourceCode"]').val("");
$('[name = "Batch"]').val("");
layer.msg("入库成功", { icon: 6, shade: 0.4, time: 1000 });
}
else {
layer.alert("失败:" + result.msg, { icon: 5, shadeClose: true, title: "错误信息" });
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, title: '提示' });
}
});
mainList.mainList(b);
}
//根据站台请求物料信息
function FindInventory(station) {
table.reload('listForm', {
url: "/" + "task" + "/" + "Task" + "/StationToInventory"
, where: station
, method: "post"
, text: { none: "暂无数据,请扫码容器编号!" }
// , text: { none: this.NoData() }
});
//$.ajax({
// async: false,
// url: "/" + "task" + "/" + "Task" + "/StationToInventory",
// type: "post",
// data: { stationCode: station },
// dataType: "json",
// success: function (result) {
// console.log(result)
// if (result.code == 200) {
// PalletIn.$set('$data', result.data);
// mainList.mainList(PalletIn);
// }
// else if (result.code == 0) {
// }
// else {
// layer.alert("失败:" + result.msg, { icon: 5, shadeClose: true, title: "错误信息" });
// }
// },
// error: function (XMLHttpRequest, textStatus, errorThrown) {
// layer.alert(errorThrown, { icon: 2, title: '提示' });
// }
//});
}
});