Package ek.aacs.uldscan

Examples of ek.aacs.uldscan.ULDSCANNINGDETAILS


          // clear
          data.clear();
          // set urno of irmtab
          irmtabUrno = irmtabRef;
         
      ULDSCANNINGDETAILS _inputUldScanInfo = (ULDSCANNINGDETAILS) _um.unmarshal(new StreamSource(new StringReader(message)));
      //check if the primary data for uld scan info are empty or null
      if(HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getFLIGHTDATE())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getFLIGHTNO())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getFLIGHTAD())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getULDNUMBER())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANACTION())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANLOCATIONCODE())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANLOCATIONDESC())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANDATETIME())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANBY())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getRECORDTYPE())
          || HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getRECORDSENDDATE())){
       
        LOG.error(" Compulsory uld scan info are empty. Message dropped. ");
        addExptInfo(EnumExceptionCodes.EMAND.name(), "");
        return false;
      }
      //ignore if it's not EK flight
      if(_inputUldScanInfo.getFLIGHTNO().contains("EK")){
        String flno = null;
        String flDate = null;
        String idUld = null;
        EntDbAfttab entFlight = null;
        BigDecimal urno = null;
        //convert the string for flight "EK" to ufis ceda flight num format
        flno = _inputUldScanInfo.getFLIGHTNO().substring(0, 2) + " " +
            HpUfisUtils.formatCedaFltn(_inputUldScanInfo.getFLIGHTNO().substring(2, _inputUldScanInfo.getFLIGHTNO().length()));
        flDate = convertFlDateToUTC(_inputUldScanInfo.getFLIGHTDATE());
        //get the flight urno for arrival
        if("A".equals(_inputUldScanInfo.getFLIGHTAD()))
          entFlight = afttabBean.findUrnoForArr(flno, flDate);

        //get the flight urno for dept
        else if("D".equals(_inputUldScanInfo.getFLIGHTAD()))
          entFlight = afttabBean.findUrnoForDept(flno, flDate);
       
        if(entFlight == null){
          LOG.error("Message dropped..");
          addExptInfo(EnumExceptionCodes.ENOFL.name(), flno);
          return false;
        }
        urno = entFlight.getUrno();
        String uldNumber = _inputUldScanInfo.getULDNUMBER().trim();
        EntDbLoadUld entUld = _dlLoadUldBean.getUldNum(urno, uldNumber);
        idUld = (entUld == null) ? "0" : entUld.getId();
       
        boolean flag = false;
        String cmdForBroadcasting =  null;
        EntDbLoadUldMove loadUldMove = null;
        EntDbLoadUldMove oldLoadUldMove = null;
       
        if("UNDO".equals(_inputUldScanInfo.getRECORDTYPE())){
          loadUldMove = _dlLoadUldMoveBean.getUldMoveByIdFlightUldNum(urno, uldNumber);
          flag = true;
        }
        if(loadUldMove == null){//null? create a new record
          if(flag){
            LOG.error(" ULD record does not exist to UNDO.  Message dropped.");
            addExptInfo(EnumExceptionCodes.ENOUD.name(), uldNumber);
            return false;
          }
          loadUldMove = new EntDbLoadUldMove();
          oldLoadUldMove = loadUldMove;
          loadUldMove.setFltDate(new HpUfisCalendar(flDate).getTime());
          loadUldMove.setUldFltno(flno);
          loadUldMove.setUldNumber(_inputUldScanInfo.getULDNUMBER());
          loadUldMove.setCreatedUser(_inputUldScanInfo.getSCANBY());
          loadUldMove.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.IRT.toString();
        }
        else{
          oldLoadUldMove = new EntDbLoadUldMove(loadUldMove);
          loadUldMove.setUpdatedUser(_inputUldScanInfo.getSCANBY());
          loadUldMove.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.URT.toString();
        }
        loadUldMove.setIdFlight(urno);
        loadUldMove.setIdLoadUlds(idUld);
        List<EntDbMdUldLoc> uldLocList = _BasicDataSingleton.getUldLocList();
        List<EntDbMdUldScanAct> uldScanActList = _BasicDataSingleton.getUldScanActList();
       
        boolean isFound = false;
        for(int i = 0; i < uldLocList.size(); i++){
          if(uldLocList.get(i).getUldPlaceLoc().trim().equals(_inputUldScanInfo.getSCANLOCATIONCODE().trim())){
            loadUldMove.setIdScanMdUldLoc(uldLocList.get(i).getId());
            isFound = true;
          }
          //if(!HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANDISLOCCODE())){ // only when the value is exist, check against the md value
            if(uldLocList.get(i).getUldPlaceLoc().trim().equals(_inputUldScanInfo.getSCANDISLOCCODE().trim())){
              loadUldMove.setIdDispMdUldLoc(uldLocList.get(i).getId());
              isFound = true;
            }
          //}
        }
        if (!isFound) {
          addExptInfo(EnumExceptionCodes.WNOMD.name(), String.format("SCAN_LOCATION_CODE/SCAN_DIS_LOC_CODE => %s/%s", _inputUldScanInfo.getSCANLOCATIONCODE().trim(),_inputUldScanInfo.getSCANDISLOCCODE().trim()));
          LOG.warn("Master Data scanLoc/scanDisLoc code is not match in MdUldLoc.");
        }
       
        isFound = false;
        for(int i = 0; i < uldScanActList.size(); i++){
          if(uldScanActList.get(i).getUldScanAction().trim().equals(_inputUldScanInfo.getSCANACTION().trim())){
            loadUldMove.setIdMdUldScanAct(uldScanActList.get(i).getId());
            isFound = true;
            break;
          }
        }
        if (!isFound) {
          addExptInfo(EnumExceptionCodes.WNOMD.name(), String.format("SCAN_ACTION => %s", _inputUldScanInfo.getSCANACTION().trim()));
          LOG.warn("Master Data uldScanAction is not match in MdUldScanAct.");
        }
       
        String status = " ";
        if("UNDO".equals(_inputUldScanInfo.getRECORDTYPE())){
          status = "X";
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.DRT.toString();
        }
        loadUldMove.setRecFlag(status);
        loadUldMove.setArrDepFlag(_inputUldScanInfo.getFLIGHTAD());
        loadUldMove.setScanAction(_inputUldScanInfo.getSCANACTION());
        loadUldMove.setScanLocCode(_inputUldScanInfo.getSCANLOCATIONCODE());
        loadUldMove.setScanLocDesc(_inputUldScanInfo.getSCANLOCATIONDESC());
        if(!HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getSCANDATETIME()))
            loadUldMove.setScanDate(new HpUfisCalendar(convertFlDateToUTC(_inputUldScanInfo.getSCANDATETIME())).getTime());
        loadUldMove.setScanUser(_inputUldScanInfo.getSCANBY());
        loadUldMove.setDataSource(HpEKConstants.ULD_SOURCE);
        loadUldMove.setDispLocCode(_inputUldScanInfo.getSCANDISLOCCODE());
        loadUldMove.setDispLocDesc(_inputUldScanInfo.getSCANDISLOCDESC());
       
        if(!HpUfisUtils.isNullOrEmptyStr(_inputUldScanInfo.getRECORDSENDDATE()))
          loadUldMove.setUldSentDate(new HpUfisCalendar(convertFlDateToUTC(_inputUldScanInfo.getRECORDSENDDATE())).getTime());
        EntDbLoadUldMove uldMove = _dlLoadUldMoveBean.merge(loadUldMove);
        if(uldMove != null){
          sendNotifyUldMoveInJson(uldMove, oldLoadUldMove, cmdForBroadcasting);
        }
      }
      else {
        LOG.error("Processing performs only for EK flight. Message dropped.");
        addExptInfo(EnumExceptionCodes.EWALC.name(), _inputUldScanInfo.getFLIGHTNO());
        return false;
      }
    } catch (JAXBException e) {
      LOG.error("JAXBContext when unmarshalling... {}", e.getMessage());
      addExptInfo(EnumExceptionCodes.EXSDF.name(), "");
View Full Code Here

TOP

Related Classes of ek.aacs.uldscan.ULDSCANNINGDETAILS

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.