示例#1
0
        public void getrpt()
        {
            this.Invoke(new Action(() =>
            {
                richTextBox3.AppendText(DateTime.Now.ToString() + "开始从服务器获取数据... ");
                richTextBox3.Focus();
            }));
            var suc = new SoapUnitTOM.SoapUnitClient();

            //  string connstr = getelement("connstr");
            //   richTextBox1.AppendText("oracle连接字符串:" + connstr + " ");
            try
            {
                oraexec ora = new oraexec(connstr);
                ora.ExecuteNonQuery("truncate table  JXC_FOR_SAP");
                //   DataTable dt = ora.GetDt("select count(1) from jxc_for_sap");
                //    richTextBox1.AppendText("select count(1) from jxc_for_sap的结果:" + dt.Rows.Count.ToString());
                DataTable dtrpt = new DataTable();
                DataTable dt    = suc.GetData(1, "DXKH", null);
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--开始查询报表... ");
                    richTextBox3.Focus();
                }));
                for (int i = 0; i < dt.Rows.Count; i++)
                // for (int i = 0; i < 10; i++)
                {
                    this.Invoke(new Action(() =>
                    {
                        richTextBox3.AppendText(DateTime.Now.ToString() + "--" + (i + 1).ToString() + "查询店铺(" + dt.Rows[i][1].ToString() + ")报表中... ");
                        // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                        richTextBox3.Focus();
                    }));
                    string[] args = { Std.Value.ToString("yyyy-MM-dd"), Etd.Value.ToString("yyyy-MM-dd"), dt.Rows[i][0].ToString(), Std.Value.ToString("yyyy-MM") };

                    dtrpt = suc.GetData(1, "Single_Shop", args);
                    //   DataTable dtrptcopy = dtrpt.Copy();
                    Task.Run(() => BulkToDB(dtrpt, "JXC_FOR_SAP"));
                    //  Task.Run(() => readexcel(dtrpt));
                }


                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--查寻结束 ");
                }));
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(er.ToString() + " ");
                }));
            }
        }
示例#2
0
        private void getsaledetail()
        {
            this.Invoke(new Action(() =>
            {
                richTextBox3.AppendText(DateTime.Now.ToString() + "开始从服务器获取数据... ");
                richTextBox3.Focus();
            }));
            var suc = new SoapUnitTOM.SoapUnitClient();

            //  string connstr = getelement("connstr");
            //   richTextBox1.AppendText("oracle连接字符串:" + connstr + " ");
            try
            {
                oraexec ora = new oraexec(connstr);

                int k = ora.ExecuteNonQuery("truncate table JXC_FOR_SALEDETAIL");

                this.Invoke(new Action(() =>
                {
                    richTextBox4.AppendText("清除已有记录结果:" + k.ToString() + " ");
                    // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                    richTextBox4.Focus();
                }));
                //   DataTable dt = ora.GetDt("select count(1) from jxc_for_sap");
                //    richTextBox1.AppendText("select count(1) from jxc_for_sap的结果:" + dt.Rows.Count.ToString());
                DataTable dtrpt = new DataTable();

                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--" + "查询店铺销售上报报表中... ");
                    // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                    richTextBox3.Focus();
                }));
                string[] args = { Std.Value.ToString("yyyy-MM") };

                dtrpt = suc.GetData(1, "Get_saleDetail", args);
                //  for (int i=0;i<dtrpt.Rows.Count;i++)
                //for (int i = 0; i < 2; i++)
                //{
                //    string sql = "insert into JXC_FOR_SALEDETAIL values ('" + dtrpt.Rows[i][0].ToString() + "','" + dtrpt.Rows[i][1].ToString() + "','" + dtrpt.Rows[i][2].ToString() + "','" + dtrpt.Rows[i][3].ToString() + "','" + dtrpt.Rows[i][4].ToString() + "'," + double.Parse(dtrpt.Rows[i][5].ToString()) + ");";
                //    //this.Invoke(new Action(() =>
                //    //{
                //    //  //  richTextBox4.AppendText(sql+" ");
                //    //  //  richTextBox4.AppendText(sql + " ");
                //    //   // richTextBox4.Focus();
                //    //}));


                //    int j = ora.ExecuteNonQuery(sql);
                //    if (j != -1)
                //   {
                //        this.Invoke(new Action(() =>
                //        {
                //            richTextBox4.AppendText("插入第" + (i + 1).ToString() + "记录,执行结果:" + j.ToString() + " ");
                //                  richTextBox4.AppendText(sql+" ");
                //                richTextBox4.Focus();
                //        }));
                //   }
                //}
                DataTable dtrptcopy = dtrpt.Clone();
                DataRow[] dr        = dtrpt.Select();
                for (int i = 0; i < 100; i++)
                {
                    dtrptcopy.ImportRow((DataRow)dr[i]);
                }
                Task.Run(() => BulkToDB(dtrptcopy, "JXC_FOR_SALEDETAIL"));
                //  Task.Run(() => readexcel(dtrpt));
                this.Invoke(new Action(() =>
                {
                    richTextBox4.AppendText("插入记录数:" + dtrpt.Rows.Count.ToString() + " ");
                    // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                    richTextBox3.Focus();
                }));



                this.Invoke(new Action(() =>
                {
                    richTextBox4.AppendText(DateTime.Now.ToString() + "--运行结束 ");
                }));
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(er.ToString() + " ");
                }));
            }
            finally
            {
            }
        }
示例#3
0
        public void getrptforsql_shop(string shopcode)
        {
            try
            {
                string docmonth = GetDate(int.Parse(textBox2.Text));
                using (SqlConnection conn = new SqlConnection(StrConn))
                {
                    conn.Open();
                    SqlCommand smd = new SqlCommand("delete from  InvData_Shop where  U_DocMonth='" + docmonth + "' and  U_AddressCode='" + shopcode + "'", conn);
                    smd.ExecuteNonQuery();

                    this.Invoke(new Action(() =>
                    {
                        richTextBox4.AppendText(DateTime.Now.ToString() + "清除原有数据完成... ");
                    }));
                }
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox4.AppendText(DateTime.Now.ToString() + "--清除原有数据失败:" + er.Message + " ");
                }));
            }
            this.Invoke(new Action(() =>
            {
                richTextBox3.AppendText(DateTime.Now.ToString() + "开始从服务器获取数据... ");
                richTextBox3.Focus();
            }));
            var suc = new SoapUnitTOM.SoapUnitClient();

            try
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--" + "查询店铺(" + shopcode + ")报表中... ");
                    // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                    richTextBox3.Focus();
                }));
                string[] args = { GetDate(int.Parse(textBox2.Text)), textBox2.Text, shopcode };

                DataTable dtrpt = suc.GetData(1, "GetInvData", args);
                //   DataTable dtrptcopy = dtrpt.Copy();
                Task.Run(() => BitchInsert(dtrpt, "InvData_Shop"));
                //  Task.Run(() => readexcel(dtrpt));



                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--查寻结束 ");
                }));
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(er.ToString() + " ");
                }));
            }
        }
示例#4
0
        public void getrptforsql()
        {
            try
            {
                string docmonth = GetDate(int.Parse(textBox2.Text));
                using (SqlConnection conn = new SqlConnection(StrConn))
                {
                    conn.Open();
                    SqlCommand smd = new SqlCommand("delete from  InvData_Shop where  U_DocMonth='" + docmonth + "' ", conn);
                    smd.ExecuteNonQuery();

                    this.Invoke(new Action(() =>
                    {
                        richTextBox4.AppendText(DateTime.Now.ToString() + "清除原有数据完成...\r\n ");
                    }));
                }
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox4.AppendText(DateTime.Now.ToString() + "--清除原有数据失败:" + er.Message + " \r\n");
                }));
            }
            this.Invoke(new Action(() =>
            {
                richTextBox3.AppendText(DateTime.Now.ToString() + "开始从服务器获取数据... \r\n");
                richTextBox3.Focus();
            }));
            var suc = new SoapUnitTOM.SoapUnitClient();

            try
            {
                List <string> parlist = new List <string>();
                parlist.Add(textBox2.Text);
                DataTable dtrpt = new DataTable();
                DataTable dt    = suc.GetData(1, "GetInvShop", parlist.ToArray());

                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--开始查询报表... \r\n");
                    richTextBox3.Focus();
                }));
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.Invoke(new Action(() =>
                    {
                        richTextBox3.AppendText(DateTime.Now.ToString() + "--" + (i + 1).ToString() + "查询店铺(" + dt.Rows[i][1].ToString() + ")报表中... \r\n");
                        // richTextBox3.AppendText(DateTime.Now.ToString() + "--查询报表中... ");
                        richTextBox3.Focus();
                    }));
                    string[] args = { GetDate(int.Parse(textBox2.Text)), textBox2.Text, dt.Rows[i][0].ToString() };

                    dtrpt = suc.GetData(1, "GetInvData", args);
                    //   DataTable dtrptcopy = dtrpt.Copy();
                    Task.Run(() => BitchInsert(dtrpt, "InvData_Shop"));
                    //  Task.Run(() => readexcel(dtrpt));
                }


                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(DateTime.Now.ToString() + "--查寻结束 \r\n");
                }));
            }
            catch (Exception er)
            {
                this.Invoke(new Action(() =>
                {
                    richTextBox3.AppendText(er.ToString() + " ");
                }));
            }
        }
示例#5
0
        public void GetBaseInfo()
        {
            this.Invoke(new Action(() =>
            {
                this.lblprocessmsg.Text = "开始从服务器获取数据...";
                this.button1.Enabled    = false;
            }));
            try
            {
                var       suc = new SoapUnitTOM.SoapUnitClient();
                DataTable dt  = suc.GetData(1, "BAR_FOR_STOCK", null);


                BarCodeInfo barCodeinfo;
                //   OleDbConnection acn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Windows.Forms.Application.StartupPath + "\\StoreTake.mdb");
                //   OleDbCommand amd;
                //    acn.Open();
                this.Invoke(new Action(() =>
                {
                    this.lblprocessmsg.Text = "待更新条码数" + dt.Rows.Count.ToString();
                    this.button1.Enabled    = false;
                }));
                //   barCodeInfoBll.RemoveAll();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    barCodeinfo           = new BarCodeInfo();
                    barCodeinfo.ItemCode  = dt.Rows[i]["ItemCode"].ToString();
                    barCodeinfo.ItemName  = dt.Rows[i]["ItemName"].ToString();
                    barCodeinfo.CodeBard  = dt.Rows[i]["CodeBard"].ToString();
                    barCodeinfo.BrandCode = dt.Rows[i]["BrandCode"].ToString();
                    barCodeinfo.BrandName = dt.Rows[i]["BrandName"].ToString();


                    this.Invoke(new Action(() =>
                    {
                        this.lblprocessmsg.Text = "更新条码" + dt.Rows[i][0].ToString();

                        this.button1.Enabled = false;
                    }));
                    string      _itemcode = dt.Rows[i]["ItemCode"].ToString();
                    BarCodeInfo result    = barCodeInfoBll.GetList().Where(b => b.ItemCode.Equals(_itemcode)).SingleOrDefault();
                    if (result != null)
                    {
                        barCodeInfoBll.Remove(result.ID);
                    }

                    if (barCodeInfoBll.Add(barCodeinfo))
                    {
                        this.Invoke(new Action(() =>
                        {
                            this.lblprocessmsg.Text = "更新" + dt.Rows[i]["CodeBard"].ToString();
                            this.button1.Enabled    = false;
                        }));
                    }
                    //this.Invoke(new Action(() =>
                    //{

                    //    this.richTextBox1.Text = "insert into BarCodeInfo(ItemCode,ItemName,CodeBard,BrandCode,BrandName) values('" + dt.Rows[i]["ItemCode"].ToString() + "','" + dt.Rows[i]["ItemName"].ToString() + "','" + dt.Rows[i]["CodeBard"].ToString() + "','" + dt.Rows[i]["BrandCode"].ToString() + "','" + dt.Rows[i]["BrandName"] + "')";
                    //    this.lblprocessmsg.Text = dt.Rows[i]["ItemCode"].ToString() + "下载插入中...";
                    //    this.button1.Enabled = false;

                    //}));
                }
                //  acn.Close();
                this.Invoke(new Action(() =>
                {
                    this.lblprocessmsg.Text = "同步数据完成!";

                    this.button1.Enabled = true;
                }));
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());


                this.Invoke(new Action(() =>
                {
                    this.richTextBox1.AppendText(ee.ToString());
                    this.button1.Enabled = true;
                }));
                return;
            }
        }