//看板明细设置 private void SetPanelDetailsControlValue(WatchPanelDetails panelDetail) { panelDetail._sscode = _ssCode; panelDetail._workShopCode = _workShopCode; panelDetail._maxLineCount = _maxLineCount; panelDetail._pageScrolling = _pageScrolling; DBTimeDimension timeObj = (DBTimeDimension)m_WatchPanelFacade.GetDBTimeDimension(_CuerrtDay); if (timeObj == null) { MessageBox.Show("数据库中缺少当前日期的时间维度,请检查Tbltimedimension表"); return; } string divideTyep = string.Empty; if (_dividedHoursByDay) { divideTyep = TimeDimension.Day; } if (_dividedHoursByMonth) { divideTyep = TimeDimension.Month; } if (_dividedHoursByWeek) { divideTyep = TimeDimension.Week; } object[] panelDetailDataSource = this.m_WatchPanelFacade.QueryPanelDetailsData(_ssCode, _CuerrtDay, _workShopCode, timeObj, divideTyep); panelDetail.panlDetailsDataSource = panelDetailDataSource; this.WorkShopTimer.Enabled = false; this.AutoTimer.Enabled = false; panelDetail.InitControlsValue(); }
//数据的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 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 { } }