作者 申海龙

安检申报添加 修改提示信息

@@ -354,88 +354,93 @@ public class SecurityDeclarationController { @@ -354,88 +354,93 @@ public class SecurityDeclarationController {
354 354
355 355
356 //查询是否存在 356 //查询是否存在
357 - if (securityDeclarationService.findWaybill(waybill) == 0 && manifestService.findWbm(waybill) == null){  
358 - //货物性质(类型)添加  
359 - for (String type: list){  
360 - SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();  
361 - sdCargoTypeEntity.setSd_waybill(waybill);  
362 - sdCargoTypeEntity.setSd_cargo_type(type);  
363 - sdCargoTypeService.save(sdCargoTypeEntity);  
364 - }  
365 -  
366 - //货物品名  
367 - String cName = cargoName.replaceAll(",", ",");  
368 - String[] split = cName.split(",");  
369 - for (int i=0; i<split.length; i++){  
370 - if (!StringUtils.isBlank(split[i]) || !"".equals(split[i])){  
371 - SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();  
372 - sdCargoNameEntity.setSd_waybill(waybill);  
373 - sdCargoNameEntity.setSd_cargo_name(split[i]);  
374 - sdCargoNameService.save(sdCargoNameEntity); 357 + if (securityDeclarationService.findWaybill(waybill) == 0){
  358 + if (manifestService.findWbm(waybill) == null){
  359 + //货物性质(类型)添加
  360 + for (String type: list){
  361 + SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
  362 + sdCargoTypeEntity.setSd_waybill(waybill);
  363 + sdCargoTypeEntity.setSd_cargo_type(type);
  364 + sdCargoTypeService.save(sdCargoTypeEntity);
375 } 365 }
376 - }  
377 366
378 - UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");  
379 -  
380 - ManifestEntity manifestEntity = new ManifestEntity();  
381 -  
382 - //添加安检申报  
383 - SecurityDeclarationEntity sd = new SecurityDeclarationEntity();  
384 - sd.setSd_waybill(waybill);  
385 - sd.setSd_cargo_agent_name(cargoAgentName);  
386 - sd.setSd_cargo_shipper_name(cargoShipperName);  
387 - sd.setSd_iata_number(iataNumber);  
388 - sd.setSd_transport_certificate(transportCertificate);  
389 - sd.setSd_transportation_prove(transportationProve);  
390 - sd.setSd_static("1");  
391 - if (ue != null){  
392 - if (ue.getId() != null ){  
393 - sd.setUSER_ID(ue.getId());  
394 - manifestEntity.setUSER_ID(ue.getId()); 367 + //货物品名
  368 + String cName = cargoName.replaceAll(",", ",");
  369 + String[] split = cName.split(",");
  370 + for (int i=0; i<split.length; i++){
  371 + if (!StringUtils.isBlank(split[i]) || !"".equals(split[i])){
  372 + SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
  373 + sdCargoNameEntity.setSd_waybill(waybill);
  374 + sdCargoNameEntity.setSd_cargo_name(split[i]);
  375 + sdCargoNameService.save(sdCargoNameEntity);
  376 + }
395 } 377 }
396 - }  
397 - securityDeclarationService.save(sd);  
398 378
399 - // 生成报文并且发送  
400 - String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);  
401 -  
402 - //存放数据Vo  
403 - SDVo sdVo = new SDVo();  
404 - sdVo.setSd_waybill(waybill);  
405 - sdVo.setSd_cargo_agent_name(cargoAgentName);  
406 - sdVo.setSd_cargo_shipper_name(cargoShipperName);  
407 - sdVo.setSd_iata_number(iataNumber);  
408 - sdVo.setSd_transport_certificate(transportCertificate);  
409 - sdVo.setSd_transportation_prove(transportationProve);  
410 - //品名  
411 - sdVo.setSd_cargo_name(cargoName);  
412 - //货物类型  
413 - String cargoType = "";  
414 - for (String s: list){  
415 - cargoType+=s+","; 379 + UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
  380 +
  381 + ManifestEntity manifestEntity = new ManifestEntity();
  382 +
  383 + //添加安检申报
  384 + SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
  385 + sd.setSd_waybill(waybill);
  386 + sd.setSd_cargo_agent_name(cargoAgentName);
  387 + sd.setSd_cargo_shipper_name(cargoShipperName);
  388 + sd.setSd_iata_number(iataNumber);
  389 + sd.setSd_transport_certificate(transportCertificate);
  390 + sd.setSd_transportation_prove(transportationProve);
  391 + sd.setSd_static("1");
  392 + if (ue != null){
  393 + if (ue.getId() != null ){
  394 + sd.setUSER_ID(ue.getId());
  395 + manifestEntity.setUSER_ID(ue.getId());
  396 + }
  397 + }
  398 + securityDeclarationService.save(sd);
  399 +
  400 + // 生成报文并且发送
  401 + String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
  402 +
  403 + //存放数据Vo
  404 + SDVo sdVo = new SDVo();
  405 + sdVo.setSd_waybill(waybill);
  406 + sdVo.setSd_cargo_agent_name(cargoAgentName);
  407 + sdVo.setSd_cargo_shipper_name(cargoShipperName);
  408 + sdVo.setSd_iata_number(iataNumber);
  409 + sdVo.setSd_transport_certificate(transportCertificate);
  410 + sdVo.setSd_transportation_prove(transportationProve);
  411 + //品名
  412 + sdVo.setSd_cargo_name(cargoName);
  413 + //货物类型
  414 + String cargoType = "";
  415 + for (String s: list){
  416 + cargoType+=s+",";
  417 + }
  418 + sdVo.setSd_cargo_type(cargoType);
  419 +
  420 + //添加预配信息
  421 + manifestEntity.setWaybillnomaster(waybill);
  422 + manifestEntity.setFlightdate(flightdate);
  423 + manifestEntity.setFlightno(flightno);
  424 + manifestEntity.setCarrier(carrier);
  425 + manifestEntity.setTotalpiece(totalpiece);
  426 + manifestEntity.setTotalweight(totalweight);
  427 + manifestEntity.setDestinationstation(destinationstation);
  428 + manifestService.save(manifestEntity);
  429 +
  430 + //生成报文
  431 + sdVo.setFlightno(flightno);
  432 + sdVo.setFlightdate(flightdate);
  433 + sdVo.setCarrier(carrier);
  434 + sdVo.setTotalpiece(totalpiece);
  435 + sdVo.setTotalweight(totalweight);
  436 + sdVo.setDestinationstation(destinationstation);
  437 + new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();
  438 +
  439 + model.setStatus(200);
  440 + }else {
  441 + model.setStatus(204);
416 } 442 }
417 - sdVo.setSd_cargo_type(cargoType);  
418 443
419 - //添加预配信息  
420 - manifestEntity.setWaybillnomaster(waybill);  
421 - manifestEntity.setFlightdate(flightdate);  
422 - manifestEntity.setFlightno(flightno);  
423 - manifestEntity.setCarrier(carrier);  
424 - manifestEntity.setTotalpiece(totalpiece);  
425 - manifestEntity.setTotalweight(totalweight);  
426 - manifestEntity.setDestinationstation(destinationstation);  
427 - manifestService.save(manifestEntity);  
428 -  
429 - //生成报文  
430 - sdVo.setFlightno(flightno);  
431 - sdVo.setFlightdate(flightdate);  
432 - sdVo.setCarrier(carrier);  
433 - sdVo.setTotalpiece(totalpiece);  
434 - sdVo.setTotalweight(totalweight);  
435 - sdVo.setDestinationstation(destinationstation);  
436 - new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();  
437 -  
438 - model.setStatus(200);  
439 }else { 444 }else {
440 model.setStatus(203); 445 model.setStatus(203);
441 } 446 }
@@ -744,7 +749,7 @@ public class SecurityDeclarationController { @@ -744,7 +749,7 @@ public class SecurityDeclarationController {
744 String path = resource.getPath(); 749 String path = resource.getPath();
745 String s = path +"../../resource/img/bar_code/"+replace+".png"; 750 String s = path +"../../resource/img/bar_code/"+replace+".png";
746 //生成条形码 751 //生成条形码
747 -// BarCodeUtil.generateFile(replace, s); 752 + BarCodeUtil.generateFile(replace, s);
748 753
749 model.addAttribute("path", replace); 754 model.addAttribute("path", replace);
750 755
@@ -297,7 +297,9 @@ @@ -297,7 +297,9 @@
297 } 297 }
298 else if (data.status == 203){ 298 else if (data.status == 203){
299 alert("安检申报不可以重复添加"); 299 alert("安检申报不可以重复添加");
300 - } else { 300 + }else if(data.status == 204){
  301 + alert("请前往预配界面添加安检申报");
  302 + } else {
301 layer.open({content:data.msg}); 303 layer.open({content:data.msg});
302 } 304 }
303 }) 305 })
@@ -217,6 +217,7 @@ @@ -217,6 +217,7 @@
217 function prebackout(id){ 217 function prebackout(id){
218 if(typeof(id) == "undefined") 218 if(typeof(id) == "undefined")
219 return; 219 return;
  220 +
220 layer.confirm("确定要撤销吗?", function(flag){ 221 layer.confirm("确定要撤销吗?", function(flag){
221 layer.close(flag); 222 layer.close(flag);
222 $.ajax({ 223 $.ajax({