예제 #1
0
파일: EDITS.cs 프로젝트: wra222/testgit
 public string PalletALabel(string FilePH, string Dn,string Pallet)
 {
     PalletAXmlCreator xmlCreator = null;
     xmlCreator = new PalletAXmlCreator();
     string res = null;
     try
     {
         xmlCreator.LoadPalletADatabaseData(Dn.ToString().Trim() + @"/" + Pallet.ToString().Trim());
         xmlCreator.WriteXml(FilePH, true);
         res = Dn;
     }
     catch (Exception err)
     {
         res = err.Message.ToString();
     }
     return res;
 }
예제 #2
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";
        
        
    }
예제 #3
0
    protected void SNVIEW_SelectedIndexChanged(object sender, EventArgs e)
    {
        XmlCreator xmlCreator = null;
        bool useOuter = true;
        string version = "";
        string Pallet_Id = SNVIEW.SelectedRow.Cells[1].Text.ToString().Trim(); //取選擇的gridview的值
        string Serial_Num = SNVIEW.SelectedRow.Cells[2].Text.ToString().Trim();
        //String value = DOCVIEW.Columns[1];
        //string doc = DOCVIEW.Rows[1];
        //Response.Write("<script type='text/javascript'>alert('"+ DOCVIEW.Rows[1] +"');</script>");
        DataConnLib con1 = new DataConnLib(ConfigurationManager.AppSettings["Database"]);//
        try
        {
            string query = "select top 1 (VERSION) from [PAK.PAKRT_Log] nolock order by CREATE_DATE desc";
            con1.SqlQueComm(query,"VERSION");
            version = con1.Ds.Tables[0].Rows[0][0].ToString().Trim(); 
        }
        catch (System.Exception err) 
        {
        
        }
        DataConnLib con = new DataConnLib(ConfigurationManager.AppSettings["Database"]);
        try 
        {
            string query = "select distinct b.DOC_CAT,b.DOC_SET_NUMBER, b.XSL_TEMPLATE_NAME, a.PO_NUM from [PAK.PAKComn] a,[PAK.PAKRT] b where a.DOC_SET_NUMBER = b.DOC_SET_NUMBER  collate Chinese_Taiwan_Stroke_90_BIN and a.InternalID = '" + BOX_DN.Text.ToString().Trim() + "'";
            con.SqlQueComm(query,"DOCTable");
            if (con.Ds.Tables.Count > 0) 
            {
                if (con.Ds.Tables[0].Rows.Count > 0)
                {
                    string dateyear = System.DateTime.Now.Year.ToString();//取當前時間的年份
                    string datemonth = System.DateTime.Now.Month.ToString().Trim();
                    if (datemonth.Length == 1)//月份是10月前的在月份前加上0
                    {
                        datemonth = "0" + datemonth;
                    }
                    string dateday = System.DateTime.Now.Day.ToString().Trim();
                    if (dateday.Length == 1)
                    {
                        dateday = "0" + dateday;
                    }
                    if (RadioButton_Step1.Checked)
                    {
                        Label_Messege.Text = "ZipFileName: Inventec_PRE_MTP_TEST_DATE_" + dateyear + datemonth + dateday + "_EDITS_REVISION_" + dateyear + version;
                    }
                    else if (RadioButton_Step2.Checked)
                    {
                        Label_Messege.Text = "ZipFileName: Inventec_MTP_TEST_DATE_" + dateyear + datemonth + dateday + "_EDITS_REVISION_" + dateyear + version;
                    }
                    else
                    {
                        Label_Messege.Text = "ZipFileName: Inventec_PROD_CHECK_DATE_" + dateyear + datemonth + dateday + "_EDITS_REVISION_" + dateyear +version;
                    }
                    #region 當選擇step1和step2時
                    if (RadioButton_Step1.Checked || RadioButton_Step2.Checked)//當step1和step2被選擇的時候
                    {
                        for (int i = 0; i < con.Ds.Tables[0].Rows.Count; i++)
                        {
                            if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Box Ship Label")
                            {
                                useOuter = true;
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                xmlCreator = new BoxLabelXmlCreator();//實例化一個xmlcreator
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/" + Serial_Num);//傳入dn和SN
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;// ConfigurationManager.AppSettings["FilePath"]取config設置的文件存放路徑再加上文件名稱;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pallet Ship Label- Pack ID Single")
                            {
                                useOuter = true;
                                //if (Pallet_Id.Substring(0,2).ToString() == "NA" || Pallet_Id.Substring(0,2).ToString() == "BA")
                                //{
                                //    continue;
                                //}
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                if (filename_XML.IndexOf("TypeA") != -1)
                                {
                                    xmlCreator = new PalletAXmlCreator();
                                }
                                else
                                {
                                    xmlCreator = new PalletBXmlCreator();
                                }
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/" + Pallet_Id); //PalletBXmlCreator();傳入數據為DN和pallet_id
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Transportation")
                            {
                                useOuter = false;
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                #region Modify by 20130312
                                // xmlCreator = new PackListXmlCreator();
                                if (con.Ds.Tables[0].Rows[i][2].ToString().Contains("Rail"))
                                {
                                    useOuter = true;
                                    xmlCreator = new MasterWaybillShipmentXmlCreator();
                                }
                                else
                                {
                                    xmlCreator = new PackListShipmentXmlCreator();
                                }
                                #endregion
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Transportation");//PackListXmlCreator()傳入參數是DN及要生成XML類型
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Shipment")
                            {
                                useOuter = false;
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                #region Modify by 20130312
                                // xmlCreator = new PackListXmlCreator();
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                if (con.Ds.Tables[0].Rows[i][2].ToString().Contains("QVC")) //add for QVC 201305
                                {
                                    xmlCreator = new PackListShipmentXmlCreator_QVC();
                                    //string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                    xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Shipment", docName_XML);

                                }
                                else
                                {
                                    if (con.Ds.Tables[0].Rows[i][2].ToString().Contains("Rail"))
                                    {
                                        useOuter = true;
                                        xmlCreator = new MasterWaybillShipmentXmlCreator();
                                    }
                                    else
                                    {
                                        xmlCreator = new PackListShipmentXmlCreator();
                                    }
                                    xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Shipment");
                                    //string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                    xmlCreator.WriteXml(docName_XML, useOuter);
                                }
                                #endregion

                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Addition")
                            {
                                useOuter = false;
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                xmlCreator = new PackListXmlCreator();
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Addition");
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Waybill- Addition")
                            {
                                useOuter = true;
                                string filename_XML = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = DropDownList_ID.Text + "_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                //xmlCreator = new WayBillXmlCreator();
                                xmlCreator = new WayBill_AdditionXMLCreat_new();
                                xmlCreator.LoadData(BOX_DN.Text.Trim());
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "POS")
                            {
                                useOuter = false;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                //xmlCreator = new WayBillShipmentXmlCreator();
                                string query_step3 = "select a.TruckID,[Date]   from HPIMES.dbo.Forwarder a,HPIMES.dbo.MAWB b where a.MAWB=b.MAWB or a.MAWB=b.HAWB and b.Delivery= '" + BOX_DN.Text.ToString().Trim() + "'";//collate Chinese_Taiwan_Stroke_90_BIN 
                                con.SqlQueComm(query_step3, "Truck");
                                if (con.Ds.Tables["Truck"].Rows.Count < 1)
                                {
                                    Exception ex = new Exception("NO MAWB Or Forwarder Data!");
                                    throw ex;

                                }

                                xmlCreator = new POSXmlCreator();
                                string TruckInfo = "";
                                TruckInfo = con.Ds.Tables["Truck"].Rows[0][0] + @"@" + con.Ds.Tables["Truck"].Rows[0][1];
                                xmlCreator.LoadData(TruckInfo);
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                        }
                    }
                    #endregion
                    #region 當選擇step3時 命名規則和step1和step2有區別將DN更換為PC
                    else if (RadioButton_Step3.Checked)
                    {
                        for (int i = 0; i < con.Ds.Tables[0].Rows.Count; i++)
                        {
                            if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Box Ship Label")
                            {
                                useOuter = true;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                xmlCreator = new BoxLabelXmlCreator();
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/" + Serial_Num);
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pallet Ship Label- Pack ID Single")
                            {
                                useOuter = true;
                                //if (Pallet_Id.Substring(0, 2).ToString() == "NA" || Pallet_Id.Substring(0, 2).ToString() == "BA")
                                //{
                                //    continue;
                                //}
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                if (filename_XML.IndexOf("TypeA") != -1)
                                {
                                    xmlCreator = new PalletAXmlCreator();
                                }
                                else
                                {
                                    xmlCreator = new PalletBXmlCreator();
                                }
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/" + Pallet_Id);
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Transportation")
                            {
                                useOuter = false;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                xmlCreator = new PackListXmlCreator();
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Transportation");
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Shipment")
                            {
                                useOuter = false;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                if (con.Ds.Tables[0].Rows[i][2].ToString().Contains("QVC")) //add for QVC 201305
                                {
                                    xmlCreator = new PackListShipmentXmlCreator_QVC();
                                    //string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                    xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Shipment", docName_XML);

                                }
                                else
                                {
                                     if (con.Ds.Tables[0].Rows[i][2].ToString().Contains("Rail"))
                                    {
                                        useOuter = true;
                                        xmlCreator = new MasterWaybillShipmentXmlCreator();
                                    }
                                    else
                                    {
                                        xmlCreator = new PackListShipmentXmlCreator();
                                    }
                                    xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Shipment");
                                    //string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                    xmlCreator.WriteXml(docName_XML, useOuter);
 
                                }
                                //xmlCreator = new PackListXmlCreator();
                                //xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Shipment");
                                //string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                //xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Pack List- Addition")
                            {
                                useOuter = false;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                xmlCreator = new PackListXmlCreator();
                                xmlCreator.LoadData(BOX_DN.Text.Trim() + "/Pack List- Addition");
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "Waybill- Additon")
                            {
                                useOuter = true;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                //xmlCreator = new WayBillXmlCreator();
                                xmlCreator = new WayBill_AdditionXMLCreat_new();
                                xmlCreator.LoadData(BOX_DN.Text.Trim());
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                            else if (con.Ds.Tables[0].Rows[i][0].ToString().Trim() == "POS")
                            {
                                useOuter = false;
                                string filename_XML = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".xml");
                                string filename_PDF = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".pdf");
                                string filename_FO = "PC_" + con.Ds.Tables[0].Rows[i][1].ToString() + "_" + con.Ds.Tables[0].Rows[i][3].ToString() + "_" + con.Ds.Tables[0].Rows[i][2].ToString().Replace(".xslt", ".fo");
                                //xmlCreator = new WayBillShipmentXmlCreator();
                                string query_step3 = "select a.TruckID,[Date]   from HPIMES.dbo.Forwarder a,HPIMES.dbo.MAWB b where a.MAWB=b.MAWB or a.MAWB=b.HAWB and b.Delivery= '" + BOX_DN.Text.ToString().Trim() + "'";//collate Chinese_Taiwan_Stroke_90_BIN 
                                con.SqlQueComm(query_step3, "Truck");
                                if (con.Ds.Tables["Truck"].Rows.Count < 1)
                                {
                                    Exception ex = new Exception("NO MAWB Or Forwarder Data!");
                                    throw ex;

                                }

                                xmlCreator = new POSXmlCreator();
                                string TruckInfo = "";
                                TruckInfo = con.Ds.Tables["Truck"].Rows[0][0] + @"@" + con.Ds.Tables["Truck"].Rows[0][1];
                                xmlCreator.LoadData(TruckInfo);
                                string docName_XML = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_XML;
                                xmlCreator.WriteXml(docName_XML, useOuter);
                                string docName_PDF = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_PDF;
                                string docName_FO = ConfigurationManager.AppSettings["FilePath"] + @"\" + filename_FO;
                                string fopPath = ConfigurationManager.AppSettings["FOPPath"];
                                //FOPWrap.FOP.GeneratePDF(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_PDF);
                                //FOPWrap.FOP.GenerateFo(
                                //    fopPath,
                                //    docName_XML,
                                //    Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()),
                                //    docName_FO);
                                DoGenFile(PDF, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_PDF);
                                DoGenFile(FO, Server.MapPath(@"~\XSL\" + con.Ds.Tables[0].Rows[i][2].ToString().Trim()), docName_XML, docName_FO);
                            }
                        }
                    }
                        //Response.Write("<script type='text/javascript'>alert('" + con.Ds.Tables[0].Rows[0][0] + "');</script>");
                }
            }
        }
                    #endregion
        catch (System.Exception err)
        {
           // MessageBox.Show(err.Message.ToString());
            logger.Error(err.Message + Environment.NewLine + err.ToString() + Environment.NewLine + err.InnerException);
            Response.Write(err);
        }

    }
예제 #4
0
    string OutputToPDF(string cmd)
    {
        logger.Debug("OutputToPDF begin");
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            //xmlCreator = new BoxLabelXmlCreator();
            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.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
            xmlCreator = new PalletBXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
            xmlCreator = new PackListXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
            //xmlCreator = new WayBillXmlCreator();
            xmlCreator = new WayBill_AdditionXMLCreat_new();
            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 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";
        */

        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";
        
        
    }
예제 #5
0
    protected void btnViewXML_Click(object sender, EventArgs e)
    {
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            xmlCreator = new BoxLabelXmlCreator();
            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.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
            xmlCreator = new PalletBXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
            xmlCreator = new PackListXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
            //xmlCreator = new WayBillXmlCreator();
            xmlCreator = new WayBill_AdditionXMLCreat_new();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
       /*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");
    }
예제 #6
0
    string OutputToPDF(string cmd)
    {
        string sessionDoc = Session["SCHEMA_FILE_NAME"].ToString();
        XmlCreator xmlCreator = null;
        Guid docGuid = Guid.NewGuid();
        bool useOuter = true;
        if (sessionDoc.StartsWith("Schema_Box_Ship_Label"))
        {
            //xmlCreator = new BoxLabelXmlCreator();
            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.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pallet_Label_TypeB"))
        {
            xmlCreator = new PalletBXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim() + "/" + lblselect.Text.ToString());
        }
        else if (sessionDoc.StartsWith("Schema_Pack_List"))
        {
            useOuter = false;
            xmlCreator = new PackListXmlCreator();
            xmlCreator.LoadData(txtInternalID.Text.Trim());
        }
        else if (sessionDoc.StartsWith("Schema_Waybill"))
        {
            //xmlCreator = new WayBillXmlCreator();
            xmlCreator = new WayBill_AdditionXMLCreat_new();
            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 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";
        
        
    }
예제 #7
0
파일: EDITS.cs 프로젝트: wra222/testgit
 public string PalletALabel(string FilePH, string Dn,string Pallet)
 {
     logger.Info("PalletALabel begin; FilePH=" + FilePH + " , Dn=" + Dn + " , Pallet=" + Pallet);
     PalletAXmlCreator xmlCreator = null;
     xmlCreator = new PalletAXmlCreator();
     string res = null;
     try
     {
         ChkAndCreatePath(FilePH);
         xmlCreator.LoadPalletADatabaseData(Dn.ToString().Trim() + @"/" + Pallet.ToString().Trim());
         xmlCreator.WriteXml(FilePH, true);
         res = Dn;
     }
     catch (Exception err)
     {
         res = RecordError("PalletALabel", ref err);
     }
     finally
     {
         logger.Info("PalletALabel end");
     }
     return res;
 }