...
|
...
|
@@ -6,6 +6,7 @@ package com.thinkgem.jeesite.modules.land.web; |
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Random;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
...
|
...
|
@@ -43,6 +44,7 @@ import com.thinkgem.jeesite.modules.yard.service.YardService; |
|
|
|
|
|
/**
|
|
|
* 货物流转类型Controller
|
|
|
*
|
|
|
* @author zhangfan
|
|
|
* @version 2018-10-08
|
|
|
*/
|
...
|
...
|
@@ -52,53 +54,57 @@ public class LandBusinesstypeListController extends BaseController { |
|
|
|
|
|
@Autowired
|
|
|
private LandBusinesstypeListService landBusinesstypeListService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private YardService yardService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private BayonetService bayService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private VehicleMainifistService veMainService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private LandRoadVeRecordService roadVeService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private SystemService systemService;
|
|
|
|
|
|
private static final String TYPE1 = "进口流转";
|
|
|
|
|
|
private static final String TYPE1 = "调拨业务";
|
|
|
private static final String TYPE2 = "进口提货";
|
|
|
private static final String TYPE3 = "出口送货";
|
|
|
private static final String TYPE4 = "出口流转";
|
|
|
|
|
|
|
|
|
private static final String TYPE4 = "分拨业务";
|
|
|
|
|
|
@ModelAttribute
|
|
|
public LandBusinesstypeList get(@RequestParam(required=false) String id) {
|
|
|
public LandBusinesstypeList get(@RequestParam(required = false) String id) {
|
|
|
LandBusinesstypeList entity = null;
|
|
|
if (StringUtils.isNotBlank(id)){
|
|
|
if (StringUtils.isNotBlank(id)) {
|
|
|
entity = landBusinesstypeListService.get(id);
|
|
|
}
|
|
|
if (entity == null){
|
|
|
if (entity == null) {
|
|
|
entity = new LandBusinesstypeList();
|
|
|
}
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequiresPermissions("land:landBusinesstypeList:view")
|
|
|
@RequestMapping(value = {"list", ""})
|
|
|
public String list(LandBusinesstypeList landBusinesstypeList, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
@RequestMapping(value = { "list", "" })
|
|
|
public String list(LandBusinesstypeList landBusinesstypeList, HttpServletRequest request,
|
|
|
HttpServletResponse response, Model model) {
|
|
|
Principal principal = UserUtils.getPrincipal();
|
|
|
String loginName = principal.getLoginName();
|
|
|
User user = systemService.getUserByLoginName(loginName);
|
|
|
landBusinesstypeList.setCreateBy(user);
|
|
|
Page<LandBusinesstypeList> page = landBusinesstypeListService.findPage(new Page<LandBusinesstypeList>(request, response), landBusinesstypeList);
|
|
|
Yard yard = new Yard();
|
|
|
List<Yard> yardList = yardService.findList(yard);
|
|
|
Page<LandBusinesstypeList> page = landBusinesstypeListService
|
|
|
.findPage(new Page<LandBusinesstypeList>(request, response), landBusinesstypeList);
|
|
|
model.addAttribute("yardList", yardList);
|
|
|
model.addAttribute("page", page);
|
|
|
return "modules/land/landBusinesstypeListList";
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequiresPermissions("land:landBusinesstypeList:view")
|
|
|
@RequestMapping(value = "check")
|
|
|
@ResponseBody
|
...
|
...
|
@@ -106,30 +112,36 @@ public class LandBusinesstypeListController extends BaseController { |
|
|
Page<LandRoadVeRecord> page = new Page<LandRoadVeRecord>();
|
|
|
List<LandBusinesstypeList> list = landBusinesstypeListService.findByStatus(frameNo);
|
|
|
List<LandRoadVeRecord> veList = roadVeService.selectByFrameNo(frameNo);
|
|
|
if(list.size()>0 ) {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
boolean flag = (list.get(i).getContrastflag()==null || list.get(i).getContrastflag().length()<1);
|
|
|
if("I".equals(list.get(i).getTurnoverflag()) && flag) {
|
|
|
page.setResultMsg("此车辆已存在进出场业务,请勿重新申报");
|
|
|
}else if("E".equals(list.get(i).getTurnoverflag())&& flag ) {
|
|
|
page.setResultMsg("此车辆已存在进出场业务,请勿重新申报");
|
|
|
}else {
|
|
|
page.setResultMsg("此车辆可以正常申报业务");
|
|
|
if (veList.size() < 1) {
|
|
|
page.setResultMsg("此车辆未备案,请先备案");
|
|
|
} else {
|
|
|
if (list.size() > 0) {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
boolean flag = (list.get(i).getContrastflag() == null
|
|
|
|| list.get(i).getContrastflag().length() < 1);
|
|
|
if ("I".equals(list.get(i).getTurnoverflag()) && flag) {
|
|
|
page.setResultMsg("此车辆已存在进出场业务,请勿重新申报");
|
|
|
} else if ("E".equals(list.get(i).getTurnoverflag()) && flag) {
|
|
|
page.setResultMsg("此车辆已存在进出场业务,请勿重新申报");
|
|
|
} else {
|
|
|
page.setResultMsg("此车辆可以正常申报业务");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
} else {
|
|
|
page.setResultMsg("此车辆可以正常申报业务");
|
|
|
}
|
|
|
}else {
|
|
|
page.setResultMsg("此车辆可以正常申报业务");
|
|
|
}
|
|
|
page.setList(veList);
|
|
|
return page;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
@RequiresPermissions("land:landBusinesstypeList:view")
|
|
|
@RequestMapping(value = "option")
|
|
|
@ResponseBody
|
|
|
public Page<Bayonet> option(String st_select,Model model) throws Exception {
|
|
|
Page<Bayonet>page = new Page<Bayonet>();
|
|
|
public Page<Bayonet> option(String st_select) throws Exception {
|
|
|
Page<Bayonet> page = new Page<Bayonet>();
|
|
|
Yard yard = yardService.findByStaionId(st_select);
|
|
|
List<Bayonet> bayonet = bayService.findByYardId(yard.getStationid());
|
|
|
page.setList(bayonet);
|
...
|
...
|
@@ -140,21 +152,19 @@ public class LandBusinesstypeListController extends BaseController { |
|
|
@RequestMapping(value = "form")
|
|
|
public String form(LandBusinesstypeList landBusinesstypeList, Model model) {
|
|
|
Yard yard = new Yard();
|
|
|
List<Yard> yardList = yardService.findList(yard);
|
|
|
LandRoadVeRecord ve = new LandRoadVeRecord();
|
|
|
Principal principal = UserUtils.getPrincipal();
|
|
|
String loginName = principal.getLoginName();
|
|
|
User user = systemService.getUserByLoginName(loginName);
|
|
|
ve.setCreateBy(user);
|
|
|
List<Yard> yardList = yardService.findList(yard);
|
|
|
LandRoadVeRecord ve = new LandRoadVeRecord();
|
|
|
User user = systemService.getUserByLoginName("admin");
|
|
|
ve.setCreateBy(user);
|
|
|
|
|
|
List<LandRoadVeRecord> veList = roadVeService.findList(ve);
|
|
|
if(landBusinesstypeList.getEndstation() !=null) {
|
|
|
Yard yard1 = yardService.findByStaionId(landBusinesstypeList.getEndstation());
|
|
|
List<LandRoadVeRecord> veList = roadVeService.findList(ve);
|
|
|
if (landBusinesstypeList.getEndstation() != null) {
|
|
|
Yard yard1 = yardService.findByStaionId(landBusinesstypeList.getEndstation());
|
|
|
List<Bayonet> bayonets = bayService.findByYardId(yard1.getStationid());
|
|
|
model.addAttribute("bayonets", bayonets);
|
|
|
}
|
|
|
model.addAttribute("veList",veList);
|
|
|
model.addAttribute("yardList", yardList);
|
|
|
}
|
|
|
model.addAttribute("veList", veList);
|
|
|
model.addAttribute("yardList", yardList);
|
|
|
model.addAttribute("landBusinesstypeList", landBusinesstypeList);
|
|
|
return "modules/land/landBusinesstypeListForm";
|
|
|
}
|
...
|
...
|
@@ -162,264 +172,411 @@ public class LandBusinesstypeListController extends BaseController { |
|
|
@RequiresPermissions("land:landBusinesstypeList:edit")
|
|
|
@RequestMapping(value = "save")
|
|
|
public String save(LandBusinesstypeList landBusinesstypeList, Model model, RedirectAttributes redirectAttributes) {
|
|
|
if (!beanValidator(model, landBusinesstypeList)){
|
|
|
if (!beanValidator(model, landBusinesstypeList)) {
|
|
|
return form(landBusinesstypeList, model);
|
|
|
}
|
|
|
landBusinesstypeList.setIsDelete("0");
|
|
|
landBusinesstypeList.setIsvalid("0");
|
|
|
if(landBusinesstypeList.getId().length()>0) {
|
|
|
boolean flag = false;
|
|
|
landBusinesstypeList.setIsDelete("0");
|
|
|
landBusinesstypeList.setIsvalid("0");
|
|
|
if (landBusinesstypeList.getId().length() > 0) {
|
|
|
String masterList = landBusinesstypeList.getMasterList();
|
|
|
insertVm(landBusinesstypeList.getMassageId(),landBusinesstypeList.getTrailerFrameNo(),masterList);
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
List<LandBusinesstypeList> list = landBusinesstypeListService.findByBarcode(landBusinesstypeList.getBarcode());
|
|
|
insertVm(landBusinesstypeList.getMassageId(), landBusinesstypeList.getTrailerFrameNo(), masterList);
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
List<LandBusinesstypeList> list = landBusinesstypeListService
|
|
|
.findByBarcode(landBusinesstypeList.getBarcode());
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
if(list.get(i).getBusinesstype().endsWith("流转")) {
|
|
|
if(list.get(i).getMasterList().length()>0) {
|
|
|
if(list.get(i).getContrastflag()==null) {
|
|
|
if (list.get(i).getBusinesstype().endsWith("业务")) {
|
|
|
if (list.get(i).getMasterList().length() > 0) {
|
|
|
if (list.get(i).getContrastflag() == null) {
|
|
|
list.get(i).setMasterList(masterList);
|
|
|
// list.get(i).setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
landBusinesstypeListService.save(list.get(i));
|
|
|
}
|
|
|
}else {
|
|
|
if("I".equals(list.get(i).getTurnoverflag())) {
|
|
|
} else {
|
|
|
if ("I".equals(list.get(i).getTurnoverflag()) && list.get(i).getContrastflag() == null) {
|
|
|
list.get(i).setMasterList(masterList);
|
|
|
// list.get(i).setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
landBusinesstypeListService.save(list.get(i));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
if(TYPE1.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
insertType1(landBusinesstypeList);
|
|
|
flag=true;
|
|
|
} else {
|
|
|
if (TYPE1.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
flag = insertType1(landBusinesstypeList);
|
|
|
}
|
|
|
if(TYPE2.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
insertType2(landBusinesstypeList);
|
|
|
if (TYPE2.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
flag = insertType2(landBusinesstypeList);
|
|
|
}
|
|
|
if(TYPE3.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
insertType3(landBusinesstypeList);
|
|
|
if (TYPE3.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
flag = insertType3(landBusinesstypeList);
|
|
|
}
|
|
|
if(TYPE4.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
insertType1(landBusinesstypeList);
|
|
|
if (TYPE4.equals(landBusinesstypeList.getBusinesstype())) {
|
|
|
flag = insertType1(landBusinesstypeList);
|
|
|
}
|
|
|
}
|
|
|
addMessage(redirectAttributes, "保存申请单成功");
|
|
|
return "redirect:"+Global.getAdminPath()+"/land/landBusinesstypeList/?repage";
|
|
|
if(flag) {
|
|
|
addMessage(redirectAttributes, "保存申请单成功");
|
|
|
}else {
|
|
|
addMessage(redirectAttributes, "保存申请单失败,请重新录入");
|
|
|
}
|
|
|
|
|
|
return "redirect:" + Global.getAdminPath() + "/land/landBusinesstypeList/?repage";
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequiresPermissions("land:landBusinesstypeList:edit")
|
|
|
@RequestMapping(value = "delete")
|
|
|
public String delete(LandBusinesstypeList landBusinesstypeList, RedirectAttributes redirectAttributes) {
|
|
|
public String delete(LandBusinesstypeList landBusinesstypeList, RedirectAttributes redirectAttributes)
|
|
|
throws Exception {
|
|
|
boolean flag = false;
|
|
|
List<LandBusinesstypeList> list = landBusinesstypeListService.findByBarcode(landBusinesstypeList.getBarcode());
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
String flag1 = list.get(i).getContrastflag();
|
|
|
if(flag1!=null) {
|
|
|
flag =true;
|
|
|
if (flag1 != null) {
|
|
|
flag = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if(!flag) {
|
|
|
if (!flag) {
|
|
|
landBusinesstypeListService.deleteByBarcode(landBusinesstypeList.getBarcode());
|
|
|
veMainService.deleteById(landBusinesstypeList.getMassageId());
|
|
|
buildBarCode.cancleBarCode(landBusinesstypeList.getTrailerFrameNo());
|
|
|
addMessage(redirectAttributes, "删除申请单成功");
|
|
|
}else {
|
|
|
} else {
|
|
|
addMessage(redirectAttributes, "删除失败,已有业务已进出站");
|
|
|
}
|
|
|
|
|
|
return "redirect:"+Global.getAdminPath()+"/land/landBusinesstypeList/?repage";
|
|
|
return "redirect:" + Global.getAdminPath() + "/land/landBusinesstypeList/?repage";
|
|
|
}
|
|
|
|
|
|
public void insertType1(LandBusinesstypeList landBusinesstypeList) {
|
|
|
//first entry in
|
|
|
String messageId = LandBusinesstypeListController.dateTimeFormat();
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String startport = landBusinesstypeList.getStartport();
|
|
|
String endport = landBusinesstypeList.getEndport();
|
|
|
String startStation = landBusinesstypeList.getStartsatation();
|
|
|
String endStation = landBusinesstypeList.getEndstation();
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(),messageId);
|
|
|
landBusinesstypeList.setStartport("");
|
|
|
landBusinesstypeList.setStartsatation("");
|
|
|
landBusinesstypeList.setEndport(startport);
|
|
|
landBusinesstypeList.setEndstation(startStation);
|
|
|
landBusinesstypeList.setBarcode(barCode);
|
|
|
landBusinesstypeList.setMasterList("");
|
|
|
landBusinesstypeList.setProdectTime(new Date());
|
|
|
landBusinesstypeList.setAisle(bayService.findByYardAndName(startStation, "1号卡口-进").getChannel());
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(),landBusinesstypeList.getTrailerFrameNo(),mainfistList);
|
|
|
|
|
|
//second out
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setBarcode(barCode);
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setEndport(startport);
|
|
|
list.setEndstation(startStation);
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList(mainfistList);
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(startStation, "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
|
|
|
//third
|
|
|
LandBusinesstypeList list1 = new LandBusinesstypeList();
|
|
|
list1.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list1.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list1.setIsDelete("0");
|
|
|
list1.setIsvalid("0");
|
|
|
list1.setIsfull(isfull);
|
|
|
list1.setBarcode(barCode);
|
|
|
list1.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list1.setCocode(landBusinesstypeList.getCocode());
|
|
|
list1.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list1.setStartport(startport);
|
|
|
list1.setStartsatation(startStation);
|
|
|
list1.setEndport(endport);
|
|
|
list1.setEndstation(endStation);
|
|
|
list1.setProdectTime(new Date());
|
|
|
list1.setMasterList(mainfistList);
|
|
|
list1.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list1.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list1.setAisle(bayService.findByYardAndName(endStation, "1号卡口-进").getChannel());
|
|
|
list1.setTurnoverflag("I");
|
|
|
list1.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list1);
|
|
|
|
|
|
//four
|
|
|
LandBusinesstypeList list2 = new LandBusinesstypeList();
|
|
|
list2.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list2.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list2.setBarcode(barCode);
|
|
|
list2.setIsDelete("0");
|
|
|
list2.setIsvalid("0");
|
|
|
list2.setIsfull(isfull);
|
|
|
list2.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list2.setCocode(landBusinesstypeList.getCocode());
|
|
|
list2.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list2.setStartport("");
|
|
|
list2.setStartsatation("");
|
|
|
list2.setStartport(startport);
|
|
|
list2.setStartsatation(startStation);
|
|
|
list2.setEndport(endport);
|
|
|
list2.setEndstation(endStation);
|
|
|
list2.setProdectTime(new Date());
|
|
|
list2.setMasterList("");
|
|
|
list2.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list2.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list2.setAisle(bayService.findByYardAndName(endStation, "1号卡口-出").getChannel());
|
|
|
list2.setTurnoverflag("E");
|
|
|
list2.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list2);
|
|
|
|
|
|
|
|
|
public boolean insertType1(LandBusinesstypeList landBusinesstypeList) {
|
|
|
boolean flag = false;
|
|
|
try {
|
|
|
// first entry in
|
|
|
String messageId = LandBusinesstypeListController.dateTimeFormat();
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String startport = landBusinesstypeList.getStartport();
|
|
|
String endport = landBusinesstypeList.getEndport();
|
|
|
String startStation = landBusinesstypeList.getStartsatation();
|
|
|
String endStation = landBusinesstypeList.getEndstation();
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
landBusinesstypeList.setStartport("");
|
|
|
landBusinesstypeList.setStartsatation("");
|
|
|
landBusinesstypeList.setEndport(startport);
|
|
|
landBusinesstypeList.setEndstation(startStation);
|
|
|
landBusinesstypeList.setMasterList("");
|
|
|
landBusinesstypeList.setProdectTime(new Date());
|
|
|
landBusinesstypeList.setAisle(bayService.findByYardAndName(startStation, "1号卡口-进").getChannel());
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(), landBusinesstypeList.getTrailerFrameNo(), mainfistList);
|
|
|
|
|
|
// second out
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setEndport(startport);
|
|
|
list.setEndstation(startStation);
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList(mainfistList);
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(startStation, "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
|
|
|
// third
|
|
|
LandBusinesstypeList list1 = new LandBusinesstypeList();
|
|
|
list1.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list1.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list1.setIsDelete("0");
|
|
|
list1.setIsvalid("0");
|
|
|
list1.setIsfull(isfull);
|
|
|
list1.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list1.setCocode(landBusinesstypeList.getCocode());
|
|
|
list1.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list1.setStartport(startport);
|
|
|
list1.setStartsatation(startStation);
|
|
|
list1.setEndport(endport);
|
|
|
list1.setEndstation(endStation);
|
|
|
list1.setProdectTime(new Date());
|
|
|
list1.setMasterList(mainfistList);
|
|
|
list1.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list1.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list1.setAisle(bayService.findByYardAndName(endStation, "1号卡口-进").getChannel());
|
|
|
list1.setTurnoverflag("I");
|
|
|
list1.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list1);
|
|
|
|
|
|
// four
|
|
|
LandBusinesstypeList list2 = new LandBusinesstypeList();
|
|
|
list2.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list2.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list2.setIsDelete("0");
|
|
|
list2.setIsvalid("0");
|
|
|
list2.setIsfull(isfull);
|
|
|
list2.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list2.setCocode(landBusinesstypeList.getCocode());
|
|
|
list2.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list2.setStartport("");
|
|
|
list2.setStartsatation("");
|
|
|
list2.setStartport(startport);
|
|
|
list2.setStartsatation(startStation);
|
|
|
list2.setEndport(endport);
|
|
|
list2.setEndstation(endStation);
|
|
|
list2.setProdectTime(new Date());
|
|
|
list2.setMasterList("");
|
|
|
list2.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list2.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list2.setAisle(bayService.findByYardAndName(endStation, "1号卡口-出").getChannel());
|
|
|
list2.setTurnoverflag("E");
|
|
|
list2.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list2);
|
|
|
|
|
|
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(), messageId);
|
|
|
List<LandBusinesstypeList> typeList = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList.size(); i++) {
|
|
|
typeList.get(i).setBarcode(barCode);
|
|
|
landBusinesstypeListService.updateEntry(typeList.get(i));
|
|
|
flag = true;
|
|
|
}
|
|
|
if (barCode==null) {
|
|
|
List<LandBusinesstypeList> typeList1 = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList1.size(); i++) {
|
|
|
landBusinesstypeListService.deleteByMessageId(typeList1.get(i));
|
|
|
flag =false;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return flag;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void insertType2(LandBusinesstypeList landBusinesstypeList) {
|
|
|
//first entry
|
|
|
String messageId = dateTimeFormat();
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(),messageId);
|
|
|
landBusinesstypeList.setBarcode(barCode);
|
|
|
landBusinesstypeList.setMasterList("");
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(),landBusinesstypeList.getTrailerFrameNo(),mainfistList);
|
|
|
//second
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setBarcode(barCode);
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setStartport(landBusinesstypeList.getStartport());
|
|
|
list.setStartsatation(landBusinesstypeList.getStartsatation());
|
|
|
list.setEndport(landBusinesstypeList.getEndport());
|
|
|
list.setEndstation(landBusinesstypeList.getEndstation());
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList(mainfistList);
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(landBusinesstypeList.getEndstation(), "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
|
|
|
public boolean insertType2(LandBusinesstypeList landBusinesstypeList) {
|
|
|
|
|
|
boolean flag = false;
|
|
|
try {
|
|
|
|
|
|
// first entry
|
|
|
String messageId = dateTimeFormat();
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
landBusinesstypeList.setMasterList("");
|
|
|
landBusinesstypeList.setProdectTime(new Date());
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(), landBusinesstypeList.getTrailerFrameNo(), mainfistList);
|
|
|
// second
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setStartport(landBusinesstypeList.getStartport());
|
|
|
list.setStartsatation(landBusinesstypeList.getStartsatation());
|
|
|
list.setEndport(landBusinesstypeList.getEndport());
|
|
|
list.setEndstation(landBusinesstypeList.getEndstation());
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList(mainfistList);
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(landBusinesstypeList.getEndstation(), "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(), messageId);
|
|
|
List<LandBusinesstypeList> typeList = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList.size(); i++) {
|
|
|
typeList.get(i).setBarcode(barCode);
|
|
|
landBusinesstypeListService.updateEntry(typeList.get(i));
|
|
|
flag = true;
|
|
|
}
|
|
|
if (barCode==null) {
|
|
|
List<LandBusinesstypeList> typeList1 = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList1.size(); i++) {
|
|
|
landBusinesstypeListService.deleteByMessageId(typeList1.get(i));
|
|
|
flag=false;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
public void insertType3(LandBusinesstypeList landBusinesstypeList) {
|
|
|
//first entry
|
|
|
|
|
|
public boolean insertType3(LandBusinesstypeList landBusinesstypeList) {
|
|
|
|
|
|
String messageId = dateTimeFormat();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(),messageId);
|
|
|
//String barCode = messageId;
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setBarcode(barCode);
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(),landBusinesstypeList.getTrailerFrameNo(),mainfistList);
|
|
|
//second
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBarcode(barCode);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setStartport(landBusinesstypeList.getStartport());
|
|
|
list.setStartsatation(landBusinesstypeList.getStartsatation());
|
|
|
list.setEndport(landBusinesstypeList.getEndport());
|
|
|
list.setEndstation(landBusinesstypeList.getEndstation());
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList("");
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(landBusinesstypeList.getEndstation(), "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
boolean flag = false;
|
|
|
try {
|
|
|
// first entry
|
|
|
String messageId = dateTimeFormat();
|
|
|
landBusinesstypeList.setMassageId(messageId);
|
|
|
String mainfistList = landBusinesstypeList.getMasterList();
|
|
|
String isfull = landBusinesstypeList.getIsfull();
|
|
|
landBusinesstypeList.setProdectTime(new Date());
|
|
|
landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
insertVm(landBusinesstypeList.getMassageId(), landBusinesstypeList.getTrailerFrameNo(), mainfistList);
|
|
|
// second
|
|
|
LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
list.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
list.setIsDelete("0");
|
|
|
list.setIsvalid("0");
|
|
|
list.setIsfull(isfull);
|
|
|
list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
list.setCocode(landBusinesstypeList.getCocode());
|
|
|
list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
list.setStartport(landBusinesstypeList.getStartport());
|
|
|
list.setStartsatation(landBusinesstypeList.getStartsatation());
|
|
|
list.setEndport(landBusinesstypeList.getEndport());
|
|
|
list.setEndstation(landBusinesstypeList.getEndstation());
|
|
|
list.setProdectTime(new Date());
|
|
|
list.setMasterList("");
|
|
|
list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
list.setAisle(bayService.findByYardAndName(landBusinesstypeList.getEndstation(), "1号卡口-出").getChannel());
|
|
|
list.setTurnoverflag("E");
|
|
|
list.setMassageId(messageId);
|
|
|
landBusinesstypeListService.save(list);
|
|
|
|
|
|
String barCode = buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(), messageId);
|
|
|
List<LandBusinesstypeList> typeList = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList.size(); i++) {
|
|
|
typeList.get(i).setBarcode(barCode);
|
|
|
landBusinesstypeListService.updateEntry(typeList.get(i));
|
|
|
flag = true;
|
|
|
}
|
|
|
if (barCode==null) {
|
|
|
List<LandBusinesstypeList> typeList1 = landBusinesstypeListService.findByMessageId(messageId);
|
|
|
for (int i = 0; i < typeList1.size(); i++) {
|
|
|
landBusinesstypeListService.deleteByMessageId(typeList1.get(i));
|
|
|
flag = false;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
* public void insertType1(LandBusinesstypeList landBusinesstypeList) { //first
|
|
|
* entry in String messageId = LandBusinesstypeListController.dateTimeFormat();
|
|
|
* String mainfistList = landBusinesstypeList.getMasterList(); String startport
|
|
|
* = landBusinesstypeList.getStartport(); String endport =
|
|
|
* landBusinesstypeList.getEndport(); String startStation =
|
|
|
* landBusinesstypeList.getStartsatation(); String endStation =
|
|
|
* landBusinesstypeList.getEndstation(); String isfull =
|
|
|
* landBusinesstypeList.getIsfull();
|
|
|
* landBusinesstypeList.setMassageId(messageId); String barCode =
|
|
|
* buildBarCode.CreateBarCode(landBusinesstypeList.getTrailerFrameNo(),messageId
|
|
|
* ); landBusinesstypeList.setStartport("");
|
|
|
* landBusinesstypeList.setStartsatation("");
|
|
|
* landBusinesstypeList.setEndport(startport);
|
|
|
* landBusinesstypeList.setEndstation(startStation);
|
|
|
* landBusinesstypeList.setBarcode(barCode);
|
|
|
* landBusinesstypeList.setMasterList("");
|
|
|
* landBusinesstypeList.setProdectTime(new Date());
|
|
|
* landBusinesstypeList.setAisle(bayService.findByYardAndName(startStation,
|
|
|
* "1号卡口-进").getChannel());
|
|
|
* landBusinesstypeListService.save(landBusinesstypeList);
|
|
|
* insertVm(landBusinesstypeList.getMassageId(),landBusinesstypeList.
|
|
|
* getTrailerFrameNo(),mainfistList);
|
|
|
*
|
|
|
* //second out LandBusinesstypeList list = new LandBusinesstypeList();
|
|
|
* list.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
* list.setAgentno(landBusinesstypeList.getAgentno()); list.setBarcode(barCode);
|
|
|
* list.setIsDelete("0"); list.setIsvalid("0"); list.setIsfull(isfull);
|
|
|
* list.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
* list.setCocode(landBusinesstypeList.getCocode());
|
|
|
* list.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
* list.setEndport(startport); list.setEndstation(startStation);
|
|
|
* list.setProdectTime(new Date()); list.setMasterList(mainfistList);
|
|
|
* list.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
* list.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
* list.setAisle(bayService.findByYardAndName(startStation,
|
|
|
* "1号卡口-出").getChannel()); list.setTurnoverflag("E");
|
|
|
* list.setMassageId(messageId); landBusinesstypeListService.save(list);
|
|
|
*
|
|
|
* //third LandBusinesstypeList list1 = new LandBusinesstypeList();
|
|
|
* list1.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
* list1.setAgentno(landBusinesstypeList.getAgentno()); list1.setIsDelete("0");
|
|
|
* list1.setIsvalid("0"); list1.setIsfull(isfull); list1.setBarcode(barCode);
|
|
|
* list1.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
* list1.setCocode(landBusinesstypeList.getCocode());
|
|
|
* list1.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
* list1.setStartport(startport); list1.setStartsatation(startStation);
|
|
|
* list1.setEndport(endport); list1.setEndstation(endStation);
|
|
|
* list1.setProdectTime(new Date()); list1.setMasterList(mainfistList);
|
|
|
* list1.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
* list1.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
* list1.setAisle(bayService.findByYardAndName(endStation,
|
|
|
* "1号卡口-进").getChannel()); list1.setTurnoverflag("I");
|
|
|
* list1.setMassageId(messageId); landBusinesstypeListService.save(list1);
|
|
|
*
|
|
|
* //four LandBusinesstypeList list2 = new LandBusinesstypeList();
|
|
|
* list2.setAgentname(landBusinesstypeList.getAgentname());
|
|
|
* list2.setAgentno(landBusinesstypeList.getAgentno());
|
|
|
* list2.setBarcode(barCode); list2.setIsDelete("0"); list2.setIsvalid("0");
|
|
|
* list2.setIsfull(isfull);
|
|
|
* list2.setBusinesstype(landBusinesstypeList.getBusinesstype());
|
|
|
* list2.setCocode(landBusinesstypeList.getCocode());
|
|
|
* list2.setTrailerFrameNo(landBusinesstypeList.getTrailerFrameNo());
|
|
|
* list2.setStartport(""); list2.setStartsatation("");
|
|
|
* list2.setStartport(startport); list2.setStartsatation(startStation);
|
|
|
* list2.setEndport(endport); list2.setEndstation(endStation);
|
|
|
* list2.setProdectTime(new Date()); list2.setMasterList("");
|
|
|
* list2.setDriverid(landBusinesstypeList.getDriverid());
|
|
|
* list2.setDrivername(landBusinesstypeList.getDrivername());
|
|
|
* list2.setAisle(bayService.findByYardAndName(endStation,
|
|
|
* "1号卡口-出").getChannel()); list2.setTurnoverflag("E");
|
|
|
* list2.setMassageId(messageId); landBusinesstypeListService.save(list2);
|
|
|
*
|
|
|
* }
|
|
|
*/
|
|
|
public static String dateTimeFormat() {
|
|
|
Date dateTime = new Date();
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
return format.format(dateTime);
|
|
|
String str = String.valueOf(new Random().nextInt(9999)+1);
|
|
|
if(str.length()==1) {
|
|
|
str = "000"+str;
|
|
|
}else if(str.length()==2) {
|
|
|
str = "00"+str;
|
|
|
}else if(str.length()==3) {
|
|
|
str = "0"+str;
|
|
|
}
|
|
|
str = format.format(dateTime)+str;
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
public void insertVm(String id ,String frameNo,String mainfistList) {
|
|
|
|
|
|
|
|
|
public void insertVm(String id, String frameNo, String mainfistList) {
|
|
|
|
|
|
List<VehicleMainifist> vmList = veMainService.selectByBueId(id);
|
|
|
|
|
|
if(mainfistList.length()>0) {
|
|
|
|
|
|
if (mainfistList.length() > 0) {
|
|
|
String[] list = mainfistList.replace(",", ",").split(",");
|
|
|
if(vmList.size()>list.length) {
|
|
|
if (vmList.size() > list.length) {
|
|
|
for (int j = 0; j < vmList.size(); j++) {
|
|
|
for (int i = 0; i < list.length; i++) {
|
|
|
if(vmList.get(j).getMainifist() != list[i]) {
|
|
|
if (vmList.get(j).getMainifist() != list[i]) {
|
|
|
veMainService.deleteEntry(vmList.get(j));
|
|
|
}
|
|
|
VehicleMainifist vm = veMainService.selectByVm(id,list[i]);
|
|
|
if(vm==null) {
|
|
|
VehicleMainifist vm = veMainService.selectByVm(id, list[i]);
|
|
|
if (vm == null) {
|
|
|
VehicleMainifist vehicleMainifist = new VehicleMainifist();
|
|
|
vehicleMainifist.setBusinessId(id);
|
|
|
vehicleMainifist.setBusinessNum(frameNo);
|
...
|
...
|
@@ -431,6 +588,5 @@ public class LandBusinesstypeListController extends BaseController { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|