protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId) { //serMeg.setAlarmMeg("WIS�T����ƪ���������g��!!"); System.Collections.Hashtable outputs = new System.Collections.Hashtable(); string meg = ""; switch (secType) { case 45: //�@�� meg = "�@���C��"; break; case 46: //�j�� meg = "�j���C��"; break; case 47: //���B meg = "���B�C��"; break; default: //��L meg = "�t�C����"; break; } byte[] colors = new byte[4] { 32, 32, 32, 32 }; if (devNames == null) return null; foreach (RemoteInterface.HC.FetchDeviceData devName in devNames) { RemoteInterface.HC.CMSOutputData output = new RemoteInterface.HC.CMSOutputData(0, 0, 0, meg, colors); outputs.Add(devName.DevName, output); } return outputs; }
/// <summary> /// �̾�CMS���������o��ܤ��e /// </summary> /// <param name="blockType">���O����</param> /// <param name="message">�T��</param> /// <param name="isIcon">���O�ϧ����(0:�����q,1:�q��D�ϥ�,2:�q�ƬG�ϥ�,3:�q�C��)</param> /// <param name="mode">�Ҧ�</param> /// <returns></returns> private RemoteInterface.HC.CMSOutputData SetCMSDislay(string blockType, string message, int isIcon,int mode) { this.mode = mode; List<string> changeTexts = new List<string>(); string str = ""; foreach (char word in message) { if (word == '[') str = ""; str += word; if (word == ']') { changeTexts.Add(str); } } System.Collections.Generic.List<RSPMegColor> rspMegColors = new System.Collections.Generic.List<RSPMegColor>(); foreach (string text in changeTexts) { int no = Convert.ToInt32(text.Substring(text.IndexOf('[') + 1, text.IndexOf(']') - 1)); string mag = setMessage(no); message = message.Replace(text, mag); MessColor messColor = (MessColor)messColorsHT[no]; rspMegColors.Add(new RSPMegColor(mag, getCMSWordColor(messColor.Forecolor, messColor.BackColor))); } string newMeg = message.Replace("\r", ""); List<byte> colors = new List<byte>(); //byte[] colors = new byte[message.Replace("\r", "").Length]; for (int i = 0; i < newMeg.Length; i++) { colors.Add(32); } foreach (RSPMegColor de in rspMegColors) { for (int i = newMeg.IndexOf(de.Message); i <= newMeg.IndexOf(de.Message) + de.Message.Length - 1; i++) { if (i == -1) continue; colors[i] = Convert.ToByte(de.Color); if (newMeg[i] == '��') colors.Insert(i, colors[i]); } } RemoteInterface.HC.CMSOutputData outputData = new RemoteInterface.HC.CMSOutputData(0, 0, 0, message.Replace("��","�@�@"), colors.ToArray()); switch (blockType) { case "1X4"://�]�w1x4���O��ܤ��e return getDisplay(outputData, 1, 4); case "2X6"://�]�w2X6���O��ܤ��e return getDisplay(outputData, 2, 6); case "2X8(�T��)"://�]�w2x8�T�⭱�O��ܤ��e return getDisplay(outputData, 2, 8); case "2X8(���m)": return get2x8Display(outputData, isIcon); case "3X6"://�]�w3X6���O��ܤ��e return getDisplay(outputData, 3, 6); case "5X2"://�]�w5X2���O��ܤ��e return getDisplay(outputData, 2, 5); case "8X1"://�]�w8X1���O��ܤ��e return getDisplay(outputData, 1, 8); default: throw new Exception("�ʤ�CMS���O�w�q!!"); } }
/// <summary> /// �̾�CMS���������o��ܤ��e /// </summary> /// <param name="blockType">���O����</param> /// <param name="message">�T��</param> /// <param name="isIcon">���O�ϧ����(0:�����q,1:�q��D�ϥ�,2:�q�ƬG�ϥ�,3:�q�C��)</param> /// <param name="mode">�Ҧ�</param> /// <returns></returns> private RemoteInterface.HC.CMSOutputData SetCMSDislay(string blockType, string message, int isIcon,int mode,string Location,int Show_icon) { this.mode = mode; List<string> changeTexts = new List<string>(); string str = ""; if (CMSDevName == "CMS-N3-S-196.7") { message = "�x���a�k"; } else if (CMSDevName == "CMS-N3-S-196.8") { message = "�x���a�k"; } foreach (char word in message) { if (word == '[') str = ""; str += word; if (word == ']') { changeTexts.Add(str); } } System.Collections.Generic.List<RSPMegColor> rspMegColors = new System.Collections.Generic.List<RSPMegColor>(); try { foreach (string text in changeTexts) { int no = Convert.ToInt32(text.Substring(text.IndexOf('[') + 1, text.IndexOf(']') - 1)); string mag = setMessage(no,Location); message = message.Replace(text,'\b' + mag + '\f'); MessColor messColor = (MessColor)messColorsHT[no]; //if (blockType == "2X8(���m)") //{ // rspMegColors.Add(new RSPMegColor(mag, messColor.Forecolor, messColor.BackColor)); //} //else //{ rspMegColors.Add(new RSPMegColor(mag, getCMSWordColor(messColor.Forecolor, messColor.BackColor))); //} } } catch (OBSLastDeviceException) { message = "���h�p�߾r�p"; rspMegColors.Clear(); } string newMeg = message.Replace("\r", ""); List<byte> colors = new List<byte>(); //byte[] colors = new byte[message.Replace("\r", "").Length]; for (int i = 0; i < newMeg.Length; i++) { colors.Add(32); } foreach (RSPMegColor de in rspMegColors) { for (int i = newMeg.IndexOf(de.Message); i <= newMeg.IndexOf(de.Message) + de.Message.Length - 1; i++) { if (i == -1) continue; colors[i] = Convert.ToByte(de.Color); if (newMeg[i] == '��') colors.Insert(i, colors[i]); } } RemoteInterface.HC.CMSOutputData outputData; if (Show_icon == 1) { byte[] vspaces = new byte[colors.Count]; outputData = new RemoteInterface.HC.CMSOutputData(4, 0, 0, 0, message.Replace("��", "�@�@"), colors.ToArray(), vspaces); outputData.AlarmClass = (int)ht["INC_NAME"]; } else { outputData = new RemoteInterface.HC.CMSOutputData(0, 0, 0, message.Replace("��", "�@�@"), colors.ToArray()); outputData.AlarmClass = (int)ht["INC_NAME"]; } switch (blockType) { case "1X4"://�]�w1x4���O��ܤ��e return getDisplay(outputData, 1, 4); case "2X6"://�]�w2X6���O��ܤ��e return getDisplay(outputData, 2, 6); case "2X8(�T��)"://�]�w2x8�T�⭱�O��ܤ��e return getDisplay(outputData, 2, 8); case "2X8(���m)": return get2x8Display(outputData, isIcon); case "3X6"://�]�w3X6���O��ܤ��e return getDisplay(outputData, 3, 6); case "5X2"://�]�w5X2���O��ܤ��e return getDisplay(outputData, 2, 5); case "8X1"://�]�w8X1���O��ܤ��e return getDisplay(outputData, 1, 8); default: throw new Exception("�ʤ�CMS���O�w�q!!"); } }
protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType) { string cmd = string.Format("Select mas.maslane1,mas.masLane2,mas.MASLANE3,cfg.g_code_id_new from {0}.{1} mas , {0}.{2} rule ,{0}.{4} cfg " + " where mas.ALARMCLASS = {3} and mas.RULEID = rule.RULEID and rule.RUNING = 'Y' and cfg.alarmclass = mas.alarmclass;" , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblRSPDefaultMessMAS, DBConnect.DB2TableName.tblRSPRule, ht["INC_NAME"],DBConnect.DB2TableName.tblSysAlarmConfig); System.Data.DataTable DT = com.Select(cmd); if (DT == null || DT.Rows.Count == 0) return null; System.Data.DataRow MASdr = DT.Rows[0]; int g_code_id = (int)MASdr[3]; System.Collections.Hashtable displayht = new System.Collections.Hashtable(); //if (devNames.Length == 0||Math.Abs(devNames[0].Mileage - int.Parse(ht["FROM_MILEPOST1"].ToString())) > getValidRangle()) return displayht; //List<object> outputs = new List<object>(); if (devNames == null || devNames.Length == 0) return displayht; RemoteInterface.HC.I_HC_FWIS hobj = EasyClient.getHost(); com.select(DBConnect.DataType.CSLS, Command.GetSelectCmd.getSectionSpeed(ht["ORIGINAL_INC_LOCATION"].ToString())); int ColNum; if (type == CategoryType.GEN) { switch (degree) { case Degree.L: ColNum = 1; break; case Degree.M: ColNum = 2; break; case Degree.H: ColNum = 3; break; case Degree.S: ColNum = 4; break; default: ColNum = 1; break; } } else { ColNum = Convert.ToInt32(ht["INC_CONGESTION"]); } cmd = string.Format("Select SuggesSpeeD{0} From {1}.{2} csls,{1}.{3} rule where AlarmClass = {4} and csls.RuleID = rule.RuleID and rule.RUNING = 'Y';" , ColNum, RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblRSPCSLSSpeed, DBConnect.DB2TableName.tblRSPRule, ht["INC_NAME"]); DT = com.Select(cmd); if (DT != null && DT.Rows.Count > 0) { maxSpeed = Convert.ToInt32(DT.Rows[0][0]); } cmd = string.Format("Select * from {0}.{1} csls,{0}.{2} rule where csls.RuleID = rule.ruleid and rule.runing = 'Y' and SuggesSpeed = {3};" , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblIIPCSLSParam, DBConnect.DB2TableName.tblRSPRule, maxSpeed); DT = com.Select(cmd); if (DT.Rows.Count < 1) { throw new Exception("not Mapping CSLS Speed"); } System.Data.DataRow dr = DT.Rows[0]; List<int> SpeedList = new List<int>(); SpeedList.Add(Convert.ToInt32(dr[UPStream1])); SpeedList.Add(Convert.ToInt32(dr[UPStream2])); SpeedList.Add(Convert.ToInt32(dr[UPStream3])); SpeedList.Add(Convert.ToInt32(dr[UPStream4])); SpeedList.Add(Convert.ToInt32(dr[UPStream5])); range = Convert.ToInt32(dr[RangerLimit]) * 1000; int i = 0; int SetSpped = 90; for (int j = 0; j < devNames.Length;j++ ) { if (devNames[j].Location == "D") { cmd = string.Format("Select sec.MaxSpeed From {0}.{1} sec, {0}.{2} cfg where sec.sectionid = cfg.sectionID and cfg.DeviceName = '{3}';" , RSPGlobal.GlobaSchema, DBConnect.DB2TableName.tblGroupSection, DBConnect.DB2TableName.tblDeviceConfig, devNames[j].DevName); DT = com.Select(cmd); if (DT.Rows.Count > 0) { SetSpped = (int)DT.Rows[0][0]; } } else { if (maxSegId != -99 && ((j == 0 && (Math.Abs(devNames[j].Mileage - Convert.ToInt32(ht["FROM_MILEPOST1"])) > range && Math.Abs(devNames[j].Mileage - Convert.ToInt32(ht["TO_MILEPOST1"])) > range)) || (j > 0 && devNames[j - 1].Location != "D" && Math.Abs(devNames[j].Mileage - devNames[j - 1].Mileage) > range))) break; if (maxSegId == -99) //範圍內 最低速限 { SetSpped = SpeedList[0]; } else //範圍外 { if (i >= SpeedList.Count || SpeedList[i].Equals(-1)) { break; } else { SetSpped = SpeedList[i]; } } i++; } byte[] landObj = new byte[] { 1, 2, 3 }; object[] obj = new object[3]; for (int k = 0; k < 3; k++) { if (MASdr[k].Equals("S")) { obj[k] = SetSpped; } else { obj[k] = new RemoteInterface.HC.CMSOutputData(0, g_code_id, 0, string.Empty, new byte[] { }); } } //List<object> output = new List<object>(); //output.AddRange(new object[] { SetSpped / 10, new RemoteInterface.HC.MASOutputData(landObj,obj) }); displayht.Add(devNames[j].DevName, new RemoteInterface.HC.MASOutputData(landObj, obj)); } return displayht; }