public frmUpdate(StationLogin StationUser) { InitializeComponent(); stationUser = StationUser; ListRight.Clear(); ListLeft.Clear(); ListRight = TempRight = GetNotOnStationEquipments(); ListLeft = TempLeft = GetOnStationEquipments(); if (ListLeft != null) { LimitCoungt = ListLeft.Count; } this.grdRight.DataSource = TempRight; this.grdLeft.DataSource = TempLeft; }
private void frmOEEDashboard_Load(object sender, EventArgs e) { WindowState = FormWindowState.Maximized; int errCode = 0; string errText = ""; #region 获取服务器的当前时间,并设置当前的系统时间 IRAPSystemClient.Instance.sfn_GetServerDateTime( ref serverTime, out errCode, out errText); if (errCode == 0) { SetSystemDateTime.SetSystemTime(serverTime); } #endregion if (stationUser == null || stationUser.SysLogID <= 0) { #region 获取当前站点的登录信息 stationUser = PadLogin(ref errCode, ref errText); if (errCode != 0) { //ShowErrorMessage(errText); return; } else { //HideErrorMessage(); } #endregion } if (stationUser != null && stationUser.SysLogID != 0) { SetTitle(); } }
/// <summary> /// 当前站点登录 /// </summary> private StationLogin PadLogin( ref int errCode, ref string errText) { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { StationLogin stationUser = new StationLogin(); IRAPUserClient.Instance.sfn_GetInfo_StationLogin( macAddress != "" ? macAddress : "60010MDV1101001", ref stationUser, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); if (errCode == 0) { return(stationUser); } else { return(null); } } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } }
/// <summary> /// 返回指定信息站点的系统登录信息(适合无登录的展现系统) /// </summary> /// <param name="stationID">站点标识</param> /// <returns>StationLogin</returns> public IRAPJsonResult sfn_GetInfo_StationLogin( string stationID, out int errCode, out string errText) { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { StationLogin data = new StationLogin(); #region 创建数据库调用参数组,并赋值 IList <IDataParameter> paramList = new List <IDataParameter>(); paramList.Add(new IRAPProcParameter("@StationID", DbType.String, stationID)); WriteLog.Instance.Write( string.Format( "调用函数 IRAP..sfn_GetInfo_StationLogin," + "参数:StationID={0}", stationID), strProcedureName); #endregion #region 执行数据库函数或存储过程 try { using (IRAPSQLConnection conn = new IRAPSQLConnection()) { string strSQL = "SELECT * FROM IRAP..sfn_GetInfo_StationLogin(" + "@StationID)"; IList <StationLogin> lstDatas = conn.CallTableFunc <StationLogin>(strSQL, paramList); if (lstDatas.Count > 0) { data = lstDatas[0].Clone(); errCode = 0; errText = string.Format("调用成功!共获得 {0} 条记录", lstDatas.Count); } else { errCode = 99001; errText = string.Format("没有[{0}]站点的系统登录信息", stationID); } WriteLog.Instance.Write(errText, strProcedureName); } } catch (Exception error) { errCode = 99000; errText = string.Format("调用 IRAP..sfn_GetInfo_StationLogin 函数发生异常:{0}", error.Message); WriteLog.Instance.Write(errText, strProcedureName); WriteLog.Instance.Write(error.StackTrace, strProcedureName); } #endregion return(Json(data)); } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } }
/// <summary> /// 返回指定信息站点的系统登录信息(适合无登录的展现系统) /// </summary> /// <param name="stationID">站点标识</param> public void sfn_GetInfo_StationLogin( string stationID, ref StationLogin stationInfo, out int errCode, out string errText) { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { stationInfo = new StationLogin(); #region 将函数调用参数加入 Hashtable 中 Hashtable hashParams = new Hashtable(); hashParams.Add("stationID", stationID); WriteLog.Instance.Write( string.Format( "调用 sfn_GetInfo_StationLogin,输入参数:" + "StationID={0}", stationID), strProcedureName); #endregion #region 执行存储过程或者函数 using (WCFClient client = new WCFClient()) { object rlt = client.WCFRESTFul( "IRAP.BL.SSO.dll", "IRAP.BL.SSO.IRAPUser", "sfn_GetInfo_StationLogin", hashParams, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); if (errCode == 0) { stationInfo = rlt as StationLogin; } } #endregion } catch (Exception error) { errCode = -1001; errText = error.Message; WriteLog.Instance.Write(errText, strProcedureName); WriteLog.Instance.Write(error.StackTrace, strProcedureName); } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } }
/// <summary> /// 刷新产线及产品 /// </summary> private void RefreshProductionLineInfo() { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { int errCode = 0; string errText = ""; if (stationUser == null || stationUser.SysLogID <= 0) { #region 获取当前站点的登录信息 stationUser = PadLogin(ref errCode, ref errText); if (errCode != 0) { return; } #endregion } if (stationUser != null && stationUser.SysLogID != 0) { ProductionLineInfo line = new ProductionLineInfo(); IRAPMDMClient.Instance.ufn_GetInfo_ProductionLine( stationUser.CommunityID, stationUser.SysLogID, ref line, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); if (errCode == 0) { lblLineName.Text = string.Format( "[{0}] {1}", line.T134Code, line.T134NodeName); } else { lblLineName.Text = "当前站点未配置产线信息"; return; } FVS_LogoImages images = new FVS_LogoImages(); IRAPMDMClient.Instance.ufn_GetInfo_LogoImages( stationUser.CommunityID, line.T134LeafID, line.T102LeafID_InProduction, ref images, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); if (errCode == 0 && images != null) { string pwoNo = ""; picCompanyLogo.Image = images.CompanyLogo; picCustomLogo.Image = images.CustomerLogo; picProduction.Image = images.CustomerProduct; switch (stationUser.CommunityID) { case 60026: ucPallet.Visible = true; ucOnePointLessons.Visible = false; break; default: ucPallet.Visible = false; ucOnePointLessons.Visible = true; break; } if (!canClose) { // 当前工单执行的瞬时达成率 RefreshExecutePWOInfo(line); } if (!canClose) { // 安灯状态 ucAndonStatus.SetSearchCondition( stationUser.CommunityID, line.T134LeafID, stationUser.SysLogID); } if (!canClose) { // 未关闭工单 ucOpenPWOs.SetSearchCondition( stationUser.CommunityID, 134, line.T134LeafID, stationUser.SysLogID, ucKPIBTS, ref pwoNo); } if (!canClose) { // FTT ucFTT.SetSearchCondition( stationUser.CommunityID, pwoNo, stationUser.SysLogID); } if (!canClose) { // 技能矩阵 ucOperatorSkillsMatrix.SetSearchCondition( stationUser.CommunityID, line.T102LeafID_InProduction, line.T134LeafID, "", stationUser.SysLogID); } if (!canClose && ucOnePointLessons.Visible) { // 一点课 ucOnePointLessons.SetSearchCondition( stationUser.CommunityID, line.T102LeafID_InProduction, "", stationUser.SysLogID); } if (!canClose && ucPallet.Visible) { // 质量问题柏拉图 ucPallet.SetSearchCondition( stationUser.CommunityID, line.T102LeafID_InProduction, 0, pwoNo, stationUser.SysLogID); } if (!canClose) { // 未关闭的变更事项 ucECNtoLine.SetSearchCondition( stationUser.CommunityID, line.T102LeafID_InProduction, stationUser.SysLogID); } } } } catch (Exception error) { WriteLog.Instance.Write(error.Message, strProcedureName); } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } }
public frmShowMDVO(StationLogin stationInfo) : this() { this.stationInfo = stationInfo; }
private void frmSPCOMain_Shown(object sender, EventArgs e) { WindowState = FormWindowState.Maximized; Application.DoEvents(); int errCode = 0; string errText = ""; #region 获取服务器的当前时间,并设置当前的系统时间 IRAPSystemClient.Instance.sfn_GetServerDateTime( ref serverTime, out errCode, out errText); if (errCode == 0) { SetSystemDateTime.SetSystemTime(serverTime); } #endregion if (stationUser == null || stationUser.SysLogID <= 0) { #region 获取当前站点的登录信息 stationUser = PadLogin(ref errCode, ref errText); if (errCode != 0) { ShowErrorMessage(errText); return; } else { HideErrorMessage(); } #endregion } if (stationUser != null) { lblStationID.Text = stationUser.HostName; #region 获取当前站点监管的工位列表,并根据工位列表生成控制图 if (stationUser.SysLogID > 0) { if (!xtraScrollableControl.Visible) { xtraScrollableControl.Visible = true; } if (workUnits.Count == 0) { btnClose.Visible = false; try { tcMain.TabPages.Clear(); workUnits = GetWorkUnits(ref errCode, ref errText); if (errCode == 0) { HideErrorMessage(); List <string> filters = new List <string>(); foreach (WIPStationProductionStatus workUnit in workUnits) { #if DEBUG //workUnit.T47LeafID = 373564; #endif XtraTabPage page = tcMain.TabPages.Add(); page.Text = workUnit.T107Name; page.Tag = workUnit; ucUncontrolChart chartNone = new ucUncontrolChart(); chartNone.Dock = DockStyle.Fill; chartNone.Parent = page; filters.Add(workUnit.T107Code); ucCharts.Add(chartNone); } if (tcMain.TabPages.Count > 0) { tcMain_SelectedPageChanged( tcMain, new TabPageChangedEventArgs( null, tcMain.TabPages[0])); } foreach (string filter in filters) { InitConsumer(filter); } InitConsumer(stationUser.SysLogID.ToString()); } else { ShowErrorMessage(errText); } } finally { btnClose.Visible = true; } } } #endregion } }
private void timer_Tick(object sender, EventArgs e) { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); timer.Enabled = false; try { int errCode = 0; string errText = ""; if (stationUser == null || stationUser.SysLogID <= 0) { #region 获取当前站点登录信息 stationUser = PadLogin(ref errCode, ref errText); if (errCode != 0) { if (!lblErrorMessage.Visible) { lblErrorMessage.Visible = true; } if (xtraScrollableControl.Visible) { xtraScrollableControl.Visible = false; } lblErrorMessage.Text = errText; return; } else { if (lblErrorMessage.Visible) { lblErrorMessage.Visible = false; xtraScrollableControl.Visible = true; } lblErrorMessage.Text = ""; } #endregion } if (stationUser != null) { if (stationUser.SysLogID > 0) { if (!xtraScrollableControl.Visible) { xtraScrollableControl.Visible = true; } if (needRefreshed) { btnClose.Visible = false; try { workUnits = GetWorkUnits(); if (workUnits != null) { GenerateTileButtons(workUnits); } } finally { btnClose.Visible = true; } } IRAPKBClient.Instance.mfn_GetInfo_StationNeedRefreshed( stationUser.CommunityID, "MDV", stationUser.HostName, ref needRefreshed, out errCode, out errText); } else { if (!lblErrorMessage.Visible) { lblErrorMessage.Visible = true; } if (xtraScrollableControl.Visible) { xtraScrollableControl.Visible = false; } lblErrorMessage.Text = stationUser.ErrText; } } } catch (Exception error) { WriteLog.Instance.Write( error.Message, strProcedureName); if (!lblErrorMessage.Visible) { lblErrorMessage.Visible = true; } if (xtraScrollableControl.Visible) { xtraScrollableControl.Visible = false; } lblErrorMessage.Text = error.Message; } finally { timer.Interval = 5000; timer.Enabled = true; } }
public void DrawChart( StationLogin stationUser, WIPStationProductionStatus workUnit, string pwoNo, int t47LeafID, int t216LeafID, int t133LeafID, int t20LeafID) { string strProcedureName = string.Format( "{0}.{1}", className, MethodBase.GetCurrentMethod().Name); int errCode = 0; string errText = ""; #region 获取Xbar-R图数据 EntitySPCChart data = new EntitySPCChart(); WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { IRAPMESClient.Instance.ufn_GetInfo_SPCChart( stationUser.CommunityID, // 60010, pwoNo, // "1C3PK1A7BA50422003", t47LeafID, // 373564, t216LeafID, // 2155621, t133LeafID, //2155684, t20LeafID, //352942, stationUser.SysLogID, //101, ref data, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); if (errCode != 0) { return; } } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } #endregion if (data.UCL != 0 || data.LCL != 0) { chartType = XbarRChartType.Control; } Font font = new Font("新宋体", 12f); #region 填写表头 picLogo.Image = data.CompanyLogoImage; lblTitle.Text = data.ChartTitle; lblChartCode.Text = data.FormCode; edtT1002Name.Text = data.T1002Name; edtT1Name.Text = data.T1Name; edtT216Name.Text = data.T216Name; edtT133Code.Text = data.T133Code; edtOperator.Text = string.Format( "{0}[{1}]", data.OperatorCode, data.OperatorName); edtT102Name.Text = data.T102Name; edtT102Code.Text = data.T102Code; edtT20Name.Text = data.T20Name; edtEngineeringSpec.Text = data.EngineeringSpec; edtSamplingInterval.Text = data.SamplingInterval; edtMeasuredDate.Text = data.MeasuredDate; #endregion #region 绘制彩虹图 chartRainBow.Series.Clear(); Series pointMeasureData = new Series("测量值", ViewType.Point) { ArgumentScaleType = ScaleType.Qualitative, LabelsVisibility = DefaultBoolean.True, }; PointSeriesView view = new PointSeriesView(); view.Color = Color.Blue; view.PointMarkerOptions.BorderColor = Color.Blue; pointMeasureData.View = view; PointSeriesLabel label = pointMeasureData.Label as PointSeriesLabel; label.Font = font; label.TextColor = Color.Black; double maxValue = 0; double minValue = 0; List <RainbowChartMeasureData> datas = data.XMLToRainbowChartDataList(); List <ConstantLine> clineAxisXs = new List <ConstantLine>(); int opType = -1; int ocCount = 0; foreach (RainbowChartMeasureData pointData in datas) { if (maxValue == 0 || maxValue < pointData.Metric01.DoubleValue) { maxValue = pointData.Metric01.DoubleValue; } if (minValue == 0 || minValue > pointData.Metric01.DoubleValue) { minValue = pointData.Metric01.DoubleValue; } SeriesPoint point = new SeriesPoint( string.Format( "{0}\n{1}", pointData.Ordinal, pointData.MeasureTime), pointData.Metric01.DoubleValue); pointMeasureData.Points.Add(point); if (opType != pointData.OpType) { ocCount = 0; opType = pointData.OpType; if (opType == 4 || opType == 5 || opType == 6) { ConstantLine clineX = new ConstantLine(); clineX.ShowInLegend = false; clineX.AxisValueSerializable = point.Argument; switch (opType) { case 4: clineX.Title.Text = "首检开始"; break; case 5: clineX.Title.Text = "过程检开始"; break; case 6: clineX.Title.Text = "末检开始"; break; } clineX.Title.Alignment = ConstantLineTitleAlignment.Far; clineX.Title.TextColor = Color.Black; clineX.Title.Font = font; clineAxisXs.Add(clineX); } } if (pointData.OpType == 5) { if (ocCount >= 2) { if (ocCount % 2 == 0) { clineAxisXs.Add( new ConstantLine() { ShowInLegend = false, AxisValueSerializable = point.Argument, }); } } ocCount++; } } chartRainBow.Series.Add(pointMeasureData); XYDiagram xyDiagram = chartRainBow.Diagram as XYDiagram; if (xyDiagram != null) { double midValue = (data.LCLData.DoubleValue + data.UCLData.DoubleValue) / 2; double splitData = (data.USLData.DoubleValue - data.LSLData.DoubleValue) / 4; double ucl = data.USLData.DoubleValue - splitData; double lcl = data.LSLData.DoubleValue + splitData; xyDiagram.DefaultPane.BackColor = Color.Red; xyDiagram.AxisX.Label.Font = font; xyDiagram.AxisY.Label.Font = font; xyDiagram.AxisX.Title.Font = font; xyDiagram.AxisX.Title.Visibility = DefaultBoolean.True; xyDiagram.AxisX.Title.Text = "时间点"; xyDiagram.AxisY.Strips.Clear(); xyDiagram.AxisY.ConstantLines.Clear(); xyDiagram.AxisX.ConstantLines.Clear(); #region 画中值线 ConstantLine constantLine = new ConstantLine(); constantLine.ShowInLegend = false; constantLine.AxisValueSerializable = midValue.ToString(); constantLine.Color = Color.Black; constantLine.LineStyle.Thickness = 3; constantLine.Title.Text = "M"; constantLine.Title.Font = font; xyDiagram.AxisY.ConstantLines.Add(constantLine); #endregion constantLine = new ConstantLine(); constantLine.ShowInLegend = false; constantLine.AxisValueSerializable = data.UCLData.DoubleValue.ToString();// ucl.ToString(); constantLine.Color = Color.Black; constantLine.LineStyle.Thickness = 2; constantLine.Title.Text = "P-C"; constantLine.Title.Font = font; xyDiagram.AxisY.ConstantLines.Add(constantLine); constantLine = new ConstantLine(); constantLine.ShowInLegend = false; constantLine.AxisValueSerializable = data.LCLData.DoubleValue.ToString();// lcl.ToString(); constantLine.Color = Color.Black; constantLine.LineStyle.Thickness = 2; constantLine.Title.Text = "P-C"; constantLine.Title.Font = font; xyDiagram.AxisY.ConstantLines.Add(constantLine); constantLine = new ConstantLine(); constantLine.ShowInLegend = false; constantLine.AxisValueSerializable = data.USLData.DoubleValue.ToString(); constantLine.Color = Color.Black; constantLine.LineStyle.Thickness = 2; constantLine.Title.Text = "Tu"; constantLine.Title.Font = font; xyDiagram.AxisY.ConstantLines.Add(constantLine); constantLine = new ConstantLine(); constantLine.ShowInLegend = false; constantLine.AxisValueSerializable = data.LSLData.DoubleValue.ToString(); constantLine.Color = Color.Black; constantLine.LineStyle.Thickness = 2; constantLine.Title.Text = "Tl"; constantLine.Title.Font = font; xyDiagram.AxisY.ConstantLines.Add(constantLine); foreach (ConstantLine lineX in clineAxisXs) { xyDiagram.AxisX.ConstantLines.Add(lineX); } WholeRange wholeRange = xyDiagram.AxisY.WholeRange; wholeRange.AlwaysShowZeroLevel = false; wholeRange.Auto = false; //if (minValue > data.LSLData.DoubleValue) // wholeRange.MinValue = data.LSLData.DoubleValue; //else // wholeRange.MinValue = minValue; //if (maxValue < data.USLData.DoubleValue) // wholeRange.MaxValue = data.USLData.DoubleValue; //else // wholeRange.MaxValue = maxValue; wholeRange.MinValue = data.LSLData.DoubleValue; wholeRange.MaxValue = data.USLData.DoubleValue; wholeRange.SideMarginsValue = splitData; wholeRange.AutoSideMargins = false; //VisualRange visualRange = xyDiagram.AxisY.VisualRange; //visualRange.Auto = false; //visualRange.MinValue = data.LSLData.DoubleValue; //visualRange.MaxValue = data.USLData.DoubleValue; //visualRange.SideMarginsValue = 1; //visualRange.AutoSideMargins = true; Strip strip = new Strip(); strip.Color = Color.Yellow; strip.MinLimit.AxisValue = data.LSLData.DoubleValue; strip.MaxLimit.AxisValue = data.USLData.DoubleValue; strip.ShowInLegend = false; xyDiagram.AxisY.Strips.Add(strip); strip = new Strip(); strip.Color = Color.Lime; strip.MinLimit.AxisValue = data.LCLData.DoubleValue; strip.MaxLimit.AxisValue = data.UCLData.DoubleValue; strip.ShowInLegend = false; xyDiagram.AxisY.Strips.Add(strip); //strip = new Strip(); //strip.Color = Color.Yellow; //strip.MinLimit.AxisValue = data.UCLData.DoubleValue; //strip.MaxLimit.AxisValue = data.USLData.DoubleValue; //strip.ShowInLegend = false; //xyDiagram.AxisY.Strips.Add(strip); } chartRainBow.Legend.Font = font; #endregion #region 如果有需要报警的消息,则弹出报警对话框 switch (data.AnomalyType) { case 0: #region 如果是正常,则根据首检5片及过程检2片之后启动超时报警 if (datas.Count > 0) { bool startCountdown = false; int lastOpType = 0; int numCheckPoint = 0; for (int i = 0; i < datas.Count; i++) { if (lastOpType != datas[i].OpType) { lastOpType = datas[i].OpType; numCheckPoint = 1; startCountdown = false; continue; } else { numCheckPoint++; } if (lastOpType == 4 && numCheckPoint % 5 == 0) { startCountdown = true; } else if (lastOpType == 5 && numCheckPoint % 2 == 0) { startCountdown = true; } else { startCountdown = false; } } IRAPMessageBox.Instance.Hide(); if (startCountdown) { timerWarning.Enabled = false; Thread.Sleep(100); timerWarning.Enabled = true; } } else { IRAPMessageBox.Instance.Hide(); timerWarning.Enabled = false; } #endregion break; case 1: case 2: case 3: case 4: IRAPMessageBox.Instance.Hide(); timerWarning.Enabled = false; IRAPMessageBox.Instance.Show( //XtraMessageBox.Show( data.AnomalyDesc, "测量数据异常", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); #if !DEBUG #region 重置统计过程 if (data.C1ID != 0) { WriteLog.Instance.WriteBeginSplitter(strProcedureName); try { IRAPMESClient.Instance.usp_WriteLog_SPCReset( stationUser.CommunityID, data.C1ID, 373564, stationUser.SysLogID, out errCode, out errText); WriteLog.Instance.Write( string.Format("({0}){1}", errCode, errText), strProcedureName); } finally { WriteLog.Instance.WriteEndSplitter(strProcedureName); } //DrawChart(stationUser, workUnit, pwoNo, t47LeafID, t216LeafID, t133LeafID, t20LeafID); } #endregion #endif break; } #endregion }