shelf.jsp
6.3 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
<%@ page import="com.myproject.util.StorageConstants" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<style type="text/css">
.box{
margin-top: 10px;
}
.noOp{
background-color: #e5e5e5 !important;
cursor: auto !important;
}
</style>
<link href="${ctx}/scripts/lobibox/css/lobibox.min.css?id=2" rel="stylesheet" type="text/css"/>
<div id="row" class="">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="form-group col-lg-12">
<input type="text" class="form-control" id="scan-code"/>
<span id="msg"></span>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-md-3">仓位</label>
<div class="col-md-9">
<div class="input-group">
<input type="text" class="form-control" id="posName" readonly><span class="input-group-addon">
<input type="checkbox" id="autoPos" checked>自动推荐
</span>
</div>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-md-3">Reel ID</label>
<div class="col-md-9">
<input type="text" class="form-control" readonly id="barcode">
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-md-3">Part Number</label>
<div class="col-md-9">
<input type="text" class="form-control" readonly id="partNumber">
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-md-3">Qty</label>
<div class="col-md-9">
<input type="text" class="form-control" id="amount" readonly>
</div>
</div>
<div class="col-md-offset-4 col-md-8">
<div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<a href="#" class="btn btn-lg green m-icon-big" id="inBtn">
入料 <i class="m-icon-big-swapup m-icon-white"></i>
</a>
</div>
<div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<a href="#" class="btn btn-lg yellow m-icon-big" id="outBtn">
出料 <i class="m-icon-big-swapdown m-icon-white"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<c:set var="scripts" scope="request">
<script type="text/javascript">
$(".btn").addClass("noOp");
function showError(erroMsg){
$("#msg").text(erroMsg);
$(".btn").addClass("noOp");
}
$(".btn").click(function (){
var noOp = $(this).hasClass("noOp");
if(!noOp){
var pos = $("#posName").val();
var code = $("#barcode").val();
$.post("${ctx}/service/store/shelf/inOutPos", {cid: '${show}', code: code, pos: pos}, function (result) {
if(result != ''){
showError(result);
}else{
$("#posName").val("");
$("#barcode").val("");
$("#partNumber").val("");
$("#amount").val("");
showError("");
}
});
}
});
$("#autoPos").change(function () {
if ($(this).prop("checked")) {
$("#posName").attr('readonly',true);
} else {
$("#posName").attr('readonly',false);
}
});
$("#posName").change(function () {
if(!$("#autoPos").prop("checked")){
var posName = $("#posName").val();
$.post("${ctx}/service/store/shelf/checkPos", {cid: '${show}', pos: posName}, function (pos) {
if(pos){
var barcode = pos.barcode;
if(barcode){
$("#barcode").val(barcode.barcode);
$("#partNumber").val(barcode.partNumber);
$("#amount").val(barcode.amount);
showError("");
$("#outBtn").removeClass("noOp");
}
}else{
$("#posName").val("");
$("#posName").attr("placeholder", posName);
showError("未找到库位");
}
});
}
});
$("#scan-code").change(function () {
var codeValue = $(this).val();
$(this).val("");
$("#posName").val("");
$("#barcode").val("");
$("#partNumber").val("");
$("#amount").val("");
$(this).val("");
$(this).attr("placeholder", codeValue);
showError("");
$.post("${ctx}/service/store/resolveBarcode", {code: codeValue}, function (data) {
var barcode = data.barcode;
if(barcode != null){
$("#barcode").val(barcode.barcode);
$("#partNumber").val(barcode.partNumber);
$("#amount").val(barcode.amount);
$("#posName").val(barcode.posName);
}
if (data.error == null) {
if(barcode.posName == null || barcode.posName == ""){
$("#inBtn").removeClass("noOp");
$.post("${ctx}/service/store/shelf/nextPos", {cid: '${show}', code: barcode.barcode}, function (posResult) {
$("#posName").val(posResult);
});
}else{
$.post("${ctx}/service/store/shelf/checkPos", {cid: '${show}', pos: barcode.posName}, function (pos) {
});
$("#outBtn").removeClass("noOp");
}
} else {
showError(data.error);
}
});
})
</script>
</c:set>