作者 申海龙

货主管理 预配 添加修改页面增加货主信息

@@ -15,6 +15,8 @@ import javax.servlet.http.HttpSession; @@ -15,6 +15,8 @@ import javax.servlet.http.HttpSession;
15 import javax.servlet.http.Part; 15 import javax.servlet.http.Part;
16 16
17 import com.agent.entity.agent.*; 17 import com.agent.entity.agent.*;
  18 +import com.agent.service.system.HzInfoService;
  19 +import com.agent.service.system.HzWaybillService;
18 import com.agent.service.system.UserService; 20 import com.agent.service.system.UserService;
19 import com.agent.util.ExcelUtil; 21 import com.agent.util.ExcelUtil;
20 import com.agent.vo.agent.ManifestVo; 22 import com.agent.vo.agent.ManifestVo;
@@ -22,9 +24,14 @@ import com.framework.util.DateFormat; @@ -22,9 +24,14 @@ import com.framework.util.DateFormat;
22 import org.apache.commons.collections.CollectionUtils; 24 import org.apache.commons.collections.CollectionUtils;
23 import org.apache.commons.lang.StringUtils; 25 import org.apache.commons.lang.StringUtils;
24 import org.apache.shiro.SecurityUtils; 26 import org.apache.shiro.SecurityUtils;
  27 +import org.hibernate.SessionFactory;
  28 +import org.hibernate.StaleObjectStateException;
25 import org.slf4j.Logger; 29 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory; 30 import org.slf4j.LoggerFactory;
  31 +import org.springframework.orm.ObjectOptimisticLockingFailureException;
  32 +import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean;
27 import org.springframework.stereotype.Controller; 33 import org.springframework.stereotype.Controller;
  34 +import org.springframework.transaction.TransactionSystemException;
28 import org.springframework.ui.Model; 35 import org.springframework.ui.Model;
29 import org.springframework.web.bind.annotation.*; 36 import org.springframework.web.bind.annotation.*;
30 37
@@ -136,6 +143,12 @@ public class ManifestController extends BasicController { @@ -136,6 +143,12 @@ public class ManifestController extends BasicController {
136 @Resource 143 @Resource
137 private UserService userService; 144 private UserService userService;
138 145
  146 + @Resource
  147 + private HzInfoService hzInfoService;
  148 +
  149 + @Resource
  150 + private HzWaybillService hzWaybillService;
  151 +
139 private BasicAgentEntity getAgent() { 152 private BasicAgentEntity getAgent() {
140 UserEntity user = Tools.getUserEntity(); 153 UserEntity user = Tools.getUserEntity();
141 long agent_id = user.getAgent(); 154 long agent_id = user.getAgent();
@@ -642,13 +655,12 @@ public class ManifestController extends BasicController { @@ -642,13 +655,12 @@ public class ManifestController extends BasicController {
642 return result; 655 return result;
643 } 656 }
644 657
645 - /**  
646 - * * 模糊查询匹配信息  
647 - *  
648 - * @param manifest  
649 - * @return  
650 - * @return  
651 - */ 658 + /**
  659 + * 模糊查询匹配信息
  660 + * @param id
  661 + * @param model
  662 + * @return
  663 + */
652 @RequestMapping(value = "/inforPre") 664 @RequestMapping(value = "/inforPre")
653 @ResponseBody 665 @ResponseBody
654 public List<PreparesecondaryEntity> inforPre(String id, Model model) { 666 public List<PreparesecondaryEntity> inforPre(String id, Model model) {
@@ -673,10 +685,13 @@ public class ManifestController extends BasicController { @@ -673,10 +685,13 @@ public class ManifestController extends BasicController {
673 @RequestMapping(value = "/edit") 685 @RequestMapping(value = "/edit")
674 public String edit(HttpServletRequest request, Long id, Model model) { 686 public String edit(HttpServletRequest request, Long id, Model model) {
675 request.setAttribute("version", System.currentTimeMillis()); 687 request.setAttribute("version", System.currentTimeMillis());
  688 + //运单号
  689 + String waybill = "";
676 ManifestEntity manifest = null; 690 ManifestEntity manifest = null;
677 // 判断是否是便捷 691 // 判断是否是便捷
678 if (id != null) { 692 if (id != null) {
679 manifest = manifestService.findOne(id); 693 manifest = manifestService.findOne(id);
  694 + waybill = manifest.getWaybillnomaster();
680 } 695 }
681 696
682 UserEntity user = SessionUtil.getUser(); 697 UserEntity user = SessionUtil.getUser();
@@ -690,7 +705,22 @@ public class ManifestController extends BasicController { @@ -690,7 +705,22 @@ public class ManifestController extends BasicController {
690 manifest.setAgentman(""); // 设置代理人名称为null 705 manifest.setAgentman(""); // 设置代理人名称为null
691 } 706 }
692 } 707 }
693 - model.addAttribute("manifest", manifest); 708 +
  709 +
  710 + //发货人类型
  711 + List<HZSHIPPERINFORMATIONEntity> shipeer = hzInfoService.findShipeer();
  712 + //订舱代理
  713 + List<HZSHIPPERINFORMATIONEntity> booking = hzInfoService.findBooking();
  714 + //操作代理
  715 + List<HZSHIPPERINFORMATIONEntity> operaion = hzInfoService.findOperaion();
  716 +
  717 + model.addAttribute("shipper", shipeer);
  718 +
  719 + model.addAttribute("booking", booking);
  720 +
  721 + model.addAttribute("operation", operaion);
  722 +
  723 + model.addAttribute("manifest", manifest);
694 // 海关关区 724 // 海关关区
695 List<String> Customs = getCustomsCode(); 725 List<String> Customs = getCustomsCode();
696 model.addAttribute("CusToms", Customs); 726 model.addAttribute("CusToms", Customs);
@@ -715,6 +745,13 @@ public class ManifestController extends BasicController { @@ -715,6 +745,13 @@ public class ManifestController extends BasicController {
715 WaybillReceiptEntity receipt = receiptService.findMain(waybill_no); 745 WaybillReceiptEntity receipt = receiptService.findMain(waybill_no);
716 request.setAttribute("receipt", receipt); 746 request.setAttribute("receipt", receipt);
717 747
  748 +
  749 + //货主与运单绑定关系
  750 + if (!StringUtils.isEmpty(waybill)){
  751 + //查询关系表 得到货主id
  752 + List<HZWAYBLLINFOEntity> infoList = hzWaybillService.findHzId(waybill);
  753 + model.addAttribute("hzId", infoList);
  754 + }
718 return "manifest/edit"; 755 return "manifest/edit";
719 } 756 }
720 757
@@ -929,14 +966,13 @@ public class ManifestController extends BasicController { @@ -929,14 +966,13 @@ public class ManifestController extends BasicController {
929 return list; 966 return list;
930 } 967 }
931 968
932 - /**  
933 - * 编辑  
934 - *  
935 - * @param id  
936 - * @return  
937 - */ 969 + /**
  970 + * 编辑
  971 + * @param waybill
  972 + * @return
  973 + */
938 // @RequestMapping(value = "/bill/edit") 974 // @RequestMapping(value = "/bill/edit")
939 - // public String editBill(Long id,Long manifestId,Model model){ 975 + // public String editBill(LongEntity4 id,LongEntity4 manifestId,Model model){
940 // ManifestBillEntity bill = null; 976 // ManifestBillEntity bill = null;
941 // if(id==null){ 977 // if(id==null){
942 // bill = new ManifestBillEntity(); 978 // bill = new ManifestBillEntity();
@@ -973,7 +1009,7 @@ public class ManifestController extends BasicController { @@ -973,7 +1009,7 @@ public class ManifestController extends BasicController {
973 @RequestMapping(value = "/save", method = { RequestMethod.POST }) 1009 @RequestMapping(value = "/save", method = { RequestMethod.POST })
974 @ResponseBody 1010 @ResponseBody
975 public ResponseModel save(ManifestEntity manifest, HttpServletRequest reuqest) { 1011 public ResponseModel save(ManifestEntity manifest, HttpServletRequest reuqest) {
976 - String flightno = manifest.getFlightno(); 1012 + String flightno = manifest.getFlightno();
977 String carrier = ""; 1013 String carrier = "";
978 if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) { 1014 if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
979 carrier = flightno.substring(0, 2); 1015 carrier = flightno.substring(0, 2);
@@ -1089,7 +1125,26 @@ public class ManifestController extends BasicController { @@ -1089,7 +1125,26 @@ public class ManifestController extends BasicController {
1089 @RequestMapping(value = "/savesend", method = { RequestMethod.POST }) 1125 @RequestMapping(value = "/savesend", method = { RequestMethod.POST })
1090 @ResponseBody 1126 @ResponseBody
1091 public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) { 1127 public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
1092 - String flightno = manifest.getFlightno(); 1128 + //发货人
  1129 + String forShortShipper = request.getParameter("for_short_shipper");
  1130 + //订舱代理
  1131 + String forShortBooking = request.getParameter("for_short_booking");
  1132 + //操作代理
  1133 + String forShortOperation = request.getParameter("for_short_operation");
  1134 +
  1135 + List<String> list = new ArrayList<>();
  1136 + if (!StringUtils.isEmpty(forShortShipper)){
  1137 + list.add(forShortShipper);
  1138 + }
  1139 + if (!StringUtils.isEmpty(forShortBooking)){
  1140 + list.add(forShortBooking);
  1141 + }
  1142 + if (!StringUtils.isEmpty(forShortOperation)){
  1143 + list.add(forShortOperation);
  1144 + }
  1145 +
  1146 +
  1147 + String flightno = manifest.getFlightno();
1093 String carrier = ""; 1148 String carrier = "";
1094 if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) { 1149 if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
1095 carrier = flightno.substring(0, 2); 1150 carrier = flightno.substring(0, 2);
@@ -1122,9 +1177,28 @@ public class ManifestController extends BasicController { @@ -1122,9 +1177,28 @@ public class ManifestController extends BasicController {
1122 manifest.setResponse_code(String.valueOf(type.getValue())); 1177 manifest.setResponse_code(String.valueOf(type.getValue()));
1123 manifest.setResponse_text(type.getName()); 1178 manifest.setResponse_text(type.getName());
1124 manifest.setSave_time(System.currentTimeMillis()); 1179 manifest.setSave_time(System.currentTimeMillis());
  1180 +
  1181 + //查询数据库是否存在 如果不存在直接添加 存在就删除 再进行添加
  1182 + if (hzWaybillService.findHzId(manifest.getWaybillnomaster()).size()>0){
  1183 + if (hzWaybillService.deleteAlls(manifest.getWaybillnomaster())>0){
  1184 + for (String sId : list){
  1185 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1186 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1187 + hzwaybllinfoEntity.setHzinfor_id(sId);
  1188 + hzWaybillService.save(hzwaybllinfoEntity);
  1189 + }
  1190 + }
  1191 +
  1192 + }else {
  1193 + for (String sId : list){
  1194 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1195 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1196 + hzwaybllinfoEntity.setHzinfor_id(sId);
  1197 + hzWaybillService.save(hzwaybllinfoEntity);
  1198 + }
  1199 + }
1125 manifestService.save(manifest); 1200 manifestService.save(manifest);
1126 receiptService.saveFromManifest(manifest, type); 1201 receiptService.saveFromManifest(manifest, type);
1127 -  
1128 // 生成报文并且发送 1202 // 生成报文并且发送
1129 String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR); 1203 String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
1130 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF); 1204 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
@@ -1239,12 +1313,11 @@ public class ManifestController extends BasicController { @@ -1239,12 +1313,11 @@ public class ManifestController extends BasicController {
1239 return model; 1313 return model;
1240 } 1314 }
1241 1315
1242 - /**  
1243 - * 保存  
1244 - *  
1245 - * @param manifest  
1246 - * @return  
1247 - */ 1316 + /**
  1317 + * 保存
  1318 + * @param preparesecondary
  1319 + * @return
  1320 + */
1248 @RequestMapping(value = "/sub_save", method = { RequestMethod.POST }) 1321 @RequestMapping(value = "/sub_save", method = { RequestMethod.POST })
1249 @ResponseBody 1322 @ResponseBody
1250 public ResponseModel sub_save(PreparesecondaryEntity preparesecondary) { 1323 public ResponseModel sub_save(PreparesecondaryEntity preparesecondary) {
@@ -1424,12 +1497,12 @@ public class ManifestController extends BasicController { @@ -1424,12 +1497,12 @@ public class ManifestController extends BasicController {
1424 return model; 1497 return model;
1425 } 1498 }
1426 1499
1427 - /**  
1428 - * 保存并且发送  
1429 - *  
1430 - * @param manifest  
1431 - * @return  
1432 - */ 1500 + /**
  1501 + * 保存并且发送
  1502 + * @param Preparesecondary
  1503 + * @param request
  1504 + * @return
  1505 + */
1433 @RequestMapping(value = "/presendDelivery", method = { RequestMethod.POST }) 1506 @RequestMapping(value = "/presendDelivery", method = { RequestMethod.POST })
1434 @ResponseBody 1507 @ResponseBody
1435 public ResponseModel presendDelivery(PreparesecondaryEntity Preparesecondary, HttpServletRequest request) { 1508 public ResponseModel presendDelivery(PreparesecondaryEntity Preparesecondary, HttpServletRequest request) {
@@ -1696,7 +1769,7 @@ public class ManifestController extends BasicController { @@ -1696,7 +1769,7 @@ public class ManifestController extends BasicController {
1696 return xml; 1769 return xml;
1697 } 1770 }
1698 1771
1699 - // private String beanToXml(String path,Long id){ 1772 + // private String beanToXml(String path,LongEntity4 id){
1700 // ManifestEntity manifestEntity = manifestService.findOne(id); 1773 // ManifestEntity manifestEntity = manifestService.findOne(id);
1701 // 1774 //
1702 // if(manifestEntity==null){ 1775 // if(manifestEntity==null){
@@ -2086,12 +2159,11 @@ public class ManifestController extends BasicController { @@ -2086,12 +2159,11 @@ public class ManifestController extends BasicController {
2086 return model; 2159 return model;
2087 } 2160 }
2088 2161
2089 - /**  
2090 - * 删除  
2091 - *  
2092 - * @param ids  
2093 - * @return  
2094 - */ 2162 + /**
  2163 + * 删除
  2164 + * @param id
  2165 + * @return
  2166 + */
2095 @RequestMapping(value = "/subdelete", method = { RequestMethod.POST }) 2167 @RequestMapping(value = "/subdelete", method = { RequestMethod.POST })
2096 @ResponseBody 2168 @ResponseBody
2097 public ResponseModel subdelete(Long id) { 2169 public ResponseModel subdelete(Long id) {
@@ -2101,6 +2173,7 @@ public class ManifestController extends BasicController { @@ -2101,6 +2173,7 @@ public class ManifestController extends BasicController {
2101 model.setStatus(200); 2173 model.setStatus(200);
2102 model.setMsg(HttpJsonMsg.SUCCESS); 2174 model.setMsg(HttpJsonMsg.SUCCESS);
2103 } catch (Exception e) { 2175 } catch (Exception e) {
  2176 + e.printStackTrace();
2104 model.setStatus(500); 2177 model.setStatus(500);
2105 model.setMsg(HttpJsonMsg.ERROR); 2178 model.setMsg(HttpJsonMsg.ERROR);
2106 logger.error("系统异常 >>", e); 2179 logger.error("系统异常 >>", e);
  1 +package com.agent.controller.system;
  2 +
  3 +import com.agent.entity.agent.HZSHIPPERINFORMATIONEntity;
  4 +import com.agent.service.system.HzInfoService;
  5 +import com.agent.util.HttpJsonMsg;
  6 +import com.agent.vo.ResponseModel;
  7 +import com.agent.vo.agent.HZSHIPPERINFORMATIONVo;
  8 +import com.framework.core.Servlets;
  9 +import com.framework.util.StringUtils;
  10 +import com.plugin.easyui.DataGrid;
  11 +import com.plugin.easyui.EasyPage;
  12 +import org.apache.commons.collections.CollectionUtils;
  13 +import org.hibernate.Session;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.stereotype.Controller;
  17 +import org.springframework.ui.Model;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestMethod;
  20 +import org.springframework.web.bind.annotation.ResponseBody;
  21 +import javax.annotation.Resource;
  22 +import javax.servlet.http.HttpServletRequest;
  23 +import javax.servlet.http.HttpSession;
  24 +import java.util.ArrayList;
  25 +import java.util.List;
  26 +import java.util.Map;
  27 +
  28 +/**
  29 + * @Auther: shenhl
  30 + * @Date: 2019/4/17 09:55
  31 + */
  32 +@RequestMapping(value = "/hzinfo")
  33 +@Controller
  34 +public class HzInfoController {
  35 +
  36 + private static final Logger logger = LoggerFactory.getLogger(HzInfoController.class);
  37 +
  38 + @Resource
  39 + private HzInfoService hzInfoService;
  40 +
  41 +
  42 + @RequestMapping(value = "/list")
  43 + public String list(){
  44 + return "system/user/hzinfo";
  45 + }
  46 +
  47 + @RequestMapping(value = "/choosetHz")
  48 + public String selectHz(){
  49 + return "hz/hzinfo";
  50 + }
  51 +
  52 +
  53 +
  54 + @RequestMapping(value = "/add")
  55 + public String add(){
  56 + return "system/user/hzinfo_add";
  57 + }
  58 +
  59 + /**
  60 + * 分页查询
  61 + * @param request
  62 + * @param pageForm
  63 + * @return
  64 + */
  65 + @RequestMapping(value = "/grid.json")
  66 + @ResponseBody
  67 + public DataGrid<HZSHIPPERINFORMATIONVo> grid(HttpServletRequest request, EasyPage<HZSHIPPERINFORMATIONEntity> pageForm) {
  68 +
  69 + Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
  70 +// searchParams.put("LIKE_phone","17600319854");
  71 + pageForm.setSearchParams(searchParams);
  72 + pageForm.parseData(hzInfoService.getPage(pageForm));
  73 + DataGrid<HZSHIPPERINFORMATIONEntity> hzshipperinformationEntityDataGrid = pageForm.getData();
  74 + List<HZSHIPPERINFORMATIONVo>rows = new ArrayList<>();
  75 + if (CollectionUtils.isNotEmpty(hzshipperinformationEntityDataGrid.getRows())){
  76 + for (HZSHIPPERINFORMATIONEntity hz: hzshipperinformationEntityDataGrid.getRows()){
  77 + HZSHIPPERINFORMATIONVo hzvo = new HZSHIPPERINFORMATIONVo();
  78 + hzvo.setId(hz.getId());
  79 + hzvo.setForShort(hz.getFor_short());
  80 + hzvo.setFullName(hz.getFull_name());
  81 + hzvo.setContacts(hz.getContacts());
  82 + if ("1".equals(hz.getThe_shipper_type())){
  83 + hzvo.setTheShipperType("发货人");
  84 + }else if ("2".equals(hz.getThe_shipper_type())){
  85 + hzvo.setTheShipperType("订舱代理");
  86 + }else {
  87 + hzvo.setTheShipperType("操作代理");
  88 + }
  89 +
  90 + hzvo.setPhone(hz.getPhone());
  91 + hzvo.setDeleteFlag(hz.getDelete_flag());
  92 +
  93 + rows.add(hzvo);
  94 + }
  95 + }
  96 + DataGrid<HZSHIPPERINFORMATIONVo> vos = new DataGrid<>();
  97 + vos.setRows(rows);
  98 + vos.setTotal(hzshipperinformationEntityDataGrid.getTotal());
  99 + return vos;
  100 + }
  101 +
  102 + /**
  103 + * 添加
  104 + * @param hz
  105 + * @param request
  106 + * @return
  107 + */
  108 + @RequestMapping("/save")
  109 + @ResponseBody
  110 + public ResponseModel save(HZSHIPPERINFORMATIONEntity hz, HttpServletRequest request){
  111 + ResponseModel model = new ResponseModel();
  112 + //获取对象值
  113 + String forshort = request.getParameter("forshort");
  114 + String fullname = request.getParameter("fullname");
  115 + //发货人
  116 + String one = request.getParameter("one");
  117 + //订舱代理
  118 + String two = request.getParameter("two");
  119 + //操作代理
  120 + String three = request.getParameter("three");
  121 + String contacts = request.getParameter("contacts");
  122 + String phone = request.getParameter("phone");
  123 +
  124 + List<String> list = new ArrayList<>();
  125 + if (!StringUtils.isBlank(one)){
  126 + list.add(one);
  127 + }
  128 + if (!StringUtils.isBlank(two)){
  129 + list.add(two);
  130 + }
  131 + if (!StringUtils.isBlank(three)){
  132 + list.add(three);
  133 + }
  134 +
  135 +
  136 + for (String type: list){
  137 + switch (type) {
  138 + case "1":
  139 + if (hzInfoService.forShortShipperType(forshort, "1") == 0) {
  140 +
  141 + HZSHIPPERINFORMATIONEntity hzshipperinformationEntity = new HZSHIPPERINFORMATIONEntity();
  142 +
  143 + hzshipperinformationEntity.setFor_short(forshort);
  144 + hzshipperinformationEntity.setFull_name(fullname);
  145 + hzshipperinformationEntity.setThe_shipper_type("1");
  146 + hzshipperinformationEntity.setContacts(contacts);
  147 + hzshipperinformationEntity.setPhone(phone);
  148 + hzshipperinformationEntity.setDelete_flag("1");
  149 + hzInfoService.save(hzshipperinformationEntity);
  150 + model.setStatus(200);
  151 + continue;
  152 + }else {
  153 + model.setStatus(201);
  154 + break;
  155 + }
  156 + case "2":
  157 + if (hzInfoService.forShortShipperType(forshort, "2") == 0) {
  158 + HZSHIPPERINFORMATIONEntity hzshipperinformationEntity = new HZSHIPPERINFORMATIONEntity();
  159 + hzshipperinformationEntity.setFor_short(forshort);
  160 + hzshipperinformationEntity.setFull_name(fullname);
  161 + hzshipperinformationEntity.setThe_shipper_type("2");
  162 + hzshipperinformationEntity.setContacts(contacts);
  163 + hzshipperinformationEntity.setPhone(phone);
  164 + hzshipperinformationEntity.setDelete_flag("1");
  165 + hzInfoService.save(hzshipperinformationEntity);
  166 + model.setStatus(200);
  167 + continue;
  168 + }else {
  169 + model.setStatus(201);
  170 + break;
  171 + }
  172 + case "3":
  173 + if (hzInfoService.forShortShipperType(forshort, "3") == 0) {
  174 + HZSHIPPERINFORMATIONEntity hzshipperinformationEntity = new HZSHIPPERINFORMATIONEntity();
  175 + hzshipperinformationEntity.setFor_short(forshort);
  176 + hzshipperinformationEntity.setFull_name(fullname);
  177 + hzshipperinformationEntity.setThe_shipper_type("3");
  178 + hzshipperinformationEntity.setContacts(contacts);
  179 + hzshipperinformationEntity.setPhone(phone);
  180 + hzshipperinformationEntity.setDelete_flag("1");
  181 + hzInfoService.save(hzshipperinformationEntity);
  182 + model.setStatus(200);
  183 + continue;
  184 + }else {
  185 + model.setStatus(201);
  186 + break;
  187 + }
  188 + }
  189 + }
  190 + return model;
  191 +
  192 + }
  193 +
  194 + /**
  195 + * 删除
  196 + *
  197 + * @param ids
  198 + * @return
  199 + */
  200 + @RequestMapping(value = "/delete", method = { RequestMethod.POST })
  201 + @ResponseBody
  202 + public ResponseModel delete(String ids) {
  203 + ResponseModel model = new ResponseModel();
  204 + try {
  205 + hzInfoService.deletes(ids);
  206 + model.setStatus(200);
  207 + model.setMsg(HttpJsonMsg.SUCCESS);
  208 + } catch (Exception e) {
  209 + model.setStatus(500);
  210 + model.setMsg(HttpJsonMsg.ERROR);
  211 + logger.error("系统异常 >>", e);
  212 + }
  213 + return model;
  214 + }
  215 +
  216 + @RequestMapping(value = {"/edit" }, method = {RequestMethod.GET })
  217 + public String edit(Long id, Model model) {
  218 + if (id != null) {
  219 + HZSHIPPERINFORMATIONEntity hz = hzInfoService.findOne(id);
  220 + model.addAttribute("entity", hz);
  221 + }
  222 + return "system/user/hzinfo_edit";
  223 + }
  224 +
  225 + /**
  226 + * 修改
  227 + * @param hz
  228 + * @param request
  229 + * @return
  230 + */
  231 + @RequestMapping(value = "/update")
  232 + @ResponseBody
  233 + public ResponseModel update(HZSHIPPERINFORMATIONEntity hz, HttpServletRequest request){
  234 + ResponseModel responseModel = new ResponseModel();
  235 +
  236 + if (hzInfoService.forShortShipperType(hz.getFor_short(), hz.getThe_shipper_type())==0){
  237 + hz.setDelete_flag("1");
  238 + int update = hzInfoService.update(hz);
  239 + if (update>0){
  240 + responseModel.setStatus(200);
  241 + }else {
  242 + responseModel.setStatus(202);
  243 + }
  244 + }else {
  245 + responseModel.setStatus(201);
  246 + }
  247 + return responseModel;
  248 + }
  249 +
  250 +}
@@ -28,6 +28,7 @@ import org.apache.shiro.SecurityUtils; @@ -28,6 +28,7 @@ import org.apache.shiro.SecurityUtils;
28 import org.slf4j.Logger; 28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory; 29 import org.slf4j.LoggerFactory;
30 import org.springframework.stereotype.Controller; 30 import org.springframework.stereotype.Controller;
  31 +import org.springframework.transaction.annotation.Transactional;
31 import org.springframework.ui.Model; 32 import org.springframework.ui.Model;
32 import org.springframework.web.bind.annotation.*; 33 import org.springframework.web.bind.annotation.*;
33 import tools.DBConnection; 34 import tools.DBConnection;
@@ -311,6 +312,7 @@ public class WaybillnomasterController extends BasicController { @@ -311,6 +312,7 @@ public class WaybillnomasterController extends BasicController {
311 model.setStatus(200); 312 model.setStatus(200);
312 model.setMsg(HttpJsonMsg.SUCCESS); 313 model.setMsg(HttpJsonMsg.SUCCESS);
313 } catch (Exception e) { 314 } catch (Exception e) {
  315 + e.printStackTrace();
314 model.setStatus(500); 316 model.setStatus(500);
315 model.setMsg(HttpJsonMsg.ERROR); 317 model.setMsg(HttpJsonMsg.ERROR);
316 logger.error("系统异常 >>", e); 318 logger.error("系统异常 >>", e);
  1 +package com.agent.entity.agent;
  2 +
  3 +/**
  4 + * @Auther: shenhl
  5 + * @Date: 2019/4/17 14:21
  6 + */
  7 +
  8 +import com.agent.entity.BasicEntity;
  9 +import com.agent.entity.IdEntity;
  10 +
  11 +import javax.persistence.*;
  12 +
  13 +/**
  14 + * 货主信息表
  15 + */
  16 +@Entity
  17 +@Table(name = "HZ_SHIPPER_INFORMATION")
  18 +public class HZSHIPPERINFORMATIONEntity extends IdEntity {
  19 +
  20 + /**
  21 + * ID
  22 + */
  23 +// @Id
  24 +// private Long id;
  25 +
  26 + /**
  27 + * 简称
  28 + */
  29 + private String for_short;
  30 +
  31 + /**
  32 + * 全称
  33 + */
  34 + private String full_name;
  35 +
  36 + /**
  37 + * 货主类型 1发货人 2订舱代理 3操作代理
  38 + */
  39 + private String the_shipper_type;
  40 +
  41 + /**
  42 + * 联系人
  43 + */
  44 + private String contacts;
  45 +
  46 + /**
  47 + * 电话
  48 + */
  49 + private String phone;
  50 +
  51 + /**
  52 + * 删除标记 1未删除 2删除
  53 + */
  54 + private String delete_flag;
  55 +
  56 +
  57 +
  58 +
  59 + public String getFull_name() {
  60 + return full_name;
  61 + }
  62 +
  63 + public void setFull_name(String full_name) {
  64 + this.full_name = full_name;
  65 + }
  66 +
  67 + public String getThe_shipper_type() {
  68 + return the_shipper_type;
  69 + }
  70 +
  71 + public void setThe_shipper_type(String the_shipper_type) {
  72 + this.the_shipper_type = the_shipper_type;
  73 + }
  74 +
  75 + public String getContacts() {
  76 + return contacts;
  77 + }
  78 +
  79 + public void setContacts(String contacts) {
  80 + this.contacts = contacts;
  81 + }
  82 + public String getPhone() {
  83 + return phone;
  84 + }
  85 +
  86 + public void setPhone(String phone) {
  87 + this.phone = phone;
  88 + }
  89 +
  90 + public String getFor_short() {
  91 + return for_short;
  92 + }
  93 +
  94 + public void setFor_short(String for_short) {
  95 + this.for_short = for_short;
  96 + }
  97 +
  98 + public String getDelete_flag() {
  99 + return delete_flag;
  100 + }
  101 +
  102 + public void setDelete_flag(String delete_flag) {
  103 + this.delete_flag = delete_flag;
  104 + }
  105 +}
  1 +package com.agent.entity.agent;
  2 +
  3 +/**
  4 + * @Auther: shenhl
  5 + * @Date: 2019/4/17 14:21
  6 + */
  7 +
  8 +import com.agent.entity.IdEntity;
  9 +
  10 +import javax.persistence.Entity;
  11 +import javax.persistence.Table;
  12 +
  13 +/**
  14 + * 货主信息表
  15 + */
  16 +@Entity
  17 +@Table(name = "HZ_WAYBILL_INFO")
  18 +public class HZWAYBLLINFOEntity extends IdEntity {
  19 +
  20 + //运单号
  21 + private String waybill_id;
  22 +
  23 + //货主id
  24 + private String hzinfor_id;
  25 +
  26 + public String getWaybill_id() {
  27 + return waybill_id;
  28 + }
  29 +
  30 + public void setWaybill_id(String waybill_id) {
  31 + this.waybill_id = waybill_id;
  32 + }
  33 +
  34 + public String getHzinfor_id() {
  35 + return hzinfor_id;
  36 + }
  37 +
  38 + public void setHzinfor_id(String hzinfor_id) {
  39 + this.hzinfor_id = hzinfor_id;
  40 + }
  41 +}
@@ -926,4 +926,4 @@ public class ManifestBillEntity extends BasicEntity { @@ -926,4 +926,4 @@ public class ManifestBillEntity extends BasicEntity {
926 public void setDangerContactType(String dangerContactType) { 926 public void setDangerContactType(String dangerContactType) {
927 this.dangerContactType = dangerContactType; 927 this.dangerContactType = dangerContactType;
928 } 928 }
929 -} 929 +}
@@ -955,7 +955,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -955,7 +955,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
955 // 当前时间为null,直接返回true 955 // 当前时间为null,直接返回true
956 if (this.getSave_time() == null) 956 if (this.getSave_time() == null)
957 return true; 957 return true;
958 - // 要比较的那个对象为null,直接返回false 958 + // 要比较的那个对象为null,直接返回false
959 else if (me.getSave_time() == null) 959 else if (me.getSave_time() == null)
960 return false; 960 return false;
961 else 961 else
@@ -996,4 +996,4 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -996,4 +996,4 @@ public class ManifestEntity extends BasicEntity implements Serializable {
996 public static void main(String[] args) { 996 public static void main(String[] args) {
997 System.out.println(Constant.getDateEnglish(new Date())); 997 System.out.println(Constant.getDateEnglish(new Date()));
998 } 998 }
999 -} 999 +}
1 package com.agent.entity.agent; 1 package com.agent.entity.agent;
2 2
3 -import com.agent.entity.BasicEntity;  
4 import com.agent.entity.IdEntity; 3 import com.agent.entity.IdEntity;
5 4
6 import javax.persistence.Column; 5 import javax.persistence.Column;
  1 +package com.agent.repository.system;
  2 +
  3 +import com.agent.entity.agent.HZSHIPPERINFORMATIONEntity;
  4 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.data.repository.PagingAndSortingRepository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * @Auther: shenhl
  14 + * @Date: 2019/4/17 14:36
  15 + */
  16 +public interface HzInfoRepository extends PagingAndSortingRepository<HZSHIPPERINFORMATIONEntity, Long>,
  17 + JpaSpecificationExecutor<HZSHIPPERINFORMATIONEntity>{
  18 +
  19 + @Query(value = "select count(*) from HZ_SHIPPER_INFORMATION where FOR_SHORT=?1 and THE_SHIPPER_TYPE = ?2 and delete_flag = 1",nativeQuery = true)
  20 + int forShortShipperType(String forshort, String theshippertype);
  21 +
  22 + @Modifying
  23 + @Query(value = "update HZ_SHIPPER_INFORMATION set delete_flag=2 where id=?1", nativeQuery = true)
  24 + void deletes(Long id);
  25 +
  26 + @Transactional
  27 + @Modifying
  28 + @Query(value = "update HZ_SHIPPER_INFORMATION set for_short=?2, full_name=?3, the_shipper_type=?4, contacts=?5, phone=?6, delete_flag=?7 where id=?1", nativeQuery = true)
  29 + int update(Long id, String for_short, String full_name, String the_shipper_type,
  30 + String contacts, String phone, String delete_flag);
  31 + @Transactional
  32 + @Modifying(clearAutomatically=true)
  33 + @Query(value = "insert into HZ_SHIPPER_INFORMATION(FOR_SHORT, FULL_NAME, THE_SHIPPER_TYPE, CONTACTS, PHONE, DELETE_FLAG) values(?1, ?2, ?3, ?4, ?5, ?6)", nativeQuery = true)
  34 + int saves(String forShort, String fullName, String theShipperType, String contacts, String phone, String deleteFlag);
  35 +
  36 + @Query(value = "select * from HZ_SHIPPER_INFORMATION where the_shipper_type=1 and delete_flag = 1", nativeQuery = true)
  37 + List<HZSHIPPERINFORMATIONEntity> findShipeer();
  38 +
  39 + @Query(value = "select * from HZ_SHIPPER_INFORMATION where the_shipper_type=2 and delete_flag = 1", nativeQuery = true)
  40 + List<HZSHIPPERINFORMATIONEntity> findBooking();
  41 +
  42 + @Query(value = "select * from HZ_SHIPPER_INFORMATION where the_shipper_type=3 and delete_flag = 1", nativeQuery = true)
  43 + List<HZSHIPPERINFORMATIONEntity> findOperaion();
  44 +
  45 + @Query(value = "select * from HZ_SHIPPER_INFORMATION where id=?1 and delete_flag = 1", nativeQuery = true)
  46 + HZSHIPPERINFORMATIONEntity findOnes(Long id);
  47 +}
  1 +package com.agent.repository.system;
  2 +
  3 +import com.agent.entity.agent.HZWAYBLLINFOEntity;
  4 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.data.repository.PagingAndSortingRepository;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * @Auther: shenhl
  14 + * @Date: 2019/4/22 16:17
  15 + */
  16 +public interface HzWaybillRepository extends PagingAndSortingRepository<HZWAYBLLINFOEntity, Long>,
  17 + JpaSpecificationExecutor<HZWAYBLLINFOEntity> {
  18 +
  19 + @Transactional
  20 + @Modifying
  21 + @Query(value = "delete from HZ_WAYBILL_INFO where waybill_id = ?1", nativeQuery = true)
  22 + int deleteAlls(String waybill);
  23 +
  24 + @Query(value = "select * from HZ_WAYBILL_INFO where waybill_id = ?1", nativeQuery = true)
  25 + List<HZWAYBLLINFOEntity> findHzId(String wabyill);
  26 +
  27 +
  28 +
  29 +}
1 package com.agent.service.agent; 1 package com.agent.service.agent;
2 2
3 import java.text.SimpleDateFormat; 3 import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
4 import java.util.Date; 5 import java.util.Date;
5 import java.util.List; 6 import java.util.List;
6 7
7 import javax.annotation.Resource; 8 import javax.annotation.Resource;
8 9
  10 +import com.agent.entity.agent.*;
  11 +import com.agent.repository.system.HzWaybillRepository;
9 import org.springframework.data.domain.Page; 12 import org.springframework.data.domain.Page;
10 import org.springframework.data.domain.PageRequest; 13 import org.springframework.data.domain.PageRequest;
11 import org.springframework.data.jpa.domain.Specification; 14 import org.springframework.data.jpa.domain.Specification;
@@ -13,10 +16,6 @@ import org.springframework.stereotype.Service; @@ -13,10 +16,6 @@ import org.springframework.stereotype.Service;
13 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
14 17
15 import com.agent.entity.Constant; 18 import com.agent.entity.Constant;
16 -import com.agent.entity.agent.ManifestEntity;  
17 -import com.agent.entity.agent.PreparesecondaryEntity;  
18 -import com.agent.entity.agent.WaybillReceiptEntity;  
19 -import com.agent.entity.agent.WaybillReceiptType;  
20 import com.agent.repository.agent.ManifestBillRepository; 19 import com.agent.repository.agent.ManifestBillRepository;
21 import com.agent.repository.agent.ManifestCommodityRepository; 20 import com.agent.repository.agent.ManifestCommodityRepository;
22 import com.agent.repository.agent.ManifestContainerRepository; 21 import com.agent.repository.agent.ManifestContainerRepository;
@@ -122,6 +121,9 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -122,6 +121,9 @@ public class ManifestService extends BasicService<ManifestEntity> {
122 @Resource 121 @Resource
123 private WaybillReceiptService receiptService; 122 private WaybillReceiptService receiptService;
124 123
  124 + @Resource
  125 + private HzWaybillRepository hzWaybillRepository;
  126 +
125 /** 127 /**
126 * 分页查询 128 * 分页查询
127 * 129 *
@@ -195,16 +197,25 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -195,16 +197,25 @@ public class ManifestService extends BasicService<ManifestEntity> {
195 197
196 @Transactional 198 @Transactional
197 public void trueDeleteAll(String ids) { 199 public void trueDeleteAll(String ids) {
198 - List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);  
199 - for (String id : list) { 200 + try {
  201 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  202 + for (String id : list) {
  203 + //分单
  204 + preparesecondaryRepository.deleteSub(Long.valueOf(id));
  205 +
  206 + ManifestEntity waybill = manifestRepository.findOne(Long.valueOf(id));
  207 + //主单号
  208 + String waybillnomaster = waybill.getWaybillnomaster();
  209 +
  210 + //删除主单和货主绑定关系
  211 + hzWaybillRepository.deleteAlls(waybillnomaster);
  212 + //主单
  213 + manifestRepository.trueDelete(Long.valueOf(id));
  214 + }
  215 + }catch (Exception e){
  216 + e.printStackTrace();
  217 + }
200 218
201 -// ManifestEntity manifest = manifestRepository.findOne(Long.valueOf(id));  
202 -// if (manifest != null) {  
203 - // 先删除子表信息  
204 - preparesecondaryRepository.deleteSub(Long.valueOf(id));  
205 -// }  
206 - manifestRepository.trueDelete(Long.valueOf(id));  
207 - }  
208 } 219 }
209 220
210 public List<ManifestEntity> findByMawbNo(String mawbNo) { 221 public List<ManifestEntity> findByMawbNo(String mawbNo) {
  1 +package com.agent.service.system;
  2 +
  3 +import com.agent.entity.agent.HZSHIPPERINFORMATIONEntity;
  4 +import com.agent.repository.system.HzInfoRepository;
  5 +import com.agent.service.BasicService;
  6 +import com.google.common.base.Splitter;
  7 +import org.springframework.data.domain.Page;
  8 +import org.springframework.data.domain.PageRequest;
  9 +import org.springframework.data.jpa.domain.Specification;
  10 +import org.springframework.stereotype.Service;
  11 +import com.plugin.easyui.EasyPage;
  12 +import org.springframework.transaction.annotation.Transactional;
  13 +
  14 +import javax.annotation.Resource;
  15 +import java.util.List;
  16 +
  17 +/**
  18 + * @Auther: shenhl
  19 + * @Date: 2019/4/17 14:36
  20 + */
  21 +
  22 +@Service
  23 +public class HzInfoService extends BasicService<HZSHIPPERINFORMATIONEntity>{
  24 +
  25 + @Resource
  26 + private HzInfoRepository hzInfoRepository;
  27 +
  28 + /**
  29 + * 分页查询
  30 + *
  31 + * @param pageForm 分页对象
  32 + * @return 包含分页信息和数据的分页对象
  33 + */
  34 + public Page<HZSHIPPERINFORMATIONEntity> getPage(EasyPage<HZSHIPPERINFORMATIONEntity> pageForm) {
  35 +
  36 + PageRequest pageRequest = buildPageRequest(pageForm);
  37 + Specification<HZSHIPPERINFORMATIONEntity> spec = buildSpecification(pageForm);
  38 + Page<HZSHIPPERINFORMATIONEntity> page = hzInfoRepository.findAll(spec, pageRequest);
  39 + return page;
  40 + }
  41 +
  42 +
  43 + public int forShortShipperType(String forShort, String theshippertype){
  44 + return hzInfoRepository.forShortShipperType(forShort, theshippertype);
  45 + }
  46 +
  47 + public HZSHIPPERINFORMATIONEntity save(HZSHIPPERINFORMATIONEntity hz){
  48 + return hzInfoRepository.save(hz);
  49 + }
  50 +
  51 +
  52 + @Transactional
  53 + public int saves(HZSHIPPERINFORMATIONEntity hz){
  54 + return hzInfoRepository.saves(hz.getFor_short(), hz.getFull_name(),
  55 + hz.getThe_shipper_type(), hz.getContacts(),
  56 + hz.getPhone(), hz.getDelete_flag());
  57 + }
  58 +
  59 + @Transactional
  60 + public void deletes(String ids) {
  61 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  62 + for (String id : list) {
  63 +
  64 + hzInfoRepository.deletes(Long.valueOf(id));
  65 + }
  66 + }
  67 +
  68 + public HZSHIPPERINFORMATIONEntity findOne(Long id){
  69 + return hzInfoRepository.findOne(id);
  70 + }
  71 +
  72 + public int update(HZSHIPPERINFORMATIONEntity hz){
  73 + return hzInfoRepository.update(hz.getId(), hz.getFor_short(), hz.getFull_name(),
  74 + hz.getThe_shipper_type(),hz.getContacts(),hz.getPhone(),hz.getDelete_flag());
  75 + }
  76 +
  77 +
  78 + public List<HZSHIPPERINFORMATIONEntity> findShipeer(){
  79 + return hzInfoRepository.findShipeer();
  80 + }
  81 +
  82 + public List<HZSHIPPERINFORMATIONEntity> findBooking(){
  83 + return hzInfoRepository.findBooking();
  84 + }
  85 +
  86 + public List<HZSHIPPERINFORMATIONEntity> findOperaion(){
  87 + return hzInfoRepository.findOperaion();
  88 + }
  89 +
  90 +}
  1 +package com.agent.service.system;
  2 +
  3 +import com.agent.entity.agent.HZSHIPPERINFORMATIONEntity;
  4 +import com.agent.entity.agent.HZWAYBLLINFOEntity;
  5 +import com.agent.repository.system.HzWaybillRepository;
  6 +import com.agent.service.BasicService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import javax.annotation.Resource;
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * @Auther: shenhl
  14 + * @Date: 2019/4/22 16:14
  15 + */
  16 +@Service
  17 +public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> {
  18 +
  19 + @Resource
  20 + private HzWaybillRepository hzWaybillRepository;
  21 +
  22 + public HZWAYBLLINFOEntity save(HZWAYBLLINFOEntity hzwaybllinfoEntity){
  23 + return hzWaybillRepository.save(hzwaybllinfoEntity);
  24 + }
  25 +
  26 + public List<HZWAYBLLINFOEntity> findHzId(String waybill){
  27 + return hzWaybillRepository.findHzId(waybill);
  28 + }
  29 +
  30 + public int deleteAlls(String waybill){
  31 + return hzWaybillRepository.deleteAlls(waybill);
  32 + }
  33 +
  34 +}
  1 +<%--
  2 + Created by IntelliJ IDEA.
  3 + User: lenovo
  4 + Date: 2019/3/15
  5 + Time: 9:33
  6 + To change this template use File | Settings | File Templates.
  7 +--%>
  8 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  9 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  10 +<%
  11 + String path = request.getContextPath();
  12 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  13 +%>
  14 +<!DOCTYPE html>
  15 +<html lang="en">
  16 +<head>
  17 + <meta charset="utf-8">
  18 + <meta name="viewport" content="width=device-width, initial-scale=1">
  19 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  20 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  21 + <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
  22 + <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
  23 +
  24 + <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  25 + <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  26 + <script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
  27 + <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  28 +
  29 +</head>
  30 +<body>
  31 +<div class="container">
  32 + <div data-options="closable:true">
  33 + <table id="dg" style="width:100%;" title="货主信息管理"
  34 + data-options="
  35 + rownumbers:true,
  36 + singleSelect:false,
  37 + autoRowHeight:false,
  38 + pagination:true,
  39 + fitColumns:true,
  40 + striped:true,
  41 + collapsible:true,
  42 + toolbar:'#tb',
  43 + pageSize:10">
  44 + <thead>
  45 + <tr>
  46 + <th field="." formatter="editFormat"><spring:message code="opt.edit" /></th>
  47 + <th field="forShort">简称</th>
  48 + <th field="fullName">全称</th>
  49 + <th field="theShipperType" sortable="true">货主类型</th>
  50 + <th field="contacts">联系人</th>
  51 + <th field="phone">电话</th>
  52 +
  53 + </tr>
  54 + </thead>
  55 + </table>
  56 + <div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
  57 + <form id="searchForm">
  58 + <table class="search_form_table">
  59 + <%--联系人:<input id="manifnum" type="text" name="search_LIKE_waybillnomaster" style="width:166px;height:35px;line-height:35px;">--%>
  60 + 电话:<input class="easyui-textbox" type="text" name="search_LIKE_phone" style="width:166px;height:35px;line-height:35px;">
  61 + <a href="javascript:doSearch()" class="easyui-linkbutton" iconCls="icon-search" data-options="selected:true"><spring:message code="opt.search" /></a>
  62 + <%--<a href="javascript:doSave()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>--%>
  63 + <%--<a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a>--%>
  64 + </table>
  65 + </form>
  66 + </div>
  67 + </div>
  68 +
  69 +</div>
  70 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  71 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  72 +<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
  73 +<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
  74 +<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
  75 +<!--弹出层引入的JS-->
  76 +<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  77 +<script type="text/javascript">
  78 +
  79 + $(function(){
  80 + function getPageNumber(){
  81 + var pageNumber = window.localStorage.getItem("pageNumber");
  82 + if(typeof(pageNumber) != "undefined")
  83 + {
  84 + try{
  85 + var pattern = /^\d+$/g; //判断是否是数字
  86 +
  87 + //console.log(pageNumber.search(pattern));
  88 +
  89 + if(pageNumber.search(pattern) >= 0)
  90 + {
  91 + var num = parseInt(pageNumber);
  92 + return num;
  93 + }
  94 + return 1;
  95 + }
  96 + catch(e){
  97 + return 1;
  98 + }
  99 + }
  100 + return 1;
  101 + }
  102 +
  103 + //console.log(getPageNumber());
  104 +
  105 + $('#dg').datagrid({
  106 + url:'<%=basePath %>hzinfo/grid.json',
  107 + //queryParams:$("#searchForm").serializeJson(),
  108 + pageNumber:getPageNumber(),
  109 + view: detailview,
  110 + detailFormatter:function(index,row){
  111 + return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
  112 + }
  113 + });
  114 + });
  115 +
  116 + function editFormat(val,row,index){
  117 +
  118 + var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="findOneHz('+row.id+')" lay-event="choose"><i class="iconfont">选择</i></a>'
  119 + html += '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" </a>';
  120 + return html;
  121 + }
  122 +
  123 +
  124 + function doSearch(){
  125 + $('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
  126 + $('#dg').datagrid("reload");
  127 + }
  128 +
  129 + function getIds() {
  130 + var ids = [];
  131 + var rows = $("#dg").datagrid('getChecked');
  132 + $.each(rows,function(key,v){
  133 + ids.push(v.id);
  134 + });
  135 + return ids;
  136 + }
  137 +
  138 + function doDelete(){
  139 + var rows = $("#dg").datagrid('getChecked');
  140 + if(rows.length==0){
  141 + layer.open({content:"<spring:message code="opt.selectone" />"});
  142 + return false;
  143 + }
  144 + layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
  145 + $.post("<%=basePath %>hzinfo/delete",{ids:getIds().join(",")},function(data){
  146 + if(data.status == 200) {
  147 + layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  148 + window.location.href="<%=basePath %>hzinfo/list";
  149 + })
  150 + }else{
  151 + layer.open({content:"<spring:message code="opt.delfailed" />!"});
  152 + }
  153 + },"json");
  154 +
  155 + });
  156 + }
  157 +
  158 + $("#manifnum").keyup(function(){
  159 + var leng = $("#manifnum").val().length;
  160 + if (leng == 3)
  161 + {
  162 + $("#manifnum").val( $("#manifnum").val()+"-")
  163 + }
  164 + })
  165 +
  166 +</script>
  167 +</body>
  168 +</html>
  169 +
  170 +
@@ -80,6 +80,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request. @@ -80,6 +80,7 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
80 <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.agent" />||agent/list',this)"><spring:message code="menu.agent" /></a></li> 80 <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.agent" />||agent/list',this)"><spring:message code="menu.agent" /></a></li>
81 <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.user" />||system/user/list',this)"><spring:message code="menu.user" /></a></li> 81 <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.user" />||system/user/list',this)"><spring:message code="menu.user" /></a></li>
82 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.wbm" />||wbm/list',this)"><spring:message code="menu.wbm" /></a></li> 82 <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.wbm" />||wbm/list',this)"><spring:message code="menu.wbm" /></a></li>
  83 + <li><a href="javascript:void(0);" onclick="addTab('<spring:message code="hz.info" />||hzinfo/list',this)"><spring:message code="hz.info" /></a></li>
83 <%-- <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.consignee_info_set" />||consignee/list')"><spring:message code="menu.consignee_info_set" /></a></li> --%> 84 <%-- <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.consignee_info_set" />||consignee/list')"><spring:message code="menu.consignee_info_set" /></a></li> --%>
84 </ul> 85 </ul>
85 </li> 86 </li>
@@ -86,6 +86,48 @@ @@ -86,6 +86,48 @@
86 } 86 }
87 </script> 87 </script>
88 </tr> 88 </tr>
  89 + <%--货主信息--%>
  90 + <tr>
  91 + <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="1">
  92 + <spring:message code="manifest.hz.information" />
  93 + </td>
  94 + </tr>
  95 +
  96 + <tr>
  97 + <td class="kv-label">
  98 + 发货人<span class="required_span">*</span>
  99 + </td>
  100 + <td class="kv-content">
  101 + <select required id="for_short_shipper" name="for_short_shipper">
  102 + <option value="" selected>-----请选择-----</option>
  103 + <c:forEach items="${shipper}" var="shipper">
  104 + <option value="${shipper.id}" <c:forEach items="${hzId}" var = "hzId"> ${shipper.id eq hzId.hzinfor_id?"selected":""} </c:forEach>>${shipper.for_short}&nbsp;&nbsp;${shipper.full_name}</option>
  105 + </c:forEach>
  106 + </select>
  107 + </td>
  108 + <td class="kv-label">
  109 + 订舱代理<span class="required_span">*</span>
  110 + </td>
  111 + <td class="kv-content">
  112 + <select id="for_short_booking" name="for_short_booking">
  113 + <option value="" selected>-----请选择-----</option>
  114 + <c:forEach items="${booking}" var="booking">
  115 + <option value="${booking.id}" <c:forEach items="${hzId}" var = "hzId"> ${booking.id eq hzId.hzinfor_id?"selected":""} </c:forEach>>${booking.for_short}&nbsp;&nbsp;${booking.full_name}</option>
  116 + </c:forEach>
  117 + </select>
  118 + </td>
  119 + <td class="kv-label">
  120 + 操作代理<span class="required_span">*</span>
  121 + </td>
  122 + <td class="kv-content">
  123 + <select id="for_short_operation" name="for_short_operation">
  124 + <option value="" selected>-----请选择-----</option>
  125 + <c:forEach items="${operation}" var="operation">
  126 + <option value="${operation.id}" <c:forEach items="${hzId}" var = "hzId"> ${operation.id eq hzId.hzinfor_id?"selected":""} </c:forEach> >${operation.for_short}&nbsp;&nbsp;${operation.full_name}</option>
  127 + </c:forEach>
  128 + </select>
  129 + </td>
  130 + </tr>
89 <tr> 131 <tr>
90 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="6"><spring:message 132 <td style="background-color: #EBEDF4; color: black;" class="kv-label" colspan="6"><spring:message
91 code="manifest.flight.information" /></td> 133 code="manifest.flight.information" /></td>
@@ -747,17 +789,25 @@ $(function(){ @@ -747,17 +789,25 @@ $(function(){
747 } 789 }
748 790
749 /* console.log("form-->"+data); */ 791 /* console.log("form-->"+data); */
750 -  
751 - $.post("<%=basePath%>manifest/savesend",data,function (data) {  
752 - parent.layer.close(layerIndex);  
753 - if (data.status == 200) {  
754 - $("#xmlContent").val(data.data);  
755 - $("#DialogShunt").window('open');  
756 - window.location.href = "<%=basePath%>manifest/list";  
757 - } else {  
758 - layer.open({content:data.msg});  
759 - }  
760 - }) 792 + var shipper = $("#for_short_shipper").val();
  793 + var booking = $("#for_short_booking").val();
  794 + var operation = $("#for_short_operation").val();
  795 + //判断货主信息是否为空
  796 + if (notEmpty(shipper) || notEmpty(booking) || notEmpty(operation)){
  797 + $.post("<%=basePath%>manifest/savesend",data,function (data) {
  798 + parent.layer.close(layerIndex);
  799 + if (data.status == 200) {
  800 + $("#xmlContent").val(data.data);
  801 + $("#DialogShunt").window('open');
  802 + window.location.href = "<%=basePath%>manifest/list";
  803 + } else {
  804 + layer.open({content:data.msg});
  805 + }
  806 + })
  807 + }else {
  808 + alert("货主信息不能为空");
  809 + }
  810 +
761 } 811 }
762 } 812 }
763 //发送交运报文 813 //发送交运报文
@@ -944,7 +994,7 @@ $(function(){ @@ -944,7 +994,7 @@ $(function(){
944 onGetData(true,defaultValue,country); 994 onGetData(true,defaultValue,country);
945 } 995 }
946 } 996 }
947 - 997 +
948 function showConsignorDialog() { 998 function showConsignorDialog() {
949 var parentName= window.name; 999 var parentName= window.name;
950 layui.use('layer', function(){ 1000 layui.use('layer', function(){
@@ -957,8 +1007,8 @@ $(function(){ @@ -957,8 +1007,8 @@ $(function(){
957 shade: 0.8, 1007 shade: 0.8,
958 area: ['90%', '80%'], 1008 area: ['90%', '80%'],
959 content: viewUrl 1009 content: viewUrl
960 - });  
961 - }); 1010 + });
  1011 + });
962 } 1012 }
963 1013
964 function onReceivConsignee(consignee) { 1014 function onReceivConsignee(consignee) {
@@ -1101,6 +1151,17 @@ $(function(){ @@ -1101,6 +1151,17 @@ $(function(){
1101 }); 1151 });
1102 } 1152 }
1103 } 1153 }
  1154 +
  1155 + function chooseFindOne() {
  1156 + layer.open({
  1157 + type : 2,
  1158 + title : '选择货主',
  1159 + maxmin : true,
  1160 + shadeClose : false, // 点击遮罩关闭层
  1161 + area : [ '50%', '60%' ],
  1162 + content : '<%=basePath %>hzinfo/choosetHz'
  1163 + });
  1164 + }
1104 1165
1105 </script> 1166 </script>
1106 </body> 1167 </body>
  1 +<%--
  2 + Created by IntelliJ IDEA.
  3 + User: lenovo
  4 + Date: 2019/3/15
  5 + Time: 9:33
  6 + To change this template use File | Settings | File Templates.
  7 +--%>
  8 +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
  9 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  10 +<%
  11 + String path = request.getContextPath();
  12 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  13 +%>
  14 +<!DOCTYPE html>
  15 +<html lang="en">
  16 +<head>
  17 + <meta charset="utf-8">
  18 + <meta name="viewport" content="width=device-width, initial-scale=1">
  19 + <link href="<%=basePath %>resource/css/base.css" rel="stylesheet">
  20 + <link rel="stylesheet" href="<%=basePath %>resource/easyui/uimaker/easyui.css">
  21 + <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/easyui/uimaker/icon.css">
  22 + <link rel="stylesheet" href="<%=basePath %>resource/css/providers.css">
  23 +
  24 + <link rel="stylesheet" href="<%=basePath%>resource/layui/css/layui.css" media="all">
  25 + <script type="text/javascript" src="<%=basePath%>resource/easyui/jquery.min.js"></script>
  26 + <script type="text/javascript" src="<%=basePath%>resource/layer-v3.0.3/layer/layer.js"></script>
  27 + <script type="text/javascript" src="<%=basePath%>resource/layui/layui.js"></script>
  28 +
  29 +</head>
  30 +<body>
  31 +<div class="container">
  32 + <div data-options="closable:true">
  33 + <table id="dg" style="width:100%;" title="货主信息管理"
  34 + data-options="
  35 + rownumbers:true,
  36 + singleSelect:false,
  37 + autoRowHeight:false,
  38 + pagination:true,
  39 + fitColumns:true,
  40 + striped:true,
  41 + collapsible:true,
  42 + toolbar:'#tb',
  43 + pageSize:10">
  44 + <thead>
  45 + <tr>
  46 + <th field="." formatter="editFormat"><spring:message code="opt.edit" /></th>
  47 + <th field="forShort">简称</th>
  48 + <th field="fullName">全称</th>
  49 + <th field="theShipperType" sortable="true">货主类型</th>
  50 + <th field="contacts">联系人</th>
  51 + <th field="phone">电话</th>
  52 +
  53 + </tr>
  54 + </thead>
  55 + </table>
  56 + <div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
  57 + <form id="searchForm">
  58 + <table class="search_form_table">
  59 + <%--联系人:<input id="manifnum" type="text" name="search_LIKE_waybillnomaster" style="width:166px;height:35px;line-height:35px;">--%>
  60 + 电话号:<input class="easyui-textbox" type="text" name="search_LIKE_phone" style="width:166px;height:35px;line-height:35px;">
  61 + <a href="javascript:doSearch()" class="easyui-linkbutton" iconCls="icon-search" data-options="selected:true"><spring:message code="opt.search" /></a>
  62 + <a href="javascript:doSave()" class="easyui-linkbutton" style="background:#18A197;color:#FFF;border: 1px solid #18A197;" iconCls="icon-add"><spring:message code="opt.add" /></a>
  63 + <a href="javascript:doDelete()" class="easyui-linkbutton" style="background:red;color:#FFF;border: 1px solid red" iconCls="icon-no"><spring:message code="opt.delete" /></a>
  64 + </table>
  65 + </form>
  66 + </div>
  67 + </div>
  68 +
  69 +</div>
  70 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
  71 +<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  72 +<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
  73 +<script type="text/javascript" src="<%=basePath %>resource/easyui/datagrid-detailview.js"></script>
  74 +<script type="text/javascript" src="<%=basePath %>resource/js/tools.js?version=${version}"></script>
  75 +<!--弹出层引入的JS-->
  76 +<script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  77 +<script type="text/javascript">
  78 +
  79 + $(function(){
  80 + function getPageNumber(){
  81 + var pageNumber = window.localStorage.getItem("pageNumber");
  82 + if(typeof(pageNumber) != "undefined")
  83 + {
  84 + try{
  85 + var pattern = /^\d+$/g; //判断是否是数字
  86 +
  87 + //console.log(pageNumber.search(pattern));
  88 +
  89 + if(pageNumber.search(pattern) >= 0)
  90 + {
  91 + var num = parseInt(pageNumber);
  92 + return num;
  93 + }
  94 + return 1;
  95 + }
  96 + catch(e){
  97 + return 1;
  98 + }
  99 + }
  100 + return 1;
  101 + }
  102 +
  103 + //console.log(getPageNumber());
  104 +
  105 + $('#dg').datagrid({
  106 + url:'<%=basePath %>hzinfo/grid.json',
  107 + //queryParams:$("#searchForm").serializeJson(),
  108 + pageNumber:getPageNumber(),
  109 + view: detailview,
  110 + detailFormatter:function(index,row){
  111 + return '<div id="ddv-' + index + '"style="padding:5px 0"></div>';
  112 + }
  113 + });
  114 + });
  115 +
  116 + function editFormat(val,row,index){
  117 +
  118 + var html='<a href="javascript:void(0)" style="padding-left:10px;text-decoration:none;color:blue;padding-right:20px;" onclick="userUpdate('+row.id+')"><i class="iconfont">&#xe65a;</i></a>'
  119 + html += '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" </a>';
  120 + return html;
  121 + }
  122 +
  123 + function seeReceipt(waybill_no,sub_waybill_no,isMain){
  124 + layui.use('layer', function(){
  125 + var layer = layui.layer;
  126 + var api="<%=basePath%>receipt/seeReceipt";
  127 + var params = "waybill_no="+waybill_no;
  128 + if(!isMain){
  129 + params+="&sub_waybill_no="+sub_waybill_no;
  130 + }
  131 + var viewUrl = api+"?"+params;
  132 +
  133 + parent.layer.open({
  134 + type: 2,
  135 + title: "<spring:message code='opt.open.receipt'/>",
  136 + shadeClose: true,
  137 + shade: 0.8,
  138 + area: ['80%', '60%'],
  139 + content: viewUrl
  140 + });
  141 + });
  142 + }
  143 +
  144 + //分单编辑
  145 + function editHbillRow(id){
  146 + window.location.href="<%=basePath %>manifest/subedit?id="+id;
  147 + }
  148 +
  149 + function editHbillFormat(val,row,index){
  150 + // var html='<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:blue;" onclick="editHbillRow('+row.id+')"><i class="iconfont">&#xe65a;</i></a>';
  151 + var html = '<a href="javascript:void(0)" style="text-decoration:none;margin-left:20px;color:red;" onclick="delHbillRow('+row.id+','+row.mawbId+','+index+')"><i class="iconfont">&#xe661;</i></a>';
  152 + return html;
  153 + }
  154 +
  155 +
  156 + function editRow(id){
  157 + var page = $("#dg").datagrid("getPager").data("pagination").options;
  158 + window.localStorage.setItem("pageNumber", page.pageNumber);
  159 + if(id==undefined){
  160 + window.location.href='<%=basePath %>manifest/edit?id=';
  161 + }else{
  162 + window.location.href='<%=basePath %>manifest/edit?id='+id;
  163 + }
  164 + }
  165 +
  166 + function userUpdate(id) {
  167 + // iframe层
  168 + layer.open({
  169 + type : 2,
  170 + title : '修改主单号用户',
  171 + maxmin : true,
  172 + shadeClose : false, // 点击遮罩关闭层
  173 + area : [ '700px', '350px' ],
  174 + content : '<%=basePath %>hzinfo/edit?id='+id
  175 + });
  176 + }
  177 +
  178 + //添加
  179 + function doSave() {
  180 + layer.open({
  181 + type : 2,
  182 + title : '新增',
  183 + maxmin : true,
  184 + shadeClose : false, // 点击遮罩关闭层
  185 + area : [ '700px', '350px' ],
  186 + content : '<%=basePath %>hzinfo/add'
  187 + });
  188 + }
  189 +
  190 + function doSearch(){
  191 + $('#dg').datagrid("options").queryParams=$("#searchForm").serializeJson();
  192 + $('#dg').datagrid("reload");
  193 + }
  194 +
  195 + function getIds() {
  196 + var ids = [];
  197 + var rows = $("#dg").datagrid('getChecked');
  198 + $.each(rows,function(key,v){
  199 + ids.push(v.id);
  200 + });
  201 + return ids;
  202 + }
  203 +
  204 + function doDelete(){
  205 + var rows = $("#dg").datagrid('getChecked');
  206 + if(rows.length==0){
  207 + layer.open({content:"<spring:message code="opt.selectone" />"});
  208 + return false;
  209 + }
  210 + layer.confirm("<spring:message code="opt.confirmdel" />?", {btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function () {
  211 + $.post("<%=basePath %>hzinfo/delete",{ids:getIds().join(",")},function(data){
  212 + if(data.status == 200) {
  213 + layer.confirm("<spring:message code="opt.delsuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  214 + window.location.href="<%=basePath %>hzinfo/list";
  215 + })
  216 + }else{
  217 + layer.open({content:"<spring:message code="opt.delfailed" />!"});
  218 + }
  219 + },"json");
  220 +
  221 + });
  222 + }
  223 +
  224 + $("#manifnum").keyup(function(){
  225 + var leng = $("#manifnum").val().length;
  226 + if (leng == 3)
  227 + {
  228 + $("#manifnum").val( $("#manifnum").val()+"-")
  229 + }
  230 + })
  231 +</script>
  232 +</body>
  233 +</html>
  234 +
  235 +
  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>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  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 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <table class="kv-table">
  31 + <tbody>
  32 + <tr>
  33 + <td class="kv-label">简称</td>
  34 + <td class="kv-content">
  35 + <input id="forshort" name="forshort" type="text" required/>
  36 + </td>
  37 + </tr>
  38 + <tr>
  39 + <td class="kv-label">全称</td>
  40 + <td class="kv-content">
  41 + <input id="fullname" name="fullname" type="text" required/>
  42 + </td>
  43 + </tr>
  44 + <tr>
  45 + <td class="kv-label">货主类型</td>
  46 + <td class="kv-content">
  47 + <div class="date">
  48 + <label>
  49 + <input id="one" name="one" type="checkbox" value="1" checked>发货人
  50 + </label>
  51 + <label>
  52 + <input id="two" name="two" type="checkbox" value="2">订舱代理
  53 + </label>
  54 + <label>
  55 + <input id="three" name="three" type="checkbox" value="3">操作代理
  56 + </label>
  57 + </div>
  58 + </td>
  59 + </tr>
  60 + <tr>
  61 + <td class="kv-label">联系人</td>
  62 + <td class="kv-content"><input type="text" id="contacts" name="contacts" required></td>
  63 + </tr>
  64 + <tr>
  65 + <td class="kv-label">电话</td>
  66 + <td class="kv-content"><input type="text" id="phone" name="phone" required></td>
  67 + </tr>
  68 +
  69 + <tr>
  70 + <td colspan="6">
  71 + <div class="opt-buttons" style="padding-top:20px;">
  72 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  73 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  74 + </button>
  75 + <%--<button type="button" class="easyui-linkbutton l-btn l-btn-small" onclick="window.location.href='<%=basePath%>system/user/list'">--%>
  76 + <%--<span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.cancel"/></span></span>--%>
  77 + <%--</button>--%>
  78 + </div>
  79 + </td>
  80 + </tr>
  81 + </tbody>
  82 + </table>
  83 + </form>
  84 + </div>
  85 + </div>
  86 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  87 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  88 + <script src="<%=basePath %>resource/js/tools.js"></script>
  89 + <script type="text/javascript">
  90 + $("#form").validate({
  91 + submitHandler:function(form){
  92 + submit();
  93 + }
  94 + });
  95 +
  96 + var selectFals = false;
  97 + function submit(){
  98 + var chboxValue=[];
  99 + var checkBox = $("input[name=one],input[name=two],input[name=three]");
  100 + for (var i=0; i<checkBox.length; i++){
  101 + if (checkBox[i].checked){
  102 + selectFals = true;
  103 + }
  104 + }
  105 +
  106 + if (selectFals == true){
  107 + var data = $("#form").serialize();
  108 + $.post("<%=basePath%>hzinfo/save",data,function(data){
  109 + if(data.status==200){
  110 + layer.confirm("<spring:message code="opt.savesuccess" />!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  111 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  112 + parent.layer.close(index);
  113 + window.parent.location.reload();
  114 + })
  115 + }else if(data.status == 201){
  116 + layer.open({content:"该简称和货主类型已存在!"});
  117 + }else {
  118 + layer.open({content:"网络异常!"});
  119 + }
  120 + })
  121 + }else {
  122 + alert("货主类型至少选择一项");
  123 + return false;
  124 + }
  125 + }
  126 + </script>
  127 +</body>
  128 +</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>
  9 +<html lang="en">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  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 +
  28 + <div class="content">
  29 + <form class="from-control" id="form">
  30 + <input type="hidden" id="id" name="id" value="${entity.id}">
  31 + <table class="kv-table">
  32 + <tbody>
  33 + <tr>
  34 + <td class="kv-label">简称</td>
  35 + <td class="kv-content">
  36 + <input id="forshort" name="for_short" type="text" value="${entity.for_short}" required/>
  37 + </td>
  38 + </tr>
  39 +
  40 + <tr>
  41 + <td class="kv-label">全称</td>
  42 + <td class="kv-content">
  43 + <input id="fullname" name="full_name" type="text" value="${entity.full_name}" required/>
  44 + </td>
  45 + </tr>
  46 + <tr>
  47 + <td class="kv-label">货主类型</td>
  48 + <td class="kv-content">
  49 + <div class="date">
  50 + <label>
  51 + <input id="one" name="the_shipper_type" type="checkbox" ${1 eq entity.the_shipper_type?"checked":""} value="1">发货人
  52 + </label>
  53 + <label>
  54 + <input id="two" name="the_shipper_type" type="checkbox" ${2 eq entity.the_shipper_type?"checked":""} value="2">订舱代理
  55 + </label>
  56 + <label>
  57 + <input id="three" name="the_shipper_type" type="checkbox" ${3 eq entity.the_shipper_type?"checked":""} value="3">操作代理
  58 + </label>
  59 + </div>
  60 + </td>
  61 + </tr>
  62 + <tr>
  63 + <td class="kv-label">联系人</td>
  64 + <td class="kv-content">
  65 + <input id="contacts" name="contacts" type="text" value="${entity.contacts}" required/>
  66 + </td>
  67 + </tr>
  68 + <tr>
  69 + <td class="kv-label">电话</td>
  70 + <td class="kv-content">
  71 + <input id="phone" name="phone" type="text" value="${entity.phone}" required/>
  72 + </td>
  73 + </tr>
  74 + <tr>
  75 + <td colspan="6">
  76 + <div class="opt-buttons" style="padding-top:20px;">
  77 + <button type="submit" class="easyui-linkbutton l-btn l-btn-small l-btn-selected " data-options="selected:true">
  78 + <span class="l-btn-left"><span class="l-btn-text"><spring:message code="opt.save" /></span></span>
  79 + </button>
  80 + </div>
  81 + </td>
  82 + </tr>
  83 + </tbody>
  84 + </table>
  85 + </form>
  86 + </div>
  87 + </div>
  88 + <script type="text/javascript" src="<%=basePath %>resource/layer-v3.0.3/layer/layer.js"></script>
  89 + <script src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
  90 + <script src="<%=basePath %>resource/js/tools.js"></script>
  91 + <script type="text/javascript">
  92 + $("#form").validate({
  93 + submitHandler:function(form){
  94 + submit();
  95 + }
  96 + });
  97 +
  98 + $(function () {
  99 + $("#form").find("input[type=checkbox]").bind("click", function () {
  100 + //当前checkbox是否选中
  101 + if (this.checked){
  102 + //除当前的checkbox其他不选中
  103 + $("#form").find("input[type=checkbox]").not(this).attr("checked", false);
  104 + }
  105 + })
  106 + })
  107 +
  108 +
  109 + var selectFals = false;
  110 + function submit(){
  111 + var chboxValue=[];
  112 + var checkBox = $("input[id=one],input[id=two],input[id=three]");
  113 + for (var i=0; i<checkBox.length; i++){
  114 + if (checkBox[i].checked){
  115 + selectFals = true;
  116 + }
  117 + }
  118 +
  119 + if (selectFals == true){
  120 + var data = $("#form").serialize();
  121 + $.post("<%=basePath%>hzinfo/update",data,function(data){
  122 + if(data.status==200){
  123 + layer.confirm("修改成功!",{btn:['<spring:message code="opt.confirm" />','<spring:message code="opt.cancel" />']},function(){
  124 + var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
  125 + parent.layer.close(index);
  126 + window.parent.location.reload();
  127 + })
  128 + }else if(data.status == 201){
  129 + layer.open({content:"该简称和货主类型已存在!"});
  130 + }else {
  131 + layer.open({content:"网络异常!"});
  132 + }
  133 + })
  134 + }else {
  135 + alert("货主类型至少选择一项");
  136 + return false;
  137 + }
  138 + }
  139 + </script>
  140 +</body>
  141 +</html>