storageView.jsp
16.4 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
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
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
345
346
347
348
349
350
351
352
353
354
355
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<link href="${ctx}/assets/global/plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/assets/global/plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
<style>
.ui-autocomplete{
z-index: 111111;
}
</style>
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<fmt:message key="menu.cloud.storage"/>
<small><fmt:message key="仓位列表"/></small>
</h3>
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-list-alt"></i><fmt:message key="storage.slotList"/>
</div>
<security:authorize ifAnyGranted="ROLE_MANAGE_VIRTUAL">
<div class="actions">
<c:if test="${not empty storage && storage.virtual}">
<a href="#" class="btn btn-default btn-sm" id="AddNewBtn">
<i class="fa fa-plus"></i> <fmt:message key="增加仓位"/> </a>
</c:if>
</div>
</security:authorize>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table id="posList"
class="table table-striped table-hover table-bordered dataTable no-footer" role="grid"
aria-describedby="sample_editable_1_info">
<thead>
<tr role="row">
<th><fmt:message key="storagePos.name"/></th>
<security:authorize ifAnyGranted="ROLE_MANAGE_VIRTUAL">
<th><fmt:message key="操作"/></th>
</security:authorize>
<th><fmt:message key="限定物编"/></th>
<th style="width:15%;"><fmt:message key="component.partNumber"/></th>
<th style="width:15%;"><fmt:message key="barcode.barcode"/></th>
<th><fmt:message key="barcode.amount"/></th>
<th><fmt:message key="仓位尺寸"/></th>
<th><fmt:message key="barcode.plateSize"/></th>
<th></th>
</tr>
</thead>
<tbody>
<c:if test="${not empty posList}">
<c:forEach items="${posList}" var="slot">
<c:set var="enabledClass" value=""/>
<c:if test="${!slot.enabled}">
<c:set var="enabledClass" value="font-grey"/>
</c:if>
<tr class="${enabledClass}" id="tr${slot.id}">
<td>
<c:out value="${slot.labelStr}"/>
</td>
<security:authorize ifAnyGranted="ROLE_MANAGE_VIRTUAL">
<td id="td${slot.id}">
<c:if test="${loginUser.debug}">
<c:if test="${!slot.enabled}">
[
<a onclick="enablePos('${slot.id}',true);">
启用
</a>]
</c:if>
<c:if test="${slot.enabled}" >
[
<a onclick="enablePos('${slot.id}',false);">
禁用
</a>]
</c:if>
</c:if>
<c:if test="${!loginUser.debug}">
[
<a onclick="removePos('${slot.id}');">
删除
</a>]
</c:if>
</td>
</security:authorize>
<td>
<c:out value="${slot.specifiedPartNumber}"/>
</td>
<td>
<c:out value="${slot.barcode.partNumber}"/>
</td>
<td>
<c:out value="${slot.barcode.barcode}"/>
</td>
<td>
<c:out value="${slot.barcode.amount}"/>
</td>
<td>
${slot.w} x ${slot.h}
</td>
<td>
<c:if test="${not empty slot.barcode.plateSize}">
${slot.barcode.plateSize} x ${slot.barcode.height}
</c:if>
</td>
<td>
<c:if test="${not empty slot.barcode.partNumber}">
<button class="btn yellow" id="btn${slot.id}" onclick="checkoutStorage('${slot.id}')">
<i class="fa fa-sign-out"></i><fmt:message key="button.checkout"/></button>
</c:if>
</td>
</tr>
</c:forEach>
</c:if>
</tbody>
</table>
</div>
</div>
</div>
<!-- END EXAMPLE TABLE PORTLET-->
</div>
</div>
<!--End of update-->
<div class="modal fade" id="updatePosModal" tabindex="-1" role="basic" aria-hidden="true"
style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title"><fmt:message key="storagePos.update"/></h4>
</div>
<div class="modal-body">
<%--<%@include file="/common/success.jsp" %>--%>
<%--<%@include file="/common/error.jsp" %>--%>
<form method="get" action="${ctx}/storage/storagePosUpdate.html" id="storagePosForm" name="storagePos" cssClass="well">
<input type="hidden" id="storagePosId" name="id"/>
<label class="control-label col-md-2"><fmt:message key="storagePos.name"/></label>
<div style="text-align:left" class="input-group col-md-4">
<input type="text" id="posName" name="posName" class="form-control"/>
</div>
<label class="control-label col-md-2"><fmt:message key="storagePos.priority"/> </label>
<div style="text-align:left" class="input-group col-md-4">
<input type="text" id="posPriority" name="priority" class="form-control"/>
</div>
<label class="control-label col-md-2"><fmt:message key="storagePos.width"/> </label>
<div style="text-align:left" class="input-group col-md-4">
<input type="text" id="posW" name="w" class="form-control"/>
</div>
<label class="control-label col-md-2"><fmt:message key="storagePos.height"/></label>
<div style="text-align:left" class="input-group col-md-4">
<input type="text" id="posH" name="h" class="form-control"/>
</div>
<%--<label class="control-label col-md-2">是否可用</label>
<div style="text-align:left" class="input-group col-md-4">
<select id="enabled" name="enabled">
<option value="true">可用</option>
<option value="false">禁用</option>
</select>
</div>--%>
</form>
</div>
<div class="modal-footer">
<button type="button" name="saveStoragePos" class="btn btn-primary" onclick="saveStoragePos()">
<i class="icon-upload icon-white"></i> <fmt:message key="button.save"/>
</button>
<button type="button" name="cancel" class="btn btn-default"
onclick="$('#updatePosModal').modal('hide');">
<i class="icon-remove"></i> <fmt:message key="button.cancel"/>
</button>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<div id="stack1" class="modal fade" tabindex="-1" data-focus-on="input:first" aria-hidden="true"
style="display: none; margin-top: 0px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">[${storage.name}]增加料格</h4>
</div>
<div class="modal-body">
<label id="err"></label>
<div class="form-group">
<label>仓位编号:</label>
<input id="newPosName" type="text" class="form-control"/>
</div>
<div class="form-group">
<label>指定物编:</label>
<input id="partNumber" type="text" class="form-control"/>
</div>
<div class="form-group">
<label>可放料盘数量:</label>
<input id="reelCount" type="text" class="form-control"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal" ><i class="fa fa-history"></i><fmt:message key="button.cancel"/></button>
<button class="btn green" type="button" onclick="savePos();"><i class="fa fa-save"></i><fmt:message
key="button.save"/></button>
</div>
</div>
<c:set var="scripts" scope="request">
<script src="${ctx}/assets/global/plugins/bootstrap-modal/js/bootstrap-modalmanager.js" type="text/javascript"></script>
<script src="${ctx}/assets/global/plugins/bootstrap-modal/js/bootstrap-modal.js"></script>
<script src="${ctx}/assets/admin/pages/scripts/ui-extended-modals.js"></script>
<script language="JavaScript" type="text/javascript">
function enablePos(posId,enabled){
$.post("${ctx}/service/store/enablePos", {pid: posId,enabled:enabled }, function (data) {
if(data != ''){
alert(data);
}else{
$("#tr"+posId).toggleClass("font-grey");
if(enabled){
$("#td"+posId).html("否[<a onclick='enablePos("+posId+",false);'>禁用</a>]");
}else{
$("#td"+posId).html("否[<a onclick='enablePos("+posId+",true);'>启用</a>]");
}
alert("操作成功");
}
})
}
function removePos(posId){
var result = confirm("确定删除?");
if(result){
$.post("${ctx}/service/store/removePos", {pid: posId}, function (data) {
alert(data);
window.location.href="";
})
}
}
var table = $('#posList');
// begin first table
table.dataTable({
"bDestroy": true,
//"aaSorting": [[ 2, "desc" ]],//给列表排序 ,第一个参数表示数组 。4 就是css grade那列。第二个参数为 desc或是asc
"sScrollXInner": "100%",
//"bSort": false, //关闭排序
"bLengthChange": false, //关闭每页显示多少条数据
"bProcessing": true, //显示是否加载
"sScrollX": "100%",
"scrollY": "300px",
"scrollCollapse": true,
"order": [
[0, "asc"]
],
paging: false,
"language": {
"search": "查找: "
}
});
function checkoutStorage(posId) {
$("#btn"+posId).attr("disabled","true");
$.post("${ctx}/service/store/checkout.html", {pids: posId}, function (data) {
alert(data);
});
}
function savePos(){
$("#err").css("color","red")
$("#err").text("");
var storageId = "${storage.id}";
var posName = $("#newPosName").val();
var partNumber = $("#partNumber").val();
var reelCountStr = $("#reelCount").val();
if(!posName){
$("#err").text("仓位编号不能为空");
return;
}
if(!partNumber){
$("#err").text("指定物编不能为空");
return;
}
if(!reelCountStr){
$("#err").text("可放料盘数量不能为空");
return;
}
var reelCount = parseInt(reelCountStr);
if (isNaN(reelCount))
{
$("#err").text("可放料盘数量必须为大于0的数字");
return;
}
$.post("${ctx}/service/store/saveVirtualPos", {sid: storageId,posName:posName,partNumber:partNumber,reelCount:reelCount }, function (data) {
alert(data);
window.location.href="";
});
}
$("#partNumber").autocomplete({
source: function (request, response) {
$.ajax({
url: "${ctx}/component/fetchComponent",
dataType: "json",
data: {
comp: request.term
},
success: function (data) {
response($.map(data, function (item) {
return {
label: item.partNumber
};
}));
}
});
},
minLength: 1
});
$("#AddNewBtn").click(function(){
$('#stack1').modal("show");
})
</script>
</c:set>