//数据的Load private void AutoTimer_Tick(object sender, EventArgs e) { try { //显示待机内容 if (_standbyContent && _UserControlID == 1) { this.GetFacSurevyFromXML(); FacMessageControl control = (FacMessageControl)this.mainLayout.GetControlFromPosition(0, 0); control.RTF = FacConfigMessage.CommonInfo; control.ValueRefresh(); } //显示综合看板 if (_comprehensivePanel && _UserControlID == 2) { FacProductMessageControlNew FacProductMessageControl = (FacProductMessageControlNew)this.mainLayout.GetControlFromPosition(0, 0); SetFacProductMessageControlValue(FacProductMessageControl); FacProductMessageControl.Dock = DockStyle.Fill; } //显示看板明细 if (_panelDetails && _UserControlID == 3) { WatchPanelDetails watchPanelDetail = (WatchPanelDetails)this.mainLayout.GetControlFromPosition(0, 0); SetPanelDetailsControlValue(watchPanelDetail); watchPanelDetail.Dock = DockStyle.Fill; } this.mainLayout.Refresh(); } catch { } }
//初始化看板显示 private void InitShowWatch() { //双屏显示时,选择第二屏显示 if (_ShowScreensNumber == 2) { //判断是否有第二屏 Screen[] allScreens = Screen.AllScreens; Screen currentScreen = Screen.FromRectangle(this.DisplayRectangle); bool isSecondScreen = false; if (allScreens.Length == 2) { isSecondScreen = true; } if (isSecondScreen) { this.DesktopLocation = Screen.AllScreens[1].Bounds.Location; this.FormBorderStyle = FormBorderStyle.None; this.DesktopBounds = Screen.AllScreens[1].Bounds; } } //是否要显示待机信息 if (_standbyContent) { FacMessageControl user = new FacMessageControl(); user.RTF = FacConfigMessage.CommonInfo; RefreshTableLayout(); this.mainLayout.Controls.Add(user, 0, 0); user.Dock = DockStyle.Fill; user.ValueRefresh(); _UserControlID = 1; return; } //显示综合看板 if (_comprehensivePanel) { FacProductMessageControlNew FacProductMessageControl = new FacProductMessageControlNew(); SetFacProductMessageControlValue(FacProductMessageControl); RefreshTableLayout(); this.mainLayout.Controls.Add(FacProductMessageControl, 0, 0); FacProductMessageControl.Dock = DockStyle.Fill; _UserControlID = 2; return; } //显示明细看板 if (_panelDetails) { WatchPanelDetails watchPanelDetail = new WatchPanelDetails(); SetPanelDetailsControlValue(watchPanelDetail); RefreshTableLayout(); this.mainLayout.Controls.Add(watchPanelDetail, 0, 0); watchPanelDetail.Dock = DockStyle.Fill; _UserControlID = 3; return; } }
//综合看板和看板明细 private void SetFacProductMessageControlValue(FacProductMessageControlNew facProductMessageControlNew) { try { #region 画面切换设置 //如果是车间看板 if (string.IsNullOrEmpty(_ssCode)) { if (!this.WorkShopTimer.Enabled && !this.AutoTimer.Enabled) { this.WorkShopTimer.Enabled = true; this.AutoTimer.Enabled = true; this._loadedCount = 0; _ssCodeInWrokShopCode = string.Empty; } } else { //产线看板 this.AutoTimer.Enabled = true; } #endregion #region 空间维度: 车间/产线 时间维度:日,周,月来统计数据, //时间维度为日时,x轴用各个时段;为周时,x轴用该周下的每一天来表示;为月时,x周用该周下的每一周来显示 //当空间维度是车间时,直通率和投入产出图要分别刷显示车间下的每条产线 string ssCode = string.Empty; DBTimeDimension timeObj = (DBTimeDimension)m_WatchPanelFacade.GetDBTimeDimension(_CuerrtDay); if (timeObj == null) { MessageBox.Show("数据库中缺少当前日期的时间维度,请检查Tbltimedimension表"); return; } if (string.IsNullOrEmpty(_ssCode) && _ssCodeListInWorkShop != null) { facProductMessageControlNew.IsWorkShopPanel = true; if (string.IsNullOrEmpty(_ssCodeInWrokShopCode)) { _ssCodeInWrokShopCode = (_ssCodeListInWorkShop[0] as StepSequence).StepSequenceCode; } ssCode = _ssCodeInWrokShopCode; } else { facProductMessageControlNew.IsWorkShopPanel = false; ssCode = _ssCode; } #region 良原因 object[] peiDataSource = null; if (_dividedHoursByDay) { peiDataSource = m_WatchPanelFacade.QueryErrorCasueTopFiveBySSCode(_CuerrtDay, _ssCode, _workShopCode); } if (_dividedHoursByWeek) { peiDataSource = m_WatchPanelFacade.QueryErrorCasueTopFiveByWeek(_ssCode, _workShopCode, timeObj); } if (_dividedHoursByMonth) { peiDataSource = m_WatchPanelFacade.QueryErrorCasueTopFiveByMonth(_ssCode, _workShopCode, timeObj); } #endregion #region 投入产出柱状图 int seq = m_WatchPanelFacade.GetSEQForLineChar(ssCode); object[] todayQtyDataSource = null; if (_dividedHoursByDay) { todayQtyDataSource = m_WatchPanelFacade.QueryLineCharDataSource(ssCode, _CuerrtDay, seq); } else { if (timeObj == null) { MessageBox.Show("数据库中缺少当前日期的时间维度,请检查Tbltimedimension表"); return; } if (_dividedHoursByMonth) { //得到当前CurrentDay对应的月数传入 todayQtyDataSource = m_WatchPanelFacade.QueryInputOutputByShiftDay(ssCode, _workShopCode, _CuerrtDay, TimeDimension.Month, timeObj); } if (_dividedHoursByWeek) { //得到当前CurrentDay对应的周数传入 todayQtyDataSource = m_WatchPanelFacade.QueryInputOutputByShiftDay(ssCode, _workShopCode, _CuerrtDay, TimeDimension.Week, timeObj); } } #endregion #region 直通率,按照不同的时间维度统计 object[] weekQtyDataSource = null; if (_dividedHoursByDay) { weekQtyDataSource = m_WatchPanelFacade.QueryFPYBySSCodeForPeriod(ssCode, _CuerrtDay, seq); } else { if (_dividedHoursByMonth) { //得到当前CurrentDay对应的月数传入 weekQtyDataSource = m_WatchPanelFacade.QueryFPYBySSCodeForMonth(ssCode, _CuerrtDay, _workShopCode, timeObj); } if (_dividedHoursByWeek) { //得到当前CurrentDay对应的周数传入 weekQtyDataSource = m_WatchPanelFacade.QueryFPYBySSCodeForWeek(ssCode, _CuerrtDay, _workShopCode, timeObj); } } #endregion #region 总投入和总产出 int inputOutPutShiftday = 0; string divideTyep = string.Empty; if (_dividedHoursByDay) { inputOutPutShiftday = _CuerrtDay; divideTyep = TimeDimension.Day; } else { inputOutPutShiftday = -1; if (_dividedHoursByMonth) { divideTyep = TimeDimension.Month; } else { divideTyep = TimeDimension.Week; } } object inputOutputByShifDay = m_WatchPanelFacade.GetInputOutputQtyByShiftDay(inputOutPutShiftday, _ssCode.Trim(), _workShopCode.Trim(), timeObj, divideTyep); #endregion #region 岗人数 int opValue = m_WatchPanelFacade.GetOnPostManCount(_CuerrtDay, _ssCode, _workShopCode, timeObj, divideTyep); //上岗人数 #endregion #endregion #region 参数到综合看板 facProductMessageControlNew.PeiDataSource = peiDataSource; facProductMessageControlNew.InputQutputQty = inputOutputByShifDay; facProductMessageControlNew.TodayQtyDataSource = todayQtyDataSource; facProductMessageControlNew.WeekQtyDataSource = weekQtyDataSource; facProductMessageControlNew.OpValue = opValue.ToString(); facProductMessageControlNew.Sscode = ssCode; facProductMessageControlNew.WorkShopCode = _workShopCode; if (_dividedHoursByDay) { facProductMessageControlNew.Dimension = TimeDimension.Day; } if (_dividedHoursByWeek) { facProductMessageControlNew.Dimension = TimeDimension.Week; } if (_dividedHoursByMonth) { facProductMessageControlNew.Dimension = TimeDimension.Month; } facProductMessageControlNew.InitControlsValue(); #endregion } catch { } }
//画面的切换 private void WatchTimer_Tick(object sender, EventArgs e) { try { #region 综合看板和看板明细之间的切换 if (_UserControlID == 1) { if (_standbyContent) { if (!this.mainLayout.GetControlFromPosition(0, 0).Name.Equals("FacMessageControl")) { this.GetFacSurevyFromXML(); this.mainLayout.Controls.Clear(); FacMessageControl control = new FacMessageControl(); control.RTF = FacConfigMessage.CommonInfo; this.mainLayout.Controls.Add(control, 0, 0); control.Dock = DockStyle.Fill; control.ValueRefresh(); _UserControlID = 3; return; } } _UserControlID = 3; } if (_UserControlID == 3) { if (_comprehensivePanel) { //if (!this.mainLayout.GetControlFromPosition(0, 0).Name.Equals("FacProductMessageControlNew")) //{ FacProductMessageControlNew FacProductMessageControl = new FacProductMessageControlNew(); SetFacProductMessageControlValue(FacProductMessageControl); RefreshTableLayout(); this.mainLayout.Controls.Add(FacProductMessageControl, 0, 0); FacProductMessageControl.Dock = DockStyle.Fill; _UserControlID = 2; return; //} } _UserControlID = 2; if (string.IsNullOrEmpty(_ssCode) && _ssCodeInWrokShopCode.Equals((_ssCodeListInWorkShop[_ssCodeListInWorkShop.Length - 1] as StepSequence).StepSequenceCode)) { AutoTimer_Tick(sender, e); } } #endregion if (_UserControlID == 2) { if (_panelDetails) { //if (!this.mainLayout.GetControlFromPosition(0, 0).Name.Equals("WatchPanelDetails")) //{ WatchPanelDetails watchPanelDetail = new WatchPanelDetails(); SetPanelDetailsControlValue(watchPanelDetail); RefreshTableLayout(); this.mainLayout.Controls.Add(watchPanelDetail, 0, 0); watchPanelDetail.Dock = DockStyle.Fill; _UserControlID = 1; return; // } } _UserControlID = 1; } if (_UserControlID == 1 && this.mainLayout.GetControlFromPosition(0, 0).Name.Equals("FacProductMessageControlNew") && _standbyContent) { this.GetFacSurevyFromXML(); this.mainLayout.Controls.Clear(); FacMessageControl control = new FacMessageControl(); control.RTF = FacConfigMessage.CommonInfo; this.mainLayout.Controls.Add(control, 0, 0); control.Dock = DockStyle.Fill; control.ValueRefresh(); _UserControlID = 3; return; } } catch { } }