try {
// ================================================
// LoadSummary update (Class-configuration)
// ================================================
// current time
HpUfisCalendar ufisCal = new HpUfisCalendar(new Date());
ufisCal.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
// 2013-07-10 update JGO move load info to new table<LOAD_PAX_SUMMARY>
// LoadSummaryPK key = new LoadSummaryPK();
// key.setIntFlId(new BigDecimal(flightData.getMflId()));
// key.setInfoId(LOAD_INFOID);
// key.setAirlineCode(" ");
// key.setFlightNumber(" ");
// key.setFlightNumberSuffix(" ");
// key.setScheduledFlightDateTime(ufisCal.getTime());
// EntDbLoadSummary load = _loadSummaryBean.getLoadSummaryByPkey(key);
// if (load == null) {
// load = new EntDbLoadSummary();
// load.setlPk(key);
// load.setIntSystem(INTSYSTEM_MACS_FLT);
// load.set_idHopo(HpEKConstants.HOPO);
// load.set_createdDate(ufisCal.getTime());
// load.set_createdUser("MACS-FLT");
// _loadSummaryBean.persist(load);
// }
EntDbLoadPaxSummary load = _loadPaxSummaryBean
.getLoadPaxSummaryByMfid(new BigDecimal(flightData.getMflId()), DATA_SOURCE);
if (load == null) {
load = new EntDbLoadPaxSummary();
load.setInterfaceFltId(new BigDecimal(flightData.getMflId()));
load.setDataSource(DATA_SOURCE);
load.setCreatedUser(MSGIF);
load.setRecStatus(" ");
_loadPaxSummaryBean.create(load);
}
// config load
load.setInfoType(LOAD_INFOID);
// 2014-01-14 updated by JGO - change to id_flight and id_conx_flight
// update afttab flight urno to load summary table
/*if (aftFlight != null) {
if ('A' == aftFlight.getAdid()) {
//load.setArrFlId(String.valueOf(aftFlight.getUrno()));
load.setIdArrFlight(aftFlight.getUrno());
} else if ('D' == aftFlight.getAdid()) {
//load.setDepFlId(String.valueOf(aftFlight.getUrno()));
load.setIdDepFlight(aftFlight.getUrno());
}
}*/
load.setIdFlight(aftFlight.getUrno());
load.setIdConxFlight(BigDecimal.ZERO);
// update class configuration
String classConfig = flightData.getClassConfiguration();
if (HpUfisUtils.isNotEmptyStr(classConfig)) {
int indexF = classConfig.indexOf(CLASS_INDICATOR_FST);
int indexJ = classConfig.indexOf(CLASS_INDICATOR_BUS);
int indexY = classConfig.indexOf(CLASS_INDICATOR_ECO);
String figure = "";
// first
if (indexF != -1 && indexJ != -1 && (indexJ - indexF) > 0) {
figure = classConfig.substring(indexF + 1, indexJ);
//load.setFirstClass(Integer.parseInt(figure));
load.setFirstPax(new BigDecimal(figure));
}
// business
if (indexJ != -1 && indexY != -1 && (indexY - indexJ) > 0) {
figure = classConfig.substring(indexJ + 1, indexY);
//load.setBusinessClass(Integer.parseInt(figure));
load.setBusinessPax(new BigDecimal(figure));
}
// economy
if (indexY != -1) {
figure = classConfig.substring(indexY + 1);
//load.setEconomyClass(Integer.parseInt(figure));
load.setEconPax(new BigDecimal(figure));
// 2014-01-15 updated by JGO - save the value to all_econ_pax field as well
load.setAllEconPax(load.getEconPax());
}
// 2013-12-16 updated by JGO - Sum the total_pax for CFG
load.setTotalPax(load.getFirstPax().add(load.getBusinessPax()).add(load.getEconPax()));
}
load.setUpdatedDate(ufisCal.getTime());
//load.setDataSource(INTSYSTEM_MACS_FLT);
load.setDataSource(DATA_SOURCE);
load.setUpdatedUser(MSGIF);
load.setRecStatus(" ");
_loadPaxSummaryBean.edit(load);