WireIn.js
2.12 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
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,
hhweb = layui.hhweb,
laydate = layui.laydate,
$ = layui.jquery,
table = layui.table,
Universal = layui.Universal;
var AreaName = 'task';
var TableName = 'Task';
var clear = function () {
//$("[name='InputGoodsNo']").focus();
$(firstText).focus();
$("[name='GoodsNo']").val('');
$("[name='WirePart']").val('');
$("[name='LotNo']").val('');
$("[name='WireLength']").val('');
};
clear();
$("[name='BarCode']").bind("keydown", function (e) {
if (e.which == 13) {
$.ajax({
url: "/" + AreaName + "/" + TableName + "/" + "WireIn",
type: "POST",
data: { barcode: $("[name='BarCode']").val() },
dataType: "json",
success: function (result) {
if (result.code == 200) {
$("[name='GoodsNo']").val(result.data[0]);
$("[name='WirePart']").val(result.data[1]);
$("[name='WireLength']").val(result.data[2]);
$("[name='LotNo']").val(result.data[3]);
$("[name='BarCode']").val('');
$(firstText).focus();
layer.msg("入库任务创建成功!", { icon: 6, shade: 0.4, time: 1000 });
} else {
layer.alert("入库失败! " + result.Message, { icon: 5, shadeClose: true, title: "错误信息" });
clear();
$(firstText).focus();
}
},
error: function () {
layer.alert(error.responseText, { icon: 2, title: '提示' });
}
});
}
});
$(".button").click(function () {
$("[name='BarCode']").val('');
clear();
});
});