private bool DeleteDeviceFromDB(int id) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(TheLoop.Controller.Project.SavePath, logger, _fileService); IDBFileVersionService dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(DBFileVersionManager.CurrentDBFileVersion); IDeviceDBServiceTest deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(TheLoop.Controller.Type, dbFileVersionService); if (deviceDBService.DeleteDeviceByID(id)) { if (BusinessLib.ProjectManager.GetInstance.MaxDeviceIDInController8021 == id) //如果最大ID等于被删除的ID,则重新赋值 { ControllerOperation8021 controllerOperation = new ControllerOperation8021(); BusinessLib.ProjectManager.GetInstance.MaxDeviceIDInController8021 = controllerOperation.GetMaxDeviceID(); } } ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(dbFileVersionService); //更新回路中存储的器件数量 loopDBService.AddLoopInfo(TheLoop); } catch (Exception ex) { return(false); } return(true); }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); this.ctlTaskView.SetLoginterface(logRecorder); this.portBufView.SetLoginterface(logRecorder); }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); this.produceRecord.SetLoginterface(logRecorder); this.mesDataRecord.SetLoginterface(logRecorder); }
private bool DeleteFromDB(int id) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(TheController.Project.SavePath, logger, _fileService); IDBFileVersionService _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(DBFileVersionManager.CurrentDBFileVersion); ILinkageConfigGeneralDBService generalDBService = new SCA.DatabaseAccess.DBContext.LinkageConfigGeneralDBService(_dbFileVersionService); if (generalDBService.DeleteGeneralLinkageConfigInfo(id)) { if (BusinessLib.ProjectManager.GetInstance.MaxIDForGeneralLinkageConfig == id) //如果最大ID等于被删除的ID,则重新赋值 { LinkageConfigGeneralService generalService = new LinkageConfigGeneralService(TheController); BusinessLib.ProjectManager.GetInstance.MaxIDForGeneralLinkageConfig = generalService.GetMaxID(); } } } catch (Exception ex) { return(false); } return(true); }
public void SetLogRecorder(ILogRecorder logRecorder) { this.logRecorder = logRecorder; foreach (AsrsCtlModel asrs in asrsCtls) { asrs.SetLogrecorder(logRecorder); } }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); this.sysSettignView.SetLoginterface(logRecorder); this.userManageView.SetLoginterface(logRecorder); }
public CCDNGHandler(IPlcRW plcRw2, string rfid, ILogRecorder logRec) { this.PlcRw2 = plcRw2; this.logRecorder = logRec; this.gzbRfid = rfid; addrPosCfg[1] = "D8730"; //A通道1位置 addrPosCfg[2] = "D8731"; //A通道2位置 }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); foreach (string strKey in childViewDic.Keys) { childViewDic[strKey].SetLoginterface(logRecorder); } }
/// <summary> /// 初始化 /// </summary> /// <param name="record"> </param> public static void Initialize(ILogRecorder record) { if (record == null) { return; } Recorder = record; IsTextRecorder = false; Recorder.Initialize(); }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); // this.productDSview.SetLoginterface(logRecorder); this.sysSettignView.SetLoginterface(logRecorder); // this.workerResView.SetLoginterface(logRecorder); this.userManageView.SetLoginterface(logRecorder); // this.mesOfflineView.SetLoginterface(logRecorder); }
/// <summary> /// 初始化 /// </summary> /// <param name="record"> </param> public static void Initialize(ILogRecorder record) { if (record != null) { Recorder = record; _isTextRecorder = record is TxtRecorder; Recorder.Initialize(); } State = LogRecorderStatus.Initialized; }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); this.produceRecord.SetLoginterface(logRecorder); this.productData.SetLoginterface(logRecorder); this.xweTestView.SetLoginterface(logRecorder); this.xwrHistroyView.SetLoginterface(logRecorder); //this.hkTestView.SetLoginterface(logRecorder); }
/// <summary> /// 创建Project /// </summary> /// <param name="project"></param> /// <returns></returns> public Model.ProjectModel CreateProject(ProjectModel project, IProjectService projectService, IFileService fileService) { if (projectService.CreateProject(project, fileService)) { Project = project; //将对象信息赋给当前属性 ILogRecorder logger = null; SCA.BusinessLogic.DBFileVersionManager dbFileVersionManager = new SCA.BusinessLogic.DBFileVersionManager(Project.SavePath, logger, fileService); _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion); InitializeDefaultSetting(); } // IsDirty = true; return(Project); }
public void SetLogRecorder(ILogRecorder logRecorder) { this.logRecorder = logRecorder; ////throw new NotImplementedException("节点监控模块,日志接口分配函数未实现"); //foreach(ThreadRunModel threadObj in threadList) //{ // threadObj.LogRecorder = logRecorder; //} //foreach(CtlNodeBaseModel ctlNode in nodeList) //{ // ctlNode.LogRecorder = logRecorder; //} }
public void OpenProject(string strPath) { ILogRecorder logger = null; //_databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(strPath, logger, _fileService); SCA.BusinessLogic.DBFileVersionManager dbFileVersionManager = new SCA.BusinessLogic.DBFileVersionManager(strPath, logger, _fileService); _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion); InitializeDefaultSetting(); IDeviceDBServiceTest deviceDBService; ProjectModel project = _projectDBService.GetProject(1); List <ControllerModel> lstControllers = _controllerDBService.GetControllersByProject(project); foreach (ControllerModel c in lstControllers) { List <LoopModel> lstLoops = _loopDBService.GetLoopsByController(c); foreach (LoopModel l in lstLoops) { deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(c.Type, _dbFileVersionService); c.Loops.Add(deviceDBService.GetDevicesByLoop(l)); } List <LinkageConfigStandard> lstStandards = _linkageConfigStandardDBService.GetStandardLinkageConfigInfoByController(c); foreach (var s in lstStandards) { c.StandardConfig.Add(s); } List <LinkageConfigMixed> lstMixed = _linkageConfigMixedDBService.GetMixedLinkageConfigInfo(c); foreach (var s in lstMixed) { c.MixedConfig.Add(s); } List <LinkageConfigGeneral> lstGeneral = _linkageConfigGeneralDBService.GetGeneralLinkageConfigInfo(c); foreach (var s in lstGeneral) { c.GeneralConfig.Add(s); } List <ManualControlBoard> lstMCB = _manualControlBoardDBService.GetManualControlBoardInfo(c); foreach (var s in lstMCB) { c.ControlBoard.Add(s); } project.Controllers.Add(c); } //private IManualControlBoardDBService _manualControlBoardDBService; project.SavePath = strPath; this.Project = project; SetMaxIDWithMemoryData(); RecentFiles.Add(Project.SavePath); SaveRecentFiles(); }
public ScrewNGHandler(IPlcRW plcRw, IPlcRW plcRw2, int channelIndex, ILogRecorder logRec) { this.PlcRw = plcRw; this.PlcRw2 = plcRw2; this.logRecorder = logRec; this.currChannelIndex = channelIndex; addrPosCfg["1-1"] = "D8730"; //A通道1位置 addrPosCfg["1-2"] = "D8731"; //A通道2位置 addrPosCfg["2-1"] = "D8732"; //B通道1位置 addrPosCfg["2-2"] = "D8733"; //B通道2位置 addrChannelCfg[1] = "D8000"; //A通道 addrChannelCfg[2] = "D8001"; //B通道 }
private void InitializeDefaultSetting() { _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; _projectDBService = new SCA.DatabaseAccess.DBContext.ProjectDBService(_databaseService); _controllerDBService = new SCA.DatabaseAccess.DBContext.ControllerDBService(_databaseService); _loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(_databaseService); _linkageConfigStandardDBService = new SCA.DatabaseAccess.DBContext.LinkageConfigStandardDBService(_databaseService); _linkageConfigGeneralDBService = new SCA.DatabaseAccess.DBContext.LinkageConfigGeneralDBService(_databaseService); _linkageConfigMixedDBService = new SCA.DatabaseAccess.DBContext.LinkageConfigMixedDBService(_databaseService); _manualControlBoardDBService = new SCA.DatabaseAccess.DBContext.ManualControlBoardDBService(_databaseService); _deviceTypeDBService = new SCA.DatabaseAccess.DBContext.DeviceTypeDBService(_databaseService); }
private bool DeleteLoopFromDB(int loopID) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; IDatabaseService _databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(_controller.Project.SavePath, logger, _fileService); ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(_databaseService); loopDBService.DeleteLoopInfo(loopID); } catch (Exception ex) { return(false); } return(true); }
private bool DeleteLoopFromDB(int loopID) { try { IFileService fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(_controller.Project.SavePath, logger, fileService); IDBFileVersionService dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion); ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(dbFileVersionService); loopDBService.DeleteLoopInfo(loopID); } catch (Exception ex) { return(false); } return(true); }
public bool SaveToDB() { try { ILogRecorder logger = null; IFileService fileService = new SCA.BusinessLib.Utility.FileService(); DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(TheController.Project.SavePath, logger, fileService); IDBFileVersionService _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion); ILinkageConfigStandardDBService dbMixedService = new LinkageConfigStandardDBService(_dbFileVersionService); dbMixedService.AddStandardLinkageConfigInfo(TheController.StandardConfig); } catch { return(false); } return(true); }
private bool DeleteDeviceFromDB(int id) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; IDatabaseService _databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(TheLoop.Controller.Project.SavePath, logger, _fileService); IDeviceDBServiceTest deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(TheLoop.Controller.Type, _databaseService); deviceDBService.DeleteDeviceByID(id); } catch (Exception ex) { return(false); } return(true); }
public bool SaveToDB() { try { ILogRecorder logger = null; IFileService fileService = new SCA.BusinessLib.Utility.FileService(); DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(this.TheLoop.Controller.Project.SavePath, logger, fileService); IDBFileVersionService _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion); ILoopDBService _loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(_dbFileVersionService); _loopDBService.AddLoopInfo(TheLoop); IDeviceDBServiceTest dbService = DeviceManagerDBServiceTest.GetDeviceDBContext(ControllerType.NT8021, _dbFileVersionService); dbService.AddDevice(TheLoop); } catch { return(false); } return(true); }
private bool DeleteControllerFromDB(ControllerModel controller) { try { IFileService _fileService = new SCA.BusinessLib.Utility.FileService(); ILogRecorder logger = null; IDatabaseService _databaseService = new SCA.DatabaseAccess.SQLiteDatabaseAccess(controller.Project.SavePath, logger, _fileService); IControllerDBService controllerDBService = new SCA.DatabaseAccess.DBContext.ControllerDBService(_databaseService); ILoopDBService loopDBService = new SCA.DatabaseAccess.DBContext.LoopDBService(_databaseService); IDeviceDBServiceTest deviceDBService = SCA.DatabaseAccess.DBContext.DeviceManagerDBServiceTest.GetDeviceDBContext(controller.Type, _databaseService); deviceDBService.DeleteAllDevicesByControllerID(controller.ID); loopDBService.DeleteLoopsByControllerID(controller.ID); controllerDBService.DeleteController(controller.ID); } catch (Exception ex) { return(false); } return(true); }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; this.stockManaView.SetLoginterface(logRecorder); this.storageView.SetLoginterface(logRecorder); }
public void SetLogRecorder(ILogRecorder logRecorder) { this.logRecorder = logRecorder; }
public virtual void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; // lineMonitorPresenter.SetLogRecorder(logRecorder); }
public DBFileVersionManager(string dataSource, ILogRecorder logger, IFileService fileService) { _dataSource = dataSource; _logger = logger; _fileService = fileService; }
public void ComfirmExecute() { this.ErrorMessagePromptImportFilePath = ""; this.ErrorMessagePromptName = ""; this.ErrorMessagePromptSaveFilePath = ""; bool verifyFlag = true; ProjectConfig projectConfig = new ProjectConfig(); Dictionary <string, RuleAndErrorMessage> dictRule = projectConfig.GetProjectInfoRegularExpression(); RuleAndErrorMessage rule = dictRule["Name"]; Regex exminator = new Regex(rule.Rule); if (!string.IsNullOrEmpty(ProjectName)) { if (!exminator.IsMatch(ProjectName)) { ErrorMessagePromptName = rule.ErrorMessage; verifyFlag = false; } } else { ErrorMessagePromptName = "请输入工程名称"; verifyFlag = false; } if (string.IsNullOrEmpty(ImportedFilePath)) { ErrorMessagePromptImportFilePath = "请选择有效导入文件路径"; verifyFlag = false; } if (string.IsNullOrEmpty(SavedFilePath)) { ErrorMessagePromptSaveFilePath = "请选择有效文件存储路径"; verifyFlag = false; } if (verifyFlag) { IFileService _fileService = new FileService(); ILogRecorder _logRecorder = null; string strImportedFilePath = this.ImportedFilePath; string strExtentionName = strImportedFilePath.Substring(strImportedFilePath.LastIndexOf(".") + 1); DBFileVersionManager dbFileVersionManager = new DBFileVersionManager(this.ImportedFilePath, _logRecorder, _fileService); //取得某一系列的数据文件操作服务(4,5,6 系列没有项目,7开始有项目信息,以文件扩展名作为划分依据) IDBFileVersionService dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByExtentionName(strExtentionName); //取得文件版本 int fileVersion = dbFileVersionService.GetFileVersion(); dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(fileVersion); //取得项目信息 ProjectModel project = dbFileVersionService.GetProject(1); project.Name = this.ProjectName; //以当前设置的名称作为项目名 project.SavePath = this.SavedFilePath + "\\" + project.Name + ".nt"; //以当前设置的路径作为项目的存储路径 IControllerOperation controllerOperation = null; //取得项目下所有控制器信息 List <ControllerModel> lstController = dbFileVersionService.GetControllersByProject(project); int dataFileVersion = 0; //数据文件版本 ControllerModel controller = null; foreach (var controllerInfo in lstController) //取得控制器操作服务 { if (project.FileVersion == -1) //4,5,6版本文件无项目信息 { project.FileVersion = controllerInfo.FileVersion; } switch (controllerInfo.Type) { case ControllerType.FT8000: controllerOperation = new ControllerOperation8000(); break; case ControllerType.FT8003: controllerOperation = new ControllerOperation8003(); break; case ControllerType.NT8001: controllerOperation = new ControllerOperation8001(); break; case ControllerType.NT8007: controllerOperation = new ControllerOperation8007(); break; case ControllerType.NT8021: controllerOperation = new ControllerOperation8021(); break; case ControllerType.NT8036: controllerOperation = new ControllerOperation8036(); break; } if (controllerOperation != null) //合法控制器类型 { dataFileVersion = Convert.ToInt32(project.FileVersion); //取得当前项目文件版本号 dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(dataFileVersion); //取得当前文件的数据文件服务 //controllerInfo = controllerOperation.OrganizeControllerInfoFromOldVersionSoftwareDataFile(oldVersionService); controller = controllerOperation.OrganizeControllerInfoFromSpecifiedDBFileVersion(dbFileVersionService, controllerInfo); //取得组织完成的控制器信息 } if (controller != null) //将组织完成的信息增加至项目中 { project.Controllers.Add(controllerInfo); } } if (dataFileVersion != 0)//将所有数据转换为当前软件应用的数据版本 { project = dbFileVersionManager.VersionConverter(dataFileVersion, DBFileVersionManager.CurrentDBFileVersion, project); } SCA.BusinessLib.ProjectManager.GetInstance.CreateProject(project); EventMediator.NotifyColleagues("DisplayTheOpenedProject", null); } }
/// <summary> /// /// </summary> /// <param name="dataSource">指定数据源</param> /// <param name="logger">日志服务</param> /// <param name="fileService">文件操作服务</param> public DBFileVersion4DBService(string dataSource, ILogRecorder logger, IFileService fileService) { _databaseService = new SCA.DatabaseAccess.MSAccessDatabaseAccess(dataSource, logger, fileService); DBFilePath = dataSource; }
public override void SetLoginterface(ILogRecorder logRecorder) { this.logRecorder = logRecorder; }