/// <summary> /// 界面数据提取 /// </summary> public RefreshData getdatas(int port, int untotal) { RefreshData refreshData = new RefreshData(); DataTable currentDt = ledShowBll.getRegistrationInfos("where workstate='2' and port='" + port + "'"); DataTable waitCars = ledShowBll.getRegistrationInfos("where workstate='1' and port='" + port + "'"); refreshData.AllWaitCas = ledShowBll.getRegistrationInfos("where workstate<'2'").Rows.Count; if (currentDt.Rows.Count > 0) { refreshData.Total = int.Parse(currentDt.Rows[0]["quantity"].ToString()); refreshData.Untotal = untotal; refreshData.CurrentCarcode = currentDt.Rows[0]["carcode"].ToString(); } else { refreshData.Total = 0; refreshData.Untotal = 0; refreshData.CurrentCarcode = "无"; } if (waitCars.Rows.Count > 0) { refreshData.WaitCarcode = waitCars.Rows[0]["carcode"].ToString(); } else { refreshData.WaitCarcode = "暂无任务!"; } refreshData.UnWorktotalCars = waitCars.Rows.Count; return refreshData; }
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("无法连接数据库"); } }
private void Refresh(RefreshData refreshData) { lblCompleteRoute.Text = refreshData.CompleteRoute.ToString(); lblCompleteCustomer.Text = refreshData.CompleteCustomer.ToString(); lblCompleteQuantity.Text = refreshData.CompleteQuantity.ToString(); lblTotalRoute.Text = refreshData.TotalRoute.ToString(); lblTotalCustomer.Text = refreshData.TotalCustomer.ToString(); lblTotalQuantity.Text = refreshData.TotalQuantity.ToString(); lblRoute.Text = (refreshData.TotalRoute - refreshData.CompleteRoute).ToString(); lblCustomer.Text = (refreshData.TotalCustomer - refreshData.CompleteCustomer).ToString(); lblQuantity.Text = (refreshData.TotalQuantity - refreshData.CompleteQuantity).ToString(); lblAverageSpeed.Text = refreshData.Average.ToString(); lblCurrentRouteTxt.Text = refreshData.RouteName.ToString(); PbarBatch.Value = (int)(Convert.ToDouble(refreshData.CompleteQuantity) / refreshData.TotalQuantity * 100); lblBatchValue.Text = PbarBatch.Value.ToString() + "%"; }