Пример #1
0
    string OutputToPDF(string cmd)
    {
        logger.Debug("OutputToPDF begin");
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        string docCattp = Session["DOC"].ToString().Trim();
        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            xmlCreator = new BoxLabelXmlCreator();
            //xmlCreator = new BoxLabelShipmentXmlCreator();
            //xmlCreator.LoadData(txtInternalID.Text.Trim());
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA"))
        {
            xmlCreator = new PalletAXmlCreator();
            //xmlCreator = new PalletAShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
            //xmlCreator = new PalletBXmlCreator();
            xmlCreator = new PalletBShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
             //xmlCreator = new PackListXmlCreator();
            xmlCreator = new PackListShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + docCattp.ToString().Trim());
         //   xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
            /////xmlCreator = new WayBillXmlCreator();
            //xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_HouseWaybills"))
        {
            xmlCreator = new HouseWaybillsXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
//---------------------add by lck------------------------------------------------
        else if (sessionDoc.StartsWith("Schema_Master_Waybill"))
        {
            xmlCreator = new MasterWaybillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + "xxxxx");
        }
//---------------------------------------------------------------------

        string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml";
        //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml");
        xmlCreator.WriteXml(docName, useOuter);

        /*
        string fopPath = ConfigurationManager.AppSettings["FOPPath"];
        FOPWrap.FOP.GeneratePDF(
            fopPath,
            docName,
            Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()),
            ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString()+".pdf");
            //Server.MapPath(@"~\Output\" + docGuid.ToString() + ".pdf"));
            //return @"~\Output\" + docGuid.ToString() + ".pdf";
        */

        /*
        string[] args = new string[] {
            // setup config file
            "-c", fopCfgXml,
            "-xml", docName,
            "-xsl", Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()),
            "-pdf", ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString()+".pdf" }; 
        InvokeFOP(args);
        */

        logger.Debug("OutputToPDF InvokeFOP begin xslFile=" + Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()) + " , xmlFile=" + docName + " , pdfFile=" + ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".pdf");
        using (localhost.EDITS c = new localhost.EDITS())
        {
            string errmsg = "";
            bool result = c.GenPDF(Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()), docName, ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".pdf", ref errmsg);
        }
        logger.Debug("OutputToPDF InvokeFOP end");
        logger.Debug("OutputToPDF end");

         if (cmd=="ViewPDF")
               return ConfigurationManager.AppSettings["FileSite"]  + docGuid.ToString() + ".pdf";
         else 
               return ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() +".pdf";
        
        
    }
Пример #2
0
    protected void btnViewXML_Click(object sender, EventArgs e)
    {
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        string docCattp = Session["DOC"].ToString().Trim();
        logger.Info("sessionDoc= " + sessionDoc);
        logger.Info("docCattp= " + docCattp);
        logger.Info("lblselect= " + lblselect.Text);
        logger.Info("txtInternalID= " + txtInternalID.Text);

        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            xmlCreator = new BoxLabelXmlCreator();
            //xmlCreator =new BoxLabelShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
            //xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA")) 
        {

          // xmlCreator = new PalletAXmlCreator();
            xmlCreator = new PalletAShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
           //xmlCreator = new PalletBXmlCreator();
           
           xmlCreator = new PalletBShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
            //useOuter = true;
            //xmlCreator = new PackListXmlCreator();
            xmlCreator = new PackListShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + docCattp.ToString().Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
           //-- xmlCreator = new WayBillXmlCreator();
            //xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_HouseWaybills"))
        {
            xmlCreator = new HouseWaybillsXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
//---------------------add by lck------------------------------------------------
        else if (sessionDoc.StartsWith("Schema_Master_Waybill"))
        {
            xmlCreator = new MasterWaybillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + "xxxxx");
        }
//---------------------------------------------------------------------
       /*if (!sessionDoc.StartsWith("Pallet Ship Label"))
        {
            string docType = Session["DOC"].ToString().Split("-".ToCharArray())[0];
            switch (docType)
            {
                case "Box Ship Label":
                    xmlCreator = new BoxLabelXmlCreator();
                    break;
                case "Pack List":
                    useOuter = false;
                    xmlCreator = new PackListXmlCreator();                                       
                    break;
                case "Waybill":
                    xmlCreator = new WayBillXmlCreator();
                    break;
            }
        }
        else
        {
            if (sessionDoc == "Pallet Ship Label- Pack ID Single")
            {
                xmlCreator = new PalletAXmlCreator();
            }
            else
            {
                xmlCreator = new PalletBXmlCreator();
            }
        }*/
        //xmlCreator.LoadData(txtInternalID.Text.Trim());
        string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml";
        //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml");
        xmlCreator.WriteXml(docName, useOuter);

        string url = ConfigurationManager.AppSettings["FileSite"] +  docGuid.ToString() + ".xml";
        //Response.Redirect(@"~\Output\" + docGuid.ToString() + ".xml");
        OpenWindows(url,"XML");
    }
Пример #3
0
    string OutputToPDF(string cmd)
    {
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        string docCattp = Session["DOC"].ToString().Trim();
        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            xmlCreator = new BoxLabelXmlCreator();
            //xmlCreator = new BoxLabelShipmentXmlCreator();
            //xmlCreator.LoadData(txtInternalID.Text.Trim());
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeA"))
        {
            xmlCreator = new PalletAXmlCreator();
            //xmlCreator = new PalletAShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
            //xmlCreator = new PalletBXmlCreator();
            xmlCreator = new PalletBShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
             //xmlCreator = new PackListXmlCreator();
            xmlCreator = new PackListShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + docCattp.ToString().Trim());
         //   xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
            /////xmlCreator = new WayBillXmlCreator();
            //xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator = new WayBillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
//---------------------add by lck------------------------------------------------
        else if (sessionDoc.StartsWith("Schema_Master_Waybill"))
        {
            xmlCreator = new MasterWaybillShipmentXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + "xxxxx");
        }
//---------------------------------------------------------------------

        string docName = ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() + ".xml";
        //string docName = Server.MapPath(@"~\Output\" + docGuid.ToString() + ".xml");
        xmlCreator.WriteXml(docName, useOuter);

        string fopPath = ConfigurationManager.AppSettings["FOPPath"];
        FOPWrap.FOP.GeneratePDF(
            fopPath,
            docName,
            Server.MapPath(@"~\XSL\" + Session["XSL"].ToString()),
            ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString()+".pdf");
            //Server.MapPath(@"~\Output\" + docGuid.ToString() + ".pdf"));
            //return @"~\Output\" + docGuid.ToString() + ".pdf";
         if (cmd=="ViewPDF")
               return ConfigurationManager.AppSettings["FileSite"]  + docGuid.ToString() + ".pdf";
         else 
               return ConfigurationManager.AppSettings["FilePath"] + @"\" + docGuid.ToString() +".pdf";
        
        
    }
Пример #4
0
    public string MasterWaybillList(string FilePH, string Dn)
    {
        MasterWaybillShipmentXmlCreator xmlCreator = null;
        xmlCreator = new MasterWaybillShipmentXmlCreator();
        string res = null;
        try
        {
            xmlCreator.LoadData(Dn.ToString().Trim() + @"/" + "");
            xmlCreator.WriteXml(FilePH, true);
            res = Dn;
        }
        catch (Exception err)
        {
            res = err.Message.ToString();
        }
        return res;

    }
Пример #5
0
 public string MasterWaybillList(string FilePH, string Dn)
 {
     logger.Info("MasterWaybillList begin; FilePH=" + FilePH + " , Dn=" + Dn);
     MasterWaybillShipmentXmlCreator xmlCreator = null;
     xmlCreator = new MasterWaybillShipmentXmlCreator();
     string res = null;
     try
     {
         ChkAndCreatePath(FilePH);
         xmlCreator.LoadData(Dn.ToString().Trim() + @"/" + "");
         xmlCreator.WriteXml(FilePH, true);
         res = Dn;
     }
     catch (Exception err)
     {
         res = RecordError("MasterWaybillList", ref err);
     }
     finally
     {
         logger.Info("MasterWaybillList end");
     }
     return res;
 }