作者 Kevin

1、优化收发货人的管理;

2、优化主单和分单编辑界面中的收发货人选择操作;
3、分单号校验规则修改为仅相同主单下不允许分单号重复;
正在显示 26 个修改的文件 包含 1488 行增加560 行删除
@@ -408,7 +408,7 @@ public class BillController extends BasicController{ @@ -408,7 +408,7 @@ public class BillController extends BasicController{
408 ResponseModel model = new ResponseModel(); 408 ResponseModel model = new ResponseModel();
409 ConsigneeEntity consignee = null; 409 ConsigneeEntity consignee = null;
410 try { 410 try {
411 - consignee = consigneeService.findByCode(sCode); 411 + consignee = consigneeService.findByCompanyAndUserId(sCode, Tools.getUserId());
412 model.setData(consignee); 412 model.setData(consignee);
413 model.setStatus(200); 413 model.setStatus(200);
414 }catch (Exception e){ 414 }catch (Exception e){
@@ -5,6 +5,7 @@ import java.util.List; @@ -5,6 +5,7 @@ import java.util.List;
5 import javax.annotation.Resource; 5 import javax.annotation.Resource;
6 import javax.servlet.http.HttpServletRequest; 6 import javax.servlet.http.HttpServletRequest;
7 7
  8 +import org.apache.commons.lang.StringUtils;
8 import org.springframework.stereotype.Controller; 9 import org.springframework.stereotype.Controller;
9 import org.springframework.ui.Model; 10 import org.springframework.ui.Model;
10 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,89 +14,127 @@ import org.springframework.web.bind.annotation.ResponseBody; @@ -13,89 +14,127 @@ import org.springframework.web.bind.annotation.ResponseBody;
13 import com.agent.controller.BasicController; 14 import com.agent.controller.BasicController;
14 import com.agent.entity.agent.ConsigneeEntity; 15 import com.agent.entity.agent.ConsigneeEntity;
15 import com.agent.service.agent.ConsigneeService; 16 import com.agent.service.agent.ConsigneeService;
16 -import com.agent.util.HttpJsonMsg;  
17 import com.agent.vo.ResponseModel; 17 import com.agent.vo.ResponseModel;
18 -import com.plugin.easyui.DataGrid;  
19 -import com.plugin.easyui.EasyPage;  
20 18
21 -import tools.NumKit;  
22 import tools.Tools; 19 import tools.Tools;
23 20
  21 +/**
  22 + *
  23 + * Depiction: 收货人控制器
  24 + * <p>
  25 + * Modify:
  26 + * <p>
  27 + * Author: William Lynn
  28 + * <p>
  29 + * Create Date:2018年5月28日 下午2:24:33
  30 + *
  31 + */
24 @Controller 32 @Controller
25 -public class ConsigneeController extends BasicController{  
26 - 33 +@RequestMapping(value = "/consignee")
  34 +public class ConsigneeController extends BasicController {
27 35
28 @Resource 36 @Resource
29 - private ConsigneeService consigneeService;  
30 -  
31 - @RequestMapping(value = "consignee/grid.json") 37 + private ConsigneeService service;
  38 +
  39 + @RequestMapping(value = "/getall")
32 @ResponseBody 40 @ResponseBody
33 - public DataGrid<ConsigneeEntity> consignee_grid_json(HttpServletRequest request, EasyPage<ConsigneeEntity> pageForm){  
34 -// Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");  
35 -// pageForm.setSearchParams(searchParams);  
36 -// pageForm.parseData(consigneeService.getPage(pageForm));  
37 -// return pageForm.getData();  
38 -  
39 - int page = NumKit.parseInt(request.getParameter("page"));  
40 - page = page<1?1:page;  
41 - int rows = NumKit.parseInt(request.getParameter("rows"));  
42 - rows = rows<1?10:rows;  
43 -  
44 - List<ConsigneeEntity> list = consigneeService.list(page, rows);  
45 - pageForm.setPage(page);  
46 - pageForm.setRows(rows);  
47 - DataGrid<ConsigneeEntity> data = new DataGrid<>();  
48 - data.setRows(list);  
49 - data.setTotal(consigneeService.total(Tools.getUserId()));  
50 - pageForm.setData(data );  
51 - return pageForm.getData();  
52 - }  
53 - @RequestMapping(value="consignee/edit")  
54 - public String consigne_edit(HttpServletRequest request, String id, Model model){  
55 - if(id != null)  
56 - {  
57 - List<ConsigneeEntity> list = consigneeService.findById(id);  
58 - if(list != null && list.size() > 0)  
59 - {  
60 - model.addAttribute("consignee", list.get(0));  
61 - } 41 + public ResponseModel getAll(HttpServletRequest request) {
  42 + ResponseModel model = new ResponseModel(200, "操作成功", null);
  43 + List<ConsigneeEntity> dataList = service.findAllByUserId(Tools.getUserId());
  44 + if (dataList == null || dataList.size() == 0) {
  45 + model = new ResponseModel(200, "没有数据", null);
  46 + } else {
  47 + model = new ResponseModel(200, "查询成功", null);
62 } 48 }
63 - return "consignee/edit"; 49 + model.setData(dataList);
  50 + return model;
  51 + }
  52 +
  53 + @RequestMapping(value = "/list")
  54 + public String list(HttpServletRequest request,boolean isWithChoose) {
  55 + request.setAttribute("isWithChoose", isWithChoose);
  56 + return "consignee/list";
64 } 57 }
65 - @RequestMapping(value = "consignee/getall") 58 +
  59 + @RequestMapping(value = "/search")
66 @ResponseBody 60 @ResponseBody
67 - public ResponseModel consignee_getall(HttpServletRequest request){ 61 + public ResponseModel search(HttpServletRequest request, Integer page, Integer limit,String key) {
  62 + if (page == null) {
  63 + page = 1;
  64 + }
  65 +
  66 + if (limit == null) {
  67 + limit = 10;
  68 + }
  69 +
68 ResponseModel model = new ResponseModel(200, "", null); 70 ResponseModel model = new ResponseModel(200, "", null);
69 - model.setData(consigneeService.findAll()); 71 + page = page < 1 ? 1 : page;
  72 + limit = limit < 1 ? 10 : limit;
  73 + List<ConsigneeEntity> dataList = service.list(page, limit,key);
  74 + if (dataList == null || dataList.size() == 0) {
  75 + model = new ResponseModel(200, "没有数据", null);
  76 + } else {
  77 + model = new ResponseModel(200, "查询成功", null);
  78 + }
  79 + model.setCount(StringUtils.isBlank(key)?service.total(Tools.getUserId()):service.total(Tools.getUserId(),key));
  80 + model.setData(dataList);
70 return model; 81 return model;
71 } 82 }
72 - @RequestMapping(value = "consignee/delete") 83 +
  84 + @RequestMapping(value = "/delete")
73 @ResponseBody 85 @ResponseBody
74 - public ResponseModel consignee_delete(HttpServletRequest request, String ids){  
75 - ResponseModel model = new ResponseModel();  
76 - try {  
77 - consigneeService.deleteAll(ids);  
78 - model.setStatus(200);  
79 - model.setMsg(HttpJsonMsg.SUCCESS);  
80 - } catch (Exception e) {  
81 - model.setStatus(500);  
82 - model.setMsg(HttpJsonMsg.ERROR);  
83 - }  
84 - return model; 86 + public ResponseModel delete(String ids) {
  87 + ResponseModel model = new ResponseModel(404, "", null);
  88 + if (!StringUtils.isBlank(ids)) {
  89 + model = new ResponseModel(200, "", null);
  90 + if (ids.indexOf(",") > 1) {
  91 + try {
  92 + service.deleteAll(ids);
  93 + model = new ResponseModel(200, "", null);
  94 + } catch (Exception e) {
  95 + model = new ResponseModel(500, "删除失败", null);
  96 + }
  97 + } else {
  98 + model = new ResponseModel(404, "ID不能为空", null);
  99 + }
  100 + }
  101 + return model;
85 } 102 }
86 - //返回渲染的页面  
87 - @RequestMapping(value="consignee/list")  
88 - public String consigner_list(){  
89 - System.out.println("hello world");  
90 - return "consignee/list"; 103 +
  104 + @RequestMapping(value = "/edit")
  105 + public String edit(HttpServletRequest request, String id, Model model) {
  106 +
  107 + if (StringUtils.isNotBlank(id)) {
  108 + ConsigneeEntity consignee = service.findById(id);
  109 + model.addAttribute("consignee", consignee);
  110 + }
  111 + return "consignee/edit";
91 } 112 }
92 -  
93 - @RequestMapping(value="consignee/save") 113 +
  114 + @RequestMapping(value = "/save")
94 @ResponseBody 115 @ResponseBody
95 - public ResponseModel consignee_save(HttpServletRequest request, ConsigneeEntity consignee){  
96 - ResponseModel model = new ResponseModel(200, "", null);  
97 - consigneeService.save(consignee); 116 + public ResponseModel save(ConsigneeEntity consignee) {
  117 + ResponseModel model = new ResponseModel(404, "", null);
  118 + if (consignee != null) {
  119 + ConsigneeEntity old = service.findByCompanyAndUserId(consignee.getName(),Tools.getUserId());
  120 + if (old == null) {
  121 + consignee.setCreator(Tools.getUserEntity());
  122 + consignee.setModifier(Tools.getUserEntity());
  123 + service.save(consignee);
  124 + model = new ResponseModel(200, "操作成功", null);
  125 + } else {
  126 + if(old.getId()!=null) {
  127 + service.save(consignee);
  128 + model = new ResponseModel(200, "修改成功", null);
  129 + }else {
  130 + model = new ResponseModel(500, "不能重复添加", null);
  131 + }
  132 + }
  133 + } else {
  134 + model = new ResponseModel(500, "参数为空", null);
  135 + }
  136 +
98 return model; 137 return model;
99 } 138 }
100 - 139 +
101 } 140 }
  1 +package com.agent.controller.agent;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.annotation.Resource;
  6 +import javax.servlet.http.HttpServletRequest;
  7 +
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.ui.Model;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.ResponseBody;
  12 +
  13 +import com.agent.controller.BasicController;
  14 +import com.agent.entity.agent.ConsigneeEntity;
  15 +import com.agent.service.agent.ConsigneeService;
  16 +import com.agent.util.HttpJsonMsg;
  17 +import com.agent.vo.ResponseModel;
  18 +import com.plugin.easyui.DataGrid;
  19 +import com.plugin.easyui.EasyPage;
  20 +
  21 +import tools.NumKit;
  22 +import tools.Tools;
  23 +
  24 +@Controller
  25 +public class ConsigneeController extends BasicController{
  26 +
  27 +
  28 + @Resource
  29 + private ConsigneeService consigneeService;
  30 +
  31 + @RequestMapping(value = "consignee/grid.json")
  32 + @ResponseBody
  33 + public DataGrid<ConsigneeEntity> consignee_grid_json(HttpServletRequest request, EasyPage<ConsigneeEntity> pageForm){
  34 +// Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
  35 +// pageForm.setSearchParams(searchParams);
  36 +// pageForm.parseData(consigneeService.getPage(pageForm));
  37 +// return pageForm.getData();
  38 +
  39 + int page = NumKit.parseInt(request.getParameter("page"));
  40 + page = page<1?1:page;
  41 + int rows = NumKit.parseInt(request.getParameter("rows"));
  42 + rows = rows<1?10:rows;
  43 +
  44 + List<ConsigneeEntity> list = consigneeService.list(page, rows);
  45 + pageForm.setPage(page);
  46 + pageForm.setRows(rows);
  47 + DataGrid<ConsigneeEntity> data = new DataGrid<>();
  48 + data.setRows(list);
  49 + data.setTotal(consigneeService.total(Tools.getUserId()));
  50 + pageForm.setData(data );
  51 + return pageForm.getData();
  52 + }
  53 + @RequestMapping(value="consignee/edit")
  54 + public String consigne_edit(HttpServletRequest request, String id, Model model){
  55 + if(id != null)
  56 + {
  57 + List<ConsigneeEntity> list = consigneeService.findById(id);
  58 + if(list != null && list.size() > 0)
  59 + {
  60 + model.addAttribute("consignee", list.get(0));
  61 + }
  62 + }
  63 + return "consignee/edit";
  64 + }
  65 + @RequestMapping(value = "consignee/getall")
  66 + @ResponseBody
  67 + public ResponseModel consignee_getall(HttpServletRequest request){
  68 + ResponseModel model = new ResponseModel(200, "", null);
  69 + model.setData(consigneeService.findAll());
  70 + return model;
  71 + }
  72 + @RequestMapping(value = "consignee/delete")
  73 + @ResponseBody
  74 + public ResponseModel consignee_delete(HttpServletRequest request, String ids){
  75 + ResponseModel model = new ResponseModel();
  76 + try {
  77 + consigneeService.deleteAll(ids);
  78 + model.setStatus(200);
  79 + model.setMsg(HttpJsonMsg.SUCCESS);
  80 + } catch (Exception e) {
  81 + model.setStatus(500);
  82 + model.setMsg(HttpJsonMsg.ERROR);
  83 + }
  84 + return model;
  85 + }
  86 + //返回渲染的页面
  87 + @RequestMapping(value="consignee/list")
  88 + public String consigner_list(){
  89 + System.out.println("hello world");
  90 + return "consignee/list";
  91 + }
  92 +
  93 + @RequestMapping(value="consignee/save")
  94 + @ResponseBody
  95 + public ResponseModel consignee_save(HttpServletRequest request, ConsigneeEntity consignee){
  96 + ResponseModel model = new ResponseModel(200, "", null);
  97 + consigneeService.save(consignee);
  98 + return model;
  99 + }
  100 +
  101 +}
@@ -51,13 +51,14 @@ public class ConsignorController extends BasicController { @@ -51,13 +51,14 @@ public class ConsignorController extends BasicController {
51 } 51 }
52 52
53 @RequestMapping(value = "/list") 53 @RequestMapping(value = "/list")
54 - public String list(HttpServletRequest request) { 54 + public String list(HttpServletRequest request,boolean isWithChoose) {
  55 + request.setAttribute("isWithChoose", isWithChoose);
55 return "consignor/list"; 56 return "consignor/list";
56 } 57 }
57 58
58 @RequestMapping(value = "/search") 59 @RequestMapping(value = "/search")
59 @ResponseBody 60 @ResponseBody
60 - public ResponseModel search(HttpServletRequest request, Integer page, Integer limit) { 61 + public ResponseModel search(HttpServletRequest request, Integer page, Integer limit,String key) {
61 if (page == null) { 62 if (page == null) {
62 page = 1; 63 page = 1;
63 } 64 }
@@ -66,16 +67,16 @@ public class ConsignorController extends BasicController { @@ -66,16 +67,16 @@ public class ConsignorController extends BasicController {
66 limit = 10; 67 limit = 10;
67 } 68 }
68 69
69 - ResponseModel model = new ResponseModel(200, "", null); 70 + ResponseModel model = new ResponseModel(200, "操作成功", null);
70 page = page < 1 ? 1 : page; 71 page = page < 1 ? 1 : page;
71 limit = limit < 1 ? 10 : limit; 72 limit = limit < 1 ? 10 : limit;
72 - List<ConsignorEntity> dataList = service.list(page, limit); 73 + List<ConsignorEntity> dataList = service.list(page, limit,key);
73 if (dataList == null || dataList.size() == 0) { 74 if (dataList == null || dataList.size() == 0) {
74 - model = new ResponseModel(404, "", null); 75 + model = new ResponseModel(200, "没有数据", null);
75 } else { 76 } else {
76 - model = new ResponseModel(200, "", null); 77 + model = new ResponseModel(200, "查询成功", null);
77 } 78 }
78 - model.setCount(service.total(Tools.getUserId())); 79 + model.setCount(StringUtils.isBlank(key)?service.total(Tools.getUserId()):service.total(Tools.getUserId(),key));
79 model.setData(dataList); 80 model.setData(dataList);
80 return model; 81 return model;
81 } 82 }
@@ -122,7 +123,12 @@ public class ConsignorController extends BasicController { @@ -122,7 +123,12 @@ public class ConsignorController extends BasicController {
122 service.save(consignor); 123 service.save(consignor);
123 model = new ResponseModel(200, "操作成功", null); 124 model = new ResponseModel(200, "操作成功", null);
124 } else { 125 } else {
125 - model = new ResponseModel(500, "不能重复添加", null); 126 + if(old.getId()!=null) {
  127 + service.save(consignor);
  128 + model = new ResponseModel(200, "修改成功", null);
  129 + }else {
  130 + model = new ResponseModel(500, "不能重复添加", null);
  131 + }
126 } 132 }
127 } else { 133 } else {
128 model = new ResponseModel(500, "参数为空", null); 134 model = new ResponseModel(500, "参数为空", null);
@@ -355,7 +355,7 @@ public class ManifestController extends BasicController { @@ -355,7 +355,7 @@ public class ManifestController extends BasicController {
355 model.put("id", mawbId); 355 model.put("id", mawbId);
356 model.put("manifest", manifest); 356 model.put("manifest", manifest);
357 model.put("pre", pre); 357 model.put("pre", pre);
358 - 358 +
359 return model; 359 return model;
360 } 360 }
361 361
@@ -546,11 +546,11 @@ public class ManifestController extends BasicController { @@ -546,11 +546,11 @@ public class ManifestController extends BasicController {
546 model.addAttribute("typeList", typeList); 546 model.addAttribute("typeList", typeList);
547 request.setAttribute("version", System.currentTimeMillis()); 547 request.setAttribute("version", System.currentTimeMillis());
548 // model.addAttribute("customsStatus",flag); 548 // model.addAttribute("customsStatus",flag);
549 -  
550 - String waybill_no = manifest!=null?manifest.getWaybillnomaster():""; 549 +
  550 + String waybill_no = manifest != null ? manifest.getWaybillnomaster() : "";
551 WaybillReceiptEntity receipt = receiptService.findByWaybillNo(waybill_no); 551 WaybillReceiptEntity receipt = receiptService.findByWaybillNo(waybill_no);
552 request.setAttribute("receipt", receipt); 552 request.setAttribute("receipt", receipt);
553 - 553 +
554 return "manifest/edit"; 554 return "manifest/edit";
555 } 555 }
556 556
@@ -665,15 +665,15 @@ public class ManifestController extends BasicController { @@ -665,15 +665,15 @@ public class ManifestController extends BasicController {
665 } 665 }
666 model.addAttribute("pre", pre); 666 model.addAttribute("pre", pre);
667 request.setAttribute("version", System.currentTimeMillis()); 667 request.setAttribute("version", System.currentTimeMillis());
668 -  
669 - String waybill_no = manifest!=null?manifest.getWaybillnomaster():""; 668 +
  669 + String waybill_no = manifest != null ? manifest.getWaybillnomaster() : "";
670 String sub_waybill_no = ""; 670 String sub_waybill_no = "";
671 - if(pre!=null&&pre.getWaybillnosecondary()!=null) { 671 + if (pre != null && pre.getWaybillnosecondary() != null) {
672 sub_waybill_no = pre.getWaybillnosecondary(); 672 sub_waybill_no = pre.getWaybillnosecondary();
673 } 673 }
674 WaybillReceiptEntity receipt = receiptService.findByWaybillNoAndSub(waybill_no, sub_waybill_no); 674 WaybillReceiptEntity receipt = receiptService.findByWaybillNoAndSub(waybill_no, sub_waybill_no);
675 request.setAttribute("receipt", receipt); 675 request.setAttribute("receipt", receipt);
676 - 676 +
677 return "manifest/sub_edit"; 677 return "manifest/sub_edit";
678 } 678 }
679 679
@@ -1247,25 +1247,23 @@ public class ManifestController extends BasicController { @@ -1247,25 +1247,23 @@ public class ManifestController extends BasicController {
1247 } 1247 }
1248 1248
1249 /** 1249 /**
1250 - * 查询分单号  
1251 - *  
1252 - * @param manifest 1250 + *
  1251 + * @param waybillnomaster
  1252 + * 主单号
  1253 + * @param waybillnoSub
  1254 + * 分单号
1253 * @return 1255 * @return
1254 */ 1256 */
1255 @RequestMapping(value = "/daryMawbNo", method = { RequestMethod.POST }) 1257 @RequestMapping(value = "/daryMawbNo", method = { RequestMethod.POST })
1256 @ResponseBody 1258 @ResponseBody
1257 - public ResponseModel daryMawbNo(Long id, String mawbNo) { 1259 + public ResponseModel daryMawbNo(String waybillnomaster, String waybillnoSub) {
1258 ResponseModel model = new ResponseModel(); 1260 ResponseModel model = new ResponseModel();
1259 List<PreparesecondaryEntity> list = null; 1261 List<PreparesecondaryEntity> list = null;
1260 - if (StringUtils.isNotEmpty(mawbNo)) {  
1261 - list = preparesecondaryServer.findByMawbNo(mawbNo);  
1262 - }  
1263 - boolean exist = false;  
1264 - if (CollectionUtils.isNotEmpty(list)) {  
1265 - if (list.size() > 0) {  
1266 - exist = true;  
1267 - } 1262 + if (StringUtils.isNotEmpty(waybillnomaster) && StringUtils.isNotEmpty(waybillnoSub)) {
  1263 + list = preparesecondaryServer.findByMainAndSub(waybillnomaster, waybillnoSub);
1268 } 1264 }
  1265 + boolean exist = list != null && list.size() > 0;
  1266 +
1269 if (exist) { 1267 if (exist) {
1270 model.setStatus(500); 1268 model.setStatus(500);
1271 } else { 1269 } else {
1 package com.agent.entity.agent; 1 package com.agent.entity.agent;
2 2
3 -import com.agent.entity.BasicEntity;  
4 -  
5 -import javax.persistence.Column;  
6 import javax.persistence.Entity; 3 import javax.persistence.Entity;
7 import javax.persistence.Table; 4 import javax.persistence.Table;
8 5
  6 +import com.agent.entity.BasicEntity;
  7 +
9 /** 8 /**
10 * Created by cohesion on 2017/3/28. 9 * Created by cohesion on 2017/3/28.
11 * 10 *
@@ -16,26 +15,27 @@ import javax.persistence.Table; @@ -16,26 +15,27 @@ import javax.persistence.Table;
16 public class ConsigneeEntity extends BasicEntity { 15 public class ConsigneeEntity extends BasicEntity {
17 16
18 /** 17 /**
19 - * 简称 18 + * 简称:收货人
20 */ 19 */
21 private String code; 20 private String code;
22 21
23 /** 22 /**
24 - * 全称 23 + * 全称:公司全名
25 */ 24 */
26 private String name; 25 private String name;
27 26
28 - /**  
29 - * 地址  
30 - */  
31 private String address; 27 private String address;
32 28
33 - /**  
34 - * 电话  
35 - */  
36 private String tel; 29 private String tel;
  30 + private String fax;
  31 + private String city;
  32 + private String country;
  33 + private String deltaname;
  34 + private String zipcode;
  35 + private String aeo;
  36 + private String cusid;
  37 + private String provincecode;
37 38
38 - @Column(name = "CODE")  
39 public String getCode() { 39 public String getCode() {
40 return code; 40 return code;
41 } 41 }
@@ -44,7 +44,6 @@ public class ConsigneeEntity extends BasicEntity { @@ -44,7 +44,6 @@ public class ConsigneeEntity extends BasicEntity {
44 this.code = code; 44 this.code = code;
45 } 45 }
46 46
47 - @Column(name = "NAME")  
48 public String getName() { 47 public String getName() {
49 return name; 48 return name;
50 } 49 }
@@ -53,7 +52,6 @@ public class ConsigneeEntity extends BasicEntity { @@ -53,7 +52,6 @@ public class ConsigneeEntity extends BasicEntity {
53 this.name = name; 52 this.name = name;
54 } 53 }
55 54
56 - @Column(name = "ADDRESS")  
57 public String getAddress() { 55 public String getAddress() {
58 return address; 56 return address;
59 } 57 }
@@ -62,7 +60,6 @@ public class ConsigneeEntity extends BasicEntity { @@ -62,7 +60,6 @@ public class ConsigneeEntity extends BasicEntity {
62 this.address = address; 60 this.address = address;
63 } 61 }
64 62
65 - @Column(name = "TEL")  
66 public String getTel() { 63 public String getTel() {
67 return tel; 64 return tel;
68 } 65 }
@@ -70,4 +67,69 @@ public class ConsigneeEntity extends BasicEntity { @@ -70,4 +67,69 @@ public class ConsigneeEntity extends BasicEntity {
70 public void setTel(String tel) { 67 public void setTel(String tel) {
71 this.tel = tel; 68 this.tel = tel;
72 } 69 }
  70 +
  71 + public String getFax() {
  72 + return fax;
  73 + }
  74 +
  75 + public void setFax(String fax) {
  76 + this.fax = fax;
  77 + }
  78 +
  79 + public String getCity() {
  80 + return city;
  81 + }
  82 +
  83 + public void setCity(String city) {
  84 + this.city = city;
  85 + }
  86 +
  87 + public String getCountry() {
  88 + return country;
  89 + }
  90 +
  91 + public void setCountry(String country) {
  92 + this.country = country;
  93 + }
  94 +
  95 + public String getDeltaname() {
  96 + return deltaname;
  97 + }
  98 +
  99 + public void setDeltaname(String deltaname) {
  100 + this.deltaname = deltaname;
  101 + }
  102 +
  103 + public String getZipcode() {
  104 + return zipcode;
  105 + }
  106 +
  107 + public void setZipcode(String zipcode) {
  108 + this.zipcode = zipcode;
  109 + }
  110 +
  111 + public String getAeo() {
  112 + return aeo;
  113 + }
  114 +
  115 + public void setAeo(String aeo) {
  116 + this.aeo = aeo;
  117 + }
  118 +
  119 + public String getCusid() {
  120 + return cusid;
  121 + }
  122 +
  123 + public void setCusid(String cusid) {
  124 + this.cusid = cusid;
  125 + }
  126 +
  127 + public String getProvincecode() {
  128 + return provincecode;
  129 + }
  130 +
  131 + public void setProvincecode(String provincecode) {
  132 + this.provincecode = provincecode;
  133 + }
  134 +
73 } 135 }
@@ -9,41 +9,40 @@ import org.springframework.data.repository.PagingAndSortingRepository; @@ -9,41 +9,40 @@ import org.springframework.data.repository.PagingAndSortingRepository;
9 import org.springframework.transaction.annotation.Transactional; 9 import org.springframework.transaction.annotation.Transactional;
10 10
11 import com.agent.entity.agent.ConsigneeEntity; 11 import com.agent.entity.agent.ConsigneeEntity;
12 -import com.agent.entity.agent.ConsigneeInfo;  
13 12
14 -public interface ConsigneeRepository extends PagingAndSortingRepository<ConsigneeEntity, Long>,  
15 - JpaSpecificationExecutor<ConsigneeEntity> { 13 +public interface ConsigneeRepository
  14 + extends PagingAndSortingRepository<ConsigneeEntity, Long>, JpaSpecificationExecutor<ConsigneeEntity> {
  15 +
  16 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE NAME = ?1 AND CREATOR = ?2 ORDER BY ID DESC", nativeQuery = true)
  17 + public List<ConsigneeEntity> findByCompanyAndUserId(String company,long user_id);
  18 +
  19 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true)
  20 + public List<ConsigneeEntity> findById(String id);
  21 +
  22 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1 and c.name LIKE %?2%) cr where cr.rn between ?3 and ?4", nativeQuery = true)
  23 + public List<ConsigneeEntity> search(long user_id,String key,int start,int end);
16 24
17 @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true) 25 @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true)
18 public List<ConsigneeEntity> list(long user_id,int start,int end); 26 public List<ConsigneeEntity> list(long user_id,int start,int end);
19 27
20 - @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CODE = ?1 AND NAME = ?2 AND CREATOR=?3 ORDER BY ID DESC", nativeQuery = true)  
21 - public List<ConsigneeEntity> findByName(String code,String name,long user_id);  
22 -  
23 - @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CODE = ?1 AND CREATOR=?2 ORDER BY ID DESC", nativeQuery = true)  
24 - public List<ConsigneeEntity> findByCode(String code,long user_id);  
25 -  
26 - @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID = ?1 AND CREATOR=?2 ORDER BY ID DESC", nativeQuery = true)  
27 - public List<ConsigneeEntity> findById(String id,long user_id);  
28 -  
29 - @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR=?1 ORDER BY ID DESC", nativeQuery = true)  
30 - public List<ConsigneeEntity> findAll2(long user_id);  
31 -  
32 - @Modifying 28 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true)
  29 + public List<ConsigneeEntity> getAllByUserId(long user_id);
  30 +
  31 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR = ?1 AND NAME LIKE %?2% ORDER BY ID DESC", nativeQuery = true)
  32 + public List<ConsigneeEntity> getAllByUserIdAndSearchkey(long user_id,String key);
  33 +
  34 + @Modifying
33 @Query(value = "DELETE FROM PUB_CONSIGNEE WHERE ID = ?1", nativeQuery = true) 35 @Query(value = "DELETE FROM PUB_CONSIGNEE WHERE ID = ?1", nativeQuery = true)
34 - void deleteAll(Long id);  
35 -  
36 - //关于,,,,,,,,,,,  
37 - @Transactional  
38 - @Modifying(clearAutomatically=true)  
39 - @Query(value = "INSERT INTO CONSIGNEE_INFO(ID, SH_COMPANY, SH_ADDRESS, SH_ZIPCODE, CITY, DELTANAME, COUNTRY, TELEPHONE, SH_FAX, SH_NAME, SH_PROVINCENAME, SH_PROVINCECODE) VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)", nativeQuery = true)  
40 - public int save(String id, String sh_company, String sh_address, String sh_zipcode, String city, String deltaname, String country, String telephone, String sh_fax, String sh_name, String sh_provincename, String sh_provincecode);  
41 -  
42 -// @Transactional  
43 -// @Modifying(clearAutomatically=true)  
44 -// @Query(value = "", nativeQuery = true)  
45 -// public int update();  
46 -  
47 - @Query(value = "SELECT * FROM CONSIGNEE_INFO WHERE ID=?1", nativeQuery = true)  
48 - public List<ConsigneeInfo> queryById(String id); 36 + void deleteById(Long id);
  37 +
  38 + // 关于,,,,,,,,,,,
  39 + @Transactional
  40 + @Modifying(clearAutomatically = true)
  41 + @Query(value = "INSERT INTO PUB_CONSIGNEE(CO_NAME, CO_TELEPHONE, CO_COMPANY, CO_COUNTRY, CO_DELTANAME, CO_CITY, CO_ADDRESS, CO_ZIPCODE, CO_FAX, SHPAEO,SHPCUSID) VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)", nativeQuery = true)
  42 + public int save(String co_name, String co_telephone, String co_company, String co_country,
  43 + String co_deltaname, String co_city, String co_address, String co_zipcode, String co_fax, String shpaeo,
  44 + String shpcusid);
  45 +
  46 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID=?1", nativeQuery = true)
  47 + public List<ConsigneeEntity> queryById(Long id);
49 } 48 }
  1 +package com.agent.repository.agent;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.data.repository.PagingAndSortingRepository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.agent.entity.agent.ConsigneeEntity;
  12 +import com.agent.entity.agent.ConsigneeInfo;
  13 +
  14 +public interface ConsigneeRepository extends PagingAndSortingRepository<ConsigneeEntity, Long>,
  15 + JpaSpecificationExecutor<ConsigneeEntity> {
  16 +
  17 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true)
  18 + public List<ConsigneeEntity> list(long user_id,int start,int end);
  19 +
  20 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CODE = ?1 AND NAME = ?2 AND CREATOR=?3 ORDER BY ID DESC", nativeQuery = true)
  21 + public List<ConsigneeEntity> findByName(String code,String name,long user_id);
  22 +
  23 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CODE = ?1 AND CREATOR=?2 ORDER BY ID DESC", nativeQuery = true)
  24 + public List<ConsigneeEntity> findByCode(String code,long user_id);
  25 +
  26 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID = ?1 AND CREATOR=?2 ORDER BY ID DESC", nativeQuery = true)
  27 + public List<ConsigneeEntity> findById(String id,long user_id);
  28 +
  29 + @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR=?1 ORDER BY ID DESC", nativeQuery = true)
  30 + public List<ConsigneeEntity> findAll2(long user_id);
  31 +
  32 + @Modifying
  33 + @Query(value = "DELETE FROM PUB_CONSIGNEE WHERE ID = ?1", nativeQuery = true)
  34 + void deleteAll(Long id);
  35 +
  36 + //关于,,,,,,,,,,,
  37 + @Transactional
  38 + @Modifying(clearAutomatically=true)
  39 + @Query(value = "INSERT INTO CONSIGNEE_INFO(ID, SH_COMPANY, SH_ADDRESS, SH_ZIPCODE, CITY, DELTANAME, COUNTRY, TELEPHONE, SH_FAX, SH_NAME, SH_PROVINCENAME, SH_PROVINCECODE) VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)", nativeQuery = true)
  40 + public int save(String id, String sh_company, String sh_address, String sh_zipcode, String city, String deltaname, String country, String telephone, String sh_fax, String sh_name, String sh_provincename, String sh_provincecode);
  41 +
  42 +// @Transactional
  43 +// @Modifying(clearAutomatically=true)
  44 +// @Query(value = "", nativeQuery = true)
  45 +// public int update();
  46 +
  47 + @Query(value = "SELECT * FROM CONSIGNEE_INFO WHERE ID=?1", nativeQuery = true)
  48 + public List<ConsigneeInfo> queryById(String id);
  49 +}
@@ -19,11 +19,17 @@ public interface ConsignorRepository @@ -19,11 +19,17 @@ public interface ConsignorRepository
19 @Query(value = "SELECT * FROM CONSIGNOR WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true) 19 @Query(value = "SELECT * FROM CONSIGNOR WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true)
20 public List<ConsignorEntity> findById(String id); 20 public List<ConsignorEntity> findById(String id);
21 21
  22 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1 and c.co_company LIKE %?2%) cr where cr.rn between ?3 and ?4", nativeQuery = true)
  23 + public List<ConsignorEntity> search(long user_id,String key,int start,int end);
  24 +
22 @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true) 25 @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true)
23 public List<ConsignorEntity> list(long user_id,int start,int end); 26 public List<ConsignorEntity> list(long user_id,int start,int end);
24 27
25 @Query(value = "SELECT * FROM CONSIGNOR WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true) 28 @Query(value = "SELECT * FROM CONSIGNOR WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true)
26 public List<ConsignorEntity> getAllByUserId(long user_id); 29 public List<ConsignorEntity> getAllByUserId(long user_id);
  30 +
  31 + @Query(value = "SELECT * FROM CONSIGNOR WHERE CREATOR = ?1 AND CO_COMPANY LIKE %?2% ORDER BY ID DESC", nativeQuery = true)
  32 + public List<ConsignorEntity> getAllByUserIdAndSearchkey(long user_id,String key);
27 33
28 @Modifying 34 @Modifying
29 @Query(value = "DELETE FROM CONSIGNOR WHERE ID = ?1", nativeQuery = true) 35 @Query(value = "DELETE FROM CONSIGNOR WHERE ID = ?1", nativeQuery = true)
@@ -22,6 +22,9 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{ @@ -22,6 +22,9 @@ JpaSpecificationExecutor<PreparesecondaryEntity>{
22 @Query(value = "SELECT * FROM PREPARESECONDARY WHERE WAYBILLNOSECONDARY = ?1", nativeQuery = true) 22 @Query(value = "SELECT * FROM PREPARESECONDARY WHERE WAYBILLNOSECONDARY = ?1", nativeQuery = true)
23 List<PreparesecondaryEntity> findByMawbNo(String mawbNo); 23 List<PreparesecondaryEntity> findByMawbNo(String mawbNo);
24 24
  25 + @Query(value = "SELECT * FROM PREPARESECONDARY WHERE WAYBILLNOMASTER = ?1 AND WAYBILLNOSECONDARY = ?2", nativeQuery = true)
  26 + List<PreparesecondaryEntity> findByMainAndSub(String waybillnomaster,String waybillnoSub);
  27 +
25 @Modifying 28 @Modifying
26 @Query(value = "DELETE FROM PREPARESECONDARY WHERE PREPAREMASTERID = ?1", nativeQuery = true) 29 @Query(value = "DELETE FROM PREPARESECONDARY WHERE PREPAREMASTERID = ?1", nativeQuery = true)
27 void deleteAll(Long id); 30 void deleteAll(Long id);
1 package com.agent.service.agent; 1 package com.agent.service.agent;
2 2
  3 +import java.util.Date;
3 import java.util.List; 4 import java.util.List;
4 5
5 import javax.annotation.Resource; 6 import javax.annotation.Resource;
6 7
7 import org.apache.commons.collections.CollectionUtils; 8 import org.apache.commons.collections.CollectionUtils;
8 -import org.springframework.data.domain.Page;  
9 -import org.springframework.data.domain.PageRequest;  
10 -import org.springframework.data.jpa.domain.Specification; 9 +import org.apache.commons.lang.StringUtils;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Transactional; 11 import org.springframework.transaction.annotation.Transactional;
13 12
14 import com.agent.entity.agent.ConsigneeEntity; 13 import com.agent.entity.agent.ConsigneeEntity;
15 -import com.agent.entity.agent.ConsignorEntity; 14 +import com.agent.entity.agent.ManifestEntity;
  15 +import com.agent.entity.agent.PreparesecondaryEntity;
16 import com.agent.repository.agent.ConsigneeRepository; 16 import com.agent.repository.agent.ConsigneeRepository;
17 import com.agent.service.BasicService; 17 import com.agent.service.BasicService;
18 import com.google.common.base.Splitter; 18 import com.google.common.base.Splitter;
19 -import com.plugin.easyui.EasyPage;  
20 19
21 import tools.Tools; 20 import tools.Tools;
22 21
  22 +/**
  23 + *
  24 + * Depiction:发货人数据库操作
  25 + * <p>
  26 + * Modify:
  27 + * <p>
  28 + * Author: William Lynn
  29 + * <p>
  30 + * Create Date:2018年5月28日 下午2:25:53
  31 + *
  32 + */
23 @Service 33 @Service
24 public class ConsigneeService extends BasicService<ConsigneeEntity> { 34 public class ConsigneeService extends BasicService<ConsigneeEntity> {
25 35
26 @Resource 36 @Resource
27 - private ConsigneeRepository consigneeRepository; 37 + private ConsigneeRepository service;
28 38
29 @Transactional 39 @Transactional
30 public void deleteAll(String ids) { 40 public void deleteAll(String ids) {
31 List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids); 41 List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
32 for (String id : list) { 42 for (String id : list) {
33 - consigneeRepository.delete(Long.valueOf(id)); 43 + service.delete(Long.valueOf(id));
34 } 44 }
35 } 45 }
36 46
37 - public ConsigneeEntity findByCodeAndName(String code, String name) {  
38 - List<ConsigneeEntity> consigns = consigneeRepository.findByName(code, name, Tools.getUserId()); 47 + public ConsigneeEntity findById(String id) {
  48 + List<ConsigneeEntity> list = service.findById(id);
  49 + return list != null && !list.isEmpty() ? list.get(0) : null;
  50 + }
  51 +
  52 + public ConsigneeEntity findByCompanyAndUserId(String company, long user_id) {
  53 + List<ConsigneeEntity> consigns = service.findByCompanyAndUserId(company, user_id);
39 if (CollectionUtils.isNotEmpty(consigns)) { 54 if (CollectionUtils.isNotEmpty(consigns)) {
40 return consigns.get(0); 55 return consigns.get(0);
41 } 56 }
42 return null; 57 return null;
43 } 58 }
44 59
45 - public ConsigneeEntity findByCode(String code) {  
46 - List<ConsigneeEntity> consigns = consigneeRepository.findByCode(code, Tools.getUserId());  
47 - if (CollectionUtils.isNotEmpty(consigns)) {  
48 - return consigns.get(0); 60 + public void save(ConsigneeEntity c) {
  61 + if (c != null) {
  62 + if (c.getCreateDate() == null) {
  63 + c.setCreateDate(new Date());
  64 + }
  65 +
  66 + if (c.getModifyDate() == null) {
  67 + c.setModifyDate(new Date());
  68 + }
  69 + service.save(c);
49 } 70 }
50 - return null;  
51 } 71 }
52 72
53 - public Page<ConsigneeEntity> getPage(EasyPage<ConsigneeEntity> pageForm) {  
54 - PageRequest pageRequest = buildPageRequest(pageForm);  
55 - Specification<ConsigneeEntity> spec = buildSpecification(pageForm);  
56 - Page<ConsigneeEntity> page = consigneeRepository.findAll(spec, pageRequest);  
57 - return page; 73 + public long count() {
  74 + return service.count();
58 } 75 }
59 - 76 +
60 public long total(long user_id) { 77 public long total(long user_id) {
61 - List<ConsigneeEntity> list = consigneeRepository.findAll2(user_id);  
62 - return list!=null?list.size():0; 78 + List<ConsigneeEntity> list = service.getAllByUserId(user_id);
  79 + return list != null ? list.size() : 0;
63 } 80 }
64 81
65 - public List<ConsigneeEntity> list(int page,int limit) {  
66 - int start = (page-1)*limit+1;  
67 - int end = page*limit;  
68 - long user_id = Tools.getUserId();  
69 - return consigneeRepository.list(user_id,start,end); 82 + public long total(long user_id,String key) {
  83 + List<ConsigneeEntity> list = service.getAllByUserIdAndSearchkey(user_id,key);
  84 + return list != null ? list.size() : 0;
70 } 85 }
71 86
72 - public void save(ConsigneeEntity c) {  
73 - c.setCreator(Tools.getUserEntity());  
74 - consigneeRepository.save(c); 87 + public List<ConsigneeEntity> list(int page, int limit, String key) {
  88 + int start = (page - 1) * limit + 1;
  89 + int end = page * limit;
  90 + long user_id = Tools.getUserId();
  91 + if (StringUtils.isBlank(key)) {
  92 + return service.list(user_id, start, end);
  93 + }
  94 +
  95 + return service.search(user_id, key, start, end);
75 } 96 }
76 97
77 - public List<ConsigneeEntity> findAll() {  
78 - return consigneeRepository.findAll2(Tools.getUserId()); 98 + public List<ConsigneeEntity> findAllByUserId(long user_id) {
  99 + return service.getAllByUserId(user_id);
79 } 100 }
80 101
81 public void update(ConsigneeEntity c) { 102 public void update(ConsigneeEntity c) {
82 - c.setCreator(Tools.getUserEntity());  
83 - consigneeRepository.save(c); 103 + service.save(c);
84 } 104 }
85 105
86 - public List<ConsigneeEntity> findById(String id) {  
87 - return consigneeRepository.findById(id, Tools.getUserId()); 106 + public void saveFromManifest(ManifestEntity manifest, long user_id) {
  107 + if (manifest != null && StringUtils.isNotBlank(manifest.getSh_company())) {
  108 + ConsigneeEntity bean = new ConsigneeEntity();
  109 + bean.setAddress(manifest.getSh_address());
  110 + bean.setCity(manifest.getSh_city());
  111 + bean.setCode(manifest.getSh_name());
  112 + bean.setCountry(manifest.getSh_country());
  113 + bean.setDeltaname(manifest.getSh_deltaname());
  114 + bean.setFax(manifest.getSh_fax());
  115 + bean.setName(manifest.getSh_company());
  116 + bean.setTel(manifest.getSh_telephone());
  117 + bean.setZipcode(manifest.getSh_zipcode());
  118 + bean.setAeo(manifest.getCneaeo());
  119 + bean.setCusid(manifest.getCnecusid());
  120 + bean.setModifyDate(new Date());
  121 + bean.setCreateDate(new Date());
  122 + bean.setCreator(Tools.getUserEntity());
  123 + bean.setModifier(Tools.getUserEntity());
  124 +
  125 + ConsigneeEntity old = findByCompanyAndUserId(manifest.getSh_company(), user_id);
  126 + if (old != null) {
  127 + service.delete(old.getId());
  128 + }
  129 + save(bean);
  130 + }
88 } 131 }
  132 +
  133 + public void saveFromPreparesecondary(PreparesecondaryEntity prepare, long user_id) {
  134 + if (prepare != null && StringUtils.isNotBlank(prepare.getSh_company())) {
  135 + ConsigneeEntity bean = new ConsigneeEntity();
  136 + bean.setAddress(prepare.getSh_address());
  137 + bean.setCity(prepare.getSh_city());
  138 + bean.setCode(prepare.getSh_name());
  139 + bean.setCountry(prepare.getSh_country());
  140 + bean.setDeltaname(prepare.getSh_deltaname());
  141 + bean.setFax(prepare.getSh_fax());
  142 + bean.setName(prepare.getSh_company());
  143 + bean.setTel(prepare.getSh_telephone());
  144 + bean.setZipcode(prepare.getSh_zipcode());
  145 + bean.setAeo(prepare.getCneaeo());
  146 + bean.setCusid(prepare.getCnecusid());
  147 + bean.setModifyDate(new Date());
  148 + bean.setCreateDate(new Date());
  149 + bean.setCreator(Tools.getUserEntity());
  150 + bean.setModifier(Tools.getUserEntity());
  151 +
  152 + ConsigneeEntity old = findByCompanyAndUserId(prepare.getSh_company(), user_id);
  153 + if (old != null) {
  154 + service.delete(old.getId());
  155 + }
  156 + save(bean);
  157 +
  158 + }
  159 + }
  160 +
89 } 161 }
  1 +package com.agent.service.agent;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.annotation.Resource;
  6 +
  7 +import org.apache.commons.collections.CollectionUtils;
  8 +import org.springframework.data.domain.Page;
  9 +import org.springframework.data.domain.PageRequest;
  10 +import org.springframework.data.jpa.domain.Specification;
  11 +import org.springframework.stereotype.Service;
  12 +import org.springframework.transaction.annotation.Transactional;
  13 +
  14 +import com.agent.entity.agent.ConsigneeEntity;
  15 +import com.agent.entity.agent.ConsignorEntity;
  16 +import com.agent.repository.agent.ConsigneeRepository;
  17 +import com.agent.service.BasicService;
  18 +import com.google.common.base.Splitter;
  19 +import com.plugin.easyui.EasyPage;
  20 +
  21 +import tools.Tools;
  22 +
  23 +@Service
  24 +public class ConsigneeService extends BasicService<ConsigneeEntity> {
  25 +
  26 + @Resource
  27 + private ConsigneeRepository consigneeRepository;
  28 +
  29 + @Transactional
  30 + public void deleteAll(String ids) {
  31 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  32 + for (String id : list) {
  33 + consigneeRepository.delete(Long.valueOf(id));
  34 + }
  35 + }
  36 +
  37 + public ConsigneeEntity findByCodeAndName(String code, String name) {
  38 + List<ConsigneeEntity> consigns = consigneeRepository.findByName(code, name, Tools.getUserId());
  39 + if (CollectionUtils.isNotEmpty(consigns)) {
  40 + return consigns.get(0);
  41 + }
  42 + return null;
  43 + }
  44 +
  45 + public ConsigneeEntity findByCode(String code) {
  46 + List<ConsigneeEntity> consigns = consigneeRepository.findByCode(code, Tools.getUserId());
  47 + if (CollectionUtils.isNotEmpty(consigns)) {
  48 + return consigns.get(0);
  49 + }
  50 + return null;
  51 + }
  52 +
  53 + public Page<ConsigneeEntity> getPage(EasyPage<ConsigneeEntity> pageForm) {
  54 + PageRequest pageRequest = buildPageRequest(pageForm);
  55 + Specification<ConsigneeEntity> spec = buildSpecification(pageForm);
  56 + Page<ConsigneeEntity> page = consigneeRepository.findAll(spec, pageRequest);
  57 + return page;
  58 + }
  59 +
  60 + public long total(long user_id) {
  61 + List<ConsigneeEntity> list = consigneeRepository.findAll2(user_id);
  62 + return list!=null?list.size():0;
  63 + }
  64 +
  65 + public List<ConsigneeEntity> list(int page,int limit) {
  66 + int start = (page-1)*limit+1;
  67 + int end = page*limit;
  68 + long user_id = Tools.getUserId();
  69 + return consigneeRepository.list(user_id,start,end);
  70 + }
  71 +
  72 + public void save(ConsigneeEntity c) {
  73 + c.setCreator(Tools.getUserEntity());
  74 + consigneeRepository.save(c);
  75 + }
  76 +
  77 + public List<ConsigneeEntity> findAll() {
  78 + return consigneeRepository.findAll2(Tools.getUserId());
  79 + }
  80 +
  81 + public void update(ConsigneeEntity c) {
  82 + c.setCreator(Tools.getUserEntity());
  83 + consigneeRepository.save(c);
  84 + }
  85 +
  86 + public List<ConsigneeEntity> findById(String id) {
  87 + return consigneeRepository.findById(id, Tools.getUserId());
  88 + }
  89 +}
@@ -78,12 +78,21 @@ public class ConsignorService extends BasicService<ConsignorEntity> { @@ -78,12 +78,21 @@ public class ConsignorService extends BasicService<ConsignorEntity> {
78 List<ConsignorEntity> list = service.getAllByUserId(user_id); 78 List<ConsignorEntity> list = service.getAllByUserId(user_id);
79 return list!=null?list.size():0; 79 return list!=null?list.size():0;
80 } 80 }
  81 +
  82 + public long total(long user_id,String key) {
  83 + List<ConsignorEntity> list = service.getAllByUserIdAndSearchkey(user_id,key);
  84 + return list!=null?list.size():0;
  85 + }
81 86
82 - public List<ConsignorEntity> list(int page,int limit) { 87 + public List<ConsignorEntity> list(int page,int limit,String key) {
83 int start = (page-1)*limit+1; 88 int start = (page-1)*limit+1;
84 int end = page*limit; 89 int end = page*limit;
85 long user_id = Tools.getUserId(); 90 long user_id = Tools.getUserId();
86 - return service.list(user_id,start,end); 91 + if(StringUtils.isBlank(key)) {
  92 + return service.list(user_id,start,end);
  93 + }
  94 +
  95 + return service.search(user_id,key,start,end);
87 } 96 }
88 97
89 public List<ConsignorEntity> findAllByUserId(long user_id) { 98 public List<ConsignorEntity> findAllByUserId(long user_id) {
@@ -80,7 +80,8 @@ public class MakeHawbService extends BasicService<MakeHawbEntity> { @@ -80,7 +80,8 @@ public class MakeHawbService extends BasicService<MakeHawbEntity> {
80 } 80 }
81 //保存收货人 81 //保存收货人
82 if(StringUtils.isNotEmpty(consign.getCode()) && StringUtils.isNotEmpty(consign.getName())){ 82 if(StringUtils.isNotEmpty(consign.getCode()) && StringUtils.isNotEmpty(consign.getName())){
83 - List<ConsigneeEntity> consigns = consigneeRepository.findByName(consign.getCode(),consign.getName(),Tools.getUserId()); 83 +// List<ConsigneeEntity> consigns = consigneeRepository.findByName(consign.getCode(),consign.getName(),Tools.getUserId());
  84 + List<ConsigneeEntity> consigns = consigneeRepository.findByCompanyAndUserId(consign.getCode(), Tools.getUserId());
84 if(CollectionUtils.isEmpty(consigns)){ 85 if(CollectionUtils.isEmpty(consigns)){
85 consign.setCreator(SessionUtil.getUser()); 86 consign.setCreator(SessionUtil.getUser());
86 consign.setCreateDate(new Date()); 87 consign.setCreateDate(new Date());
@@ -102,7 +102,8 @@ public class MakeMawbService extends BasicService<MakeMawbEntity> { @@ -102,7 +102,8 @@ public class MakeMawbService extends BasicService<MakeMawbEntity> {
102 public MakeMawbEntity save(MakeMawbEntity bill,MawbOtherFeeEntity otherFee,ConsigneeEntity consign,List<PackageSizeEntity> sizeList) { 102 public MakeMawbEntity save(MakeMawbEntity bill,MawbOtherFeeEntity otherFee,ConsigneeEntity consign,List<PackageSizeEntity> sizeList) {
103 //保存收货人 103 //保存收货人
104 if(StringUtils.isNotEmpty(consign.getCode()) && StringUtils.isNotEmpty(consign.getName())){ 104 if(StringUtils.isNotEmpty(consign.getCode()) && StringUtils.isNotEmpty(consign.getName())){
105 - List<ConsigneeEntity> consignees = consigneeRepository.findByName(consign.getCode(),consign.getName(),Tools.getUserId()); 105 +// List<ConsigneeEntity> consignees = consigneeRepository.findByName(consign.getCode(),consign.getName(),Tools.getUserId());
  106 + List<ConsigneeEntity> consignees = consigneeRepository.findByCompanyAndUserId(consign.getCode(), Tools.getUserId());
106 if(CollectionUtils.isEmpty(consignees)){ 107 if(CollectionUtils.isEmpty(consignees)){
107 consign = consigneeRepository.save(consign); 108 consign = consigneeRepository.save(consign);
108 } 109 }
@@ -51,6 +51,10 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity @@ -51,6 +51,10 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity
51 public List<PreparesecondaryEntity> findByMawbNo(String mawbNo) { 51 public List<PreparesecondaryEntity> findByMawbNo(String mawbNo) {
52 return preparesecondaryRepository.findByMawbNo(mawbNo); 52 return preparesecondaryRepository.findByMawbNo(mawbNo);
53 } 53 }
  54 +
  55 + public List<PreparesecondaryEntity> findByMainAndSub(String waybillnomaster,String waybillnoSub) {
  56 + return preparesecondaryRepository.findByMainAndSub(waybillnomaster, waybillnoSub);
  57 + }
54 58
55 public void deleteAll(Long ids) { 59 public void deleteAll(Long ids) {
56 preparesecondaryRepository.deleteAll(ids); 60 preparesecondaryRepository.deleteAll(ids);
1 -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
2 -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 1 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
3 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 4 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
4 <% 5 <%
5 - String path = request.getContextPath();  
6 - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  8 + + path + "/";
7 %> 9 %>
8 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 10 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
9 <html> 11 <html>
10 <head> 12 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 13 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 -<title>编辑</title>  
13 - <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">  
14 - <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">  
15 - <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">  
16 - <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">  
17 - <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>  
18 - <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>  
19 - <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>  
20 - <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">  
21 - <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>  
22 - <!-- validate 验证中英文 -->  
23 - <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script> 14 +<meta name="viewport" content="width=device-width, initial-scale=1">
  15 +<title><spring:message code="menu.consignee_info_set" /></title>
  16 +<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  17 +<script type="text/javascript" src="<%=basePath%>resource/validate/jquery.validate.js"></script>
  18 +<script type="text/javascript" src="<%=basePath%>resource/validate/validate-extends.js"></script>
  19 +<!-- validate 验证中英文 -->
  20 +<script type="text/javascript"
  21 + src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  22 +<link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  23 +<script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  24 +<script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>
  25 +<style type="text/css">
  26 +.required_span {
  27 + color: red;
  28 + margin-left: 10px;
  29 + font-size: 20px;
  30 +}
  31 +</style>
24 </head> 32 </head>
25 <body> 33 <body>
26 - <div class="container">  
27 - <div class="content">  
28 - <form class="form-control" id="form">  
29 - <input type="hidden" id="id" name="id" value="${consignee.id }" >  
30 - <table class="kv-table">  
31 - <tbody>  
32 - <tr>  
33 - <td class="kv-label"><spring:message code="consignee.code" /></td>  
34 - <td class="kv-content">  
35 - <input id="code" name="code" value="${consignee.code }">  
36 - </td>  
37 -  
38 - <td class="kv-label"><spring:message code="consignee.name" /></td>  
39 - <td class="kv-content">  
40 - <input id="name" name="name" value="${consignee.name }">  
41 - </td>  
42 - </tr>  
43 - <tr>  
44 - <td class="kv-label"><spring:message code="consignee.address" /></td>  
45 - <td class="kv-content">  
46 - <input id="address" name="address" value="${consignee.address}">  
47 - </td>  
48 -  
49 - <td class="kv-label"><spring:message code="consignee.tel" /></td>  
50 - <td class="kv-content">  
51 - <input id="tel" name="tel" value="${consignee.tel }">  
52 - </td>  
53 - </tr>  
54 - <tr>  
55 - <td colspan="6">  
56 - <div class="opt-buttons" style="padding-top:20px;" id="divsubmit">  
57 - <button onclick="save()" type="button" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">  
58 - <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save"/></span></span>  
59 - </button>  
60 -  
61 - </div>  
62 - </td>  
63 - </tr> 34 + <div style="padding: 15px;">
  35 + <h3>编辑收货人</h3>
  36 + <form class="layui-form">
  37 + <input type="hidden" id="id" name="id" value="${consignee.id}">
  38 + <table class="layui-table">
  39 + <tbody>
  40 + <tr>
  41 + <td><spring:message code="manifest.company" /><span class="required_span">*</span></td>
  42 + <td colspan="5">
  43 + <input type="text" name="name" id="name" maxlength="70" lay-verify="required"
  44 + value="${consignee.name}" autocomplete="off" class="layui-input" required
  45 + oninput="onInputChange(event,'name','oninput')" lay-verify="required"
  46 + onpropertychange="onInputChange(event,'name','onpropertychange')">
  47 + </td>
  48 + </tr>
  49 +
  50 + <tr>
  51 + <td><spring:message code="manifest.shr.name" /><span class="required_span">*</span></td>
  52 + <td>
  53 + <input type="text" name="code" id="code" value="${consignee.code}"
  54 + maxlength="70" autocomplete="off" class="layui-input" required lay-verify="required"
  55 + oninput="onInputChange(event,'code','oninput')"
  56 + onpropertychange="onInputChange(event,'code','onpropertychange')">
  57 + </td>
64 58
65 - </tbody>  
66 - </table>  
67 - </form>  
68 - </div>  
69 - <script>  
70 - //保存  
71 - function save(){  
72 - var data = $("#form").serialize();  
73 - $.post("<%=basePath %>consignee/save",data,function (data) {  
74 - if (data.status == 200) {  
75 - window.location.href = "<%=basePath %>consignee/list" ;  
76 - } else {  
77 - layer.open({content: "<spring:message code="opt.savefailed"/>"});  
78 - }  
79 - }) 59 + <td><spring:message code="manifest.telephone" /></td>
  60 + <td>
  61 + <input type="text" name="tel" value="${consignee.tel}"
  62 + autocomplete="off" class="layui-input" maxlength="50">
  63 + </td>
  64 +
  65 + <td><spring:message code="manifest.fax" /></td>
  66 + <td>
  67 + <input type="text" name="fax" value="${consignee.fax}"
  68 + autocomplete="off" class="layui-input" maxlength="50">
  69 + </td>
  70 + </tr>
  71 +
  72 + <tr>
  73 + <td><spring:message code="manifest.country" /><span class="required_span">*</span></td>
  74 + <td>
  75 + <input required type="text" name="country" id="country" value="${consignee.country}"
  76 + autocomplete="off" class="layui-input" maxlength="2" lay-verify="required"
  77 + oninput="onInputChange(event,'country','oninput')"
  78 + onpropertychange="onInputChange(event,'country','onpropertychange')">
  79 + </td>
  80 +
  81 + <td><spring:message code="manifest.city" /><span class="required_span">*</span></td>
  82 + <td>
  83 + <input required type="text" name="city" id="city" value="${consignee.city}"
  84 + autocomplete="off" class="layui-input" required lay-verify="required" maxlength="70"
  85 + oninput="onInputChange(event,'city','oninput')"
  86 + onpropertychange="onInputChange(event,'city','onpropertychange')">
  87 + </td>
  88 +
  89 + <td><spring:message code="manifest.zip.code" /></td>
  90 + <td>
  91 + <input type="text" name="zipcode" value="${consignee.zipcode}" autocomplete="off" class="layui-input" maxlength="9">
  92 + </td>
  93 + </tr>
  94 +
  95 + <tr>
  96 + <td><spring:message code="manifest.address" /><span class="required_span">*</span></td>
  97 + <td colspan="5">
  98 + <input required type="text" name="address" id="address" value="${consignee.address}"
  99 + autocomplete="off" class="layui-input" maxlength="70" lay-verify="required"
  100 + oninput="onInputChange(event,'address','oninput')"
  101 + onpropertychange="onInputChange(event,'address','onpropertychange')">
  102 + </td>
  103 + </tr>
  104 +
  105 + <tr>
  106 + <td><spring:message code="manifest.enterprise.code" /><span class="required_span">*</span></td>
  107 + <td>
  108 + <input required id="cnecusid" type="text" name="cusid" value="${consignee.cusid}"
  109 + autocomplete="off" class="layui-input" maxlength="128" lay-verify="required"
  110 + oninput="onInputChange(event,'cnecusid','oninput')"
  111 + onpropertychange="onInputChange(event,'cnecusid','onpropertychange')">
  112 + </td>
  113 +
  114 + <td><spring:message code="manifest.shr.cneaeo" /></td>
  115 + <td colspan="3">
  116 + <input type="text" name="aeo" id="cneaeo"
  117 + value="${consignee.aeo}" autocomplete="off" class="layui-input" maxlength="20"
  118 + oninput="onInputChange(event,'cneaeo','oninput')"
  119 + onpropertychange="onInputChange(event,'cneaeo','onpropertychange')">
  120 + </td>
  121 + </tr>
  122 + </tbody>
  123 + </table>
  124 +
  125 + <div class="layui-form-item">
  126 + <div class="layui-input-block">
  127 + <button class="layui-btn" lay-submit lay-filter="formDemo"><spring:message code="opt.save"/></span></button>
  128 + <button type="button" class="layui-btn layui-btn-primary"
  129 + onclick="self.location=document.referrer;">返回</button>
  130 + </div>
  131 + </div>
  132 + </form>
  133 + </div>
  134 +
  135 + <script>
  136 + var layer;
  137 + layui.use('layer', function() {
  138 + layer = layui.layer;
  139 + });
  140 +
  141 + $(window).load(function() {
  142 + });
  143 +
  144 + layui.use('form', function() {
  145 + var form = layui.form;
  146 +
  147 + form.on('submit(formDemo)', function(data){
  148 + save(data.field);
  149 + return false;
  150 + });
  151 +
  152 + });
  153 +
  154 + function save(data){
  155 + var url = "<%=basePath%>/consignee/save";
  156 + var params = "code=" + data.code;
  157 + params += "&name=" + data.name;
  158 + if (data.id) {
  159 + params += "&id=" + data.id;
80 } 160 }
81 - //取消  
82 - function cancel(){  
83 - 161 + if (data.cusid) {
  162 + params += "&cusid=" + data.cusid;
84 } 163 }
85 - </script>  
86 - </div> 164 + if (data.aeo) {
  165 + params += "&aeo=" + data.aeo;
  166 + }
  167 + if (data.address) {
  168 + params += "&address=" + data.address;
  169 + }
  170 + if (data.zipcode) {
  171 + params += "&zipcode=" + data.zipcode;
  172 + }
  173 + if (data.city) {
  174 + params += "&city=" + data.city;
  175 + }
  176 + if (data.deltaname) {
  177 + params += "&deltaname=" + data.deltaname;
  178 + }
  179 + if (data.country) {
  180 + params += "&country=" + data.country;
  181 + }
  182 + if (data.provincecode) {
  183 + params += "&provincecode=" + data.provincecode;
  184 + }
  185 + if (data.tel) {
  186 + params += "&tel=" + data.tel;
  187 + }
  188 + if (data.fax) {
  189 + params += "&fax=" + data.fax;
  190 + }
  191 +
  192 + $.post(url, params, function(response, status) {
  193 + if (response.status == 200) {
  194 + setInterval("afterSuccess()","1000");
  195 + }
  196 +
  197 + layer.msg(response.msg);
  198 + });
  199 + }
  200 +
  201 + function afterSuccess(){
  202 + self.location = document.referrer;
  203 + }
  204 + </script>
87 </body> 205 </body>
88 </html> 206 </html>
  1 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  3 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9 +<html>
  10 +<head>
  11 +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  12 +<title>编辑</title>
  13 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  14 + <link href="<%=basePath %>resource/css/basic_info.css" rel="stylesheet">
  15 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  16 + <link href="<%=basePath %>resource/css/form.css" rel="stylesheet">
  17 + <script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  18 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate.js"></script>
  19 + <script type="text/javascript" src="<%=basePath %>resource/validate/validate-extends.js"></script>
  20 + <link rel="stylesheet" href="<%=basePath %>resource/css/form.css">
  21 + <script type="text/javascript" src="<%=basePath %>resource/js/tools.js"></script>
  22 + <!-- validate 验证中英文 -->
  23 + <script type="text/javascript" src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  24 +</head>
  25 +<body>
  26 + <div class="container">
  27 + <div class="content">
  28 + <form class="form-control" id="form">
  29 + <input type="hidden" id="id" name="id" value="${consignee.id }" >
  30 + <table class="kv-table">
  31 + <tbody>
  32 + <tr>
  33 + <td class="kv-label"><spring:message code="consignee.code" /></td>
  34 + <td class="kv-content">
  35 + <input id="code" name="code" value="${consignee.code }">
  36 + </td>
  37 +
  38 + <td class="kv-label"><spring:message code="consignee.name" /></td>
  39 + <td class="kv-content">
  40 + <input id="name" name="name" value="${consignee.name }" maxlength="70">
  41 + </td>
  42 + </tr>
  43 + <tr>
  44 + <td class="kv-label"><spring:message code="consignee.address" /></td>
  45 + <td class="kv-content">
  46 + <input id="address" name="address" value="${consignee.address}" maxlength="70">
  47 + </td>
  48 +
  49 + <td class="kv-label"><spring:message code="consignee.tel" /></td>
  50 + <td class="kv-content">
  51 + <input id="tel" name="tel" value="${consignee.tel }" maxlength="50">
  52 + </td>
  53 + </tr>
  54 + <tr>
  55 + <td colspan="6">
  56 + <div class="opt-buttons" style="padding-top:20px;" id="divsubmit">
  57 + <button onclick="save()" type="button" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  58 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save"/></span></span>
  59 + </button>
  60 +
  61 + </div>
  62 + </td>
  63 + </tr>
  64 +
  65 + </tbody>
  66 + </table>
  67 + </form>
  68 + </div>
  69 + <script>
  70 + //保存
  71 + function save(){
  72 + var data = $("#form").serialize();
  73 + $.post("<%=basePath %>consignee/save",data,function (data) {
  74 + if (data.status == 200) {
  75 + window.location.href = "<%=basePath %>consignee/list" ;
  76 + } else {
  77 + layer.open({content: "<spring:message code="opt.savefailed"/>"});
  78 + }
  79 + })
  80 + }
  81 + //取消
  82 + function cancel(){
  83 +
  84 + }
  85 + </script>
  86 + </div>
  87 +</body>
  88 +</html>
@@ -11,123 +11,174 @@ @@ -11,123 +11,174 @@
11 <html> 11 <html>
12 <head> 12 <head>
13 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 13 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
14 -<title><string:message code="menu.consignee_info_set" /></title>  
15 <meta name="viewport" content="width=device-width, initial-scale=1"> 14 <meta name="viewport" content="width=device-width, initial-scale=1">
16 -<link href="<%=basePath%>resource/css/base.css" rel="stylesheet">  
17 -<link href="<%=basePath%>resource/css/basic_info.css" rel="stylesheet">  
18 -<link rel="stylesheet" type="text/css" href="<%=basePath%>resource/easyui/uimaker/icon.css">  
19 -<link rel="stylesheet" href="<%=basePath%>resource/easyui/uimaker/easyui.css">  
20 -<link rel="stylesheet" href="<%=basePath%>resource/css/form.css"> 15 +<title><spring:message code="menu.consignee_info_set" /></title>
21 <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script> 16 <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
22 <script type="text/javascript" src="<%=basePath%>resource/validate/jquery.validate.js"></script> 17 <script type="text/javascript" src="<%=basePath%>resource/validate/jquery.validate.js"></script>
23 <script type="text/javascript" src="<%=basePath%>resource/validate/validate-extends.js"></script> 18 <script type="text/javascript" src="<%=basePath%>resource/validate/validate-extends.js"></script>
24 -<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.easyui.min.js"></script>  
25 -<script type="text/javascript"  
26 - src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>  
27 -<script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>  
28 -<!--弹出层引入的JS-->  
29 -<script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>  
30 -  
31 -  
32 -<style type="text/css">  
33 -.required_span {  
34 - color: red;  
35 - margin-left: 10px;  
36 - font-size: 20px;  
37 -}  
38 -</style>  
39 <!-- validate 验证中英文 --> 19 <!-- validate 验证中英文 -->
40 <script type="text/javascript" 20 <script type="text/javascript"
41 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script> 21 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  22 +<link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  23 +<script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  24 +<script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>
42 </head> 25 </head>
43 <body> 26 <body>
44 - <div class="container">  
45 - <table id="dg" style="width: 100%;" title='<spring:message code="consignee.list"/>'  
46 - data-options="  
47 - rownumbers:true,  
48 - singleSelect:false,  
49 - autoRowHeight:false,  
50 - pagination:true,  
51 - fitColumns:true,  
52 - striped:true,  
53 - collapsible:true,  
54 - toolbar:'#tb',  
55 - pageSize:10">  
56 - <thead>  
57 - <tr>  
58 - <th field="id" checkbox="true"></th>  
59 - <th field="." formatter="editFormat" width="40"><spring:message code="opt.edit" /></th>  
60 - <th field="code" width="100"><spring:message code="consignee.code" /></th>  
61 - <th field="name" width="100"><spring:message code="consignee.name" /></th>  
62 - <th field="address" width="100"><spring:message code="consignee.address" /></th>  
63 - <th field="tel" width="50"><spring:message code="consignee.tel" /></th>  
64 - </tr>  
65 - </thead>  
66 - </table>  
67 - <div id="tb" style="padding: 0 30px;">  
68 - <input type="hidden" id="idcc">  
69 - <form id="searchForm">  
70 - <table class="search_form_table">  
71 - <a href="javascript:editRow()" class="easyui-linkbutton"  
72 - style="background: #18A197; color: #FFF; border: 1px solid #18A197;" iconCls="icon-add">  
73 - <spring:message code="opt.add" />  
74 - </a>  
75 - <a href="javascript:doDelete()" class="easyui-linkbutton"  
76 - style="background: red; color: #FFF; border: 1px solid red" iconCls="icon-no">  
77 - <spring:message code="opt.delete" />  
78 - </a>  
79 -  
80 - </table>  
81 - </form> 27 + <div class="layui-collapse">
  28 + <div class="layui-colla-item">
  29 + <h2 class="layui-colla-title">
  30 + <spring:message code="menu.consignee_info_set" />
  31 + </h2>
  32 + <div class="layui-colla-content layui-show">
  33 + <div class="layui-row">
  34 + <div class="layui-col-md2">
  35 + <button class="layui-btn" onclick="edit()">新增</button>
  36 + <button class="layui-btn layui-btn-danger" onclick="onDelete()">删除</button>
  37 + </div>
  38 + <div class="layui-col-md3">
  39 + <input id="searchInput" class="layui-input" type="text"
  40 + oninput="onInputChange(event,'searchInput','oninput')"
  41 + onpropertychange="onInputChange(event,'searchInput','onpropertychange')"
  42 + placeholder="请输入关键字" autocomplete="on">
  43 + </div>
  44 + <div class="layui-col-md3">
  45 + <button class="layui-btn layui-btn-normal" onclick="doSearch()">搜索</button>
  46 + </div>
  47 + </div>
  48 + <table id="consignee-table" class="layui-hide" lay-filter="consignee-table"></table>
  49 + </div>
82 </div> 50 </div>
83 </div> 51 </div>
84 52
  53 + <script type="text/html" id="opt-bar">
  54 + <i class="layui-icon layui-icon-edit" style="font-size: 14px; color: #1E9FFF;" lay-event="edit">编辑</i>
  55 + </script>
  56 + <script type="text/html" id="choose-bar">
  57 + <i class="layui-icon layui-icon-ok" style="font-size: 15px;font:bold; color: blue;" lay-event="choose">选择</i>
  58 + </script>
  59 +
85 <script> 60 <script>
86 - <%-- $.ajax({  
87 - url:"<%=basePath %>consignee/grid.json",  
88 - success:function(data){  
89 - console.log(data); 61 + var layer;
  62 + layui.use('layer', function() {
  63 + layer = layui.layer;
  64 + });
  65 +
  66 + layui.use('element', function() {
  67 + var element = layui.element;
  68 + });
  69 +
  70 + $(window).load(function() {
  71 + doSearch();
  72 + });
  73 +
  74 + var table;
  75 + function doSearch() {
  76 + var api = "<%=basePath%>consignee/search";
  77 + var searchKey = $("#searchInput").val();
  78 + if(!isEmpty(searchKey)){
  79 + api += "?key="+searchKey;
  80 + }
  81 +
  82 + layui.use('table', function() {
  83 + table = layui.table;
  84 + table.on('checkbox(consignee-table)', function(obj) {
  85 + /* console.log(JSON.stringify(obj)) */
  86 + });
  87 +
  88 + table.render({
  89 + elem : '#consignee-table',
  90 + url : api,
  91 + limit : 10,
  92 + page : true,
  93 + loading : true,
  94 + limits : [ 10, 15, 20, 25, 30, 35, 40, 45, 50 ],
  95 + text : {none:'暂无数据'},
  96 + cols : [ [ //表头
  97 + {
  98 + type : 'checkbox',
  99 + fixed : 'left',
  100 + width : 60
  101 + }, {
  102 + field : '',
  103 + title : '操作',
  104 + toolbar : '#opt-bar',
  105 + width : 80
  106 + },
  107 + <c:if test="${isWithChoose}">{field : '',title : '选择',toolbar : '#choose-bar',width : 80}, </c:if>
  108 + {
  109 + field : 'name',
  110 + title : '收货人公司',
  111 + }, {
  112 + field : 'city',
  113 + title : '收货人城市',
  114 + sort : true
  115 + }, {
  116 + field : 'country',
  117 + title : '国家代码',
  118 + sort : true,
  119 + width : 100
  120 + }, {
  121 + field : 'tel',
  122 + title : '电话'
  123 + } ] ]
  124 + });
  125 + });
  126 + }
  127 +
  128 + function onDelete() {
  129 + var checkStatus = table.checkStatus('consignee-table');
  130 + var data = checkStatus.data;
  131 + if(data&&data.length){
  132 + var ids="";
  133 + for (var i = 0; i < data.length; i++) {
  134 + var item = data[i];
  135 + var id = item.id;
  136 + ids+=id;
  137 + ids+=","
  138 + }
  139 +
  140 + parent.layer.confirm('确定删除吗?', function(index) {
  141 + parent.layer.close(index);
  142 + doDelete(ids);
  143 + });
90 } 144 }
91 - }); --%>  
92 - $(function(){  
93 - $("#dg").datagrid({  
94 - url:"<%=basePath%>consignee/grid.json",  
95 - /* queryParams:$("#searchForm").serializeJson(), */  
96 - onLoadSuccess:function(data){  
97 - console.log("load data success!"); 145 + }
  146 +
  147 + function doDelete(ids) {
  148 + var api = "<%=basePath%>consignee/delete";
  149 + $.post(api, "ids="+ids, function(response, status) {
  150 + if(response.status==200){
  151 + parent.layer.msg('删除成功');
  152 + window.location.reload();
  153 + }else{
  154 + parent.layer.msg("操作失败");
  155 + console.log("response-->"+JSON.stringify(response));
  156 + }
  157 + });
  158 + }
  159 +
  160 + layui.use('table', function() {
  161 + var table = layui.table;
  162 + table.on('tool(consignee-table)', function(obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
  163 + var data = obj.data; //获得当前行数据
  164 + var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
  165 + var tr = obj.tr; //获得当前行 tr 的DOM对象
  166 +
  167 + if (layEvent === 'edit') { //编辑
  168 + window.location.href = "<%=basePath%>/consignee/edit?id="+data.id;
  169 + }else if (layEvent === 'choose') {
  170 + //选择
  171 + var iframe = window.parent.document.getElementById('page-iframe').contentWindow;
  172 + iframe.onReceivConsignee(data);
  173 + parent.layer.closeAll();
98 } 174 }
99 }); 175 });
100 }); 176 });
101 177
102 - function editFormat(val, row, index){  
103 - console.log(row);  
104 - return '<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;padding-right:20px;" onclick="editRow('+row.id+')"><i class="iconfont">&#xe65a;</i></a>'; 178 + function edit(){
  179 + window.location.href = "<%=basePath%>/consignee/edit";
105 } 180 }
106 - function editRow(id){  
107 - if(typeof(id) == "undefined")  
108 - window.location.href = "<%=basePath%>/consignee/edit";  
109 - else  
110 - window.location.href = "<%=basePath%>/consignee/edit?id="+id;  
111 - }  
112 - function doDelete(){  
113 - var rows = $("#dg").datagrid('getChecked');  
114 - if(rows.length==0){  
115 - layer.open({content:"请先选中要删除的行"});  
116 - return false;  
117 - }  
118 - layer.confirm("确定要删除么?",{btn:['确定','取消']}, function () {  
119 - $.post("<%=basePath%>consignee/delete",{ids:getIds().join(",")},function(data){  
120 - if(data.status == 200) {  
121 - layer.confirm("删除成功!",{btn:['确定','取消']},function(){  
122 - window.location.href="<%=basePath%>consignee/list";  
123 - })  
124 - }else{  
125 - layer.open({content:"删除失败!"});  
126 - }  
127 - },"json");  
128 -  
129 - });  
130 - } 181 +
131 </script> 182 </script>
132 </body> 183 </body>
133 </html> 184 </html>
  1 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  2 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  8 + + path + "/";
  9 +%>
  10 +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  11 +<html>
  12 +<head>
  13 +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  14 +<title><string:message code="menu.consignee_info_set" /></title>
  15 +<meta name="viewport" content="width=device-width, initial-scale=1">
  16 +<link href="<%=basePath%>resource/css/base.css" rel="stylesheet">
  17 +<link href="<%=basePath%>resource/css/basic_info.css" rel="stylesheet">
  18 +<link rel="stylesheet" type="text/css" href="<%=basePath%>resource/easyui/uimaker/icon.css">
  19 +<link rel="stylesheet" href="<%=basePath%>resource/easyui/uimaker/easyui.css">
  20 +<link rel="stylesheet" href="<%=basePath%>resource/css/form.css">
  21 +<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  22 +<script type="text/javascript" src="<%=basePath%>resource/validate/jquery.validate.js"></script>
  23 +<script type="text/javascript" src="<%=basePath%>resource/validate/validate-extends.js"></script>
  24 +<script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.easyui.min.js"></script>
  25 +<script type="text/javascript"
  26 + src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
  27 +<script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>
  28 +<!--弹出层引入的JS-->
  29 +<script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
  30 +
  31 +
  32 +<style type="text/css">
  33 +.required_span {
  34 + color: red;
  35 + margin-left: 10px;
  36 + font-size: 20px;
  37 +}
  38 +</style>
  39 +<!-- validate 验证中英文 -->
  40 +<script type="text/javascript"
  41 + src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  42 +</head>
  43 +<body>
  44 + <div class="container">
  45 + <table id="dg" style="width: 100%;" title='<spring:message code="consignee.list"/>'
  46 + data-options="
  47 + rownumbers:true,
  48 + singleSelect:false,
  49 + autoRowHeight:false,
  50 + pagination:true,
  51 + fitColumns:true,
  52 + striped:true,
  53 + collapsible:true,
  54 + toolbar:'#tb',
  55 + pageSize:10">
  56 + <thead>
  57 + <tr>
  58 + <th field="id" checkbox="true"></th>
  59 + <th field="." formatter="editFormat" width="40"><spring:message code="opt.edit" /></th>
  60 + <th field="code" width="100"><spring:message code="consignee.code" /></th>
  61 + <th field="name" width="100"><spring:message code="consignee.name" /></th>
  62 + <th field="address" width="100"><spring:message code="consignee.address" /></th>
  63 + <th field="tel" width="50"><spring:message code="consignee.tel" /></th>
  64 + </tr>
  65 + </thead>
  66 + </table>
  67 + <div id="tb" style="padding: 0 30px;">
  68 + <input type="hidden" id="idcc">
  69 + <form id="searchForm">
  70 + <table class="search_form_table">
  71 + <a href="javascript:editRow()" class="easyui-linkbutton"
  72 + style="background: #18A197; color: #FFF; border: 1px solid #18A197;" iconCls="icon-add">
  73 + <spring:message code="opt.add" />
  74 + </a>
  75 + <a href="javascript:doDelete()" class="easyui-linkbutton"
  76 + style="background: red; color: #FFF; border: 1px solid red" iconCls="icon-no">
  77 + <spring:message code="opt.delete" />
  78 + </a>
  79 +
  80 + </table>
  81 + </form>
  82 + </div>
  83 + </div>
  84 +
  85 + <script>
  86 + <%-- $.ajax({
  87 + url:"<%=basePath %>consignee/grid.json",
  88 + success:function(data){
  89 + console.log(data);
  90 + }
  91 + }); --%>
  92 + $(function(){
  93 + $("#dg").datagrid({
  94 + url:"<%=basePath%>consignee/grid.json",
  95 + /* queryParams:$("#searchForm").serializeJson(), */
  96 + onLoadSuccess:function(data){
  97 + console.log("load data success!");
  98 + }
  99 + });
  100 + });
  101 +
  102 + function editFormat(val, row, index){
  103 + console.log(row);
  104 + return '<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;padding-right:20px;" onclick="editRow('+row.id+')"><i class="iconfont">&#xe65a;</i></a>';
  105 + }
  106 + function editRow(id){
  107 + if(typeof(id) == "undefined")
  108 + window.location.href = "<%=basePath%>/consignee/edit";
  109 + else
  110 + window.location.href = "<%=basePath%>/consignee/edit?id="+id;
  111 + }
  112 + function doDelete(){
  113 + var rows = $("#dg").datagrid('getChecked');
  114 + if(rows.length==0){
  115 + layer.open({content:"请先选中要删除的行"});
  116 + return false;
  117 + }
  118 + layer.confirm("确定要删除么?",{btn:['确定','取消']}, function () {
  119 + $.post("<%=basePath%>consignee/delete",{ids:getIds().join(",")},function(data){
  120 + if(data.status == 200) {
  121 + layer.confirm("删除成功!",{btn:['确定','取消']},function(){
  122 + window.location.href="<%=basePath%>consignee/list";
  123 + })
  124 + }else{
  125 + layer.open({content:"删除失败!"});
  126 + }
  127 + },"json");
  128 +
  129 + });
  130 + }
  131 + </script>
  132 +</body>
  133 +</html>
@@ -23,79 +23,91 @@ @@ -23,79 +23,91 @@
23 <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script> 23 <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
24 <script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script> 24 <script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>
25 <style type="text/css"> 25 <style type="text/css">
26 -.required_span {  
27 - color: red;  
28 - margin-left: 10px;  
29 - font-size: 20px;  
30 -} 26 + .required_span {
  27 + color: red;
  28 + margin-left: 10px;
  29 + font-size: 20px;
  30 + }
31 </style> 31 </style>
32 </head> 32 </head>
33 <body> 33 <body>
34 - <form class="layui-form">  
35 - <input type="hidden" id="id" name="id" value="${consignor.id}">  
36 - <table class="layui-table">  
37 - <tbody>  
38 - <tr>  
39 - <td><spring:message code="manifest.company" /><span class="required_span">*</span></td>  
40 - <td colspan="5"><input type="text" name="co_company" id="co_company" maxlength="70"  
41 - value="${consignor.co_company}" autocomplete="off" class="layui-input" required  
42 - maxlength="45" oninput="onInputChange(event,'co_company','oninput')"  
43 - onpropertychange="onInputChange(event,'co_company','onpropertychange')"></td>  
44 - </tr>  
45 -  
46 - <tr>  
47 - <td><spring:message code="manifest.send_name" /><span class="required_span">*</span></td>  
48 - <td><input type="text" name="co_name" value="${consignor.co_name}" maxlength="70"  
49 - autocomplete="off" class="layui-input" required maxlength="50"></td>  
50 - <td><spring:message code="manifest.telephone" /></td>  
51 - <td><input type="text" name="co_telephone" placeholder="<spring:message code="manifest.fhr.fh_placeholder"/>"  
52 - value="${consignor.co_telephone}" autocomplete="off" class="layui-input" maxlength="50"></td>  
53 - <td><spring:message code="manifest.fax" /></td>  
54 - <td><input type="text" name="co_fax" placeholder="<spring:message code="manifest.fhr.fh_placeholder"/>" value="${consignor.co_fax}"  
55 - autocomplete="off" class="layui-input" maxlength="45"></td>  
56 - </tr>  
57 -  
58 -  
59 - <tr>  
60 - <td><spring:message code="manifest.country" /><span class="required_span">*</span></td>  
61 - <td><input required type="text" name="co_country" value="${consignor.co_country}"  
62 - autocomplete="off" class="layui-input" maxlength="2"></td>  
63 - <td><spring:message code="manifest.city" /></td>  
64 - <td><input type="text" name="co_city"  
65 - value="${consignor.co_city}" autocomplete="off" class="layui-input" required maxlength="70"></td>  
66 - <td><spring:message code="manifest.zip.code" /></td>  
67 - <td><input type="text" name="co_zipcode" value="${consignor.co_zipcode}"  
68 - autocomplete="off" class="layui-input" maxlength="9"></td>  
69 - </tr>  
70 -  
71 - <tr>  
72 - <td><spring:message code="manifest.address" /><span class="required_span">*</span></td>  
73 - <td colspan="5"><input required type="text" name="co_address"  
74 - value="${consignor.co_address}" autocomplete="off" class="layui-input" maxlength="70"></td>  
75 - </tr>  
76 -  
77 - <tr>  
78 - <td><spring:message code="manifest.fhr.shpcusid" /><span class="required_span">*</span></td>  
79 - <td><input id="shpcusid" type="text" name="shpcusid" value="${consignor.shpcusid}"  
80 - autocomplete="off" class="layui-input" maxlength="100" oninput="onInputChange(event,'shpcusid','oninput')"  
81 - onpropertychange="onInputChange(event,'shpcusid','onpropertychange')"></td>  
82 - <td><spring:message code="manifest.fhr.shpaeo" /></td>  
83 - <td colspan="3"><input type="text" name="shpaeo" id="shpaeo"  
84 - value="${consignor.shpaeo}" autocomplete="off" class="layui-input" maxlength="20"  
85 - oninput="onInputChange(event,'shpaeo','oninput')"  
86 - onpropertychange="onInputChange(event,'shpaeo','onpropertychange')"></td>  
87 - </tr>  
88 - </tbody>  
89 - </table>  
90 -  
91 - <div class="layui-form-item">  
92 - <div class="layui-input-block">  
93 - <button class="layui-btn" lay-submit lay-filter="formDemo"><spring:message code="opt.save"/></span></button>  
94 - <button type="button" class="layui-btn layui-btn-primary"  
95 - onclick="self.location=document.referrer;">返回</button> 34 + <div style="padding: 15px;">
  35 + <h3>编辑发货人</h3>
  36 + <form class="layui-form">
  37 + <input type="hidden" id="id" name="id" value="${consignor.id}">
  38 + <table class="layui-table">
  39 + <tbody>
  40 + <tr>
  41 + <td><spring:message code="manifest.company" /><span class="required_span">*</span></td>
  42 + <td colspan="5"><input type="text" name="co_company" id="co_company" maxlength="70"
  43 + value="${consignor.co_company}" autocomplete="off" class="layui-input" required lay-verify="required"
  44 + oninput="onInputChange(event,'co_company','oninput')"
  45 + onpropertychange="onInputChange(event,'co_company','onpropertychange')"></td>
  46 + </tr>
  47 +
  48 + <tr>
  49 + <td><spring:message code="manifest.send_name" /><span class="required_span">*</span></td>
  50 + <td><input type="text" id="co_name" name="co_name" value="${consignor.co_name}" maxlength="70"
  51 + autocomplete="off" class="layui-input" required lay-verify="required"
  52 + oninput="onInputChange(event,'co_name','oninput')"
  53 + onpropertychange="onInputChange(event,'co_name','onpropertychange')"></td>
  54 + <td><spring:message code="manifest.telephone" /></td>
  55 + <td><input type="text" name="co_telephone" placeholder="<spring:message code="manifest.fhr.fh_placeholder"/>"
  56 + value="${consignor.co_telephone}" autocomplete="off" class="layui-input" maxlength="50"></td>
  57 + <td><spring:message code="manifest.fax" /></td>
  58 + <td><input type="text" name="co_fax" placeholder="<spring:message code="manifest.fhr.fh_placeholder"/>" value="${consignor.co_fax}"
  59 + autocomplete="off" class="layui-input" maxlength="50"></td>
  60 + </tr>
  61 +
  62 + <tr>
  63 + <td><spring:message code="manifest.country" /><span class="required_span">*</span></td>
  64 + <td><input required id="co_country" type="text" name="co_country" value="${consignor.co_country}"
  65 + autocomplete="off" class="layui-input" maxlength="2" lay-verify="required"
  66 + oninput="onInputChange(event,'co_country','oninput')"
  67 + onpropertychange="onInputChange(event,'co_country','onpropertychange')"></td>
  68 + <td><spring:message code="manifest.city" /></td>
  69 + <td>
  70 + <input type="text" name="co_city" id="co_city" value="${consignor.co_city}"
  71 + autocomplete="off" class="layui-input" required maxlength="35" lay-verify="required"
  72 + oninput="onInputChange(event,'co_city','oninput')"
  73 + onpropertychange="onInputChange(event,'co_city','onpropertychange')">
  74 + </td>
  75 + <td><spring:message code="manifest.zip.code" /></td>
  76 + <td><input type="text" name="co_zipcode" value="${consignor.co_zipcode}"
  77 + autocomplete="off" class="layui-input" maxlength="9"></td>
  78 + </tr>
  79 +
  80 + <tr>
  81 + <td><spring:message code="manifest.address" /><span class="required_span">*</span></td>
  82 + <td colspan="5"><input id="co_address" required type="text" name="co_address" lay-verify="required"
  83 + value="${consignor.co_address}" autocomplete="off" class="layui-input" maxlength="70"
  84 + oninput="onInputChange(event,'co_address','oninput')"
  85 + onpropertychange="onInputChange(event,'co_address','onpropertychange')"></td>
  86 + </tr>
  87 +
  88 + <tr>
  89 + <td><spring:message code="manifest.enterprise.code" /><span class="required_span">*</span></td>
  90 + <td><input required id="shpcusid" type="text" name="shpcusid" value="${consignor.shpcusid}" lay-verify="required"
  91 + autocomplete="off" class="layui-input" maxlength="128" oninput="onInputChange(event,'shpcusid','oninput')"
  92 + onpropertychange="onInputChange(event,'shpcusid','onpropertychange')"></td>
  93 + <td><spring:message code="manifest.fhr.shpaeo" /></td>
  94 + <td colspan="3"><input type="text" name="shpaeo" id="shpaeo"
  95 + value="${consignor.shpaeo}" autocomplete="off" class="layui-input" maxlength="20"
  96 + oninput="onInputChange(event,'shpaeo','oninput')"
  97 + onpropertychange="onInputChange(event,'shpaeo','onpropertychange')"></td>
  98 + </tr>
  99 + </tbody>
  100 + </table>
  101 +
  102 + <div class="layui-form-item">
  103 + <div class="layui-input-block">
  104 + <button class="layui-btn" lay-submit lay-filter="formDemo"><spring:message code="opt.save"/></span></button>
  105 + <button type="button" class="layui-btn layui-btn-primary"
  106 + onclick="self.location=document.referrer;">返回</button>
  107 + </div>
96 </div> 108 </div>
97 - </div>  
98 - </form> 109 + </form>
  110 + </div>
99 111
100 <script> 112 <script>
101 var layer; 113 var layer;
@@ -20,10 +20,12 @@ @@ -20,10 +20,12 @@
20 <script type="text/javascript" 20 <script type="text/javascript"
21 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script> 21 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
22 <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all"> 22 <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  23 +<script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
23 <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script> 24 <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
24 <script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script> 25 <script type="text/javascript" src="<%=basePath%>resource/js/tools.js"></script>
25 </head> 26 </head>
26 <body> 27 <body>
  28 + <input type="hidden" id="mainIframeName" name="mainIframeName" value="${parentName}">
27 <div class="layui-collapse"> 29 <div class="layui-collapse">
28 <div class="layui-colla-item"> 30 <div class="layui-colla-item">
29 <h2 class="layui-colla-title"> 31 <h2 class="layui-colla-title">
@@ -31,10 +33,19 @@ @@ -31,10 +33,19 @@
31 </h2> 33 </h2>
32 <div class="layui-colla-content layui-show"> 34 <div class="layui-colla-content layui-show">
33 <div class="layui-row"> 35 <div class="layui-row">
34 - <div class="layui-col-md12"> 36 + <div class="layui-col-md2">
35 <button class="layui-btn" onclick="edit()">新增</button> 37 <button class="layui-btn" onclick="edit()">新增</button>
36 <button class="layui-btn layui-btn-danger" onclick="onDelete()">删除</button> 38 <button class="layui-btn layui-btn-danger" onclick="onDelete()">删除</button>
37 </div> 39 </div>
  40 + <div class="layui-col-md3">
  41 + <input id="searchInput" class="layui-input" type="text"
  42 + oninput="onInputChange(event,'searchInput','oninput')"
  43 + onpropertychange="onInputChange(event,'searchInput','onpropertychange')"
  44 + placeholder="请输入关键字" autocomplete="on">
  45 + </div>
  46 + <div class="layui-col-md3">
  47 + <button class="layui-btn layui-btn-normal" onclick="doSearch()">搜索</button>
  48 + </div>
38 </div> 49 </div>
39 <table id="consignor-table" class="layui-hide" lay-filter="consignor-table"></table> 50 <table id="consignor-table" class="layui-hide" lay-filter="consignor-table"></table>
40 </div> 51 </div>
@@ -44,6 +55,10 @@ @@ -44,6 +55,10 @@
44 <script type="text/html" id="opt-bar"> 55 <script type="text/html" id="opt-bar">
45 <i class="layui-icon layui-icon-edit" style="font-size: 14px; color: #1E9FFF;" lay-event="edit">编辑</i> 56 <i class="layui-icon layui-icon-edit" style="font-size: 14px; color: #1E9FFF;" lay-event="edit">编辑</i>
46 </script> 57 </script>
  58 +
  59 + <script type="text/html" id="choose-bar">
  60 + <i class="layui-icon layui-icon-ok" style="font-size: 15px;font:bold; color: blue;" lay-event="choose">选择</i>
  61 + </script>
47 62
48 <script> 63 <script>
49 var layer; 64 var layer;
@@ -62,6 +77,11 @@ @@ -62,6 +77,11 @@
62 var table; 77 var table;
63 function doSearch() { 78 function doSearch() {
64 var api = "<%=basePath%>consignor/search"; 79 var api = "<%=basePath%>consignor/search";
  80 + var searchKey = $("#searchInput").val();
  81 + if(!isEmpty(searchKey)){
  82 + api += "?key="+searchKey;
  83 + }
  84 +
65 layui.use('table', function() { 85 layui.use('table', function() {
66 table = layui.table; 86 table = layui.table;
67 table.on('checkbox(consignor-table)', function(obj) { 87 table.on('checkbox(consignor-table)', function(obj) {
@@ -75,7 +95,7 @@ @@ -75,7 +95,7 @@
75 page : true, 95 page : true,
76 loading : true, 96 loading : true,
77 limits : [ 10, 15, 20, 25, 30, 35, 40, 45, 50 ], 97 limits : [ 10, 15, 20, 25, 30, 35, 40, 45, 50 ],
78 - text : '暂无数据', 98 + text : {none:'暂无数据'},
79 cols : [ [ //表头 99 cols : [ [ //表头
80 { 100 {
81 type : 'checkbox', 101 type : 'checkbox',
@@ -86,7 +106,9 @@ @@ -86,7 +106,9 @@
86 title : '操作', 106 title : '操作',
87 toolbar : '#opt-bar', 107 toolbar : '#opt-bar',
88 width : 80 108 width : 80
89 - }, { 109 + },
  110 + <c:if test="${isWithChoose}">{field : '',title : '选择',toolbar : '#choose-bar',width : 80}, </c:if>
  111 + {
90 field : 'co_company', 112 field : 'co_company',
91 title : '发货人公司', 113 title : '发货人公司',
92 }, { 114 }, {
@@ -119,7 +141,7 @@ @@ -119,7 +141,7 @@
119 } 141 }
120 142
121 parent.layer.confirm('确定删除吗?', function(index) { 143 parent.layer.confirm('确定删除吗?', function(index) {
122 - layer.close(index); 144 + parent.layer.close(index);
123 doDelete(ids); 145 doDelete(ids);
124 }); 146 });
125 } 147 }
@@ -129,10 +151,10 @@ @@ -129,10 +151,10 @@
129 var api = "<%=basePath%>consignor/delete"; 151 var api = "<%=basePath%>consignor/delete";
130 $.post(api, "ids="+ids, function(response, status) { 152 $.post(api, "ids="+ids, function(response, status) {
131 if(response.status==200){ 153 if(response.status==200){
132 - layer.msg('删除成功'); 154 + parent.layer.msg('删除成功');
133 window.location.reload(); 155 window.location.reload();
134 }else{ 156 }else{
135 - layer.msg("操作失败"); 157 + parent.layer.msg("操作失败");
136 console.log("response-->"+JSON.stringify(response)); 158 console.log("response-->"+JSON.stringify(response));
137 } 159 }
138 }); 160 });
@@ -145,12 +167,19 @@ @@ -145,12 +167,19 @@
145 var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) 167 var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
146 var tr = obj.tr; //获得当前行 tr 的DOM对象 168 var tr = obj.tr; //获得当前行 tr 的DOM对象
147 169
148 - if (layEvent === 'edit') { //编辑 170 + if (layEvent === 'edit') {
  171 + //编辑
149 window.location.href = "<%=basePath%>/consignor/edit?id="+data.id; 172 window.location.href = "<%=basePath%>/consignor/edit?id="+data.id;
  173 + }else if (layEvent === 'choose') {
  174 + //选择
  175 + var iframe = window.parent.document.getElementById('page-iframe').contentWindow;
  176 + iframe.onReceivConsignor(data);
  177 + parent.layer.closeAll();
150 } 178 }
151 }); 179 });
152 }); 180 });
153 181
  182 +
154 function edit(){ 183 function edit(){
155 window.location.href = "<%=basePath%>/consignor/edit"; 184 window.location.href = "<%=basePath%>/consignor/edit";
156 } 185 }
@@ -164,7 +164,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request. @@ -164,7 +164,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
164 <div id="pf-page"> 164 <div id="pf-page">
165 <div class="easyui-tabs1" style="width:100%;height:100%;"> 165 <div class="easyui-tabs1" style="width:100%;height:100%;">
166 <div title='<spring:message code="menu.premanifest" />' data-options="closable:true"> 166 <div title='<spring:message code="menu.premanifest" />' data-options="closable:true">
167 - <iframe class="page-iframe" src="<%=basePath %>manifest/list?type=domestic" frameborder="no" border="no" height="100%" width="100%" scrolling="auto"></iframe> 167 + <iframe id="page-iframe" class="page-iframe" src="<%=basePath %>manifest/list?type=domestic" frameborder="no" border="no" height="100%" width="100%" scrolling="auto"></iframe>
168 </div> 168 </div>
169 </div> 169 </div>
170 </div> 170 </div>
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 <!-- validate 验证中英文 --> 38 <!-- validate 验证中英文 -->
39 <script type="text/javascript" 39 <script type="text/javascript"
40 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script> 40 src="<%=basePath %>resource/validate/jquery.validate-${pageContext.response.locale}.js"></script>
  41 +
41 </head> 42 </head>
42 <body> 43 <body>
43 <div class="container"> 44 <div class="container">
@@ -82,57 +83,14 @@ @@ -82,57 +83,14 @@
82 checkNo(val); 83 checkNo(val);
83 } 84 }
84 //用户输入订单号满足格式 85 //用户输入订单号满足格式
85 - <%-- if(val.length == 12 && val.indexOf("-") >= 0)  
86 - {  
87 - $.ajax({  
88 - url:"<%=basePath%>/manifest/gettreecode",  
89 - method:"get",  
90 - data:{  
91 - STOCKPRE:val.split("-")[0]  
92 - },  
93 - success:function(data){  
94 - var d = data.data;  
95 - $("#carrier").val(d.cARRIERID);  
96 - }  
97 - });  
98 - } --%>  
99 -  
100 } 86 }
101 </script> 87 </script>
102 </tr> 88 </tr>
103 - <!-- <tr> -->  
104 - <%-- <td class="kv-label"><spring:message code="delivery.name.of.goods" /></td>  
105 - <td class="kv-content"><input id="name_ofgoods" name="name_ofgoods" type="text"  
106 - value="${manifest.name_ofgoods }"></td> --%>  
107 - <%-- <td class="kv-label"><spring:message code="delivery.delivery.station" /><span  
108 - class="required_span">*</span></td>  
109 - <td class="kv-content"><select id="delivery_station" name="delivery_station">  
110 - <option value="001"  
111 - <c:if test = "${manifest.delivery_station ==001 }">selected="selected"</c:if>><spring:message  
112 - code="delivery.ground.handling" /></option>  
113 - </select></td>  
114 - <td class="kv-label"><spring:message code="delivery.delivery.type" /></td>  
115 - <td class="kv-content"><select class="delivery" id="de_type" name="de_type">  
116 - <option value="001" <c:if test = "${manifest.de_type ==001 }">selected="selected"</c:if>><spring:message  
117 - code="manifest.general.delivery" /></option>  
118 - <option value="002" <c:if test = "${manifest.de_type ==002 }">selected="selected"</c:if>><spring:message  
119 - code="manifest.mail.delivery" /></option>  
120 - <option value="003" <c:if test = "${manifest.de_type ==003 }">selected="selected"</c:if>><spring:message  
121 - code="manifest.International" /></option>  
122 - </select></td> --%>  
123 - <!-- </tr> -->  
124 <tr> 89 <tr>
125 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="6"><spring:message 90 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="6"><spring:message
126 code="manifest.flight.information" /></td> 91 code="manifest.flight.information" /></td>
127 </tr> 92 </tr>
128 <tr> 93 <tr>
129 - <%-- <td class="kv-label"><spring:message code="manifest.carrier" /><span  
130 - class="required_span">*</span></td> --%>  
131 - <%-- <td class="kv-content"><input required id="carrier_new" name="carrier" type="text"  
132 - placeholder="<spring:message code='manifest.carrier.tip'/>"  
133 - value="${manifest.carrier}" oninput="onInputChange(event,'carrier_new','oninput')"  
134 - onpropertychange="onInputChange(event,'carrier_new','onpropertychange')"></td> --%>  
135 -  
136 <td class="kv-label"><spring:message code="manifest.flight.number" /><span 94 <td class="kv-label"><spring:message code="manifest.flight.number" /><span
137 class="required_span">*</span></td> 95 class="required_span">*</span></td>
138 <td class="kv-content"><input required id="flightno" name="flightno" type="text" 96 <td class="kv-content"><input required id="flightno" name="flightno" type="text"
@@ -261,23 +219,12 @@ @@ -261,23 +219,12 @@
261 </td> 219 </td>
262 220
263 </tr> 221 </tr>
264 - <%-- <tr>  
265 - <td class="kv-label"><spring:message code="manifest.agent.name" /></td>  
266 - <td class="kv-content"><input id="agentman" name="agentman" type="text"  
267 - value="${manifest.agentman}"  
268 - placeholder="<spring:message code="agent.namePlaceholder"/>"></td>  
269 - <td class="kv-label"><spring:message code="manifest.agent.company" /></td>  
270 - <td class="kv-content" colspan="3">  
271 - <input id="agentcompany" name="agentcompany" type="text" value="${manifest.agentcompany}"  
272 - placeholder="<spring:message code="agent.companyPlaceholder"/>">  
273 - </td>  
274 - </tr> --%>  
275 <!-- 发货人信息 start --> 222 <!-- 发货人信息 start -->
276 <tr style="background-color: #EBEDF4; color: black;"> 223 <tr style="background-color: #EBEDF4; color: black;">
277 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message 224 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message
278 code="manifest.shipper.information" /></td> 225 code="manifest.shipper.information" /></td>
279 - <!-- <td class="kv-label"> <button type="button" class="layui-btn layui-btn-normal layui-icon layui-icon-user" onclick="showDialog()">弹出选择框</button> </td> -->  
280 - <td class="kv-content" colspan="4"><select onchange="changeConsignorSelect()" 226 + <td class="kv-label"> <button type="button" class="layui-btn layui-btn-sm layui-icon layui-icon-user" onclick="showConsignorDialog()">请选择发货人</button> </td>
  227 + <%-- <td class="kv-content" colspan="4"><select onchange="changeConsignorSelect()"
281 id="fh_select"> 228 id="fh_select">
282 <option value="-1">请选择</option> 229 <option value="-1">请选择</option>
283 </select> <script> 230 </select> <script>
@@ -337,7 +284,7 @@ @@ -337,7 +284,7 @@
337 } 284 }
338 }); 285 });
339 </script> 286 </script>
340 - </td> 287 + </td> --%>
341 </tr> 288 </tr>
342 <tr> 289 <tr>
343 <td class="kv-label"><spring:message code="manifest.company" /><span 290 <td class="kv-label"><spring:message code="manifest.company" /><span
@@ -361,10 +308,6 @@ @@ -361,10 +308,6 @@
361 onpropertychange="onInputChange(event,'co_country','onpropertychange')"></td> 308 onpropertychange="onInputChange(event,'co_country','onpropertychange')"></td>
362 </tr> 309 </tr>
363 <tr> 310 <tr>
364 - <%-- <td class="kv-label"><spring:message code="manifest.city" /></td>  
365 - <td class="kv-content"><input id="co_city" name="co_city" type="text"  
366 - value="${manifest.co_city }" oninput="onInputChange(event,'co_city','oninput')"  
367 - onpropertychange="onInputChange(event,'co_city','onpropertychange')"></td> --%>  
368 <td class="kv-label"><spring:message code="manifest.state" /></td> 311 <td class="kv-label"><spring:message code="manifest.state" /></td>
369 <td class="kv-content"><input id="co_deltaname" name="co_deltaname" type="text" maxlength="35" 312 <td class="kv-content"><input id="co_deltaname" name="co_deltaname" type="text" maxlength="35"
370 value="${manifest.co_deltaname}"></td> 313 value="${manifest.co_deltaname}"></td>
@@ -423,7 +366,8 @@ @@ -423,7 +366,8 @@
423 <tr style="background-color: #EBEDF4; color: black;"> 366 <tr style="background-color: #EBEDF4; color: black;">
424 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message 367 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message
425 code="manifest.consignee" /></td> 368 code="manifest.consignee" /></td>
426 - <td class="kv-content" colspan="5"><select onchange="changeConsigneeSelect()" 369 + <td class="kv-label"> <button type="button" class="layui-btn layui-btn-sm layui-icon layui-icon-user" onclick="showConsigneeDialog()">请选择收货人</button> </td>
  370 + <%-- <td class="kv-content" colspan="5"><select onchange="changeConsigneeSelect()"
427 id="consignee_select"> 371 id="consignee_select">
428 <option value="-1">请选择</option> 372 <option value="-1">请选择</option>
429 </select> <script> 373 </select> <script>
@@ -437,7 +381,7 @@ @@ -437,7 +381,7 @@
437 var consignee = consigneeList[index]; 381 var consignee = consigneeList[index];
438 $("#sh_company").val(consignee.code?consignee.code:""); 382 $("#sh_company").val(consignee.code?consignee.code:"");
439 383
440 - var address = consignee.co_address; 384 + var address = consignee.address;
441 if(notEmpty(address)){ 385 if(notEmpty(address)){
442 if(address.length>70){ 386 if(address.length>70){
443 address = address.substring(0,70); 387 address = address.substring(0,70);
@@ -471,7 +415,7 @@ @@ -471,7 +415,7 @@
471 } 415 }
472 } 416 }
473 }); 417 });
474 - </script></td> 418 + </script></td> --%>
475 </tr> 419 </tr>
476 <tr> 420 <tr>
477 <td class="kv-label"><spring:message code="manifest.company" /><span 421 <td class="kv-label"><spring:message code="manifest.company" /><span
@@ -522,16 +466,6 @@ @@ -522,16 +466,6 @@
522 <td style="display: none;" class="kv-content" colspan="5"><input required id="sh_name" 466 <td style="display: none;" class="kv-content" colspan="5"><input required id="sh_name"
523 name="sh_name" type="text" value="${manifest.sh_name }"></td> 467 name="sh_name" type="text" value="${manifest.sh_name }"></td>
524 </tr> 468 </tr>
525 - <%-- <tr>  
526 - <td class="kv-label"><spring:message code="manifest.province.code" /></td>  
527 - <td class="kv-content"><input id="sh_provincecode" name="sh_provincecode" type="text"  
528 - value="${manifest.sh_provincecode }"  
529 - oninput="onInputChange(event,'sh_provincecode','oninput')"  
530 - onpropertychange="onInputChange(event,'sh_provincecode','onpropertychange')"></td>  
531 - <td class="kv-label"><spring:message code="manifest.province.name" /></td>  
532 - <td class="kv-content" colspan="3"><input id="sh_provincename" name="sh_provincename" type="text"  
533 - value="${manifest.sh_provincename }"></td>  
534 - </tr> --%>  
535 469
536 <tr> 470 <tr>
537 <td class="kv-label" colspan="6"> 471 <td class="kv-label" colspan="6">
@@ -749,8 +683,6 @@ $(function(){ @@ -749,8 +683,6 @@ $(function(){
749 submitHandler:function(form){ 683 submitHandler:function(form){
750 var co_telephone = $("#co_telephone").val(); 684 var co_telephone = $("#co_telephone").val();
751 var co_fax = $("#co_fax").val(); 685 var co_fax = $("#co_fax").val();
752 - console.log("co_telephone-->"+co_telephone);  
753 - console.log("co_fax-->"+co_fax);  
754 686
755 if(isEmpty(co_telephone)&&isEmpty(co_fax)){ 687 if(isEmpty(co_telephone)&&isEmpty(co_fax)){
756 layer.open({content: "<spring:message code='manifest.fhr.fh_placeholder'/>"}); 688 layer.open({content: "<spring:message code='manifest.fhr.fh_placeholder'/>"});
@@ -1082,16 +1014,93 @@ $(function(){ @@ -1082,16 +1014,93 @@ $(function(){
1082 }); 1014 });
1083 } 1015 }
1084 1016
1085 - function showDialog() { 1017 + function onReceivConsignor(consignor){
  1018 + if(consignor){
  1019 + $("#co_company").val(consignor.co_company?consignor.co_company.toUpperCase():"");
  1020 + var address = consignor.co_address;
  1021 + if(notEmpty(address)){
  1022 + if(address.length>70){
  1023 + address = address.substring(0,70);
  1024 + }
  1025 + }else{
  1026 + address = "";
  1027 + }
  1028 + $("#co_address").val(address.toUpperCase());
  1029 + $("#co_telephone").val(consignor.co_telephone?consignor.co_telephone:"");
  1030 + $("#co_country").val(consignor.co_country?consignor.co_country:"CN");
  1031 + $("#co_city").val(consignor.co_city?consignor.co_city.toUpperCase():"");
  1032 + $("#co_deltaname").val(consignor.co_deltaname?consignor.co_deltaname.toUpperCase():"");
  1033 + $("#co_name").val(consignor.co_name?consignor.co_name.toUpperCase():"");
  1034 + $("#co_fax").val(consignor.co_fax?consignor.co_fax:"");
  1035 + $("#co_zipcode").val(consignor.co_zipcode?consignor.co_zipcode:"");
  1036 + $("#shpaeo").val(consignor.shpaeo?consignor.shpaeo:"");
  1037 +
  1038 + if(notEmpty(consignor.shpcusid)){
  1039 + var temp_1 = consignor.shpcusid.split("+")[0];
  1040 + var temp_2 = consignor.shpcusid.split("+")[1];
  1041 + if(notEmpty(temp_2)){
  1042 + $("#shpcusid").val(temp_2.toUpperCase());
  1043 + }
  1044 + }
  1045 + }
  1046 + }
  1047 +
  1048 + function showConsignorDialog() {
  1049 + var parentName= window.name;
  1050 + layui.use('layer', function(){
  1051 + var layer = layui.layer;
  1052 + var viewUrl="<%=basePath%>consignor/list?isWithChoose=true";
  1053 + parent.layer.open({
  1054 + type: 2,
  1055 + title: '',
  1056 + shadeClose: false,
  1057 + shade: 0.8,
  1058 + area: ['90%', '80%'],
  1059 + content: viewUrl
  1060 + });
  1061 + });
  1062 + }
  1063 +
  1064 + function onReceivConsignee(consignee) {
  1065 + var address = consignee.address;
  1066 + if(notEmpty(address)){
  1067 + if(address.length>70){
  1068 + address = address.substring(0,70);
  1069 + }
  1070 + }else{
  1071 + address = "";
  1072 + }
  1073 +
  1074 + $("#sh_address").val(address.toUpperCase());
  1075 + $("#sh_company").val(consignee.name?consignee.name:"");
  1076 + $("#sh_telephone").val(consignee.tel?consignee.tel:"");
  1077 + $("#sh_country").val(consignee.name?consignee.name:"");
  1078 + $("#sh_name").val(consignee.code?consignee.code:"");
  1079 + $("#sh_city").val(consignee.city?consignee.city.toUpperCase():"");
  1080 + $("#sh_fax").val(consignee.fax?consignee.fax:"");
  1081 + $("#sh_zipcode").val(consignee.zipcode?consignee.zipcode:"");
  1082 + $("#cneaeo").val(consignee.aeo?consignee.aeo:"");
  1083 +
  1084 + if(notEmpty(consignee.cusid)){
  1085 + var temp_1 = consignee.cusid.split("+")[0];
  1086 + var temp_2 = consignee.cusid.split("+")[1];
  1087 + if(notEmpty(temp_2)){
  1088 + $("#cnecusid").val(temp_2.toUpperCase());
  1089 + }
  1090 + }
  1091 + }
  1092 +
  1093 + function showConsigneeDialog() {
  1094 + var parentName= window.name;
1086 layui.use('layer', function(){ 1095 layui.use('layer', function(){
1087 var layer = layui.layer; 1096 var layer = layui.layer;
1088 - var viewUrl="<%=basePath%>consignor/list"; 1097 + var viewUrl="<%=basePath%>consignee/list?isWithChoose=true";
1089 parent.layer.open({ 1098 parent.layer.open({
1090 type: 2, 1099 type: 2,
1091 title: '', 1100 title: '',
1092 - shadeClose: true, 1101 + shadeClose: false,
1093 shade: 0.8, 1102 shade: 0.8,
1094 - area: ['50%', '90%'], 1103 + area: ['90%', '80%'],
1095 content: viewUrl 1104 content: viewUrl
1096 }); 1105 });
1097 }); 1106 });
@@ -43,8 +43,8 @@ @@ -43,8 +43,8 @@
43 <th field="flightdate" formatter="formatFlightDate"><spring:message code="manifest.flight.date"/></th> 43 <th field="flightdate" formatter="formatFlightDate"><spring:message code="manifest.flight.date"/></th>
44 <th field="originatingstation"><spring:message code="manifest.starting.point"/></th> 44 <th field="originatingstation"><spring:message code="manifest.starting.point"/></th>
45 <th field="destinationstation"><spring:message code="manifest.destination"/></th> 45 <th field="destinationstation"><spring:message code="manifest.destination"/></th>
46 - <th field="preparetotalweight"><spring:message code="manifest.pre.weight"/></th>  
47 <th field="preparetotalpiece"><spring:message code="manifest.number.of.fittings"/></th> 46 <th field="preparetotalpiece"><spring:message code="manifest.number.of.fittings"/></th>
  47 + <th field="preparetotalweight"><spring:message code="manifest.pre.weight"/></th>
48 <th field="response_text" formatter="checkResponseText" width="200"><spring:message code="manifest.response_text" /></th> 48 <th field="response_text" formatter="checkResponseText" width="200"><spring:message code="manifest.response_text" /></th>
49 <th field=".." formatter="operatorFormat"><spring:message code="opt.operator" /></th> 49 <th field=".." formatter="operatorFormat"><spring:message code="opt.operator" /></th>
50 </tr> 50 </tr>
@@ -66,10 +66,6 @@ @@ -66,10 +66,6 @@
66 name="waybillnosecondary" type="hidden" value="${pre.waybillnosecondary }"></td> 66 name="waybillnosecondary" type="hidden" value="${pre.waybillnosecondary }"></td>
67 </tr> 67 </tr>
68 <tr> 68 <tr>
69 - <%-- <td class="kv-label"><spring:message code="delivery.name.of.goods" /><span  
70 - class="required_span">*</span></td>  
71 - <td class="kv-content"><input required id="name_ofgoods" name="name_ofgoods" type="text"  
72 - value="${pre.name_ofgoods }"></td> --%>  
73 <td class="kv-label"><spring:message code="delivery.delivery.station" /><span 69 <td class="kv-label"><spring:message code="delivery.delivery.station" /><span
74 class="required_span">*</span></td> 70 class="required_span">*</span></td>
75 <td class="kv-content"><select required id="delivery_station" name="delivery_station"> 71 <td class="kv-content"><select required id="delivery_station" name="delivery_station">
@@ -97,13 +93,6 @@ @@ -97,13 +93,6 @@
97 code="manifest.flight.information" /></td> 93 code="manifest.flight.information" /></td>
98 </tr> 94 </tr>
99 <tr> 95 <tr>
100 - <%-- <td class="kv-label"><spring:message code="manifest.carrier" /><span  
101 - class="required_span">*</span></td> --%>  
102 - <%-- <td class="kv-content"><input required id="carrier_new" name="carrier" type="text"  
103 - placeholder="<spring:message code='manifest.carrier.tip'/>"  
104 - value="${pre.carrier}" oninput="onInputChange(event,'carrier_new','oninput')"  
105 - onpropertychange="onInputChange(event,'carrier_new','onpropertychange')"></td> --%>  
106 -  
107 <td class="kv-label"><spring:message code="manifest.flight.number" /><span 96 <td class="kv-label"><spring:message code="manifest.flight.number" /><span
108 class="required_span">*</span></td> 97 class="required_span">*</span></td>
109 <td class="kv-content"><input required id="flightno" name="flightno" type="text" 98 <td class="kv-content"><input required id="flightno" name="flightno" type="text"
@@ -220,22 +209,14 @@ @@ -220,22 +209,14 @@
220 onpropertychange="onInputChange(event,'productname','onpropertychange')"/> 209 onpropertychange="onInputChange(event,'productname','onpropertychange')"/>
221 </td> 210 </td>
222 </tr> 211 </tr>
223 - <%-- <tr>  
224 - <td class="kv-label"><spring:message code="manifest.agent.name" /></td>  
225 - <td class="kv-content"><input id="agentman" name="agentman" type="text"  
226 - value="${agent.threeCode}" placeholder="<spring:message code="agent.namePlaceholder"/>"></td>  
227 - <td class="kv-label"><spring:message code="manifest.agent.company" /></td>  
228 - <td class="kv-content" colspan="3"><input id="agentcompany" name="agentcompany"  
229 - style="width: 400px;" type="text" value="${agent.nameCn }"  
230 - placeholder="<spring:message code="agent.companyPlaceholder"/>"></td>  
231 - </tr> --%>  
232 <!-- 货物信息 end --> 212 <!-- 货物信息 end -->
233 213
234 <!-- 发货信息 start --> 214 <!-- 发货信息 start -->
235 <tr style="background-color: #EBEDF4; color: black;"> 215 <tr style="background-color: #EBEDF4; color: black;">
236 <td style="background-color: #EBEDF4; color: black;" class="kv-label"><spring:message 216 <td style="background-color: #EBEDF4; color: black;" class="kv-label"><spring:message
237 code="manifest.shipper.information" /></td> 217 code="manifest.shipper.information" /></td>
238 - <td class="kv-content" colspan="5"><select onchange="changeConsignorSelect()" 218 + <td class="kv-label"> <button type="button" class="layui-btn layui-btn-sm layui-icon layui-icon-user" onclick="showConsignorDialog()">请选择发货人</button> </td>
  219 + <%-- <td class="kv-content" colspan="5"><select onchange="changeConsignorSelect()"
239 id="fh_select"> 220 id="fh_select">
240 <option value="-1">请选择</option> 221 <option value="-1">请选择</option>
241 </select> <script> 222 </select> <script>
@@ -294,7 +275,7 @@ @@ -294,7 +275,7 @@
294 } 275 }
295 } 276 }
296 }); 277 });
297 - </script></td> 278 + </script></td> --%>
298 </tr> 279 </tr>
299 <tr> 280 <tr>
300 <td class="kv-label"><spring:message code="manifest.company" /><span 281 <td class="kv-label"><spring:message code="manifest.company" /><span
@@ -318,10 +299,6 @@ @@ -318,10 +299,6 @@
318 onpropertychange="onInputChange(event,'co_country','onpropertychange')"></td> 299 onpropertychange="onInputChange(event,'co_country','onpropertychange')"></td>
319 </tr> 300 </tr>
320 <tr> 301 <tr>
321 - <%-- <td class="kv-label"><spring:message code="manifest.city" /><span class="required_span">*</span></td>  
322 - <td class="kv-content"><input required id="co_city" name="co_city" type="text"  
323 - value="${pre.co_city }" oninput="onInputChange(event,'co_city','oninput')"  
324 - onpropertychange="onInputChange(event,'co_city','onpropertychange')"></td> --%>  
325 <td class="kv-label"><spring:message code="manifest.state" /></td> 302 <td class="kv-label"><spring:message code="manifest.state" /></td>
326 <td class="kv-content"><input id="co_deltaname" name="co_deltaname" type="text" maxlength="35" 303 <td class="kv-content"><input id="co_deltaname" name="co_deltaname" type="text" maxlength="35"
327 value="${pre.co_deltaname }"></td> 304 value="${pre.co_deltaname }"></td>
@@ -347,10 +324,6 @@ @@ -347,10 +324,6 @@
347 onpropertychange="onInputChange(event,'shpaeo','onpropertychange')"></td> 324 onpropertychange="onInputChange(event,'shpaeo','onpropertychange')"></td>
348 </tr> 325 </tr>
349 <tr> 326 <tr>
350 - <%-- <td class="kv-label"><spring:message code="manifest.fhr.shpcusid" /></td>  
351 - <td class="kv-content" colspan="3"><input id="shpcusid" name="shpcusid"  
352 - type="text" value="${pre.shpcusid }" oninput="onInputChange(event,'shpcusid','oninput')"  
353 - onpropertychange="onInputChange(event,'shpcusid','onpropertychange')"></td> --%>  
354 <td class="kv-label" colspan="6"><select id="co_cusid" required> 327 <td class="kv-label" colspan="6"><select id="co_cusid" required>
355 <c:if test="${not empty pre.shpcusid}"> 328 <c:if test="${not empty pre.shpcusid}">
356 <c:set var="tempShpType" value='${fn:split(pre.shpcusid,"+")[0]}' /> 329 <c:set var="tempShpType" value='${fn:split(pre.shpcusid,"+")[0]}' />
@@ -375,7 +348,8 @@ @@ -375,7 +348,8 @@
375 <tr style="background-color: #EBEDF4; color: black;"> 348 <tr style="background-color: #EBEDF4; color: black;">
376 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message 349 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1"><spring:message
377 code="manifest.consignee" /></td> 350 code="manifest.consignee" /></td>
378 - <td class="kv-content" colspan="5"><select onchange="changeConsigneeSelect()" 351 + <td class="kv-label"> <button type="button" class="layui-btn layui-btn-sm layui-icon layui-icon-user" onclick="showConsigneeDialog()">请选择收货人</button> </td>
  352 + <%-- <td class="kv-content" colspan="5"><select onchange="changeConsigneeSelect()"
379 id="consignee_select"> 353 id="consignee_select">
380 <option value="-1">请选择</option> 354 <option value="-1">请选择</option>
381 </select> <script> 355 </select> <script>
@@ -413,7 +387,7 @@ @@ -413,7 +387,7 @@
413 } 387 }
414 } 388 }
415 }); 389 });
416 - </script></td> 390 + </script></td> --%>
417 </tr> 391 </tr>
418 <tr> 392 <tr>
419 <td class="kv-label"><spring:message code="manifest.company" /><span 393 <td class="kv-label"><spring:message code="manifest.company" /><span
@@ -462,21 +436,7 @@ @@ -462,21 +436,7 @@
462 onpropertychange="onInputChange(event,'cneaeo','onpropertychange')"></td> 436 onpropertychange="onInputChange(event,'cneaeo','onpropertychange')"></td>
463 </tr> 437 </tr>
464 438
465 - <%-- <tr>  
466 - <td class="kv-label"><spring:message code="manifest.province.code" /></td>  
467 - <td class="kv-content"><input id="sh_provincecode" name="sh_provincecode" type="text"  
468 - value="${pre.sh_provincecode }" oninput="onInputChange(event,'sh_provincecode','oninput')"  
469 - onpropertychange="onInputChange(event,'sh_provincecode','onpropertychange')"></td>  
470 - <td class="kv-label"><spring:message code="manifest.province.name" /></td>  
471 - <td class="kv-content" colspan="3"><input id="sh_provincename" name="sh_provincename"  
472 - type="text" value="${pre.sh_provincename }"></td>  
473 - </tr> --%>  
474 <tr> 439 <tr>
475 - <%-- <td class="kv-label"><spring:message code="manifest.shr.cnecusid" /></td>  
476 - <td class="kv-content"><input id="cnecusid" name="cnecusid" type="text"  
477 - value="${pre.cnecusid }" oninput="onInputChange(event,'cnecusid','oninput')"  
478 - onpropertychange="onInputChange(event,'cnecusid','onpropertychange')"></td> --%>  
479 -  
480 <td class="kv-label" colspan="6"><select id="sh_cusid" required> 440 <td class="kv-label" colspan="6"><select id="sh_cusid" required>
481 <c:if test="${not empty pre.cnecusid}"> 441 <c:if test="${not empty pre.cnecusid}">
482 <c:set var="tempCneType" value='${fn:split(pre.cnecusid,"+")[0]}' /> 442 <c:set var="tempCneType" value='${fn:split(pre.cnecusid,"+")[0]}' />
@@ -744,7 +704,7 @@ @@ -744,7 +704,7 @@
744 layer.open({content: "有错"}); 704 layer.open({content: "有错"});
745 $("#ways").val(""); 705 $("#ways").val("");
746 }else{ 706 }else{
747 - $.post("<%=basePath%>manifest/daryMawbNo",{id:$("#id").val(),mawbNo:wad},function(data) { 707 + $.post("<%=basePath%>manifest/daryMawbNo",{waybillnomaster:$("#waybillnomaster").val(),waybillnoSub:wad},function(data) {
748 if (data.status == 500) { 708 if (data.status == 500) {
749 layer.open({content: "<spring:message code="opt.repeatno"/>"}); 709 layer.open({content: "<spring:message code="opt.repeatno"/>"});
750 $("#ways").val(""); 710 $("#ways").val("");
@@ -1071,9 +1031,6 @@ @@ -1071,9 +1031,6 @@
1071 success : function(data) { 1031 success : function(data) {
1072 if (data.status == 200) { 1032 if (data.status == 200) {
1073 if (data.data) { 1033 if (data.data) {
1074 - console.log("shpType-->"+shpType);  
1075 - console.log("cneType-->"+cneType);  
1076 -  
1077 for (var i = 0; i < data.data.length; i++) { 1034 for (var i = 0; i < data.data.length; i++) {
1078 var type = data.data[i].enterprise_type; 1035 var type = data.data[i].enterprise_type;
1079 if(selectId=="co_cusid"){ 1036 if(selectId=="co_cusid"){
@@ -1098,6 +1055,98 @@ @@ -1098,6 +1055,98 @@
1098 }); 1055 });
1099 } 1056 }
1100 1057
  1058 + function onReceivConsignor(consignor){
  1059 + if(consignor){
  1060 + $("#co_company").val(consignor.co_company?consignor.co_company.toUpperCase():"");
  1061 + var address = consignor.co_address;
  1062 + if(notEmpty(address)){
  1063 + if(address.length>70){
  1064 + address = address.substring(0,70);
  1065 + }
  1066 + }else{
  1067 + address = "";
  1068 + }
  1069 + $("#co_address").val(address.toUpperCase());
  1070 + $("#co_telephone").val(consignor.co_telephone?consignor.co_telephone:"");
  1071 + $("#co_country").val(consignor.co_country?consignor.co_country:"CN");
  1072 + $("#co_city").val(consignor.co_city?consignor.co_city.toUpperCase():"");
  1073 + $("#co_deltaname").val(consignor.co_deltaname?consignor.co_deltaname.toUpperCase():"");
  1074 + $("#co_name").val(consignor.co_name?consignor.co_name.toUpperCase():"");
  1075 + $("#co_fax").val(consignor.co_fax?consignor.co_fax:"");
  1076 + $("#co_zipcode").val(consignor.co_zipcode?consignor.co_zipcode:"");
  1077 + $("#shpaeo").val(consignor.shpaeo?consignor.shpaeo:"");
  1078 +
  1079 + if(notEmpty(consignor.shpcusid)){
  1080 + var temp_1 = consignor.shpcusid.split("+")[0];
  1081 + var temp_2 = consignor.shpcusid.split("+")[1];
  1082 + if(notEmpty(temp_2)){
  1083 + $("#shpcusid").val(temp_2.toUpperCase());
  1084 + }
  1085 + }
  1086 + }
  1087 + }
  1088 +
  1089 + function showConsignorDialog() {
  1090 + var parentName= window.name;
  1091 + layui.use('layer', function(){
  1092 + var layer = layui.layer;
  1093 + var viewUrl="<%=basePath%>consignor/list?isWithChoose=true";
  1094 + parent.layer.open({
  1095 + type: 2,
  1096 + title: '',
  1097 + shadeClose: false,
  1098 + shade: 0.8,
  1099 + area: ['90%', '80%'],
  1100 + content: viewUrl
  1101 + });
  1102 + });
  1103 + }
  1104 +
  1105 + function onReceivConsignee(consignee) {
  1106 + var address = consignee.address;
  1107 + if(notEmpty(address)){
  1108 + if(address.length>70){
  1109 + address = address.substring(0,70);
  1110 + }
  1111 + }else{
  1112 + address = "";
  1113 + }
  1114 +
  1115 + $("#sh_address").val(address.toUpperCase());
  1116 + $("#sh_company").val(consignee.name?consignee.name:"");
  1117 + $("#sh_telephone").val(consignee.tel?consignee.tel:"");
  1118 + $("#sh_country").val(consignee.name?consignee.name:"");
  1119 + $("#sh_name").val(consignee.code?consignee.code:"");
  1120 + $("#sh_city").val(consignee.city?consignee.city.toUpperCase():"");
  1121 + $("#sh_fax").val(consignee.fax?consignee.fax:"");
  1122 + $("#sh_zipcode").val(consignee.zipcode?consignee.zipcode:"");
  1123 + $("#cneaeo").val(consignee.aeo?consignee.aeo:"");
  1124 +
  1125 + if(notEmpty(consignee.cusid)){
  1126 + var temp_1 = consignee.cusid.split("+")[0];
  1127 + var temp_2 = consignee.cusid.split("+")[1];
  1128 + if(notEmpty(temp_2)){
  1129 + $("#cnecusid").val(temp_2.toUpperCase());
  1130 + }
  1131 + }
  1132 + }
  1133 +
  1134 + function showConsigneeDialog() {
  1135 + var parentName= window.name;
  1136 + layui.use('layer', function(){
  1137 + var layer = layui.layer;
  1138 + var viewUrl="<%=basePath%>consignee/list?isWithChoose=true";
  1139 + parent.layer.open({
  1140 + type: 2,
  1141 + title: '',
  1142 + shadeClose: false,
  1143 + shade: 0.8,
  1144 + area: ['90%', '80%'],
  1145 + content: viewUrl
  1146 + });
  1147 + });
  1148 + }
  1149 +
1101 </script> 1150 </script>
1102 </body> 1151 </body>
1103 </html> 1152 </html>