Exemple #1
0
        private void Run()
        {
            try
            {
                //lblTimeTxt.Text = DateTime.Now.ToString("yyyy年MM月dd日hh时mm分");
                lblTimeTxt.Text = DateTime.Now.ToString();
                using (PersistentManager pm = new PersistentManager("DefaultConnection"))
                {

                    TimeDao timeshow = new TimeDao();
                    timeshow.SetPersistentManager(pm);
                    //一号
                    string sortNo = Convert.ToString("one");

                    DataTable infoTable = timeshow.FindSortTime(sortNo);
                    RefreshAgv refreshAgv = new RefreshAgv();
                    int nu = 0;
                    RefreshData2 re = new RefreshData2();
                    if (infoTable.Rows.Count > 1)
                    {
                        nu = Convert.ToInt32(infoTable.Rows[0]["Times"]);

                        double a = nu * 0.0 / 3600;
                        re.CompleteQuantity2 = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]) / Convert.ToInt32(a);
                    }
                    else
                    {
                        re.CompleteQuantity2 = 0;
                    }

                }

                using (PersistentManager pm = new PersistentManager("DefaultConnection2"))
                {
                    LedShowDao ledShowDao = new LedShowDao();
                    ledShowDao.SetPersistentManager(pm);
                    string sortNo = Convert.ToString("all");

                    DataTable infoTable = ledShowDao.FindOrderInfo(sortNo);
                    RefreshData refreshData = new RefreshData();
                    refreshData.TotalCustomer = Convert.ToInt32(infoTable.Rows[0]["CUSTOMERNUM"]);
                    refreshData.TotalRoute = Convert.ToInt32(infoTable.Rows[0]["ROUTENUM"]);
                    refreshData.TotalQuantity = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]);

                    //已分拣
                    infoTable = ledShowDao.FindOrderInfo("");
                    refreshData.CompleteCustomer = Convert.ToInt32(infoTable.Rows[0]["CUSTOMERNUM"]);
                    refreshData.CompleteRoute = Convert.ToInt32(infoTable.Rows[0]["ROUTENUM"]);
                    refreshData.CompleteQuantity = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]);

                    if (refreshData.CompleteQuantity >= 1)
                    {
                        refreshData.Average = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]) / ledShowDao.FindSortingAverage();
                    }
                    else
                    {
                        refreshData.Average = 0;
                    }
                    if (ledShowDao.FindCurrentRoute().Rows.Count != 0)
                    {
                        refreshData.RouteName = ledShowDao.FindCurrentRoute().Rows[0]["ROUTENAME"].ToString();
                    }
                    else
                    {
                        refreshData.RouteName = "";
                    }

                    refreshData.Batch = Convert.ToDateTime(ledShowDao.FindOrderdate().Rows[0]["ORDERDATE"]).ToString("yyyy-MM-dd") + "批次:" + ledShowDao.FindOrderdate().Rows[0]["BATCHNO"].ToString();
                    Refresh(refreshData);
                }
                using (PersistentManager pm = new PersistentManager("DefaultConnection3"))
                {

                    LedShowDao ledShowDao = new LedShowDao();
                    ledShowDao.SetPersistentManager(pm);
                    string sortNo = Convert.ToString("all"); ;

                    DataTable infoTable = ledShowDao.FindOrderInfo(sortNo);
                    RefreshData2 refreshData2 = new RefreshData2();
                    refreshData2.TotalCustomer2 = Convert.ToInt32(infoTable.Rows[0]["CUSTOMERNUM"]);
                    refreshData2.TotalRoute2 = Convert.ToInt32(infoTable.Rows[0]["ROUTENUM"]);
                    refreshData2.TotalQuantity2 = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]);

                    infoTable = ledShowDao.FindOrderInfo("");
                    refreshData2.CompleteCustomer2 = Convert.ToInt32(infoTable.Rows[0]["CUSTOMERNUM"]);
                    refreshData2.CompleteRoute2 = Convert.ToInt32(infoTable.Rows[0]["ROUTENUM"]);
                    refreshData2.CompleteQuantity2 = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]);
                    if (refreshData2.CompleteQuantity2 >= 1)
                    {
                        refreshData2.Average2 = Convert.ToInt32(infoTable.Rows[0]["QUANTITY"]) / ledShowDao.FindSortingAverage();
                    }
                    else
                    {
                        refreshData2.Average2 = 0;
                    }
                    if (ledShowDao.FindCurrentRoute().Rows.Count != 0)
                    {
                        refreshData2.RouteName2 = ledShowDao.FindCurrentRoute().Rows[0]["ROUTENAME"].ToString();
                    }
                    else
                    {
                        refreshData2.RouteName2 = "";
                    }
                    refreshData2.Batch2 = Convert.ToDateTime(ledShowDao.FindOrderdate().Rows[0]["ORDERDATE"]).ToString("yyyy-MM-dd") + "批次:" + ledShowDao.FindOrderdate().Rows[0]["BATCHNO"].ToString();
                    Refresh2(refreshData2);

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("无法连接数据库");

            }
        }
Exemple #2
0
        private void Refresh2(RefreshData2 refreshData)
        {
            lblCompleteRoute2.Text = refreshData.CompleteRoute2.ToString();
            lblCompleteCustomer2.Text = refreshData.CompleteCustomer2.ToString();
            lblCompleteQuantity2.Text = refreshData.CompleteQuantity2.ToString();
            lblTotalRoute2.Text = refreshData.TotalRoute2.ToString();
            lblTotalCustomer2.Text = refreshData.TotalCustomer2.ToString();
            lblTotalQuantity2.Text = refreshData.TotalQuantity2.ToString();
            lblRoute2.Text = (refreshData.TotalRoute2 - refreshData.CompleteRoute2).ToString();
            lblCustomer2.Text = (refreshData.TotalCustomer2 - refreshData.CompleteCustomer2).ToString();
            lblQuantity2.Text = (refreshData.TotalQuantity2 - refreshData.CompleteQuantity2).ToString();

            lblAverageSpeed2.Text = refreshData.Average2.ToString();
            lblCurrentRouteTxt2.Text = refreshData.RouteName2.ToString();
            PbarBatch2.Value = (int)(Convert.ToDouble(refreshData.CompleteQuantity2) / refreshData.TotalQuantity2 * 100);
            lblBatchValue2.Text = PbarBatch2.Value.ToString() + "%";
        }