Package com.commander4j.messages

Examples of com.commander4j.messages.IncommingProcessOrderStatusChange


    {
      JDBInterfaceLog il = new JDBInterfaceLog(getHostID(), getSessionID());
      JeMail mail = new JeMail(getHostID(), getSessionID());
      JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
      IncommingMaterialDefinition imd = new IncommingMaterialDefinition(getHostID(), getSessionID());
      IncommingProcessOrderStatusChange iposc = new IncommingProcessOrderStatusChange(getHostID(), getSessionID());
      IncommingProductionDeclarationConfirmation ipd = new IncommingProductionDeclarationConfirmation(getHostID(), getSessionID());
      IncommingProcessOrder ipo = new IncommingProcessOrder(getHostID(), getSessionID());
      IncommingPalletStatusChange ipsc = new IncommingPalletStatusChange(getHostID(), getSessionID());
      IncommingBatchStatusChange bsc = new IncommingBatchStatusChange(getHostID(), getSessionID());
      IncommingInspectionResult iirslt = new IncommingInspectionResult(getHostID(), getSessionID());
      IncommingDespatchConfirmation idc = new IncommingDespatchConfirmation(getHostID(), getSessionID());
      IncommingQMInspectionRequest iireq = new IncommingQMInspectionRequest(getHostID(), getSessionID());
      GenericMessageHeader gmh = new GenericMessageHeader();
      LinkedList<String> filenames = new LinkedList<String>();
      BasicFileAttributes attrs;
     
      while (true)
      {

        com.commander4j.util.JWait.milliSec(100);

        if (allDone)
        {
          if (dbconnected)
          {
            Common.hostList.getHost(hostID).disconnect(getSessionID());
          }
          return;
        }

        if (InboundMessageCollectionThread.recoveringFiles == false)
        {

          dir = new File(inputPath);

          chld = dir.listFiles((FileFilter) FileFileFilter.FILE);

          if (chld == null)
          {
            allDone = true;
          } else
          {
            Arrays.sort(chld, LastModifiedFileComparator.LASTMODIFIED_COMPARATOR);
            filenames.clear();

            for (int i = 0; (i < chld.length) & (i < maxfiles); i++)
            {
              fileName = chld[i].getName();
              try
              {
                attrs = Files.readAttributes(chld[i].getAbsoluteFile().toPath(), BasicFileAttributes.class);

                if (attrs.size() > 0)
                {
                  if (fileName.indexOf(".xml") > 0)
                  {
                    filenames.addFirst(fileName);
                    com.commander4j.util.JWait.milliSec(50);
                  }
                } else
                {
                  try
                  {
                    chld[i].delete();
                  }
                  catch (Exception ex)
                  {
                   
                  }
                }
              } catch (IOException e)
              {

              }

            }

            if (filenames.size() > 0)
            {
              logger.debug("Begin processing " + String.valueOf(filenames.size()) + " files.");
              for (int i = filenames.size() - 1; i >= 0; i--)
              {
                if (allDone)
                {
                  if (dbconnected)
                  {
                    Common.hostList.getHost(hostID).disconnect(getSessionID());
                  }
                  return;
                }

                fromFile = filenames.get(i);

                try
                {
                  logger.debug("<---  START OF PROCESSING " + fromFile + "  ---->");
                  logger.debug("Reading message header : " + inputPath + fromFile);

                  if (gmh.readAddressInfo(inputPath + fromFile, getSessionID()) == true)
                  {

                    messageProcessedOK = true;
                    errorMessage = "";

                    if (gmh.getInterfaceType().length() == 0)
                    {
                      messageProcessedOK = false;
                      errorMessage = "Unrecognised Commander4j XML message format in file " + fromFile;
                      logger.debug(errorMessage);
                      String datetime = "";
                      datetime = JUtility.getISOTimeStampStringFormat(JUtility.getSQLDateTime());
                      gmh.setMessageDate(datetime);
                      gmh.setInterfaceDirection("Unknown");
                      gmh.setMessageInformation(fromFile);
                      gmh.setInterfaceType("Unknown");
                      gmh.setMessageRef("Unknown");
                    } else
                    {
                      if (gmh.getInterfaceDirection().equals("Input") == false)
                      {
                        messageProcessedOK = false;
                        errorMessage = "Inbound message ignored - Interface Direction = " + gmh.getInterfaceDirection();
                      } else
                      {
                        String interfaceType = gmh.getInterfaceType();
                        logger.debug("Processing " + interfaceType + " started.");
                        if (interfaceType.equals("Despatch Confirmation") == true)
                        {
                          messageProcessedOK = idc.processMessage(gmh);
                          errorMessage = idc.getErrorMessage();
                        }

                        if (interfaceType.equals("Material Definition") == true)
                        {
                          messageProcessedOK = imd.processMessage(gmh);
                          errorMessage = imd.getErrorMessage();
                        }

                        if (interfaceType.equals("Process Order") == true)
                        {
                          messageProcessedOK = ipo.processMessage(gmh);
                          errorMessage = ipo.getErrorMessage();
                        }

                        if (interfaceType.equals("Pallet Status Change") == true)
                        {
                          messageProcessedOK = ipsc.processMessage(gmh);
                          errorMessage = ipsc.getErrorMessage();
                        }

                        if (interfaceType.equals("Batch Status Change") == true)
                        {
                          messageProcessedOK = bsc.processMessage(gmh);
                          errorMessage = bsc.getErrorMessage();
                        }

                        if (interfaceType.equals("Process Order Status Change") == true)
                        {
                          messageProcessedOK = iposc.processMessage(gmh);
                          errorMessage = iposc.getErrorMessage();
                        }

                        if (interfaceType.equals("Production Declaration") == true)
                        {
                          messageProcessedOK = ipd.processMessage(gmh);
View Full Code Here


    {
      JDBInterfaceLog il = new JDBInterfaceLog(getHostID(), getSessionID());
      JeMail mail = new JeMail(getHostID(), getSessionID());
      JDBInterface inter = new JDBInterface(getHostID(), getSessionID());
      IncommingMaterialDefinition imd = new IncommingMaterialDefinition(getHostID(), getSessionID());
      IncommingProcessOrderStatusChange iposc = new IncommingProcessOrderStatusChange(getHostID(), getSessionID());
      IncommingProductionDeclarationConfirmation ipd = new IncommingProductionDeclarationConfirmation(getHostID(), getSessionID());
      IncommingProcessOrder ipo = new IncommingProcessOrder(getHostID(), getSessionID());
      IncommingPalletStatusChange ipsc = new IncommingPalletStatusChange(getHostID(), getSessionID());
      IncommingBatchStatusChange bsc = new IncommingBatchStatusChange(getHostID(), getSessionID());
      IncommingInspectionResult iirslt = new IncommingInspectionResult(getHostID(), getSessionID());
      IncommingDespatchConfirmation idc = new IncommingDespatchConfirmation(getHostID(), getSessionID());
      IncommingQMInspectionRequest iireq = new IncommingQMInspectionRequest(getHostID(), getSessionID());
      GenericMessageHeader gmh = new GenericMessageHeader();
      LinkedList<String> filenames = new LinkedList<String>();

      while (true)
      {

        com.commander4j.util.JWait.milliSec(100);

        if (allDone)
        {
          if (dbconnected)
          {
            Common.hostList.getHost(hostID).disconnect(getSessionID());
          }
          return;
        }

        if (InboundMessageCollectionThread.recoveringFiles == false)
        {

          dir = new File(inputPath);
          chld = dir.list();

          if (chld == null)
          {
            allDone = true;
          }
          else
          {
            filenames.clear();
            for (int i = 0; (i < chld.length) & (i < maxfiles); i++)
            {
              fileName = chld[i];
              if (fileName.indexOf(".xml") > 0)
              {
                filenames.addFirst(fileName);
                com.commander4j.util.JWait.milliSec(50);
              }
            }

            if (filenames.size() > 0)
            {
              logger.debug("Begin processing " + String.valueOf(filenames.size()) + " files.");
              for (int i = filenames.size() - 1; i >= 0; i--)
              {
                if (allDone)
                {
                  if (dbconnected)
                  {
                    Common.hostList.getHost(hostID).disconnect(getSessionID());
                  }
                  return;
                }

                fromFile = filenames.get(i);

                try
                {
                  logger.debug("<---  START OF PROCESSING " + fromFile + "  ---->");
                  logger.debug("Reading message header : " + inputPath + fromFile);

                  if (gmh.readAddressInfo(inputPath + fromFile, getSessionID()) == true)
                  {

                    messageProcessedOK = true;
                    errorMessage = "";

                    if (gmh.getInterfaceType().length() == 0)
                    {
                      messageProcessedOK = false;
                      errorMessage = "Unrecognised Commander4j XML message format in file " + fromFile;
                      logger.debug(errorMessage);
                      String datetime = "";
                      datetime = JUtility.getISOTimeStampStringFormat(JUtility.getSQLDateTime());
                      gmh.setMessageDate(datetime);
                      gmh.setInterfaceDirection("Unknown");
                      gmh.setMessageInformation(fromFile);
                      gmh.setInterfaceType("Unknown");
                      gmh.setMessageRef("Unknown");
                    }
                    else
                    {
                      if (gmh.getInterfaceDirection().equals("Input") == false)
                      {
                        messageProcessedOK = false;
                        errorMessage = "Inbound message ignored - Interface Direction = " + gmh.getInterfaceDirection();
                      }
                      else
                      {
                        String interfaceType = gmh.getInterfaceType();
                        logger.debug("Processing " + interfaceType + " started.");
                        if (interfaceType.equals("Despatch Confirmation") == true)
                        {
                          messageProcessedOK = idc.processMessage(gmh);
                          errorMessage = idc.getErrorMessage();
                        }

                        if (interfaceType.equals("Material Definition") == true)
                        {
                          messageProcessedOK = imd.processMessage(gmh);
                          errorMessage = imd.getErrorMessage();
                        }

                        if (interfaceType.equals("Process Order") == true)
                        {
                          messageProcessedOK = ipo.processMessage(gmh);
                          errorMessage = ipo.getErrorMessage();
                        }

                        if (interfaceType.equals("Pallet Status Change") == true)
                        {
                          messageProcessedOK = ipsc.processMessage(gmh);
                          errorMessage = ipsc.getErrorMessage();
                        }

                        if (interfaceType.equals("Batch Status Change") == true)
                        {
                          messageProcessedOK = bsc.processMessage(gmh);
                          errorMessage = bsc.getErrorMessage();
                        }

                        if (interfaceType.equals("Process Order Status Change") == true)
                        {
                          messageProcessedOK = iposc.processMessage(gmh);
                          errorMessage = iposc.getErrorMessage();
                        }

                        if (interfaceType.equals("Production Declaration") == true)
                        {
                          messageProcessedOK = ipd.processMessage(gmh);
View Full Code Here

TOP

Related Classes of com.commander4j.messages.IncommingProcessOrderStatusChange

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.