/// <summary> /// 设置产品的VOBC设备的状态函数 /// </summary> /// <param name="ip">ip地址</param> /// <param name="systype">VOBC子系统标识</param> /// <param name="updateState">更新状态</param> public void SetProductVOBCDeviceState(string ip, vobcSystemType systype, int updateState) { //根据IP获取对应的product内容 VOBCProduct product = this.Find(x => (x.Ip == ip)) as VOBCProduct; //product非空验证 if (null != product) { //依据检索出的product 根据产品实体名称 获取对应的device内容 IDevice device = product.CBelongsDevice.Find(y => y.DeviceName == CommonMethod.GetStringByType(systype)); //device非空验证 if (null != device) { if (updateState == CommonConstValue.constValueHEX55) { device.State = "更新成功"; } else if (updateState == CommonConstValue.constValueHEXAA) { device.State = "更新失败"; } else { device.State = "更新失败"; } //任一系更新失败则整个相关设备更新失败 ///通知界面数据变化 base.dataModify.Modify(); //记录日志 LogManager.InfoLog.LogProcInfo("IProContainer", "SetProductVOBCDeviceProcState", "设置IP为" + ip + "的产品" + product.ProductID + "中的设备" + device.DeviceName + "的烧录状态为" + device.State); product.Report.ReportWindow(ip + "的产品" + product.ProductID + "中的设备" + device.DeviceName + "的烧录状态为" + device.State); } else { //记录异常日志 LogManager.InfoLog.LogProcError("IProContainer", "SetProductVOBCDeviceProcState", "设置IP为" + ip + "的产品" + product.ProductID + "中的设备" + CommonMethod.GetStringByType(systype) + "的烧录状态时,未检索到该device"); product.Report.ReportWindow(ip + "的产品" + product.ProductID + "中的设备" + CommonMethod.GetStringByType(systype) + "的烧录状态时,未检索到该device"); } } else { //记录异常日志 LogManager.InfoLog.LogProcError("IProContainer", "SetProductVOBCDeviceProcState", "设置VOBC产品实体烧录状态时,未获取到IP为" + ip + "的产品"); product.Report.ReportWindow("设置VOBC产品实体烧录状态时,未获取到IP为" + ip + "的产品"); } }
/// <summary> /// VOBC产品集合容器的数据加载 /// </summary> /// <param name="node"></param> public override void LoadXml(XmlNode node) { m_vobcBlueGateWay = node.Attributes[CShareLib.VOBC_BLUE_GATEWAY].Value; m_vobcRedGateWay = node.Attributes[CShareLib.VOBC_RED_GATEWAY].Value; m_vobcNetMask = node.Attributes[CShareLib.VOBC_NET_MASK].Value; ///遍历容器内的所有子节点,加载各个产品数据 foreach (XmlNode xmlNode in node.ChildNodes) { VOBCProduct vobcProduct = new VOBCProduct(); vobcProduct.LoadXml(xmlNode); LogManager.InfoLog.LogConfigurationInfo("线路数据", "VOBC产品数据", "完成加载VOBC产品设备:" + vobcProduct.ProductID); this.Add(vobcProduct); } }
/// <summary> /// 重写函数“获取待发送文件列表并校验文件是否存在” /// </summary> /// <param name="vobc">VOBC产品对象类</param> /// <returns>执行结果 成功or失败</returns> public override bool GetFileListAndCheckExist(VOBCProduct vobc) { //处理结果 bool dealResult = true; //文件路径键值信息 Dictionary <string, string> filePathList = new Dictionary <string, string>(); //待烧录文件类型列表 List <vobcFileType> fileTypeList = new List <vobcFileType>(); //获取烧录文件配置 DeployConfiState configState = vobc.DeployConfigCheck; //检查引导文件勾选状态 if (configState.IsBootLoaderCheck) { filePathList.Add(m_mmiBootRomPath.Key, m_mmiBootRomPath.Value); fileTypeList.Add(vobcFileType.BootLoader); } //检查内核文件勾选状态 if (configState.IsCoreCheck) { filePathList.Add(m_mmiCorePath.Key, m_mmiCorePath.Value); fileTypeList.Add(vobcFileType.CORE); } //检查配置文件勾选状态 if (configState.IsNvRamCheck) { filePathList.Add(m_mmiConfigPath.Key, m_mmiConfigPath.Value); fileTypeList.Add(vobcFileType.NVRAM); } //有文件需要发送 if (filePathList.Count > 0) { //文件是否全部真实存在 若有任何一个不存在 该子子系统将不进行烧录 bool isFileAllExist = true; foreach (string filePath in filePathList.Keys) { //文件存在 if (System.IO.File.Exists(filePath)) { //文件存在 不执行操作 } //文件不存在 else { //不是所有文件都存在 isFileAllExist = false; //处理失败 dealResult = false; //启用跳过标志 将不执行该子子系统的部署 vobc.SkipFlag = true; //不在执行过程中 //vobc.InProcess = false; Modified @ 10.16 //日志信息 string logMsg = "VOBC" + vobc.ProductID + " 子子系统设备:" + DeviceType + "的待发送文件不存在,文件地址应为:" + filePath; //记录日志 LogManager.InfoLog.LogCommunicationInfo("VOBCMMIDevice", "GetFileListAndCheckExist", logMsg); //界面信息打印 vobc.Report.ReportWindow(logMsg); } } //如果文件都存在 数据添加到集合队列中 if (isFileAllExist) { ///构造VOBC产品MMI设备的checkfile m_vobcCheckFile.vobcSystemType = vobcSystemType.MMI; m_vobcCheckFile.vobcFilePathList = filePathList; m_vobcCheckFile.vobcFileTypeList = fileTypeList; vobc.CheckFileList.Add(m_vobcCheckFile); } else { //无操作 } } //没有文件需要发送 else { //处理失败 dealResult = false; //启用跳过标志 将不执行该子子系统的部署 vobc.SkipFlag = true; //日志信息 string logMsg = "VOBC" + vobc.ProductID + " 子子系统设备:" + DeviceType + "没有文件需要发送,部署停止,请检查选择并重新开始部署!"; //记录日志 LogManager.InfoLog.LogCommunicationInfo("VOBCMMIDevice", "GetFileListAndCheckExist", logMsg); //界面信息打印 vobc.Report.ReportWindow(logMsg); } return(dealResult); }
/// <summary> /// VOBC产品ATP设备校验文件方法 /// </summary> public override bool CheckFile(VOBCProduct vobc) { return(base.CheckFile(vobc)); }
/// <summary> /// VOBC产品MMI设备发送文件方法 /// </summary> public override bool SendFile(VOBCProduct vobc) { //执行父类中的发送文件函数 return(base.SendFile(vobc)); }
/// <summary> /// VOBC产品子子系统设备执行部署实现方法 /// </summary> /// <param name="configState">预检状态信息</param> public override void RunDeploy(DeployConfiState configState) { //获取当前正在处理的vobc产品类对象 VOBCProduct vobc = base.BelongProduct as VOBCProduct; //当前为VOBC产品第一个烧录设备 执行产品烧录前的准备过程 if (vobc.InProcess == false && vobc.SkipFlag == false) { ///清空烧录过程状态 vobc.ResetDeviceProcState(); //通知界面刷新 CDeviceDataFactory.Instance.VobcContainer.dataModify.Modify(); //预检状态信息赋值 vobc.DeployConfigCheck = configState; vobc.recvCheckCount = 0; //开始部署前清空更新成功文件计数 UpdateSuccessFileCount = 0; #region 给予更新状态实例赋初始值--依据用户在界面中勾选的烧录文件类型 vobc._updateFileState = new VOBCUpdateFileState(); vobc._updateFileState.AtoBootCompleteFlag = configState.IsBootLoaderCheck; vobc._updateFileState.AtpBootCompleteFlag = configState.IsBootLoaderCheck; vobc._updateFileState.ComBootCompleteFlag = configState.IsBootLoaderCheck; vobc._updateFileState.MmiBootCompleteFlag = configState.IsBootLoaderCheck; vobc._updateFileState.CcovBootCompleteFlag = configState.IsBootLoaderCheck; vobc._updateFileState.AtoCoreCompleteFlag = configState.IsCoreCheck; vobc._updateFileState.AtpCoreCompleteFlag = configState.IsCoreCheck; vobc._updateFileState.ComCoreCompleteFlag = configState.IsCoreCheck; vobc._updateFileState.MmiCoreCompleteFlag = configState.IsCoreCheck; vobc._updateFileState.CcovCoreCompleteFlag = configState.IsCoreCheck; vobc._updateFileState.AtoDataCompleteFlag = configState.IsDataCheck; vobc._updateFileState.AtpDataCompleteFlag = configState.IsDataCheck; vobc._updateFileState.CcovDataCompleteFlag = configState.IsDataCheck; vobc._updateFileState.AtoNvramCompleteFlag = configState.IsNvRamCheck; vobc._updateFileState.AtpNvramCompleteFlag = configState.IsNvRamCheck; vobc._updateFileState.MmiNvramCompleteFlag = configState.IsNvRamCheck; vobc._updateFileState.CcovConfigCompleteFlag = configState.IsIniCheck; #endregion //获取对端状态 VOBCProduct oppovobc = CDeviceDataFactory.Instance.GetOppositeProductByIDEnd(vobc.ProductID); //设备预检 string preCheckResult = PreCheck(vobc.VobcStateInfo, oppovobc.VobcStateInfo); //预检结论等于空即预检成功 不等于空 预检失败 if (preCheckResult != String.Empty) { //设置VOBC产品下的子子系统预检状态 foreach (IDevice device in vobc.CBelongsDevice) { device.PreCheckResult = false; device.PreCheckFailReason = preCheckResult; } //刷新界面 CDeviceDataFactory.Instance.VobcContainer.dataModify.Modify(); //记录警告日志 LogManager.InfoLog.LogProcWarning("VOBCDevice", "RunDeploy", "VOBC产品:" + base.BelongProduct.ProductID + "预检失败,原因" + preCheckResult); LogManager.InfoLog.LogProcWarning("VOBCDevice", "RunDeploy", "VOBC产品:" + base.BelongProduct.ProductID + "部署未执行,部署进程结束"); vobc.SkipFlag = true; vobc.InProcess = false; vobc.Report.ReportWindow("VOBC" + vobc.ProductID + "更新失败!请检查是否满足预检通过条件并重新开始部署"); ///通知刷新背景色 CDeviceDataFactory.Instance.VobcContainer.dataModify.Color(); } else { //设置VOBC产品下的子子系统预检状态 foreach (IDevice device in vobc.CBelongsDevice) { device.PreCheckResult = true; device.PreCheckFailReason = preCheckResult; } //记录日志 LogManager.InfoLog.LogProcInfo("VOBCDevice", "RunDeploy", "开始VOBC产品:" + base.BelongProduct.ProductID + "部署过程"); //设置跳过标志为false 后续代码根据此标志 执行具体部署 vobc.SkipFlag = false; //生成配置文件 BelongProduct.GenConfig(); //当前处于部署阶段 vobc.InProcess = true; } ////用完清空VobcStateInfo(有误) //vobc.VobcStateInfo = null; //oppovobc.VobcStateInfo = null; } //如果跳过标志为假且当前处在部署第一阶段,执行部署 if ((!vobc.SkipFlag) && (vobc.StepOne)) { vobc.InProcess = true; CDeviceDataFactory.Instance.VobcContainer.dataModify.Color(); //执行部署 DeployExec(); //若执行部署过程中 跳出标志被置为true if (vobc.SkipFlag == true) { ///当前处于部署之中 if (vobc.InProcess == true) { //刷新界面日志信息 vobc.Report.ReportWindow("VOBC" + vobc.ProductID + "更新失败:执行过程中出现失败环节,请重新开始部署"); vobc.InProcess = false; } ///通知刷新背景色 CDeviceDataFactory.Instance.VobcContainer.dataModify.Color(); } } //当前处于第一阶段但是跳过标志为true,则更新失败 else if (vobc.StepOne) { LogManager.InfoLog.LogProcInfo("VOBCDevice", "RunDeploy", base.BelongProduct.ProductID + "部署过程失败:生成配置文件前的相关环节失败或未收到允许上传的回复"); //vobc.Report.ReportWindow("更新失败!(生成配置文件前的相关环节失败或未收到允许上传的回复)"); //刷新界面 CDeviceDataFactory.Instance.VobcContainer.dataModify.Modify(); CDeviceDataFactory.Instance.VobcContainer.dataModify.Color(); } //当前处于第二阶段,任何在第二阶段运行至此处的设备不予理会,第一阶段结束后则证明更新标志为已下发 else { } }
/// <summary> /// VOBC子子系统设备部署执行(更新复位)执行虚方法 /// </summary> public virtual void DeployExec() { //获取VOBC产品实例 VOBCProduct vobc = base.BelongProduct as VOBCProduct; //验证需要发送的文件是否存在(返回true 则代表文件检查成功且已发送了文件传输请求) if (GetFileListAndCheckExist(vobc)) { ////记录日志 //LogManager.InfoLog.LogProcInfo(this.GetType().Name, "DeployExec", "开始VOBC产品:" + base.BelongProduct.ProductID + "的子子系统:" + base.DeviceType + "部署过程"); //发送文件 if (!SendFile(vobc)) { //LogManager.InfoLog.LogProcError(this.GetType().Name, "DeployExec", "VOBC产品:" + base.BelongProduct.ProductID + "的子子系统:" + base.DeviceType + "发送文件超时,部署失败!"); vobc.Report.ReportWindow("VOBC产品:" + base.BelongProduct.ProductID + "的子子系统:" + base.DeviceType + "发送文件超时,部署失败!"); vobc.SkipFlag = true; //vobc.InProcess = false; Modified @ 10.16 在外层置false //Modified @ 9.28 与DataAnalysis的操作重复,且时机不同步,删除此处界面变化,判断仅用于跳出执行流程。 //CDeviceDataFactory.Instance.VobcContainer.SetProductDeviceState(vobc.Ip, Convert.ToInt32(vobc.Port), "发送失败"); //CDeviceDataFactory.Instance.VobcContainer.SetProductState(vobc.Ip, Convert.ToInt32(vobc.Port), "更新失败"); return; } //执行文件校验操作 if (!CheckFile(vobc)) { //LogManager.InfoLog.LogProcError(this.GetType().Name, "DeployExec", "VOBC产品:" + base.BelongProduct.ProductID + "的子子系统:" + base.DeviceType + "校验文件超时或未通过,部署失败!"); vobc.Report.ReportWindow("VOBC产品:" + base.BelongProduct.ProductID + "的子子系统:" + base.DeviceType + "校验文件超时或未通过,部署失败!"); vobc.SkipFlag = true; //vobc.InProcess = false; Modified @ 10.16 在外层置false //Modified @ 9.28 与DataAnalysis的操作重复,且时机不同步,删除此处界面变化,判断仅用于跳出执行流程。 //CDeviceDataFactory.Instance.VobcContainer.SetProductDeviceState(vobc.Ip, Convert.ToInt32(vobc.Port),"校验失败"); //CDeviceDataFactory.Instance.VobcContainer.SetProductState(vobc.Ip,Convert.ToInt32(vobc.Port),"更新失败"); return; } //检查VOBC产品是否全部发送和校验,这里有冗余操作,并不是在这里完成的文件校验核对 @ 10.16 if (vobc.IsFileChecked()) { //记录日志 LogManager.InfoLog.LogProcInfo(this.GetType().Name, "DeployExec", "VOBC" + base.BelongProduct.ProductID + "所有文件校验通过,开始更新过程"); //刷新界面显示内容 vobc.Report.ReportWindow("VOBC" + vobc.ProductID + "部署文件校验成功!"); //执行文件更新流程 if (!BelongProduct.FileUpdate()) { vobc.SkipFlag = true; vobc.InProcess = false; } } else { ///校验不通过次数+1 vobc.recvCheckCount++; } if (vobc.recvCheckCount == vobc.CSelectedDeviceType.Count) { ///接收到全部device的校验回复,依然失败,校验失败 vobc.Report.ReportWindow("VOBC" + vobc.ProductID + "部署文件校验失败!"); vobc.SkipFlag = true; //vobc.InProcess = false; Modified @ 10.16 在外层置false CDeviceDataFactory.Instance.VobcContainer.SetProductFailReason(vobc.Ip, Convert.ToInt32(vobc.Port), "文件校验未通过"); CDeviceDataFactory.Instance.VobcContainer.SetProductState(vobc.Ip, Convert.ToInt32(vobc.Port), "更新失败"); } } else { //暂时什么都不做 } }
/// <summary> /// VOBC子子系统设备校验文件的虚方法 /// </summary> public virtual bool CheckFile(VOBCProduct vobc) { //执行结果 bool excuteResult = false; //重置接收校验状态为false Modified @ 11.9 vobc.CheckState = false; //文件校验请求日志记录 LogManager.InfoLog.LogProcInfo(this.GetType().Name, "CheckFile", "发送VOBC产品:" + base.BelongProduct.ProductID + "的部署文件校验信息请求"); Thread.Sleep(20000); //设置烧录子子系统在界面中的显示状态--文件校验中 CDeviceDataFactory.Instance.VobcContainer.SetProductDeviceState(vobc.Ip, Convert.ToInt32(vobc.Port), CommonMethod.GetVobcSystemListByType(m_vobcCheckFile.vobcSystemType), Convert.ToString(CommonMethod.GetVobcDeployNameByType(vobcSystemDeployState.FileCheck))); CDeviceDataFactory.Instance.VobcContainer.dataModify.Modify(); //发送校验请求 VOBCCommand checkCommand = new VOBCCommand(vobc.Ip, Convert.ToInt32(vobc.Port), vobc.ProductID, vobcCommandType.checkFile, m_vobcCheckFile); CommandQueue.instance.m_CommandQueue.Enqueue(checkCommand); //计数 非正常情况跳出循环 int skipCount = 0; //do while循环正常执行跳出的条件 bool rev = false; do { ///如果接收校验状态为true if (vobc.CheckState) { //记录日志 LogManager.InfoLog.LogProcInfo(this.GetType().Name, "CheckFile", "已收到VOBC产品:" + base.BelongProduct.ProductID + "的部署文件校验回复"); //设置处理标志为true rev = true; //根据子子系统类型 设置相应帧标志 switch (vobcSysType) { case vobcSystemType.ATP_1: vobc.SentCheckState.m_atpSent = true; break; case vobcSystemType.ATO_1: vobc.SentCheckState.m_atoSent = true; break; case vobcSystemType.CCOV: vobc.SentCheckState.m_ccovSent = true; break; case vobcSystemType.COM_1: vobc.SentCheckState.m_comSent = true; break; case vobcSystemType.MMI: vobc.SentCheckState.m_mmiSent = true; break; default: //TODO break; } excuteResult = true; } else { //计数15次 未收到校验通过更新就跳出循环结束 Modified @ 9.28 if ((skipCount > 30) || (vobc.SkipFlag)) { //vobc.SkipFlag = true; excuteResult = false; break; } else { //跳出计数+1 skipCount++; //休眠1秒 Thread.Sleep(1000); } } } while (rev == false); return(excuteResult); }
/// <summary> /// VOBC子子系统设备发送部署文件的虚方法 /// </summary> public virtual bool SendFile(VOBCProduct vobc) { //执行结果 bool excuteResult = false; //计数 非正常情况跳出循环 int skipCount = 0; //do while循环正常执行跳出的条件 bool rev = false; do { ///如果文件状态为true if (vobc.FileState) { //日志记录 LogManager.InfoLog.LogProcInfo("VOBCATODevice", "SendFile", "已收到文件请求回复,发送VOBC产品:" + base.BelongProduct.ProductID + "的部署文件"); //界面信息打印 vobc.Report.ReportWindow("VOBC" + vobc.ProductID + " 子子系统设备:" + DeviceType + "正在发送部署文件......"); //设置烧录子子系统在界面中的显示状态--文件上传中 CDeviceDataFactory.Instance.VobcContainer.SetProductDeviceState(vobc.Ip, Convert.ToInt32(vobc.Port), CommonMethod.GetVobcSystemListByType(m_vobcCheckFile.vobcSystemType), Convert.ToString(CommonMethod.GetVobcDeployNameByType(vobcSystemDeployState.FileUploading))); CDeviceDataFactory.Instance.VobcContainer.dataModify.Modify(); //创建发送文件数据帧 VOBCCommand sendFileCommand = new VOBCCommand(vobc.Ip, Convert.ToInt32(vobc.Port), vobc.ProductID, vobcCommandType.sendFile, m_vobcCheckFile); //添加命令到队列中 CommandQueue.instance.m_CommandQueue.Enqueue(sendFileCommand); excuteResult = true; //执行成功 修改标志 rev = true; } else { //计数15次 跳出循环 Modified @ 9.28 if ((skipCount > skipCountMax) || (vobc.SkipFlag)) { //vobc.SkipFlag = true; excuteResult = false; break; } else { //跳出计数+1 skipCount++; //休眠1秒 Thread.Sleep(1000); } } } while (rev == false); return(excuteResult); }
/// <summary> /// 获取待发送文件列表并校验文件是否存在 /// </summary> /// <param name="vobc">VOBC产品对象类</param> /// <returns>执行结果 成功or失败</returns> public virtual bool GetFileListAndCheckExist(VOBCProduct vobc) { return(false); }
/// <summary> /// VOBC待烧录设备是否存在检查 /// </summary> /// <param name="vobc">要校验的文件集合</param> /// <returns>成功/失败</returns> private List <string> FilePreCheck(VOBCProduct vobc) { return(null); }
/// <summary> /// 外部接口设置VOBC某产品实体的某设备烧录成功状态,仅用于更新烧录成功失败状态,区别于常规状态设置SetProductDeviceState /// </summary> /// <param name="ip">vobc产品IP</param> /// <param name="systype">产品子系统类型</param> /// <param name="fileType">产品子系统更新文件类型</param> /// <returns>无</returns> public void SetProductVOBCDeviceState(string ip, vobcSystemType systype, Common.vobcFileType fileType) { //更新状态 bool updateState = true; //根据IP获取对应的product内容 VOBCProduct product = this.Find(x => (x.Ip == ip)) as VOBCProduct; //product非空验证 if (null != product) { //依据检索出的product 根据产品实体名称 获取对应的device内容 IDevice device = product.CBelongsDevice.Find(y => y.DeviceName == CommonMethod.GetStringByType(systype)); //device非空验证 if (null != device) { //根据子子系统类型 获取该子子系统的更新结果 switch (systype) { case vobcSystemType.ATP_1: case vobcSystemType.ATP_2: case vobcSystemType.ATP_3: updateState = product.CheckUpdateResultTypeFile("ATP"); break; case vobcSystemType.ATO_1: case vobcSystemType.ATO_2: updateState = product.CheckUpdateResultTypeFile("ATO"); break; case vobcSystemType.COM_1: case vobcSystemType.COM_2: updateState = product.CheckUpdateResultTypeFile("COM"); break; case vobcSystemType.MMI: updateState = product.CheckUpdateResultTypeFile("MMI"); break; case vobcSystemType.CCOV: updateState = product.CheckUpdateResultTypeFile("CCOV"); break; default: //TODO 不处理 break; } //根据子子系统更新结果 赋值更新状态 device.State = updateState ? "更新成功" : "更新失败"; ///通知界面数据变化 base.dataModify.Modify(); //记录日志 LogManager.InfoLog.LogProcInfo("IProContainer", "SetProductVOBCDeviceProcState", "设置IP为" + ip + "的产品" + product.ProductID + "中的设备" + device.DeviceName + "的烧录状态为成功"); } else { //记录异常日志 LogManager.InfoLog.LogProcError("IProContainer", "SetProductVOBCDeviceProcState", "设置IP为" + ip + "的产品" + product.ProductID + "中的设备" + CommonMethod.GetStringByType(systype) + "的烧录状态时,未检索到该device"); } } else { //记录异常日志 LogManager.InfoLog.LogProcError("IProContainer", "SetProductVOBCDeviceProcState", "设置VOBC产品实体烧录状态时,未获取到IP为" + ip + "的产品"); } }
/// <summary> /// 重写函数“获取待发送文件列表并校验文件是否存在” /// </summary> /// <param name="vobc">VOBC产品对象类</param> /// <returns>执行结果 成功or失败</returns> public override bool GetFileListAndCheckExist(VOBCProduct vobc) { //处理结果 bool dealResult = true; //if (base.BelongProduct.ProductID.Contains("TC1")) //{ // try // { // //CCOV统一使用一个配置文件config.ini,将红/蓝网关IP信息和WGB设备厂商信息写在一起 // File.Copy(System.Windows.Forms.Application.StartupPath + CShareLib.VOBC_GEN_FILEPATH + "\\Red\\config.ini", m_ccovIniPath.Key, true); // } // catch // { // MessageBox.Show("请检查CCOV配置文件路径"); // } //} //else if (base.BelongProduct.ProductID.Contains("TC2")) //{ // try // { // //CCOV统一使用一个配置文件config.ini,将红/蓝网关IP信息和WGB设备厂商信息写在一起 // File.Copy(System.Windows.Forms.Application.StartupPath + CShareLib.VOBC_GEN_FILEPATH + "\\Blue\\config.ini", m_ccovIniPath.Key, true); // } // catch // { // MessageBox.Show("请检查CCOV配置文件路径"); // } //} //else //{ // LogManager.InfoLog.LogCommunicationError("MainWindow", "ProductReport", "非法列车!"); //} //文件路径键值信息 Dictionary <string, string> filePathList = new Dictionary <string, string>(); //待烧录文件类型列表 List <vobcFileType> fileTypeList = new List <vobcFileType>(); //获取烧录文件配置 DeployConfiState configState = vobc.DeployConfigCheck; //检查引导文件勾选状态 if (configState.IsBootLoaderCheck) { filePathList.Add(m_ccovBootRomPath.Key, m_ccovBootRomPath.Value); fileTypeList.Add(vobcFileType.BootLoader); } //检查内核文件勾选状态 if (configState.IsCoreCheck) { filePathList.Add(m_ccovCorePath.Key, m_ccovCorePath.Value); fileTypeList.Add(vobcFileType.CORE); } //检查数据文件勾选状态 if (configState.IsDataCheck) { filePathList.Add(m_ccovDataPath.Key, m_ccovDataPath.Value); fileTypeList.Add(vobcFileType.DATA); } //检查ini配置文件勾选状态 if (configState.IsIniCheck) { filePathList.Add(m_ccovIniPath.Key, m_ccovIniPath.Value); fileTypeList.Add(vobcFileType.CCOVConfig); } //有文件需要发送 if (filePathList.Count > 0) { //文件是否全部真实存在 若有任何一个不存在 该子子系统将不进行烧录 bool isFileAllExist = true; foreach (string filePath in filePathList.Keys) { //文件存在 if (System.IO.File.Exists(filePath)) { //文件存在 不执行操作 } //文件不存在 else { //不是所有文件都存在 isFileAllExist = false; //处理失败 dealResult = false; //启用跳过标志 将不执行该子子系统的部署 vobc.SkipFlag = true; //不在执行过程中 //vobc.InProcess = false; Modified @ 10.16 //日志信息 string logMsg = "VOBC" + vobc.ProductID + " 子子系统设备:" + DeviceType + "的待发送文件不存在,文件地址应为:" + filePath; //记录日志 LogManager.InfoLog.LogCommunicationInfo("VOBCCCOVDevice", "GetFileListAndCheckExist", logMsg); //界面信息打印 vobc.Report.ReportWindow(logMsg); ///通知刷新背景色 CDeviceDataFactory.Instance.VobcContainer.dataModify.Color(); } } //如果文件都存在 数据添加到集合队列中 if (isFileAllExist) { ///构造VOBC产品CCOV设备的checkfile m_vobcCheckFile.vobcSystemType = vobcSystemType.CCOV; m_vobcCheckFile.vobcFilePathList = filePathList; m_vobcCheckFile.vobcFileTypeList = fileTypeList; vobc.CheckFileList.Add(m_vobcCheckFile); } else { //无操作 } } //没有文件需要发送 else { //处理失败 dealResult = false; //启用跳过标志 将不执行该子子系统的部署 vobc.SkipFlag = true; //日志信息 string logMsg = "VOBC" + vobc.ProductID + " 子子系统设备:" + DeviceType + "没有文件需要发送,部署停止,请检查选择并重新开始部署!"; //记录日志 LogManager.InfoLog.LogCommunicationInfo("VOBCCCOVDevice", "GetFileListAndCheckExist", logMsg); //界面信息打印 vobc.Report.ReportWindow(logMsg); } return(dealResult); }