⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preadvicepagehelper.java

📁 according to pre-advice different group criteria to show Pre-advice page group show.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		}
	}

	private void fillRouteInfo(DataPacket dpOut) throws Exception {
		// List routeList = advice.getPreAdviceRoute();
		int i = 0;

		List porList = new ArrayList();
		List fndList = new ArrayList();
		for (Iterator it = advice.getAbstractSO().iterator(); it.hasNext();) {
			AbstractSO so = (AbstractSO) it.next();
			String por = so.getPor().getDisplayName() + ";" + DateHelper.formatDateToString(so.getPorETD());
			String fnd = so.getFnd().getDisplayName() + ";" + DateHelper.formatDateToString(so.getFNDETA());
			if (!porList.contains(por)) {
				porList.add(por);
			}
			if (!fndList.contains(fnd)) {
				fndList.add(fnd);
			}
		}

		// if multi-fnd, fnd group will be displayed.
		showFND = fndList.size() > 1;

		StringBuffer porText = new StringBuffer();
		StringBuffer fndText = new StringBuffer();
		for (Iterator it = porList.iterator(); it.hasNext();) {
			porText.append(it.next()).append(it.hasNext() ? ";" : "");
		}

		for (Iterator it = fndList.iterator(); it.hasNext();) {
			fndText.append(it.next()).append(it.hasNext() ? ";" : "");
		}

		// fill global por, fnd for empty grouping route;
		dpOut.putNodeString("por", porText.toString());
		dpOut.putNodeString("fnd", fndText.toString());

		for (Iterator it = advice.getPreAdviceRoute().iterator(); it.hasNext();) {
			PreAdviceRoute route = (PreAdviceRoute) it.next();

			// if (route.getIsGroupingRoute().booleanValue() &&
			// route.getRouteLegs().size() == 0)
			// continue;

			String routePrefix = "route_list[" + i + "]";

			dpOut.putNodeString(routePrefix + ".oid", value2String(route.getOid()));
			if (route.getIsGroupingRoute().booleanValue()) {
				dpOut.putNodeString(routePrefix + ".isfixed", "true");
			} else {
				dpOut.putNodeString(routePrefix + ".isfixed", "false");
			}

			if (route.getIsProposed().booleanValue()) {
				dpOut.putNodeString("proposed_route_no", Integer.toString(i));
			}

			dpOut.putNodeString(routePrefix + ".iscreatebycustomer", value2String(route.getIsCreateByCustomer()));
			dpOut.putNodeString(routePrefix + ".isdeleted", "false");
			dpOut.putNodeString(routePrefix + ".isproposed", route.getIsProposed() == null || !route.getIsProposed().booleanValue() ? "false" : "true");
			if (route.getRouteLegs() != null && route.getRouteLegs().size() != 0) {
				fillRouteVesselVoyageInfo(dpOut, routePrefix, route, porText.toString(), fndText.toString());
			} else {
				String voyagePrefix = routePrefix + ".shipmentadviceroutevoyage_list[" + 0 + "]";
				String noPlannedVsl = "No Planned Vessel";
				dpOut.putNodeString(voyagePrefix + ".voyagetext", noPlannedVsl);
				dpOut.putNodeString("show_feeder", "false");
				dpOut.putNodeString(voyagePrefix + ".voyagetype", "");
				for (int j = 0; j < porList.size(); j++) {
					String porStr = (String) porList.get(j);
					dpOut.putNodeString(voyagePrefix + ".portext", porStr);
				}
				Date date = advice.getEtd();
				dpOut.putNodeString(voyagePrefix + ".poltext", value2String(advice.getPol().getName()) + ";" + (date == null ? "" : DateHelper.formatDateToString(date)));
				date = advice.getEta();
				dpOut.putNodeString(voyagePrefix + ".podtext", value2String(advice.getPod().getName()) + ";" + (date == null ? "" : DateHelper.formatDateToString(date)));
				for (int j = 0; j < fndList.size(); j++) {
					String fndStr = (String) fndList.get(j);
					dpOut.putNodeString(voyagePrefix + ".fndtext", fndStr);
				}
			}

			i++;
		}

		// other recomendation route
		/*
		 * List routeRepository =
		 * getGeneratePreAdviceService().getOtherSuggestedRoutes(advice); for
		 * (int j = i; j < i + routeRepository.size(); i++) { String routePrefix =
		 * "route_list[" + j + "]"; PreAdviceRoute route = (PreAdviceRoute)
		 * routeRepository.get(j);
		 * 
		 * dpOut.putNodeString(routePrefix + ".oid",
		 * value2String(route.getOid())); dpOut.putNodeString(routePrefix +
		 * ".isfixed", "false");
		 * 
		 * dpOut.putNodeString(routePrefix + ".iscreatebycustomer",
		 * value2String(route.getIsCreateByCustomer()));
		 * dpOut.putNodeString(routePrefix + ".isdeleted", "true");
		 * dpOut.putNodeString(routePrefix + ".isproposed", "false");
		 * 
		 * fillRouteVesselVoyageInfo(dpOut, routePrefix, route,
		 * porText.toString(), fndText.toString()); }
		 */
	}

	private void fillRouteVesselVoyageInfo(DataPacket dpOut, String routePrefix, PreAdviceRoute route, String porText, String fndText) throws Exception {
		// if route has feeder only, will ignore the show feeder rule.
		boolean allFeeder = true;
		for (Iterator it = route.getPreAdviceRouteLeg().iterator(); allFeeder && it.hasNext();) {
			PreAdviceRouteLeg voyage = (PreAdviceRouteLeg) it.next();
			allFeeder = allFeeder && TransportScheduleConstant.TYPE_FEEDER.equals(voyage.getVoyageType());
		}

		boolean showFeeder = allFeeder || advice.getReqShowFeederVSL().booleanValue();
		dpOut.putNodeString("show_feeder", showFeeder ? "true" : "false");
		int i = 0;
		for (Iterator it = route.getPreAdviceRouteLeg().iterator(); it.hasNext();) {
			PreAdviceRouteLeg voyage = (PreAdviceRouteLeg) it.next();
			// if (!showFeeder &&
			// TransportScheduleConstant.TYPE_FEEDER.equals(voyage.getVoyageType()))
			// {
			// continue;
			// }

			String voyagePrefix = routePrefix + ".shipmentadviceroutevoyage_list[" + i + "]";

			Date date;
			dpOut.putNodeString(voyagePrefix + ".voyageseq", value2String(voyage.getVoyageSequence()));
			dpOut.putNodeString(voyagePrefix + ".voyagetype", value2String(voyage.getVoyageType()));
			dpOut.putNodeString(voyagePrefix + ".fw_carrier", value2String(voyage.getCarrierText()));
			dpOut.putNodeString(voyagePrefix + ".voyagetext", value2String(voyage.getVoyageText()));
			dpOut.putNodeString(voyagePrefix + ".portext", i == 0 ? porText : "");
			date = voyage.getEtd();
			dpOut.putNodeString(voyagePrefix + ".poltext", value2String(voyage.getPolText()) + ";" + (date == null ? "" : DateHelper.formatDateToString(date)));
			date = voyage.getEta();
			dpOut.putNodeString(voyagePrefix + ".podtext", value2String(voyage.getPodText()) + ";" + (date == null ? "" : DateHelper.formatDateToString(date)));
			dpOut.putNodeString(voyagePrefix + ".fndtext", "");
			if (voyage.getTransportSchedule() != null) {
				dpOut.putNodeString(voyagePrefix + ".schedule_oid", voyage.getTransportSchedule().getOid().toString());
			}
			if (voyage.getPol() != null && voyage.getPod() != null) {
				dpOut.putNodeString(voyagePrefix + ".pol_stop_oid", voyage.getPol().getOid().toString());
				dpOut.putNodeString(voyagePrefix + ".pod_stop_oid", voyage.getPod().getOid().toString());
			}
			TransportScheduleStop fromStop = null;
			//TransportScheduleStop toStop = null;
			//PreAdviceRouteLeg firstPreRouteLeg = (PreAdviceRouteLeg)route.getPreAdviceRouteLeg().get(0);
			if (voyage.getTransportSchedule() != null && voyage.getFromStop() != null 
					&& voyage.getTransportSchedule().getTheTransportScheduleStop() != null && voyage.getTransportSchedule().getTheTransportScheduleStop().size() > 0) {
				for (int j = 0; j < voyage.getTransportSchedule().getTheTransportScheduleStop().size(); j++) {
					TransportScheduleStop stop = (TransportScheduleStop)voyage.getTransportSchedule().getTheTransportScheduleStop().get(j);
					if (stop.getOid().equals(voyage.getFromStop().getOid())) {
						fromStop = stop;
					}
					//if (stop.getOid().equals(firstPreRouteLeg.getToStop().getOid())) {
					//	toStop = stop;
					//}
				}
				dpOut.putNodeString(voyagePrefix + ".cy_closing_date", fromStop != null ? DateHelper.formatDateToString(fromStop.getCyCutoff()) : "");
				
				String cutoffDate = "";
				TradeService ts = new TradeServiceImpl(sessionContext.getSessionContextDataSource());
				Trade trade = ts.calculateTrade(advice.getPol(), advice.getPod());
				Date siCutoffDate = PreAdviceUtil.getSICutoffDate(trade, fromStop);
				cutoffDate = siCutoffDate != null ? DateHelper.formatDateToString(siCutoffDate) : "";
				dpOut.putNodeString(voyagePrefix + ".si_cutoff_date", cutoffDate);
				
			} else {
				dpOut.putNodeString(voyagePrefix + ".cy_closing_date", "");
				dpOut.putNodeString(voyagePrefix + ".si_cutoff_date", "");
			}
			
			
			// StringBuffer siCutOffDates = new StringBuffer();
			// if (voyage.getTransportSchedule() != null &&
			// voyage.getTransportSchedule().getFirstTransportScheduleStop() !=
			// null) {
			// List cutOffs =
			// voyage.getTransportSchedule().getFirstTransportScheduleStop().getTheTransportScheduleStopCutOff();
			// for (int j = 0; j < cutOffs.size(); j++) {
			// TransportScheduleStopCutOff tssCutOff =
			// (TransportScheduleStopCutOff)cutOffs.get(j);
			// if ("S".equals(tssCutOff.getCutOffType())) {
			// siCutOffDates.append(DateHelper.formatDateToString(tssCutOff.getCutOff())).append("
			// ");
			// }
			// }
			// }
			
			i++;
		}
		if (i > 0) {
			i--;
			String voyagePrefix = routePrefix + ".shipmentadviceroutevoyage_list[" + i + "]";
			dpOut.putNodeString(voyagePrefix + ".fndtext", fndText);
		}
	}

	private double[] fillSOGroupInfo(List customizedFields, DataPacket dpOut, List soList1, String parentIndex) throws Exception {
		// summary
		long soNoOfPack = 0;
		long soUnits = 0;
		double soVol = 0;
		double soGwt = 0;

		String[] soReturn = addNode(dpOut, PreAdvicePageConstants.NODE_TYPE_SO, parentIndex);
		dpOut.putNodeString(soReturn[1] + ".from_stuffing", "false");
		// int j = 0;
		for (int i1 = 0; i1 < soList1.size(); i1++) {
			AbstractSO so = (AbstractSO) soList1.get(i1);
			// if
			// ((BusinessTypeOidConstants.CRD).equals(so.getBizType().getOid()))
			// {
			String soPrefix = soReturn[1] + ".so_list[" + i1 + "]";
			// String soPrefix = fillSOInformation(dpOut, soReturn[1], i1, so);
			dpOut.putNodeString(soPrefix + ".oid", so.getOid().toString());
			dpOut.putNodeString(soPrefix + ".so_num", so.getSoNumber());
			dpOut.putNodeString(soPrefix + ".so_biz_type", so.getBizType().getAbbreviation());
			dpOut.putNodeString(soPrefix + ".customer", so.getCustomer().getCompanyCode());
			dpOut.putNodeString(soPrefix + ".last_stamp", Long.toString(so.getLastUpdatedTi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -