inlandsave.jsp
13.6 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="<%=basePath%>resource/css/base.css?version=${version}" rel="stylesheet">
<link href="<%=basePath%>resource/css/basic_info.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="<%=basePath%>resource/easyui/uimaker/icon.css?version=${version}">
<link rel="stylesheet" href="<%=basePath%>resource/easyui/uimaker/easyui.css?version=${version}">
<link rel="stylesheet" href="<%=basePath%>resource/css/form.css?version=${version}">
<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js?version=${version}"></script>
<script type="text/javascript" src="<%=basePath%>resource/validate/jquery.validate.js?version=${version}"></script>
<script type="text/javascript" src="<%=basePath%>resource/validate/validate-extends.js?version=${version}"></script>
<link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css?version=${version}" media="all">
<script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js?version=${version}"></script>
<script type="text/javascript" src="<%=basePath%>resource/layui/layui.js?version=${version}"></script>
<style type="text/css">
.required_span {
color: red;
margin-left: 10px;
font-size: 20px;
}
</style>
<!-- validate 验证中英文 -->
<script type="text/javascript"
src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
</head>
<body>
<div class="container">
<div class="content">
<form class="from-control" id="form">
<%--<input type="hidden" id="id" name="id" value="${sd.id}">--%>
<table class="kv-table" id="tableId">
<tbody>
<tr>
<td class="kv-label">主单号
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required id="waybill" minlength="12" name="waybill" type="text" onblur="input_change(this)">
</td>
<script>
function input_change(obj){
var val = $(obj).val();
if(val){
checkNo(val);
}
//用户输入订单号满足格式
}
</script>
<td class="kv-label">航空货物性质
<span class="required_span">*</span>
</td>
<td class="kv-content">
<label>
<input id="one" onchange="riskType(this.value)" name="one" type="radio" value="A" checked>普通货物
</label>
<label>
<input id="two" onchange="riskType(this.value)" name="one" type="radio" value="B">特种货物
</label>
<label>
<input id="three" onchange="riskType(this.value)" name="one" type="radio" value="C">危险品
</label>
<label>
<input id="four" onchange="riskType(this.value)" name="one" type="radio" value="D">航空快件
</label>
<div id="cc3" style="display: none">
<select id="cc2" class="easyui-combobox" name="dept" style="width:200px">
<option value="C1">爆炸物</option>
<option value="C2">压缩气体和液化气体</option>
<option value="C3">易燃液体</option>
<option value="C4">易燃固体、自燃物品、遇湿易燃物品</option>
<option value="C5">氧化物和有机过氧化物</option>
<option value="C6">毒性物质和感染性物质</option>
<option value="C7">放射性物质</option>
<option value="C8">腐蚀品</option>
<option value="C9">杂项危险品-ELI/RLI:锂离子电池(与设备放于同一包装/已安装于设备中)</option>
<option value="C10">杂项危险品-ELM/RLM:锂金属电池(与设备放于同一包装/已安装于设备中)</option>
<option value="C11">杂项危险品-RBI/EBI:锂离子电池</option>
<option value="C12">杂项危险品-RBM/EBM:锂金属电池</option>
<option value="C13">杂项危险品-其他杂项危险品</option>
</select>
</div>
</td>
</tr>
<tr>
<td class="kv-label">承运航空公司
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required name="carrier" id="carrier" type="text" placeholder="如:CV">
</td>
<td class="kv-label">航班号
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required type="text" name="flightno" id="flightno" placeholder="如:0000">
</td>
</tr>
<tr>
<td class="kv-label">日期
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required name="flightdate" id="flightdate" type="date">
</td>
<td class="kv-label">航空货物托运人名称
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required id="sd_cargo_shipper_name" name="sd_cargo_shipper_name" type="text">
</td>
</tr>
<tr>
<td class="kv-label">航空货运销售代理人名称
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required id="sd_cargo_agent_name" name="sd_cargo_agent_name" type="text">
</td>
<td class="kv-label">航协编号
<span class="required_span"></span>
</td>
<td class="kv-content">
<input id="sd_iata_number" name="sd_iata_number" type="text">
</td>
</tr>
<tr>
<td class="kv-label">货物品名
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required id="sd_cargo_name" name="sd_cargo_name" type="text" placeholder="品名分别用逗号隔开">
</td>
<td class="kv-label">公斤
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required type="text" name="totalweight" id="totalweight">
</td>
</tr>
<tr>
<td class="kv-label">件数
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required type="text" name="totalpiece" id="totalpiece">
</td>
<td class="kv-label">目的地
<span class="required_span">*</span>
</td>
<td class="kv-content">
<input required type="text" name="destinationstation" id="destinationstation">
</td>
</tr>
<tr>
<td class="kv-label">运输条件鉴定书
</td>
<td class="kv-content">
<input id="sd_transport_certificate" name="sd_transport_certificate" type="text">
</td>
<td class="kv-label">航空公司同意运输证明
</td>
<td class="kv-content">
<input id="sd_transportation_prove" name="sd_transportation_prove" type="text" placeholder="运输证明分别用逗号隔开">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<div class="opt-buttons" style="padding-top: 20px;text-align: right;" id="divsubmit">
<a onclick="savesend()" class="easyui-linkbutton l-btn l-btn-small l-btn-selected "
data-options="selected:true">
<span class="l-btn-left"><span class="l-btn-text"><spring:message
code="opt.saveandsend" /></span></span>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div id="DialogShunt" class="easyui-dialog" title="报文" style="width: 800px; height: 800px;"
data-options="iconCls:'pag-list',modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,closed:true">
<div style="margin-left: 5px; margin-right: 5px; margin-top: 5px;">
<div class="data-tips-info">
<div class="data-tips-tip icon-tip"></div>
</div>
<div class="modal-body" style="padding-top: 3px; padding-left: 20px; padding-right: 3px;">
<textarea id="xmlContent" style="width: 100%; height: 400px;"></textarea>
</div>
<div style="text-align: center; padding-top: 30px;"></div>
</div>
</div>
<!-- 外部js -->
<script type="text/javascript" src="<%=basePath%>resource/My97DatePicker/WdatePicker.js?version=${version}"></script>
<script src="<%=basePath%>resource/easyui/jquery.easyui.min.js?version=${version}"></script>
<script src="<%=basePath%>/resource/js/tools.js?version=${version}"></script>
<!--弹出层引入的JS-->
<script type="text/javascript">
var layerIndex;
var layer;
layui.use('layer', function(){
layer = layui.layer;
});
function viewXml(){
if($("#ids").val()==''){
layer.open({content:"<spring:message code='manifest.send.message.failed'/>"});
}else{
$("#mask").show();
showMask();
$("#mask").append("<spring:message code='manifest.send'/>");
$.post("<%=basePath%>manifest/xml",{id:$("#ids").val()},function(data){
// layer.open({content:data.data});
layer.open({content:"<spring:message code='manifest.send.message.successfully'/>"});
hideMask();
})
}
}
function riskType(value) {
if (value == "C"){
document.getElementById("cc3").style.display='block'
}else {
document.getElementById("cc3").style.display='none'
}
}
var selectFals = false;
//发送报文并且保存
function savesend(){
var isValid = $("#form").valid();
if(isValid){
layerIndex = parent.layer.load(1, {
shade: [0.6,'#000000'] //0.1透明度
});
var chboxValue=[];
var checkBox = $("input[name=one],input[name=two],input[name=three],input[name=four]");
for (var i=0; i<checkBox.length; i++){
if (checkBox[i].checked){
selectFals = true;
}
}
var waybill = $("#waybill").val();
if (selectFals == true){
var data = $("#form").serialize();
$.post("<%=basePath%>declaration/inlandsave?waybill="+waybill,data,function (data) {
parent.layer.close(layerIndex);
if (data.status == 200) {
$("#xmlContent").val(data.data);
$("#DialogShunt").window('open');
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(index);
}
else if (data.status == 203){
alert("安检申报不可以重复添加");
}else if(data.status == 204){
alert("请前往预配界面添加安检申报");
} else {
layer.open({content:data.msg});
}
})
}else {
alert("货物性质至少选择一项");
return false;
}
}
}
//主单号校验
function checkNo(content){
if (content) {
var reg = /^(\d{3})(-)(\d{8})$/;
var flag = content.match(reg);
if(flag==null){
layui.use('layer', function(){
var layer = layui.layer;
parent.layer.alert('主单号格式错误,请检查运单号位数及格式,例如:172-30937185', {icon: 0});
$("#waybill").focus();
});
return;
}
content = content.replace(/ /g,'');
$("#waybill").val(content);
if(content.length>4){
var forth = content.substring(3,4);
if(forth!='-'){
var start = content.substring(0,3);
var end = content.substring(3,content.length);
content = start+"-"+end;
$("#waybill").val(content);
}
}
if(content.length>12){
content = content.substring(0,12);
$("#waybill").val(content);
}
if(content.length<12){
layui.use('layer', function(){
var layer = layui.layer;
parent.layer.alert('主单号不能少于12位~!', {icon: 0});
$("#waybill").focus();
});
return;
}
var array = content.split("-");
if(array!=null&&array.length==2){
var end = array[1];
if(end&&end.length==8){
var number = parseInt(end);
var start = number/10;
var remainder = parseInt(start)%7;
var last = number%10;
if(remainder!=last){
layui.use('layer', function(){
var layer = layui.layer;
parent.layer.alert('主单号不符合模七校验,请修改~!', {icon: 6});
$("#waybill").focus();
});
}else{
//模七校验通过,校验是否有重复
checkRepeatNo(content);
}
}
}
}
}
</script>
</body>
</html>