public static void UpdataTrayData(string strStationName, string posName) { if (("取料站" == strStationName || "Barrel站" == strStationName) && posName.Contains("料盘")) { if (StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic().ContainsKey(posName)) { int indexofstring = posName.IndexOf("_"); string sub = posName.Substring(indexofstring + 1); indexofstring = sub.IndexOf("_"); sub = sub.Substring(0, indexofstring); int index = sub.ToInt(); if (posName.Contains($"_M_SP")) { TrayMgr.GetInstance().trayDataLoadArr[index - 1].PlaceLeftTopcoordinate = TrayMgr.GetInstance().trayDataLoadArr[index - 1].PickLeftTopcoordinate = new Coordinate() { X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX, Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY, Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ, }; TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init(); } if (posName.Contains($"_M_EP")) { TrayMgr.GetInstance().trayDataLoadArr[index - 1].PlaceRightBottomcoordinate = TrayMgr.GetInstance().trayDataLoadArr[index - 1].PickRightBottomcoordinate = new Coordinate() { X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX, Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY, Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ, }; TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init(); } if (posName.Contains($"_V_SP")) { TrayMgr.GetInstance().trayDataLoadArr[index - 1].SnapLeftTopcoordinate = new Coordinate() { X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX, Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY, Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ, }; TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init(); } if (posName.Contains($"_V_EP")) { TrayMgr.GetInstance().trayDataLoadArr[index - 1].SnapRightBottomcoordinate = new Coordinate() { X = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointX, Y = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointY, Z = StationMgr.GetInstance().GetStation(strStationName).GetStationPointDic()[posName].pointZ, }; TrayMgr.GetInstance().trayDataLoadArr[index - 1].Init(); } } } }
public static void BuildStationNpc(StationMgr stationMgr) { if (stationMgr == null) { return; } GameObject go = GameObject.Find("Npc/NpcRoot"); if (go == null) { return; } Transform npcRootTrans = go.transform; if (npcRootTrans == null) { return; } int stationCount = npcRootTrans.childCount; for (int i = 0; i < stationCount; ++i) { Transform stationTrans = npcRootTrans.GetChild(i); System.UInt16 stationIndex = (System.UInt16)System.Enum.Parse(typeof(StationType), stationTrans.gameObject.name); Station station = stationMgr.GetStation(stationIndex); if (station == null) { return; } VVV(station, stationTrans, stationIndex); } }
/// <summary> /// 关闭工站/设备,释放各种资源 /// </summary> public void Close() { string errInfo = ""; ///关闭工站 IJFMainStation mainStation = StationMgr.MainStation; if (null != mainStation) { mainStation.Stop(out errInfo); } string[] stationNames = StationMgr.AllStationNames(); if (null != stationNames && stationNames.Length > 0) { foreach (string stationName in stationNames) { IJFStation station = StationMgr.GetStation(stationName); station.Stop(); } } ///关闭所有设备 string[] deviceIDs = InitorManager.GetIDs(typeof(IJFDevice)); if (null != deviceIDs && deviceIDs.Length > 0) { foreach (string devID in deviceIDs) { IJFDevice dev = InitorManager.GetInitor(devID) as IJFDevice; dev.CloseDevice(); } } ///释放其他对象 ///添加代码 ... }
public static void BuildStationCamera(StationMgr stationMgr) { if (stationMgr == null) { return; } GameObject go = GameObject.Find("Camera/CameraRoot"); if (go == null) { return; } Transform cameraRootTrans = go.transform; int stationCount = cameraRootTrans.childCount; Transform tempTrans = null; for (int i = 0; i < stationCount; ++i) { tempTrans = cameraRootTrans.GetChild(i); System.UInt16 stationIndex = (System.UInt16)System.Enum.Parse(typeof(StationType), tempTrans.gameObject.name); Station station = stationMgr.GetStation(stationIndex); if (station == null) { return; } Dictionary <UInt16, Camera> tempDict = new Dictionary <UInt16, Camera> (); RRR(station, tempTrans, stationIndex, tempDict); } }
private void LoadProductFile(string strFile) { if (InvokeRequired) { this.BeginInvoke(new Action(() => LoadProductFile(strFile))); } else { label_CurrentFile.Text = "当前产品:" + strFile; //读取工站位置坐标 ConfigToolMgr.GetInstance().UpdatePointFilePath(); Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>(); foreach (var tem in StationMgr.GetInstance().GetAllStationName()) { ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit); StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit); } ConfigToolMgr.GetInstance().UpdataMoveparamconfigPath(); ConfigToolMgr.GetInstance().ReadMoveParamConfig(); ConfigToolMgr.GetInstance().ReadHomeParamConfig(); VisionMgr.GetInstance().CurrentVisionProcessDir = ParamSetMgr.GetInstance().CurrentWorkDir + "\\" + ParamSetMgr.GetInstance().CurrentProductFile + "\\" + @"Config\Vision\"; VisionMgr.GetInstance().Read(); ParamSetMgr.GetInstance().m_eventLoadProductFileUpadata?.Invoke(); //VisionMgr.GetInstance().PrItemChangedEvent GC.Collect(); } }
public static StationMgr BuildStationPoint() { GameObject go = GameObject.Find("Point/PointRoot"); if (go == null) { return(null); } Transform pointRootTrans = go.transform; if (pointRootTrans == null) { return(null); } StationMgr stationMgr = new StationMgr(); int stationCount = pointRootTrans.childCount; for (int i = 0; i < stationCount; ++i) { Transform stationTrans = pointRootTrans.GetChild(i); System.UInt16 stationIndex = (System.UInt16)System.Enum.Parse(typeof(StationType), stationTrans.gameObject.name); Station station = XXX(stationTrans); stationMgr.AddStation2Mgr(stationIndex, station); } go.transform.parent.gameObject.SetActive(false); return(stationMgr); }
public static void AddStation() { //添加工站 StationMgr.GetInstance().AddStation(new StationForm(), "AA站", new StationAA(StationMgr.GetInstance().GetStation("AA站"))); StationMgr.GetInstance().AddStation(new StationForm(), "转盘站", new StationTable(StationMgr.GetInstance().GetStation("转盘站"))); StationMgr.GetInstance().AddStation(new StationForm(), "点胶站", new StationDisp(StationMgr.GetInstance().GetStation("点胶站"))); Dictionary <Form, Stationbase> keyValuePairs = StationMgr.GetInstance().GetDicStaion(); }
public bool IsCanLeave(bool bmanual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{lb.LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; return(lb.CheckJackUpCliyderStateInPos(false) && bIsAxisStop); }
public override bool IsCanLeave(bool bmanual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmanual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; bool bIsAxisInPosOnOutPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dDischargePos) < 0.3; return(CheckJackUpCliyderStateInPos(false) && bIsAxisStop && bIsAxisInPosOnOutPos); }
private void button_start_Click(object sender, EventArgs e) { UserTest.RunLog.Write($"【点击启动】", LogType.Info, PathHelper.LogPathManual); //ProcessSysIo("启动", true); if (GlobalVariable.g_StationState == StationState.StationStateStop) { if (!IsSafeDoorAndGrating()) { return; } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } StationMgr.GetInstance().Run(); // sys.g_StationState = StationState.StationStateRun; } else if (GlobalVariable.g_StationState == StationState.StationStateRun) { // sys.g_StationState = StationState.StationStatePause; //暂停 StationMgr.GetInstance().Pause(); } else if (GlobalVariable.g_StationState == StationState.StationStatePause) { if (!IsSafeDoorAndGrating()) { return; } IOMgr.GetInstace().WriteIoBit("绿灯", false); IOMgr.GetInstace().WriteIoBit("红灯", false); IOMgr.GetInstace().WriteIoBit("黄灯", true); IOMgr.GetInstace().WriteIoBit("蜂鸣", false); StationMgr.GetInstance().Resume(); } else if (GlobalVariable.g_StationState == StationState.StationStateEmg) { MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } }
private APP() { MotionMgr = MotionMgr.GetInstace(); IOMgr = IOMgr.GetInstace(); AlarmMgr = AlarmMgr.GetIntance(); ConfigToolMgr = ConfigToolMgr.GetInstance(); StationMgr = StationMgr.GetInstance(); ParamSetMgr = ParamSetMgr.GetInstance(); ComMgr = ComMgr.GetInstance(); TcpMgr = TcpMgr.GetInstance(); SocketSeverMgr = SocketSeverMgr.GetInstace(); }
private void button_start_Click(object sender, EventArgs e) { // ProcessSysIo("启动", true); if (GlobalVariable.g_StationState == StationState.StationStateStop) { if (!IsSafeDoorAndGrating()) { return; } ParamSetMgr.GetInstance().SetBoolParam("启动清料", false); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } StationMgr.GetInstance().Run(); // sys.g_StationState = StationState.StationStateRun; } else if (GlobalVariable.g_StationState == StationState.StationStateRun) { // sys.g_StationState = StationState.StationStatePause; //暂停 StationMgr.GetInstance().Pause(); } else if (GlobalVariable.g_StationState == StationState.StationStatePause) { if (!IsSafeDoorAndGrating()) { return; } IOMgr.GetInstace().WriteIoBit("绿灯", false); IOMgr.GetInstace().WriteIoBit("红灯", false); IOMgr.GetInstace().WriteIoBit("黄灯", true); IOMgr.GetInstace().WriteIoBit("蜂鸣", false); StationMgr.GetInstance().Resume(); } else if (GlobalVariable.g_StationState == StationState.StationStateEmg) { MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void BuildPointInfo(StationMgr stationMgr) { if (stationMgr == null) { return; } foreach (var item in System.Enum.GetValues(typeof(StationType))) { Station station = stationMgr.GetStation((System.UInt16)item); BBB(station); } }
public override bool IsOutFinishDealOK(bool bmaual) { if (MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) > AxisState.NormalStop) { AlarmMgr.GetIntance().WarnWithDlg($"流水线{LineName} 在出料前,轴{MotionMgr.GetInstace().GetAxisName(nAxisNo)} ,报警{MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo).ToString()},程序停止", null, CommonDlg.DlgWaranType.WaranOK, null, bmaual); StationMgr.GetInstance().Stop(); } bool bIsAxisStop = MotionMgr.GetInstace().IsAxisNormalStop(nAxisNo) == AxisState.NormalStop; double pos = MotionMgr.GetInstace().GetAxisActPos(nAxisNo); bool bIsAxisInPosOnFeedPos = Math.Abs(MotionMgr.GetInstace().GetAxisActPos(nAxisNo) - dFeedPos) < 0.3; return(bIsAxisStop & bIsAxisInPosOnFeedPos); }
public void Init() { Stopwatch sw = new Stopwatch(); sw.Start(); m_stationMgr = ReadStationPoint.BuildStationPoint(); ReadStationPoint.BuildPointInfo(m_stationMgr); ReadStationPoint.BuildStationDevices(m_stationMgr); ReadStationPoint.BuildStationNpc(m_stationMgr); ReadStationPoint.BuildStationCamera(m_stationMgr); sw.Stop(); TimeSpan ts2 = sw.Elapsed; UnityEngine.Debug.Log("sw总共花费" + ts2.TotalMilliseconds + "ms."); }
private static void JJJ(StationMgr stationMgr, DeviceMgr deviceMgr, Transform deviceTypeTrans, System.UInt16 stationIndex, DeviceType deviceType) { int deviceCount = deviceTypeTrans.childCount; for (int i = 0; i < deviceCount; ++i) { Transform deviceTrans = deviceTypeTrans.GetChild(i); string deviceName = deviceTrans.gameObject.name; Device deviceCom = deviceTrans.GetComponent <Device> (); if (deviceCom == null) { continue; } deviceCom.DeviceId = (int)deviceType + i + 1; deviceCom.StationIndex = stationIndex; deviceCom.DeviceType = deviceType; deviceMgr.AddDevice(deviceCom); OneStation station = TDFramework.SingletonMgr.GameGlobalInfo.StationDeviceAndPointInfo.GetStation(stationIndex); // deviceType, deviceName PointBindInfoList list = station.GetPointBindInfoList(deviceType, deviceName); int pointCount = list.m_pointBindInfoList.Count; for (int j = 0; j < pointCount; ++j) { PointBindInfo pointBindInfo = list.m_pointBindInfoList[j]; int pointStatus = (int)System.Enum.Parse(typeof(PointStatus), pointBindInfo.m_name); int queueIndex = pointBindInfo.m_queueIndex; Point point = GetFirstPoint(stationMgr, stationIndex, pointStatus, queueIndex); point.m_device = deviceCom; } #region 设备是屏蔽门,需管理上行和下行屏蔽门 if (deviceCom is PingBiMenDevice) { PingBiMenMgr pingBiMenMgr = (PingBiMenMgr)deviceMgr; PingBiMenDevice device = (PingBiMenDevice)deviceCom; if (device.PingBiMenType == PingBiMenType.Down) { //下行屏蔽门 pingBiMenMgr.AddDevice2XiaXingPingBiMenList(deviceCom); } else if (device.PingBiMenType == PingBiMenType.Up) { //上行屏蔽门 pingBiMenMgr.AddDevice2ShangXingPingBiMenList(deviceCom); } } #endregion } }
/// <summary> /// 初始化产品数据参数 /// </summary> public static void InitProductNum() { NozzleMgr.GetInstance().Read(); try { StationTable stationTable = (StationTable)StationMgr.GetInstance().GetStation("转盘站"); TableData.GetInstance().Add(stationTable.GetStationPointDic()["A工位AA位"].pointU, 2); TableData.GetInstance().Add(stationTable.GetStationPointDic()["A工位夹取位"].pointU, 2); TableData.GetInstance().Add(stationTable.GetStationPointDic()["B工位AA位"].pointU, 1); TableData.GetInstance().Add(stationTable.GetStationPointDic()["B工位夹取位"].pointU, 1); TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["A工位AA位"].pointU, "A_AA"); TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["A工位夹取位"].pointU, "A_Pick"); TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["B工位AA位"].pointU, "B_AA"); TableData.GetInstance().AddPosStationName(stationTable.GetStationPointDic()["B工位夹取位"].pointU, "B_Pick"); TableData.GetInstance().AddStationResult("A_AA", false); TableData.GetInstance().AddStationResult("A_Pick", false); TableData.GetInstance().AddStationResult("B_AA", false); TableData.GetInstance().AddStationResult("B_Pick", false); TableData.GetInstance().AddStationResult("A_UnLoadLoad", false); TableData.GetInstance().AddStationResult("B_UnLoadLoad", false); TableData.GetInstance().dicTableCmdStart.Add("A_AA", false); TableData.GetInstance().dicTableCmdStart.Add("B_AA", false); TableData.GetInstance().dicTableCmdStart.Add("A_Pick", false); TableData.GetInstance().dicTableCmdStart.Add("B_Pick", false); TableData.GetInstance().dicTableCmdStart.Add("A_UnLoadLoad", false); TableData.GetInstance().dicTableCmdStart.Add("B_UnLoadLoad", false); TableData.GetInstance().AxisNo = stationTable.AxisU; TableData.GetInstance().listPoss.Clear(); TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["A工位夹取位"].pointU); TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["A工位AA位"].pointU); TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["B工位夹取位"].pointU); TableData.GetInstance().listPoss.Add(stationTable.GetStationPointDic()["B工位AA位"].pointU); } catch (Exception e) { } // }
private static void PointBindDevice(string[] str, StationMgr stationMgr, System.UInt16 stationIndex, Device deviceCom) { if (str.Length >= 3) { int pointStatus = (int)System.Enum.Parse(typeof(PointStatus), str[1]); int queueIndex1 = int.Parse(str[2]); Point point = GetFirstPoint(stationMgr, stationIndex, pointStatus, queueIndex1); point.m_device = deviceCom; if (str.Length == 4) { //有两个点关联同一个设备 int queueIndex2 = int.Parse(str[3]); point = GetFirstPoint(stationMgr, stationIndex, pointStatus, queueIndex2); point.m_device = deviceCom; } } }
private void button_stop_Click(object sender, EventArgs e) { if (MessageBox.Show("是否确定停止", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } _logger.Info("stop:开始"); if (GlobalVariable.g_StationState == StationState.StationStateRun || GlobalVariable.g_StationState == StationState.StationStatePause) { StationMgr.GetInstance().Stop(); } else { DoWhile.StopCirculate(); } _logger.Info("stop:结束"); AlarmMgr.GetIntance().StopAlarmBeet(); }
private bool checkSafe() { StationAA stationAA = (StationAA)StationMgr.GetInstance().GetStation("AA站"); StationDisp stationDisp = (StationDisp)StationMgr.GetInstance().GetStation("点胶站"); double SafeHeightAA = stationAA.GetStationPointDic()["安全位置"].pointZ; double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; double getAAPos = MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ); double getDispPos = MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ); if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || getAAPos < SafeHeightAA - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } return(false); } if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || getDispPos < SafeHeightDisp - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } return(false); } //if (!IOMgr.GetInstace().ReadIoInBit("A治具盖上检测")) if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("A")) { MessageBox.Show("转盘运动前,检查A治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); return(false); } // if (!IOMgr.GetInstace().ReadIoInBit("B治具盖上检测")) if (!SysFunConfig.LodUnloadPatten.IsSafeWhenURun("B")) { MessageBox.Show("转盘运动前,检查B治具盖上检测失败!", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); return(false); } Info($"安全位置检查成功,disp:{MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ)}aa:{ MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ)}."); return(true); }
public static bool IsSafeWhenTableAxisMoveHandler(int nAxisNo, double currentpos, double dsstpos, MoveType moveType) { StationAA stationAA = (StationAA)StationMgr.GetInstance().GetStation("AA站"); StationDisp stationDisp = (StationDisp)StationMgr.GetInstance().GetStation("点胶站"); double SafeHeightAA = stationAA.GetStationPointDic()["安全位置"].pointZ; double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; // double SafeHeightDisp = stationDisp.GetStationPointDic()["安全位置"].pointZ; if (MotionMgr.GetInstace().GetAxisName(nAxisNo) == "U") { if (MotionMgr.GetInstace().GetHomeFinishFlag(stationAA.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationAA.AxisZ) < SafeHeightAA - 0.5) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查AA站Z轴没有回原点或者低于安全高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(false); } if (MotionMgr.GetInstace().GetHomeFinishFlag(stationDisp.AxisZ) != AxisHomeFinishFlag.Homed || MotionMgr.GetInstace().GetAxisPos(stationDisp.AxisZ) < SafeHeightDisp - 1) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.Error("转盘运动前,检查点胶站Z轴没有回原点或者低于吐胶点高度"); return(false); } if (ParamSetMgr.GetInstance().GetBoolParam("是否侧向UV") && (!IOMgr.GetInstace().ReadIoInBit("左侧UV原位") || !IOMgr.GetInstace().ReadIoInBit("左侧UV原位"))) { if (GlobalVariable.g_StationState != StationState.StationStateRun) { MessageBox.Show("转盘运动前,左右UV是否在原位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.Error("转盘运动前,左右UV是否在原位"); return(false); } } return(true); }
private void button_stop_Click(object sender, EventArgs e) { UserTest.RunLog.Write($"点击【停止】", LogType.Info, PathHelper.LogPathManual); if (MessageBox.Show("是否确定停止? 如果为回零状态会关闭软件!", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } if (!Form_Auto.IsHome) { IsShowCloseForm = true; Form_Auto.EvenStop(); this.Close(); } else { _logger.Info("stop:开始"); StationMgr.GetInstance().Stop(); _logger.Info("stop:结束"); AlarmMgr.GetIntance().StopAlarmBeet(); } }
private static void HHH(StationMgr stationMgr, Station station, Transform stationTrans, System.UInt16 stationIndex) { int deviceTypeCount = stationTrans.childCount; for (int i = 0; i < deviceTypeCount; ++i) { DeviceMgr deviceMgr = null; Transform deviceTypeTrans = stationTrans.GetChild(i); DeviceType deviceType = (DeviceType)System.Enum.Parse(typeof(DeviceType), deviceTypeTrans.gameObject.name); if (deviceType == DeviceType.ZhaJi) { deviceMgr = new ZhaJiMgr(); } else if (deviceType == DeviceType.PingBiMen) { deviceMgr = new PingBiMenMgr(); } //deviceTypeTrans是闸机父容器或者屏蔽门父容器 JJJ(stationMgr, deviceMgr, deviceTypeTrans, stationIndex, deviceType); station.AddDeviceMgr(deviceMgr); } }
public static void bandStationAndVisionCtrl(string stationname, VisionControl visionControl, int index = 1) { Stationbase pb = StationMgr.GetInstance().GetStation(stationname); switch (index) { case 1: pb.VisionControl = visionControl; break; case 2: pb.VisionControl2 = visionControl; break; case 3: pb.VisionControl3 = visionControl; break; case 4: pb.VisionControl4 = visionControl; break; } }
private static Point GetFirstPoint(StationMgr stationMgr, System.UInt16 stationIndex, int pointStatus, int queueIndex) { Point point = stationMgr.GetFirstPoint(stationIndex, pointStatus, queueIndex); return(point); }
private void button_pause_Click(object sender, EventArgs e) { StationMgr.GetInstance().Pause(); }
private void Form1_Load(object sender, EventArgs e) { #region 变量定义 run = DateTime.Now; #endregion #region 初始化参数配置 EvenAddPara(); //读工站配置 ConfigToolMgr.GetInstance().ReadStationConfig(); //读取用户设置 ConfigToolMgr.GetInstance().ReadUserConfig(); ConfigToolMgr.GetInstance().ReadUserParam(); //读取产品文件 ConfigToolMgr.GetInstance().ReadProductDir_Name(); //添加工位 UserConfig.AddStation(); //读取工站位置坐标 Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>(); foreach (var tem in StationMgr.GetInstance().GetAllStationName()) { ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit); StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit); } GlobalVariable.g_StationState = StationState.StationStateStop; UserTest.algType = ParamSetMgr.GetInstance().GetStringParam("算法类型"); #endregion #region 初始化硬件 EvenAddHardware(); ConfigToolMgr.GetInstance().ReadEthConfig(); ConfigToolMgr.GetInstance().ReadComConfig(); //读硬件配置 并创建IO,Motion 卡类 对象 并以默认参数配置卡 ConfigToolMgr.GetInstance().ReadMotionCardConfig(); ConfigToolMgr.GetInstance().ReadIoCardConfig(); ConfigToolMgr.GetInstance().ReadIoInputConfig(); ConfigToolMgr.GetInstance().ReadIoOutputConfig(); //读运动配置 ConfigToolMgr.GetInstance().ReadMoveParamConfig(); ConfigToolMgr.GetInstance().ReadHomeParamConfig(); //初始化IO Motion if (!IOMgr.GetInstace().initAllIoCard()) { MessageBox.Show("初始化IO卡失败"); return; } if (!MotionMgr.GetInstace().OpenAllCard()) { MessageBox.Show("初始化控制卡失败"); return; } #endregion #region 初始化界面加载 Ver.Text = "软件版本:" + System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("1.yyyy.MMdd.HHmm"); //界面加载初始化 this.WindowState = FormWindowState.Maximized; int BtnHeight = button_stop.Height + 10; panel_window.Location = new System.Drawing.Point(0, BtnHeight); panel_window.Size = new Size(this.Width - 30, this.Height - BtnHeight - 1); Form_Auto autoform = new Form_Auto(); m_dicAllWindows.Add(button_Home, autoform); m_dicAllWindows.Add(button_Set, new Form_Set()); m_dicAllWindows.Add(button_vision, new Form_VisionDebug()); m_dicAllWindows.Add(button_Param, new Form_ParamSet()); m_dicAllWindows.Add(button_UserSMgr, new UserManger()); m_currentForm = autoform; autoform.TopLevel = false; autoform.Dock = DockStyle.Fill; autoform.Parent = this.panel_window; autoform.Show(); //初始化登入权限 User user = new User(); int index = sys.g_listUser.FindIndex(t => t._userName == "admin"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.超级管理员 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "user"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.客户操作员 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "debug"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.调试工程师 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "engineer"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.软件工程师 }; sys.g_listUser.Add(user); } #endregion }
public void ProcessSysIo(string strIoName, bool bCurrentState) { if (InvokeRequired) { this.BeginInvoke(new Action(() => ProcessSysIo(strIoName, bCurrentState))); } else { if (strIoName == "急停" && !bCurrentState && !bAlreadyEmg) { bAlreadyEmg = true; if (GlobalVariable.g_StationState == StationState.StationStateRun || GlobalVariable.g_StationState == StationState.StationStatePause) { MotionMgr.GetInstace().StopEmg(); StationMgr.GetInstance().Stop(); MotionMgr.GetInstace().StopEmg(); } GlobalVariable.g_StationState = StationState.StationStateEmg; if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", false); } //IOMgr.GetInstace().WriteIoBit("蜂鸣", true); alarmtimer.Interval = 500; alarmtimer.Start(); AlarmMgr.GetIntance().Warn("急停被按下,点击后关闭软件!", AlarmType.AlarmType_Emg); AlarmMgr.GetIntance().StopAlarmBeet(); this.Close(); } if (strIoName == "安全门" && !bCurrentState) { if (ParamSetMgr.GetInstance().GetBoolParam("启用安全门")) { if (GlobalVariable.g_StationState == StationState.StationStateRun) { StationMgr.GetInstance().Pause(); IOMgr.GetInstace().WriteIoBit("绿灯", false); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } //AlarmMgr.GetIntance().Warn("安全门打开"); MessageBox.Show("安全门打开", "Waran", MessageBoxButtons.OK, MessageBoxIcon.Warning); // WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全门打开", null, DlgWaranType.WaranOK); } } } if (strIoName == "暂停" && bCurrentState) { if (GlobalVariable.g_StationState == StationState.StationStateRun) { StationMgr.GetInstance().Pause(); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } //AlarmMgr.GetIntance().Warn("安全门打开"); // WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全门打开", null, DlgWaranType.WaranOK); } } if (strIoName == "安全光栅" && !bCurrentState) { if (ParamSetMgr.GetInstance().GetBoolParam("启用安全光栅")) { if (ParamSetMgr.GetInstance().GetBoolParam("启用安全光栅")) { if (GlobalVariable.g_StationState == StationState.StationStateRun) { StationMgr.GetInstance().Pause(); IOMgr.GetInstace().WriteIoBit("绿灯", false); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } // AlarmMgr.GetIntance().Warn("安全光栅打开"); //WaranResult waranResult = AlarmMgr.GetIntance().WarnWithDlg("安全光栅打开", null, DlgWaranType.WaranOK); MessageBox.Show("安全光栅打开", "Waran", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } if (strIoName == "启动" && bCurrentState) { if (GlobalVariable.g_StationState == StationState.StationStateStop) { if (!IsSafeDoorAndGrating()) { return; } Thread.Sleep(500); StationMgr.GetInstance().Run(); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } } else if (GlobalVariable.g_StationState == StationState.StationStatePause) { if (!IsSafeDoorAndGrating()) { return; } StationMgr.GetInstance().Resume(); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } } else { MessageBox.Show("发生错误,请先复位", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (strIoName == "复位" && bCurrentState) { if (GlobalVariable.g_StationState == StationState.StationStateEmg) { alarmtimer.Stop(); GlobalVariable.g_StationState = StationState.StationStateStop; MotionMgr.GetInstace().ResetAxis(); if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯")) { IOMgr.GetInstace().WriteIoBit("绿灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯")) { IOMgr.GetInstace().WriteIoBit("红灯", false); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯")) { IOMgr.GetInstace().WriteIoBit("黄灯", true); } if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣")) { IOMgr.GetInstace().WriteIoBit("蜂鸣", false); } bStartAlarmTimer = false; bAlreadyEmg = false; } } } }
public bool Carray(bool bmanul = false) { Info("右剥料工站:搬运气缸开始搬运物料"); WaranResult waranResult; // CheckAndUp(bmanul); retry_carry_up: ParamSetMgr.GetInstance().SetBoolParam("右剥料完成", false); Info("右装料Z轴气缸电磁阀 上升"); IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", false); waranResult = CheckIobyName("右装料Z轴气缸原位", true, "右剥料工站:右装料Z轴气缸电磁阀 上升失败,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carry_up; } StationRightPackage stationLeftPackage = (StationRightPackage)StationMgr.GetInstance().GetStation("右贴装站"); int AxisYNooFPageBack = stationLeftPackage.AxisY; int AxiXYNooFPageBack = stationLeftPackage.AxisX; retry_carryMoving: if (MotionMgr.GetInstace().GetHomeFinishFlag(AxisY) == AxisHomeFinishFlag.Homed && MotionMgr.GetInstace().GetAxisPos(AxisY) > GetStationPointDic()["剥料准备位"].pointY - 50 && MotionMgr.GetInstace().GetHomeFinishFlag(AxisYNooFPageBack) == AxisHomeFinishFlag.Homed && MotionMgr.GetInstace().GetAxisPos(AxisYNooFPageBack) < stationLeftPackage.GetStationPointDic()["搬料安全位"].pointY - 50 ) { #if false IOMgr.GetInstace().WriteIoBit("右剥料前推压紧气缸电磁阀", true); waranResult = CheckIobyName("右剥料前推压紧气缸到位", true, "右剥料工站:右剥料前推压紧气缸到位失败,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carryMoving; } IOMgr.GetInstace().WriteIoBit("右剥料压紧气缸电磁阀", true); waranResult = CheckIobyName("右剥料压紧气缸到位", true, "右剥料工站:右剥料压紧气缸到位失败,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carryMoving; } #endif Info("右装料搬运气缸电磁阀 移动搬料"); IOMgr.GetInstace().WriteIoBit("右装料搬运气缸电磁阀", true); waranResult = CheckIobyName("右装料搬运气缸到位", true, "右剥料工站:右装料搬运气缸到位失败,物料可能掉落,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carryMoving; } // CheckBuzzerPlaneAndUp(); retry_carry_down: Info("右装料Z轴气缸电磁阀 下降"); IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", true); waranResult = CheckIobyName("右装料Z轴气缸到位", true, "右剥料工站:右装料Z轴气缸原下降失败,物料可能掉落,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carry_down; } Info("右装料真空吸电磁阀 关闭"); Info("右装料破真空电磁阀 打开"); Info("右剥料真空吸电磁阀 打开"); IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", true); IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false); IOMgr.GetInstace().WriteIoBit("右剥料真空吸电磁阀", true); Thread.Sleep(ParamSetMgr.GetInstance().GetIntParam("吸真空延时")); IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false); retry_carry_up2: Info("右装料Z轴气缸电磁阀 上升"); IOMgr.GetInstace().WriteIoBit("右装料Z轴气缸电磁阀", false); waranResult = CheckIobyName("右装料Z轴气缸原位", true, "右剥料工站:右装料Z轴气缸电磁阀 上升 失败,请检查气缸和感应器 线路 ", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carry_up2; } waranResult = CheckIobyName("右剥料真空检测", true, "右剥料工站:Carray:蜂鸣器片 在剥料平台未吸紧", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carry_down; } Info("右装料真空吸电磁阀 复检 检查料是否脱落"); IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false); IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", true); waranResult = CheckIobyName("右装料真空检测", false, "右剥料工站 :Carray:蜂鸣器片 在装料抓手上未脱离", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carry_down; } IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false); retry_carryMovingback: Info("右装料搬运气缸电磁阀 移动搬料"); IOMgr.GetInstace().WriteIoBit("右装料搬运气缸电磁阀", false); waranResult = CheckIobyName("右装料搬运气缸原位", true, "右剥料工站:Carray:搬运气缸回到原位", bmanul); if (waranResult == WaranResult.Retry) { goto retry_carryMovingback; } IOMgr.GetInstace().WriteIoBit("右装料真空吸电磁阀", false); IOMgr.GetInstace().WriteIoBit("右装料破真空电磁阀", false); IOMgr.GetInstace().WriteIoBit("右剥料真空吸电磁阀", false); IOMgr.GetInstace().WriteIoBit("右剥料后压紧气缸电磁阀", false); ParamSetMgr.GetInstance().SetIntParam("右剥料次数", 0); NozzleMgr.GetInstance().nozzleArr[(int)NozzleType.RightStripNozzle].nozzleState = NozzleState.None; PlaneMgr.GetInstance().PlaneArr[(int)PlaneType.rightStripPlane].planeState = PlaneState.Have; return(true); } else { Info("Y轴 在剥料准备位前 不能移动 请挪开 或者 右剥料平台Y轴 没有回原点"); return(false); WaranResult waranResult2 = AlarmMgr.GetIntance().WarnWithDlg("Y轴 在剥料准备位前 不能移动 请挪开 或者 右剥料平台Y轴 没有回原点", bmanul ? null : this, CommonDlg.DlgWaranType.WaranInorge_Stop_Pause_Retry); if (waranResult2 == WaranResult.Retry) { goto retry_carryMoving; } } }
private void Form1_Load(object sender, EventArgs e) { //读取网口串口配置 ParamSetMgr.GetInstance().SetBoolParam("启用安全门", true); ParamSetMgr.GetInstance().SetBoolParam("启用安全光栅", true); ConfigToolMgr.GetInstance().ReadEthConfig(); ConfigToolMgr.GetInstance().ReadComConfig(); //读硬件配置 并创建IO,Motion 卡类 对象 并以默认参数配置卡 ConfigToolMgr.GetInstance().ReadMotionCardConfig(); ConfigToolMgr.GetInstance().ReadIoCardConfig(); ConfigToolMgr.GetInstance().ReadIoInputConfig(); ConfigToolMgr.GetInstance().ReadIoOutputConfig(); //读工站配置 ConfigToolMgr.GetInstance().ReadStationConfig(); //读取用户设置 ConfigToolMgr.GetInstance().ReadUserConfig(); //读取产品文件 ConfigToolMgr.GetInstance().ReadProductDir_Name(); //读运动配置 ConfigToolMgr.GetInstance().ReadMoveParamConfig(); ConfigToolMgr.GetInstance().ReadHomeParamConfig(); ConfigToolMgr.GetInstance().ReadUserParam(); //视觉x文件路径初始化 VisionMgr.GetInstance().CurrentVisionProcessDir = ParamSetMgr.GetInstance().CurrentWorkDir + "\\" + ParamSetMgr.GetInstance().CurrentProductFile + "\\" + @"Config\Vision\"; string str = VisionMgr.GetInstance().CurrentVisionProcessDir; //初始化 Motion IO MotionMgr.GetInstace().OpenAllCard(); IOMgr.GetInstace().initAllIoCard(); //AA参数加载 UserConfig.BandEventOnForm1(this); this.WindowState = FormWindowState.Maximized; int BtnHeight = button_stop.Height + 10; panel_window.Location = new System.Drawing.Point(0, BtnHeight); panel_window.Size = new Size(this.Width - 30, this.Height - BtnHeight - 1); Form_Auto autoform = new Form_Auto(); m_dicAllWindows.Add(button_Home, autoform); m_dicAllWindows.Add(button_Set, new Form_Set()); m_dicAllWindows.Add(button_vision, new Form_VisionDebug()); m_dicAllWindows.Add(button_Param, new Form_ParamSet()); m_dicAllWindows.Add(button_UserSMgr, new UserManger()); m_currentForm = autoform; UserConfig.AddStation(); //读取工站位置坐标 Dictionary <string, PointInfo> dicPonit = new Dictionary <string, PointInfo>(); foreach (var tem in StationMgr.GetInstance().GetAllStationName()) { ConfigToolMgr.GetInstance().ReadPoint(tem, out dicPonit); StationMgr.GetInstance().GetStation(tem).SetStationPointDic(dicPonit); } // 注册安全函数 UserConfig.AddIoSafeOperate(); UserConfig.AddAxisSafeOperate(); //初始化 工站状态 GlobalVariable.g_StationState = StationState.StationStateStop; IOMgr.GetInstace().m_deltgateSystemSingl += ProcessSysIo; MotionMgr.GetInstace().m_eventAxisSingl += ProcessSysIo; autoform.TopLevel = false; autoform.Dock = DockStyle.Fill; autoform.Parent = this.panel_window; autoform.Show(); //初始化权限 sys.g_eventRightChanged += ChangedUserRight; User user = new User(); int index = sys.g_listUser.FindIndex(t => t._userName == "admin"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.超级管理员 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "user"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.客户操作员 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "debug"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.调试工程师 }; sys.g_listUser.Add(user); } index = sys.g_listUser.FindIndex(t => t._userName == "engineer"); if (index == -1) { user = new User() { _userName = "******", _userPassWord = "******", _userRight = UserRight.软件工程师 }; sys.g_listUser.Add(user); } GlobalVariable.g_eventStationStateChanged += StationStateChangedHandler; }