Exemplo n.º 1
0
        /// <summary>
        /// 直接打印,是否显示打印对话框
        /// </summary>
        /// <param name="p_ShowPrintDialog"></param>
        public void Print(bool p_ShowPrintDialog)
        {
            try
            {
                //1.获取打印机插件是否设置了打印拣选单的面单
                NewXmlControl xmlfile = new NewXmlControl(Comm.StartupPath + "//config//config.xml", false, "Passport");
                bool          isexit  = xmlfile.IsExitinnertextOfNode("转运单", "page");
                if (isexit)
                {
                    //设置打印机的名称
                    //pd.PrinterSettings.PrinterName = xmlfile.GetinnertextOfPrintName("Umail", "page");
                }
                else
                {
                    throw new Exception("没有配置转运单面单!请先配置!");
                }
                DataTable dt = new DataTable("table1");
                dt.Columns.Add(new DataColumn("ID", typeof(string)));
                dt.Columns.Add(new DataColumn("packgecode", typeof(string)));
                dt.Columns.Add(new DataColumn("number", typeof(string)));
                dt.Columns.Add(new DataColumn("time", typeof(string)));

                DataRow row = dt.NewRow();

                row["ID"]         = packge.workid;
                row["packgecode"] = packge.zhuanyuncode;
                dt.Rows.Add(row);
                PrintCenter printer = new PrintCenter();
                printer.ZPLPrintzhuanyun(dt, true, 1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 直接打印,是否显示打印对话框
        /// </summary>
        /// <param name="p_ShowPrintDialog"></param>
        public void Print(bool p_ShowPrintDialog)
        {
            try
            {
                //1.获取打印机插件是否设置了打印拣选单的面单
                NewXmlControl xmlfile = new NewXmlControl(Comm.StartupPath + "//config//config.xml", false, "Passport");
                bool          isexit  = xmlfile.IsExitinnertextOfNode("Upacket", "page");
                if (isexit)
                {
                    //设置打印机的名称
                    //pd.PrinterSettings.PrinterName = xmlfile.GetinnertextOfPrintName("Umail", "page");
                }
                else
                {
                    throw new Exception("没有配置Upacket面单!请先配置!");
                }

                DataTable dt = new DataTable("table1");
                dt.Columns.Add(new DataColumn("ZIPCode", typeof(string)));
                dt.Columns.Add(new DataColumn("address1", typeof(string)));
                dt.Columns.Add(new DataColumn("address2", typeof(string)));
                dt.Columns.Add(new DataColumn("address3", typeof(string)));
                dt.Columns.Add(new DataColumn("SKU", typeof(string)));
                dt.Columns.Add(new DataColumn("Companyaddr", typeof(string))); //Companyaddr2
                dt.Columns.Add(new DataColumn("Companyaddr2", typeof(string)));
                dt.Columns.Add(new DataColumn("shopname", typeof(string)));
                dt.Columns.Add(new DataColumn("shoppost", typeof(string)));
                dt.Columns.Add(new DataColumn("shopphone", typeof(string)));
                dt.Columns.Add(new DataColumn("Phone", typeof(string)));
                dt.Columns.Add(new DataColumn("CustumerName", typeof(string)));
                dt.Columns.Add(new DataColumn("ExpressCode", typeof(string)));
                dt.Columns.Add(new DataColumn("packgeinfo", typeof(string)));
                dt.Columns.Add(new DataColumn("MessageForBuyer", typeof(string)));
                dt.Columns.Add(new DataColumn("SendShopname", typeof(string)));
                dt.Columns.Add(new DataColumn("packgecode", typeof(string)));
                DataRow row = dt.NewRow();
                //判断是否存在 - 符号
                if (pwork.data_4.Contains("-"))
                {
                    row["ZIPCode"] = "〒:" + pwork.data_4;   //"〒 160-0023";
                }
                else
                {
                    row["ZIPCode"] = "〒:" + pwork.data_4.Insert(3, "-");
                }
                if (pwork.data_5.Length > 30)
                {
                    row["address1"] = pwork.data_5.Substring(0, 15);  //"金华金帆街172金字火腿";
                    row["address2"] = pwork.data_5.Substring(15, 15); //"乐诚网络";
                    row["address3"] = pwork.data_5.Substring(30);
                }
                else if (pwork.data_5.Length <= 30 && pwork.data_5.Length >= 15)
                {
                    row["address1"] = pwork.data_5.Substring(0, 15); //"金华金帆街172金字火腿";
                    row["address2"] = pwork.data_5.Substring(15);    //"乐诚网络";
                    row["address3"] = "";
                }
                else if (pwork.data_5.Length < 15)
                {
                    row["address1"] = pwork.data_5; //"金华金帆街172金字火腿";
                    row["address2"] = "";           //"乐诚网络";
                    row["address3"] = "";
                }
                row["SKU"] = "";
                //判断是否存在 - 符号
                if (pwork.data_3.Contains("-"))
                {
                    row["Phone"] = pwork.data_3;  //"〒 160-0023";
                }
                else
                {
                    row["Phone"] = pwork.data_3.Insert(3, "-").Insert(8, "-");
                }
                row["CustumerName"]    = pwork.data_2;
                row["ExpressCode"]     = pwork.data_9;
                row["packgeinfo"]      = pwork.data_1;
                row["MessageForBuyer"] = null;
                row["SKU"]             = pwork.data_7;
                row["SendShopname"]    = "Shop: " + pwork.Shopname; // + pwork.Platform + " + "
                row["packgecode"]      = pwork.data_10;
                row["shopname"]        = "Name: " + pwork.Shopname;
                row["shoppost"]        = "[差出人返還先]  〒:" + pwork.Shopzip;
                row["shopphone"]       = "TEL: " + pwork.Shopphone;
                row["Companyaddr"]     = pwork.Shopaddress;
                row["Companyaddr2"]    = "";
                dt.Rows.Add(row);
                PrintCenter printer = new PrintCenter();
                printer.ZPLPrintUpacket(dt, true, 1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 直接打印,是否显示打印对话框
        /// </summary>
        /// <param name="p_ShowPrintDialog"></param>
        public void Print(bool p_ShowPrintDialog)
        {
            try
            {
                //1.获取打印机插件是否设置了打印拣选单的面单
                NewXmlControl xmlfile = new NewXmlControl(Comm.StartupPath + "//config//config.xml", false, "Passport");
                bool          isexit  = xmlfile.IsExitinnertextOfNode("Yamato", "page");
                if (isexit)
                {
                    //设置打印机的名称
                    //pd.PrinterSettings.PrinterName = xmlfile.GetinnertextOfPrintName("Umail", "page");
                }
                else
                {
                    throw new Exception("没有配置Yamato面单!请先配置!");
                }

                DataTable dt = new DataTable("table1");
                dt.Columns.Add(new DataColumn("ZIPCode", typeof(string)));
                dt.Columns.Add(new DataColumn("address1", typeof(string)));
                dt.Columns.Add(new DataColumn("address2", typeof(string)));
                dt.Columns.Add(new DataColumn("address3", typeof(string)));
                dt.Columns.Add(new DataColumn("SKU", typeof(string)));
                dt.Columns.Add(new DataColumn("YamtoCompany1", typeof(string)));
                dt.Columns.Add(new DataColumn("YamtoCompany2", typeof(string)));
                dt.Columns.Add(new DataColumn("YamtoCompany3", typeof(string)));
                dt.Columns.Add(new DataColumn("YamtoCompany4", typeof(string)));
                dt.Columns.Add(new DataColumn("Phone", typeof(string)));
                dt.Columns.Add(new DataColumn("CustumerName", typeof(string)));
                dt.Columns.Add(new DataColumn("ExpressCode", typeof(string)));
                dt.Columns.Add(new DataColumn("MessageForBuyer", typeof(string)));
                dt.Columns.Add(new DataColumn("SendShopname", typeof(string)));
                dt.Columns.Add(new DataColumn("packgecode", typeof(string)));         //OurZipCode
                dt.Columns.Add(new DataColumn("OurZipCode", typeof(string)));         //OurZipCode
                dt.Columns.Add(new DataColumn("Ourtelephone", typeof(string)));       //OurZipCode
                dt.Columns.Add(new DataColumn("OurCompannyAddress", typeof(string))); //OurZipCode
                DataRow row = dt.NewRow();
                //判断是否存在 - 符号
                if (string.IsNullOrEmpty(pwork.data_4))
                {
                    new main().Log(pwork.data_4 + "包裹号不存在邮编,请确认!");
                    //Log(DateTime.Now.ToString());
                    return;   //"〒 160-0023";
                }
                if (pwork.data_4.Contains("-"))
                {
                    row["ZIPCode"] = "〒 " + pwork.data_1;   //"〒 160-0023";
                }
                else
                {
                    row["ZIPCode"] = "〒 " + pwork.data_1.Insert(3, "-");
                }
                if (string.IsNullOrEmpty(pwork.data_5))
                {
                    new main().Log(pwork.data_5 + "包裹号不存在地址,请确认!");
                    //Log(DateTime.Now.ToString());
                    return;   //"〒 160-0023";
                }
                if (pwork.data_5.Length > 30)
                {
                    row["address1"] = pwork.data_5.Substring(0, 9);  //"金华金帆街172金字火腿";
                    row["address2"] = pwork.data_5.Substring(9, 21); //"乐诚网络";
                    row["address3"] = pwork.data_5.Substring(30);
                }
                else if (pwork.data_5.Length <= 30 || pwork.data_5.Length >= 9)
                {
                    row["address1"] = pwork.data_5.Substring(0, 9); //"金华金帆街172金字火腿";
                    row["address2"] = pwork.data_5.Substring(9);    //"乐诚网络";
                    row["address3"] = "";
                }
                else if (pwork.data_5.Length < 9)
                {
                    row["address1"] = pwork.data_5; //"金华金帆街172金字火腿";
                    row["address2"] = "";           //"乐诚网络";
                    row["address3"] = "";
                }

                row["SKU"]           = pwork.data_7;
                row["YamtoCompany1"] = "ヤマト運輸株式会社";
                row["YamtoCompany2"] = "北東京物流システム支店";             //,西新宿3丁目センター
                row["YamtoCompany3"] = "この荷物が郵便物ではありません 030-600"; //036-292
                row["YamtoCompany4"] = "お問い合せ先 フリーダイヤル 0120-11-8010";
                //判断是否存在 - 符号
                if (pwork.data_3.Contains("-"))
                {
                    row["Phone"] = pwork.data_3;  //"〒 160-0023";   MessageForBuyer
                }
                else
                {
                    row["Phone"] = pwork.data_3.Insert(3, "-").Insert(8, "-");
                }

                row["CustumerName"]       = pwork.data_2;
                row["ExpressCode"]        = pwork.data_9;
                row["MessageForBuyer"]    = null;//pwork.data_9;
                row["SendShopname"]       = "Shop: " + pwork.Platform + " + " + pwork.Shopname;
                row["packgecode"]         = pwork.data_10;
                row["OurZipCode"]         = pwork.Shopzip;
                row["Ourtelephone"]       = pwork.Shopphone;
                row["OurCompannyAddress"] = pwork.Shopaddress;
                dt.Rows.Add(row);
                PrintCenter printer = new PrintCenter();
                printer.ZPLPrintYamato(dt, true, 1);
                dt.Clear();
                pwork = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }