示例#1
0
        /// <summary>
        /// ShenTong 面单打印
        /// </summary>
        /// <param name="printPiece"></param>
        public void ZhongTong(int printPiece)
        {
            timer1.Enabled = true;
            toolStripStatusLabel1.ForeColor = Color.FromArgb(80, Color.DarkRed);
            toolStripStatusLabel1.Text = "您正在打印申通面单.";
            try
            {
                MyService.Credentials = System.Net.CredentialCache.DefaultCredentials;
                string address = m_Address;
                MyService.Url = "http://" + address + "/DeliveryPrintService.asmx";
                List<ShenTongInfo> listCollection= new List<ShenTongInfo>();

                int j = 0;

                //发运方式
                //var shippingMethods = "申通";
                //StringBuilder sbb=new StringBuilder();

                //List<listinfo> infok =  new List<listinfo>();
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {

                    if (dataGridView1.Rows[i].Cells["Column3"].Value.ToString() == "否")
                    {
                        j++;
                        if (j <= printPiece)
                        {
                            DataTable info = MyService.GetOrderInfoPart(dataGridView1.Rows[i].Cells["Column1"].Value.ToString()).Tables[0];

                            if (info != null)
                            {
                                int rw = info.Rows.Count;

                                if (rw > 0)
                                {

                                    ShenTongInfo ZhongTong = new ShenTongInfo();
                                    //shenTong.salseType = "T";//销售类型// info.Rows[0]["SalesType"].ToString();
                                    ZhongTong.shopName = "柠檬绿茶";
                                    //shenTong.MergerOrderID = Int32.Parse(info.Rows[0]["Tid"].ToString());//Int32.Parse(info.Rows[0]["mergerOrderId"].ToString());
                                    ZhongTong.Consignee = info.Rows[0]["Consignee"].ToString();//收货人

                                    ZhongTong.Freight = info.Rows[0]["freight"].ToString();

                                    //string clientUserName = info.Rows[0]["GuestName"].ToString();

                                    ZhongTong.cDCName = info.Rows[0]["Provinces"].ToString();//地区名称

                                    //返回面单显示的信息
                                    ZhongTong.ExpressMessage = GetExpressMessage(ZhongTong.salseType, ZhongTong.shopName);

                                    ZhongTong.GetAddress = info.Rows[0]["Provinces"] + " " + info.Rows[0]["City"] + " " + info.Rows[0]["District"] + " " + info.Rows[0]["Address"];

                                    //大字
                                    ZhongTong.DaZi = dazi2(info.Rows[0]["Provinces"].ToString(), info.Rows[0]["City"].ToString(),
                                                         info.Rows[0]["District"].ToString());

                                    //shenTong.OrderNum = dataGridView1.Rows[i].Cells["Column1"].Value.ToString() + "    " + DateTime.Now.ToString("yyyy-MM-dd");
                                    ZhongTong.RiQi = DateTime.Now.ToString("yyyy-MM-dd");

                                    ZhongTong.OrderNo = dataGridView1.Rows[i].Cells["Column1"].Value.ToString();
                                    ZhongTong.Phone = info.Rows[0]["Tel"] + " " + "  " + " " + info.Rows[0]["Phone"];

                                    ZhongTong.shopName = string.Empty;
                                    ZhongTong.StockName = string.Empty;
                                    if (info.Rows.Count>0)
                                    {
                                        ZhongTong.YanSe1 = info.Rows[0]["Color"].ToString();
                                        ZhongTong.ChiMa1 = info.Rows[0]["Size"].ToString();
                                        ZhongTong.Num1 = info.Rows[0]["Num"].ToString();
                                        ZhongTong.StockCode1 = info.Rows[0]["Pcode"].ToString();
                                    }
                                    if (info.Rows.Count>1)
                                    {
                                        ZhongTong.YanSe2 = info.Rows[1]["Color"].ToString();
                                        ZhongTong.ChiMa2 = info.Rows[1]["Size"].ToString();
                                        ZhongTong.Num2 = info.Rows[1]["Num"].ToString();
                                        ZhongTong.StockCode2 = info.Rows[1]["Pcode"].ToString();
                                    }
                                    if (info.Rows.Count > 2)
                                    {
                                        ZhongTong.YanSe3 = info.Rows[2]["Color"].ToString();
                                        ZhongTong.ChiMa3 = info.Rows[2]["Size"].ToString();
                                        ZhongTong.Num3 = info.Rows[2]["Num"].ToString();
                                        ZhongTong.StockCode3 = info.Rows[2]["Pcode"].ToString();
                                    }
                                    if (info.Rows.Count > 3)
                                    {
                                        ZhongTong.YanSe4 = info.Rows[3]["Color"].ToString();
                                        ZhongTong.ChiMa4 = info.Rows[3]["Size"].ToString();
                                        ZhongTong.Num4 = info.Rows[3]["Num"].ToString();
                                        ZhongTong.StockCode4 = info.Rows[3]["Pcode"].ToString();
                                    } if (info.Rows.Count > 4)
                                    {
                                        ZhongTong.YanSe5 = info.Rows[4]["Color"].ToString();
                                        ZhongTong.ChiMa5 = info.Rows[4]["Size"].ToString();
                                        ZhongTong.Num5 = info.Rows[4]["Num"].ToString();
                                        ZhongTong.StockCode5 = info.Rows[4]["Pcode"].ToString();
                                    } if (info.Rows.Count > 5)
                                    {
                                        ZhongTong.YanSe6 = info.Rows[5]["Color"].ToString();
                                        ZhongTong.ChiMa6 = info.Rows[5]["Size"].ToString();
                                        ZhongTong.Num6 = info.Rows[5]["Num"].ToString();
                                        ZhongTong.StockCode6 = info.Rows[5]["Pcode"].ToString();
                                    }
                                    if (info.Rows.Count > 6)
                                    {
                                        ZhongTong.YanSe7 = info.Rows[6]["Color"].ToString();
                                        ZhongTong.ChiMa7 = info.Rows[6]["Size"].ToString();
                                        ZhongTong.Num7 = info.Rows[6]["Num"].ToString();
                                        ZhongTong.StockCode7 = info.Rows[6]["Pcode"].ToString();
                                    }
                                    if (info.Rows.Count > 7)
                                    {
                                        ZhongTong.YanSe8 = info.Rows[7]["Color"].ToString();
                                        ZhongTong.ChiMa8 = info.Rows[7]["Size"].ToString();
                                        ZhongTong.Num8 = info.Rows[7]["Num"].ToString();
                                        ZhongTong.StockCode8 = info.Rows[7]["Pcode"].ToString();
                                    } if (info.Rows.Count > 8)
                                    {
                                        ZhongTong.YanSe9 = info.Rows[8]["Color"].ToString();
                                        ZhongTong.ChiMa9 = info.Rows[8]["Size"].ToString();
                                        ZhongTong.Num9 = info.Rows[8]["Num"].ToString();
                                        ZhongTong.StockCode9 = info.Rows[8]["Pcode"].ToString();
                                    } if (info.Rows.Count > 9)
                                    {
                                        ZhongTong.YanSe0 = info.Rows[9]["Color"].ToString();
                                        ZhongTong.ChiMa0 = info.Rows[9]["Size"].ToString();
                                        ZhongTong.Num0 = info.Rows[9]["Num"].ToString();
                                        ZhongTong.StockCode0 = info.Rows[9]["Pcode"].ToString();
                                    }

                                    //ZhongTong.StockCode = info.Rows[0]["Pcode"].ToString();//商品代码
                                    //for (int k = 0; k < info.Rows.Count; k++)
                                    //{
                                    //    listinfo al = new listinfo();
                                    //    al.StockCode1 = info.Rows[k]["Pcode"].ToString();//商品代码
                                    //    al.YanSe1 = info.Rows[k]["Color"].ToString();//颜色
                                    //    al.ChiMa1 = info.Rows[k]["Size"].ToString();//尺码
                                    //    al.num1 = info.Rows[k]["Num"].ToString();// MyService.GetTotalCount(dataGridView1.Rows[i].Cells["Column1"].Value.ToString());】
                                    //    infok.Add(al);
                                    //}

                                    //ZhongTong.YanSe = info.Rows[0]["Color"].ToString();//颜色
                                    //ZhongTong.ChiMa = info.Rows[0]["Size"].ToString();//尺码

                                    //ZhongTong.TotalCount = info.Rows[0]["Num"].ToString();//数量 //MyService.GetTotalCount(dataGridView1.Rows[i].Cells["Column1"].Value.ToString());
                                    listCollection.Add(ZhongTong);
                                    //if (listCollection.Count > 0)
                                    //{
                                    //    MyBound(listCollection, infok, "ZhongTong.rpt");

                                    //}
                                }
                            }
                        }

                    }

                }
                if (listCollection.Count > 0)
                {
                    MyBound(listCollection, "ZhongTong.rpt");
                    //没有保存的数据
                    saveOk = false;
                }
            }
            catch (Exception ee)
            {

                MessageBox.Show(ee.Message);
            }

            timer1.Enabled = false;
            toolStripStatusLabel1.ForeColor = Color.FromArgb(80, Color.DarkGreen);
            toolStripStatusLabel1.Text = "打印申通面单完毕   [时间:" + System.DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒") + "]";
        }
示例#2
0
        /// <summary>
        /// ShenTong 面单打印
        /// </summary>
        /// <param name="printPiece"></param>
        public void ShenTong(int printPiece)
        {
            timer1.Enabled = true;
            toolStripStatusLabel1.ForeColor = Color.FromArgb(80, Color.DarkRed);
            toolStripStatusLabel1.Text = "您正在打印申通面单.";
            try
            {
                MyService.Credentials = System.Net.CredentialCache.DefaultCredentials;
                string address = m_Address;
                MyService.Url = "http://" + address + "/DeliveryPrintService.asmx";
                List<ShenTongInfo> listCollection = new List<ShenTongInfo>();
                listCollection.Clear();
                int j = 0;

                //发运方式
                //var shippingMethods = "申通";
                //StringBuilder sbb=new StringBuilder();

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["Column3"].Value.ToString() == "否")
                    {
                        j++;
                        if (j <= printPiece)
                        {
                            DataTable info = MyService.GetOrderInfoPart(dataGridView1.Rows[i].Cells["Column1"].Value.ToString()).Tables[0];

                            if (info != null)
                            {
                                int rw = info.Rows.Count;

                                if (rw > 0)
                                {

                                    ShenTongInfo shenTong = new ShenTongInfo();
                                    //shenTong.salseType = "T";//销售类型// info.Rows[0]["SalesType"].ToString();
                                    shenTong.shopName = "柠檬绿茶";
                                    //shenTong.MergerOrderID = Int32.Parse(info.Rows[0]["Tid"].ToString());//Int32.Parse(info.Rows[0]["mergerOrderId"].ToString());
                                    shenTong.Consignee = info.Rows[0]["Consignee"].ToString();//收货人

                                    shenTong.Freight = info.Rows[0]["freight"].ToString();

                                    //string clientUserName = info.Rows[0]["GuestName"].ToString();

                                    shenTong.cDCName = info.Rows[0]["Provinces"].ToString();//地区名称

                                    //返回面单显示的信息
                                    shenTong.ExpressMessage = GetExpressMessage(shenTong.salseType, shenTong.shopName);

                                    shenTong.GetAddress = info.Rows[0]["Provinces"] + " " + info.Rows[0]["City"] + " " + info.Rows[0]["District"] + " " + info.Rows[0]["Address"];

                                    //大字
                                    shenTong.DaZi = dazi(info.Rows[0]["Provinces"].ToString(), info.Rows[0]["City"].ToString(),
                                                         info.Rows[0]["District"].ToString());

                                    //shenTong.OrderNum = dataGridView1.Rows[i].Cells["Column1"].Value.ToString() + "    " + DateTime.Now.ToString("yyyy-MM-dd");
                                    shenTong.RiQi = DateTime.Now.ToString("yyyy-MM-dd");

                                    shenTong.OrderNo = dataGridView1.Rows[i].Cells["Column1"].Value.ToString();
                                    shenTong.Phone = info.Rows[0]["Tel"] + " " + "  " + " " + info.Rows[0]["Phone"];

                                    shenTong.shopName = string.Empty;
                                    shenTong.StockName = string.Empty;
                                    //shenTong.StockCode = info.Rows[0]["Pcode"].ToString();//商品代码

                                    //shenTong.YanSe = info.Rows[0]["Color"].ToString();//颜色
                                    //shenTong.ChiMa = info.Rows[0]["Size"].ToString();//尺码

                                    //shenTong.TotalCount = info.Rows[0]["Num"].ToString();//数量 //MyService.GetTotalCount(dataGridView1.Rows[i].Cells["Column1"].Value.ToString());
                                    listCollection.Add(shenTong);
                                }
                            }
                        }

                    }

                }
                if (listCollection.Count > 0)
                {
                    //MyBound(listCollection, "ShenTong.rpt");
                    //没有保存的数据
                    saveOk = false;
                }
            }
            catch (Exception ee)
            {

                MessageBox.Show(ee.Message);
            }

            timer1.Enabled = false;
            toolStripStatusLabel1.ForeColor = Color.FromArgb(80, Color.DarkGreen);
            toolStripStatusLabel1.Text = "打印申通面单完毕   [时间:" + System.DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒") + "]";
        }