barcodeUpdate.jsp
10.0 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
<%@ page import="com.myproject.webapp.controller.webService.DataCache" %><%--
Created by IntelliJ IDEA.
User: kangmor
Date: 2015/12/2
Time: 21:31
--%>
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8"%>
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<fmt:message key="barcode.updateTitle"/>
</h3>
<!--Begin of update-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN PORTLET-->
<div class="portlet box green-jungle">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-pencil"></i><fmt:message key="barcode.updateTitle"/>
</div>
<div class="actions">
<a href="${ctx}/barcode/barcodeUpdate.html" class="btn btn-default btn-sm">
<i class="fa fa-plus"></i> <fmt:message key="button.add"/> </a>
<a href="barcodeSearch.html" class="btn btn-default btn-sm">
<i class="fa fa-reply"></i> <fmt:message key="button.return"/> </a>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form:form commandName="barcode" class="form-horizontal form-bordered" action="barcodeUpdate.html">
<form:hidden path="id"/>
<form:hidden path="type"/>
<div class="form-body">
<%@include file="/common/success.jsp"%>
<%@include file="/common/error.jsp"%>
<c:if test='<%=!DataCache.isProductionFor("ChengDuKaiTian") %>'>
<div class="form-group">
<label class="control-label col-md-2"><fmt:message key="barcode.barcode"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" id="barcodeStr" path="barcode" class="form-control"/>
<c:if test="${barcode.id != null}">
<span class="input-group-addon">
<a onclick="printFun();"><fmt:message key="barcode.print"/> </a>
</span>
</c:if>
<form:errors path="barcode" cssStyle="color: red"/>
</div>
</div>
<label class="control-label col-md-2"><fmt:message key="barcode.partNumber"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" id="partNumber" path="partNumber" class="form-control"/>
<form:errors path="partNumber" cssStyle="color: red"/>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2"><fmt:message key="barcode.plateSize"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" id="plateSize" path="plateSize" class="form-control"/>
</div>
</div>
<label class="control-label col-md-2"><fmt:message key="barcode.height"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" id="height" path="height" class="form-control"/>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2"><fmt:message key="barcode.amount"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" id="amount" path="amount" class="form-control"/>
</div>
</div>
<label class="control-label col-md-2"><fmt:message key="barcode.expireDate"/></label>
<div class="col-md-4">
<div style="text-align:left" class="input-group">
<form:input type="text" path="expireDate" class="form-control form-control-inline input-medium date-picker" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2"><fmt:message key="barcode.memo"/></label>
<div class="col-md-9">
<div style="text-align:left;width:100%;" class="input-group">
<form:textarea id="memo" path="memo" class="form-control" style="height:100px;" />
</div>
</div>
</div>
</c:if>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<button class="btn green" type="submit" name="method" value="add"><i class="fa fa-save"></i><fmt:message key="button.save"/></button>
<c:if test="${not empty barcode.id}">
<button class="btn red" type="submit" name="method" value="delete"><i class="fa fa-trash-o"></i><fmt:message key="button.delete"/></button>
</c:if>
<button type="button" class="btn default" onclick="window.location=''"><i class="fa fa-history"></i><fmt:message key="button.cancel"/></button>
</div>
</div>
</div>
</form:form>
<!-- END FORM-->
</div>
</div>
<!-- END PORTLET-->
</div>
</div>
<!--End of update-->
<c:set var="scripts" scope="request">
<script>
function printFun(){
var codeStr = $("#barcodeStr").val();
window.open('${ctx}/qrcode.html?barcode=' + codeStr);
}
$("#partNumber").autocomplete({
source: function (request, response) {
$.ajax({
url: "${ctx}/component/fetchComponent",
dataType: "json",
data: {
pn: request.term
},
success: function (data) {
response($.map(data, function (item) {
return {
label: item.partNumber,
id: item.id,
partNumber: item.partNumber,
plateSize: item.plateSize,
height:item.height,
amount:item.amount,
type:item.type
};
}));
}
});
},
minLength: 1,
select: function( event, ui ) {
// log( ui.item ?
// "Selected: " + ui.item.label :
// "Nothing selected, input was " + this.value);
$("#plateSize").val(ui.item.plateSize);
$("#partNumber").val(ui.item.partNumber);
$("#height").val(ui.item.height);
$("#amount").val(ui.item.amount);
$("#type").val(ui.item.type);
}
});
function saveBarcode() {
$("#operation").val("save");
$("#barcodeGenerateForm").submit();
}
$('#size').change(function(){
var selectValue = $(this).children('option:selected').val();
if(selectValue != ""){
var strs = selectValue.split("x");
$("#plateSize").val(strs[0]);
$("#height").val(strs[1]);
if(strs[0] == '8'){
//散料夹具
$('#partNumber').val("BULK_TRAY");
}else if(strs[0] == '8.0'){
//隔料夹具
$("#plateSize").val("8");
$('#partNumber').val("SPLIT_BULK_TRAY");
}else{
//盘料
$('#partNumber').val("COMPONENT");
}
}
})
if(${barcode.plateSize > 0}){
var sizeOptionValue = "${barcode.plateSize}x${barcode.height}";
var sizeOption = $("#size option[value="+sizeOptionValue+"]");
if(sizeOption.length <= 0){
$("#size").append("<option value='"+sizeOptionValue+"'>"+sizeOptionValue+"</option>");
}
$('#size').val(sizeOptionValue);
}else{
//$('#partNumber').val("BULK_TRAY");
}
fetchBarcode = function(fieldStr){
var opt = {
source: function (request, response) {
$.ajax({
url: "${ctx}/service/store/fetchBarcode",
dataType: "json",
data: {
fieldStr: fieldStr,
fieldVal: request.term,
},
success: function (data) {
response($.map(data, function (item) {
return {
label: eval("item."+fieldStr),
id: item.id,
otherField1: item.otherField1,
otherField2: item.otherField2,
otherField3: item.otherField3,
otherField4: item.otherField4,
otherField5: item.otherField5,
otherField6: item.otherField6,
amount: item.amount,
partNumber: item.partNumber,
plateSize: item.plateSize,
height: item.height
};
}));
}
});
},
minLength: 1,
select: function( event, ui ) {
$("#otherField1").val(ui.item.otherField1);
$("#otherField2").val(ui.item.otherField2);
$("#otherField3").val(ui.item.otherField3);
$("#amount").val(ui.item.amount);
$("#otherField4").val(ui.item.otherField4);
$("#otherField5").val(ui.item.otherField5);
$("#otherField6").val(ui.item.otherField5);
$('#partNumber').val(ui.item.partNumber);
$('#plateSize').val(ui.item.plateSize);
$('#height').val(ui.item.height);
var sizeOptionValue = ui.item.plateSize + "x"+ ui.item.height;
var sizeOption = $("#size option[value="+sizeOptionValue+"]");
if(sizeOption.length <= 0){
$("#size").append("<option value='"+sizeOptionValue+"'>"+sizeOptionValue+"</option>");
}
$('#size').val(sizeOptionValue);
}
}
return opt;
}
$("#otherField2").autocomplete(fetchBarcode("otherField2"));
$("#otherField1").autocomplete(fetchBarcode("otherField1"));
$("#otherField3").autocomplete(fetchBarcode("otherField3"));
$("#otherField4").autocomplete(fetchBarcode("otherField4"));
$("#otherField5").autocomplete(fetchBarcode("otherField5"));
</script>
</c:set>