1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- namespace FPER
- {
- public partial class frmMapConfig : Form
- {
- MDIParent mdi = null;
- delegate void deleFormInit();
- LogFileCreate LFC = new LogFileCreate();
- //선택 item
- // ListViewItem IGroup_selectItem;
- // QUERYMode IGroup_cmd;
- // ListViewItem IGroupDevice_selectItem;
- // QUERYMode IGroupDevice_cmd;
- //선택 item
- ListViewItem OGroup_selectItem;
- QUERYMode OGroup_cmd;
- ListViewItem OGroupDevice_selectItem;
- QUERYMode OGroupDevice_cmd;
- QUERYMode Map_cmd;
- ListViewItem Map_selectItem;
- public frmMapConfig()
- {
- InitializeComponent();
- // cyim 2013.7.12 디자인개선작업 : 맵설정
- this.button_Menu_Group.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- }
- public void Form_Init()
- {
- try
- {
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.Source), Application.ProductName);
- }
- }
- string receiver_id = null; // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : warning 제거
- private void frmMapConfig_Load(object sender, EventArgs e)
- {
- // cyim 2013.8.1 : 더블버퍼링 적용
- SetStyle(ControlStyles.UserPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- //this.UpdateStyles();
- SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.UpdateStyles();
- try
- {
- mdi = (MDIParent)this.MdiParent;
- txtThisReceiverID.Text = string.Format("{0:00}", mdi.myReceiverID);
- // cyim 2015.8.4 수신반을 위한 static 클래스 정리 : warning 제거
- receiver_id = Int32.Parse(txtThisReceiverID.Text).ToString();
- /***********************************************************************/
- /* 입력그룹 */
- /***********************************************************************/
- //VIEW모드로 변경한다.
- /*
- Util.GroupUIChange(panelIGroup, UIMode.cancel);
- //그룹의 데이터를 초기화한다.
- IGroupSelectData(null);
- IGroup_getData();
- IGroupDevice_getData();
- */
- /***********************************************************************/
- /***********************************************************************/
- /* 출력그룹 */
- /***********************************************************************/
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelOGroup, UIMode.cancel);
- //그룹의 데이터를 초기화한다.
- OGroupSelectData(null);
- OGroup_getData();
- OGroupDevice_getData();
- /***********************************************************************/
- /***********************************************************************/
- /* 맵 */
- /***********************************************************************/
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelMap, UIMode.cancel);
- //맵 데이터를 초기화한다.
- MapSelectData(null);
- Map_getData();
- //IMap_getData();
- //OMap_getData();
- /***********************************************************************/
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmMapConfig_Activated(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 2;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmMapConfig_Disposed(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 0;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /*******************************************************
- * [입력그룹] LISTVIEW에 데이터 불러오기
- ******************************************************/
- /*
- private void IGroup_getData()
- {
- try
- {
- IGroupSelectData(null);
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- DataTable dt = dacMap.Group_Select(null,code_GroupIO.Input);
- ListViewIGroup.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- ListViewItem item = new ListViewItem(Convert.ToString(dr["GROUP_ID"]));
- item.SubItems.Add(dr["GROUP_NAME"].ToString());
- ListViewIGroup.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- */
- /*
- //리스트VIEW에 그룹선택시
- private void ListViewIGroup_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- IGroup_cmd = QUERYMode.update;
- //VIEW모드로 변경한다.[입력그룹]
- Util.GroupUIChange(panelIGroup, UIMode.input);
- IGroupSelectData(itm);
- IGroupDevice_getData();
- }
- else
- {
- IGroup_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelIGroup, UIMode.cancel);
- IGroupSelectData(null);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- */
- //그룹표시
- //입력그룹 데이터 표시
- /*
- private void IGroupSelectData(ListViewItem itm)
- {
- try {
- IGroup_selectItem = itm;
- if (itm == null)
- {
- txtIGroupID.Text = "";
- txtIGroupName.Text = "";
- if (IGroup_cmd == QUERYMode.insert)
- {
- txtIGroupID.ReadOnly = false;
- txtIGroupID.BackColor = Color.White;
- txtIGroupName.ReadOnly = false;
- btnIGroupOK.Enabled = true;
- }
- else
- {
- txtIGroupID.ReadOnly = true;
- txtIGroupID.BackColor = SystemColors.Control;
- btnIGroupAdd.Enabled = true;
- btnIGroupDel.Enabled = false;
- btnIGroupOK.Enabled = false;
- }
- btnIGroupDeviceAdd.Enabled = false;
- btnIGroupDeviceSearch.Enabled = false;
- }
- else
- {
- txtIGroupID.Text = itm.Text;
- txtIGroupID.BackColor = SystemColors.Control;
- txtIGroupName.Text = itm.SubItems[1].Text;
- txtIGroupID.ReadOnly = true;
- btnIGroupAdd.Enabled = true;
- btnIGroupDel.Enabled = true;
- btnIGroupOK.Enabled = true;
- btnIGroupDeviceAdd.Enabled = true;
- btnIGroupDeviceSearch.Enabled = true;
- }
- IGroupDeviceSelectData(null);
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- //그룹추가
- private void btnIGroupAdd_Click(object sender, EventArgs e)
- {
- try {
- //입력모드로 변경한다.
- IGroup_cmd = QUERYMode.insert;
- Util.GroupUIChange(panelIGroup, UIMode.input);
- IGroupSelectData(null);
- txtIGroupID.Text = "GI";
- txtIGroupID.Focus();
- btnIGroupAdd.Enabled = false;
- btnIGroupDel.Enabled = false;
- btnIGroupCancel.Visible = true;
- btnIGroupOK.Enabled = true;
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- //그룹저장
- private void btnIGroupOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (IGroup_cmd == QUERYMode.insert || IGroup_cmd == QUERYMode.update)
- {
- Util.ChkTxtBox(txtIGroupID, "입력그룹ID");
- Util.ChkTxtBox(txtIGroupName, "입력그룹명");
- String GroupID = txtIGroupID.Text.Trim();
- String GroupName = txtIGroupName.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- dacMap.Group_Update(IGroup_cmd, GroupID, code_GroupIO.Input, GroupName);
- }
- IGroup_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelIGroup, UIMode.cancel);
- //데이터 불러오기
- IGroup_getData();
- IGroupDevice_getData();
- IGroupSelectData(null);
- btnIGroupCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //그룹삭제
- private void btnIGroupDel_Click(object sender, EventArgs e)
- {
- try
- {
- IGroup_cmd = QUERYMode.delete;
- String GroupID = txtIGroupID.Text.Trim();
- String GroupName = txtIGroupName.Text.Trim();
- String msg = string.Format("{0}[{1}]을/를 삭제하시겠습니까?", GroupName, GroupID);
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- dacMap.Group_Update(QUERYMode.delete, GroupID, code_GroupIO.Input, GroupName);
- }
- //VIEW모드로 변경한다.
- IGroup_cmd = QUERYMode.select;
- Util.GroupUIChange(panelIGroup, UIMode.cancel);
- //입력 CLEAR
- IGroupSelectData(null);
- //데이터 불러오기
- IGroup_getData();
- IGroupDevice_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void txtIGroupID_TextChanged(object sender, EventArgs e)
- {
- try {
- Util.ToUpper(txtIGroupID);
- }
- catch (Exception ex) {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void mskIGroupDeviceID_TextChanged(object sender, EventArgs e)
- {
- try
- {
- String dev_id_s = mskIGroupDeviceID.Text.Trim();
- if (dev_id_s.Length == 13)
- {
- String GroupID = txtIGroupID.Text.Trim();
- //MI-##-#-###-# :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- if (dev_id.Comm_id == 3)
- {
- DacIODeviceConfig dacIODeviceConfig = new DacIODeviceConfig();
- DataTable dt = dacIODeviceConfig.Device_Select(mdi.MyReceiverID
- , dev_id.Board_id,dev_id.Device_id, dev_id.Inout_type);
- if (dt.Rows.Count > 0)
- {
- DataRow dr = dt.Rows[0];
- txtIGroupDeviceTypeCode.Text = dr["DEVICE_TYPE"].ToString();
- txtIGroupDeviceTypeName.Text = dr["DEVICE_TYPE_NAME"].ToString();
- txtIGroupDeviceMemo.Text = dr["DEVICE_NAME"].ToString();
- txtIGroupPositionCode.Text = dr["POSITION_CODE"].ToString();
- txtIGroupPositionName.Text = dr["POSITION_NAME"].ToString();
- }
- }
- else
- {
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig();
- DataTable dt = dacDeviceConfig.Device_Select(mdi.MyReceiverID
- , dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- if (dt.Rows.Count > 0)
- {
- DataRow dr = dt.Rows[0];
- txtIGroupDeviceTypeCode.Text = dr["DEVICE_TYPE"].ToString();
- txtIGroupDeviceTypeName.Text = dr["DEVICE_TYPE_NAME"].ToString();
- txtIGroupDeviceMemo.Text = dr["DEVICE_NAME"].ToString();
- txtIGroupPositionCode.Text = dr["POSITION_CODE"].ToString();
- txtIGroupPositionName.Text = dr["POSITION_NAME"].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- */
- /*******************************************************
- * [입력그룹 회로정보] LISTVIEW에 데이터 불러오기
- ******************************************************/
- /*
- private void IGroupDevice_getData()
- {
- try
- {
- IGroupDeviceSelectData(null);
- String GroupID = txtIGroupID.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- DataTable dt = dacMap.Group_Device_Select(GroupID, mdi.MyReceiverID);
- ListViewIGroupDevice.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- String dev_id = dr["DEVICE_ID"].ToString();
- MskDeviceIDString dev_s = new MskDeviceIDString(int.Parse(dr["COMM_ID"].ToString()), int.Parse(dr["BOARD_ID"].ToString()), int.Parse(dr["LOOP_NO"].ToString())
- , int.Parse(dr["REPEATER_ID"].ToString()), int.Parse(dr["DEVICE_ID"].ToString()), dr["INOUT_TYPE"].ToString());
- ListViewItem item = new ListViewItem(dev_s.MskId);
- item.SubItems.Add(dr["DEVICE_TYPE"].ToString() + "-" + dr["DEVICE_TYPE_NAME"].ToString());
- item.SubItems.Add(dr["POSITION_CODE"].ToString() + "-" + dr["POSITION_NAME"].ToString());
- item.SubItems.Add(dr["DEVICE_NAME"].ToString());
- ListViewIGroupDevice.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //입력그룹 회로 데이터 표시
- private void IGroupDeviceSelectData(ListViewItem itm)
- {
- try {
- IGroupDevice_selectItem = itm;
- if (itm == null)
- {
- mskIGroupDeviceID.Text = "";
- txtIGroupDeviceTypeCode.Text = "";
- txtIGroupDeviceTypeName.Text = "";
- txtIGroupDeviceMemo.Text = "";
- txtIGroupPositionCode.Text = "";
- txtIGroupPositionName.Text = "";
- if (IGroupDevice_cmd == QUERYMode.insert)
- {
- //mskIGroupDeviceID.ReadOnly = false;
- //mskIGroupDeviceID.BackColor = Color.White;
- btnIGroupDeviceOK.Enabled = true;
- btnIGroupDeviceSearch.Enabled = true;
- }
- else
- {
- //mskIGroupDeviceID.ReadOnly = true;
- //mskIGroupDeviceID.BackColor = SystemColors.Control;
- //btnIGroupDeviceAdd.Enabled = true;
- btnIGroupDeviceDel.Enabled = false;
- btnIGroupDeviceOK.Enabled = false;
- btnIGroupDeviceSearch.Enabled = false;
- }
- }
- else
- {
- String dev_id_s = itm.Text;
- dev_id_s = dev_id_s.Replace("-", "");
- if (dev_id_s.Substring(0, 1).Equals("I"))
- {
- //IO보드
- mskIGroupDeviceID.Mask = "A-A-00-00";
- }
- else
- {
- //중계기>AA-00-0-000-0
- mskIGroupDeviceID.Mask = ">AA-00-0-000-0";
- }
- mskIGroupDeviceID.Text = dev_id_s;
- //mskIGroupDeviceID.BackColor = SystemColors.Control;
- String GroupDeviceType = itm.SubItems[1].Text;
- if (GroupDeviceType.Length > 0)
- {
- int pos = GroupDeviceType.IndexOf("-");
- if (pos != -1)
- {
- txtIGroupDeviceTypeCode.Text = GroupDeviceType.Substring(0, pos);
- txtIGroupDeviceTypeName.Text = GroupDeviceType.Substring(pos+1);
- }
- }
- String GroupPostion = itm.SubItems[2].Text;
- if (GroupPostion.Length > 0)
- {
- int pos = GroupPostion.IndexOf("-");
- if (pos != -1)
- {
- txtIGroupPositionCode.Text = GroupPostion.Substring(0, pos);
- txtIGroupPositionName.Text = GroupPostion.Substring(pos + 1);
- }
- }
- txtIGroupDeviceMemo.Text = itm.SubItems[3].Text;
- //mskIGroupDeviceID.ReadOnly = true;
- //btnIGroupDeviceAdd.Enabled = true;
- btnIGroupDeviceSearch.Enabled = false;
- btnIGroupDeviceDel.Enabled = true;
- btnIGroupDeviceOK.Enabled = true;
- }
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- private void btnIGroupCancel_Click(object sender, EventArgs e)
- {
- try {
- //VIEW모드로 변경한다.
- IGroup_cmd = QUERYMode.select;
- Util.GroupUIChange(panelIGroup, UIMode.cancel);
- IGroupSelectData(null);
- btnIGroupCancel.Visible = false;
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- private void btnIGroupDeviceAdd_Click(object sender, EventArgs e)
- {
- try {
- //입력모드로 변경한다.
- IGroupDevice_cmd = QUERYMode.insert;
- //Util.GroupControlChange(panelIGroupDevice, UIMode.input);
- //mskIGroupDeviceID.ReadOnly = false;
- IGroupDeviceSelectData(null);
- btnIGroupDeviceSearch.Focus();
- btnIGroupDeviceAdd.Enabled = false;
- btnIGroupDeviceDel.Enabled = false;
- btnIGroupDeviceCancel.Visible = true;
- btnIGroupDeviceOK.Enabled = true;
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- private void btnIGroupDeviceDel_Click(object sender, EventArgs e)
- {
- try
- {
- String GroupID = txtIGroupID.Text.Trim();
- String dev_id_s = mskIGroupDeviceID.Text.Trim();
- //MI-##-#-###-# :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- String msg = string.Format("{0}을/를 삭제하시겠습니까?", dev_id_s);
- IGroupDevice_cmd = QUERYMode.delete;
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- dacMap.Group_Device_Update(IGroupDevice_cmd, GroupID, mdi.MyReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- //VIEW모드로 변경한다.
- IGroupDevice_cmd = QUERYMode.select;
- //Util.GroupControlChange(panelIGroupDevice, UIMode.cancel);
- //mskIGroupDeviceID.ReadOnly = true;
- //입력 CLEAR
- IGroupDeviceSelectData(null);
- //데이터 불러오기
- IGroupDevice_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnIGroupDeviceCancel_Click(object sender, EventArgs e)
- {
- try {
- //VIEW모드로 변경한다.
- IGroupDevice_cmd = QUERYMode.select;
- //Util.GroupControlChange(panelIGroupDevice, UIMode.cancel);
- //mskIGroupDeviceID.ReadOnly = true;
- IGroupDeviceSelectData(null);
- btnIGroupDeviceCancel.Visible = false;
- btnIGroupDeviceAdd.Enabled = true;
- btnIGroupDeviceSearch.Enabled = true;
- }
- catch(Exception ex) {
- Util.UErrorMessage(ex,0,0);
- }
- }
- private void btnIGroupDeviceOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (IGroupDevice_cmd == QUERYMode.insert || IGroupDevice_cmd == QUERYMode.update)
- {
- Util.ChkTxtBox(mskIGroupDeviceID, "회로번호");
- String GroupID = txtIGroupID.Text.Trim();
- String dev_id_s = mskIGroupDeviceID.Text;
- //MI-##-#-##### :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- dacMap.Group_Device_Update(IGroupDevice_cmd, GroupID, mdi.MyReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- IGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelIGroupDevice, UIMode.cancel);
- //mskIGroupDeviceID.ReadOnly = true;
- //데이터 불러오기
- IGroupDevice_getData();
- IGroupDeviceSelectData(null);
- btnIGroupDeviceAdd.Enabled = true;
- btnIGroupDeviceCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void ListViewIGroupDevice_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- IGroupDevice_cmd = QUERYMode.update;
- //VIEW모드로 변경한다.[입력그룹]
- //Util.GroupControlChange(panelIGroupDevice, UIMode.input);
- //mskIGroupDeviceID.ReadOnly = false;
- IGroupDeviceSelectData(itm);
- }
- else
- {
- IGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelIGroupDevice, UIMode.cancel);
- //mskIGroupDeviceID.ReadOnly = true;
- IGroupDeviceSelectData(null);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //회로검색버튼 클릭시
- private void btnIGroupDeviceSearch_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalDeviceList frm = new frmModalDeviceList();
- SearchCodeVo vo = new SearchCodeVo(null);
- InputIDVo inputVo = new InputIDVo();
- inputVo.ReceiverID = this.mdi.MyReceiverID;
- inputVo.InoutType = code_InOutType.Input;
- String dev_id_s = mskIGroupDeviceID.Text.Trim();
- if (dev_id_s.Length == 13)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- inputVo.BoardID = dev_id.Board_id;
- inputVo.CommID = dev_id.Comm_id;
- inputVo.LoopNo = dev_id.Loop_no;
- inputVo.DeviceID = dev_id.Device_id;
- }
- frm.SearchCode = vo;
- frm.InputVo = inputVo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- InputIDVo[] inputVos = (InputIDVo[])vo.SelectObject;
- if (inputVos.Length > 0)
- {
- //if (inputVos.Length == 1)
- //{
- // MskDeviceIDString dev_id = new MskDeviceIDString(inputVos[0].CommID, inputVos[0].BoardID
- // , inputVos[0].LoopNo, inputVos[0].RepeaterID
- // , inputVos[0].DeviceID, inputVos[0].InoutType);
- // mskIGroupDeviceID.Text = dev_id.MskId;
- //}
- //else
- //{
- String GroupID = txtIGroupID.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);
- for (int i = 0; i < inputVos.Length; i++)
- {
- //String dev_id_s = mskIGroupDeviceID.Text;
- ////MI-##-#-##### :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- //MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- MskDeviceIDString dev_id = new MskDeviceIDString(inputVos[i].CommID, inputVos[i].BoardID
- , inputVos[i].LoopNo, inputVos[i].RepeaterID
- , inputVos[i].DeviceID, inputVos[i].InoutType);
- dacMap.Group_Device_Update(IGroupDevice_cmd, GroupID, mdi.MyReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- IGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelIGroupDevice, UIMode.cancel);
- //mskIGroupDeviceID.ReadOnly = true;
- //데이터 불러오기
- IGroupDevice_getData();
- IGroupDeviceSelectData(null);
- btnIGroupDeviceAdd.Enabled = true;
- //btnIGroupDeviceCancel.Visible = false;
- //}
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex,0,0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- /*******************************************************
- * [출력그룹] LISTVIEW에 데이터 불러오기
- ******************************************************/
- private void OGroup_getData()
- {
- try
- {
- OGroupSelectData(null);
- DacMap dacMap = new DacMap(mdi.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- // cyim 2014.8.14 그룹정보는 수신기아이디에 따라 출력됨
- //DataTable dt = dacMap.Group_Select(null, code_GroupIO.Output);
- DataTable dt = dacMap.Group_Select(null, code_GroupIO.Output, receiver_id); // cyim 2015.8.4 수신반을 위한 static 클래스 정리
- ListViewOGroup.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- ListViewItem item = new ListViewItem(Convert.ToString(dr["GROUP_ID"]));
- item.SubItems.Add(dr["GROUP_NAME"].ToString());
- ListViewOGroup.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //리스트VIEW에 그룹선택시
- private void ListViewOGroup_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- OGroup_cmd = QUERYMode.update;
- //VIEW모드로 변경한다.[출력그룹]
- Util.GroupUIChange(panelOGroup, UIMode.input);
- OGroupSelectData(itm);
- OGroupDevice_getData();
- }
- else
- {
- OGroup_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelOGroup, UIMode.cancel);
- OGroupSelectData(null);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //그룹표시
- //출력그룹 데이터 표시
- private void OGroupSelectData(ListViewItem itm)
- {
- try
- {
- OGroup_selectItem = itm;
- if (itm == null)
- {
- txtOGroupID.Text = "";
- txtOGroupName.Text = "";
- if (OGroup_cmd == QUERYMode.insert)
- {
- txtOGroupID.ReadOnly = false;
- txtOGroupID.BackColor = Color.White;
- txtOGroupName.ReadOnly = false;
- btnOGroupOK.Enabled = true;
- }
- else
- {
- txtOGroupID.ReadOnly = true;
- txtOGroupID.BackColor = SystemColors.Control;
- btnOGroupAdd.Enabled = true;
- btnOGroupDel.Enabled = false;
- btnOGroupOK.Enabled = false;
- }
- btnOGroupDeviceAdd.Enabled = false;
- btnOGroupDeviceSearch.Enabled = false;
- }
- else
- {
- txtOGroupID.Text = itm.Text;
- txtOGroupID.BackColor = SystemColors.Control;
- txtOGroupName.Text = itm.SubItems[1].Text;
- txtOGroupID.ReadOnly = true;
- btnOGroupAdd.Enabled = true;
- btnOGroupDel.Enabled = true;
- btnOGroupOK.Enabled = true;
- btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceSearch.Enabled = true;
- }
- OGroupDeviceSelectData(null);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //그룹추가
- private void btnOGroupAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //출력모드로 변경한다.
- OGroup_cmd = QUERYMode.insert;
- Util.GroupUIChange(panelOGroup, UIMode.input);
- OGroupSelectData(null);
- txtOGroupID.Text = "GO";
- txtOGroupID.Focus();
- btnOGroupAdd.Enabled = false;
- btnOGroupDel.Enabled = false;
- btnOGroupCancel.Visible = true;
- btnOGroupOK.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //그룹저장
- private void btnOGroupOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (OGroup_cmd == QUERYMode.insert || OGroup_cmd == QUERYMode.update)
- {
- Util.ChkTxtBox(txtOGroupID, "출력그룹ID");
- Util.ChkTxtBox(txtOGroupName, "출력그룹명");
- String GroupID = txtOGroupID.Text.Trim();
- String GroupName = txtOGroupName.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Group_Update(OGroup_cmd, GroupID, code_GroupIO.Output, GroupName);
- }
- OGroup_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelOGroup, UIMode.cancel);
- //데이터 불러오기
- OGroup_getData();
- OGroupDevice_getData();
- OGroupSelectData(null);
- btnOGroupCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //그룹삭제
- private void btnOGroupDel_Click(object sender, EventArgs e)
- {
- try
- {
- OGroup_cmd = QUERYMode.delete;
- String GroupID = txtOGroupID.Text.Trim();
- String GroupName = txtOGroupName.Text.Trim();
- String msg = string.Format("{0}[{1}]을/를 삭제하시겠습니까?", GroupName, GroupID);
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Group_Update(QUERYMode.delete, GroupID, code_GroupIO.Output, GroupName);
- }
- //VIEW모드로 변경한다.
- OGroup_cmd = QUERYMode.select;
- Util.GroupUIChange(panelOGroup, UIMode.cancel);
- //출력 CLEAR
- OGroupSelectData(null);
- //데이터 불러오기
- OGroup_getData();
- OGroupDevice_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void txtOGroupID_TextChanged(object sender, EventArgs e)
- {
- try
- {
- Util.ToUpper(txtOGroupID);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void mskOGroupDeviceID_TextChanged(object sender, EventArgs e)
- {
- try
- {
- String dev_id_s = mskOGroupDeviceID.Text.Trim();
- if (dev_id_s.Length == 13)
- {
- String GroupID = txtOGroupID.Text.Trim();
- //MI-##-#-###-# :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- if (dev_id.Comm_id == 3)
- {
- DacIODeviceConfig dacIODeviceConfig = new DacIODeviceConfig(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacIODeviceConfig.Device_Select(mdi.myReceiverID
- , dev_id.Board_id, dev_id.Device_id, dev_id.Inout_type);
- if (dt.Rows.Count > 0)
- {
- DataRow dr = dt.Rows[0];
- txtOGroupDeviceTypeCode.Text = dr["DEVICE_TYPE"].ToString();
- txtOGroupDeviceTypeName.Text = dr["DEVICE_TYPE_NAME"].ToString();
- txtOGroupDeviceMemo.Text = dr["DEVICE_NAME"].ToString();
- txtOGroupPositionCode.Text = dr["POSITION_CODE"].ToString();
- txtOGroupPositionName.Text = dr["POSITION_NAME"].ToString();
- }
- }
- else
- {
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacDeviceConfig.Device_Select(mdi.myReceiverID
- , dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- if (dt.Rows.Count > 0)
- {
- DataRow dr = dt.Rows[0];
- txtOGroupDeviceTypeCode.Text = dr["DEVICE_TYPE"].ToString();
- txtOGroupDeviceTypeName.Text = dr["DEVICE_TYPE_NAME"].ToString();
- txtOGroupDeviceMemo.Text = dr["DEVICE_NAME"].ToString();
- txtOGroupPositionCode.Text = dr["POSITION_CODE"].ToString();
- txtOGroupPositionName.Text = dr["POSITION_NAME"].ToString();
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- /*******************************************************
- * [출력그룹 회로정보] LISTVIEW에 데이터 불러오기
- ******************************************************/
- private void OGroupDevice_getData()
- {
- try
- {
- OGroupDeviceSelectData(null);
- String GroupID = txtOGroupID.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacMap.Group_Device_Select(GroupID, mdi.myReceiverID);
- ListViewOGroupDevice.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- String dev_id = dr["DEVICE_ID"].ToString();
- MskDeviceIDString dev_s = new MskDeviceIDString(int.Parse(dr["COMM_ID"].ToString()), int.Parse(dr["BOARD_ID"].ToString()), int.Parse(dr["LOOP_NO"].ToString())
- , int.Parse(dr["REPEATER_ID"].ToString()), int.Parse(dr["DEVICE_ID"].ToString()), dr["INOUT_TYPE"].ToString());
- ListViewItem item = new ListViewItem(dr["RECEIVER_ID"].ToString() + ":" + dev_s.MskId); // cyim 2014.8.12 수신기 아이디까지 회로번호로 보이도록 수정
- item.SubItems.Add(dr["DEVICE_TYPE"].ToString() + "-" + dr["DEVICE_TYPE_NAME"].ToString());
- item.SubItems.Add(dr["POSITION_CODE"].ToString() + "-" + dr["POSITION_NAME"].ToString());
- item.SubItems.Add(dr["DEVICE_NAME"].ToString());
- ListViewOGroupDevice.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //출력그룹 회로 데이터 표시
- private void OGroupDeviceSelectData(ListViewItem itm)
- {
- try
- {
- OGroupDevice_selectItem = itm;
- if (itm == null)
- {
- mskOGroupDeviceID.Text = "";
- txtOGroupDeviceTypeCode.Text = "";
- txtOGroupDeviceTypeName.Text = "";
- txtOGroupDeviceMemo.Text = "";
- txtOGroupPositionCode.Text = "";
- txtOGroupPositionName.Text = "";
- if (OGroupDevice_cmd == QUERYMode.insert)
- {
- //mskOGroupDeviceID.ReadOnly = false;
- //mskOGroupDeviceID.BackColor = Color.White;
- btnOGroupDeviceOK.Enabled = true;
- btnOGroupDeviceSearch.Enabled = true;
- }
- else
- {
- //mskOGroupDeviceID.ReadOnly = true;
- //mskOGroupDeviceID.BackColor = SystemColors.Control;
- //btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceDel.Enabled = false;
- btnOGroupDeviceOK.Enabled = false;
- btnOGroupDeviceSearch.Enabled = false;
- }
- }
- else
- {
- String dev_id_s = itm.Text;
- dev_id_s = dev_id_s.Replace("-", "");
- if (dev_id_s.Substring(0, 1).Equals("I"))
- {
- //IO보드
- mskOGroupDeviceID.Mask = "A-A-00-00";
- }
- else
- {
- //중계기>AA-00-0-000-0
- mskOGroupDeviceID.Mask = ">AA-00-0-000-0";
- }
- mskOGroupDeviceID.Text = dev_id_s;
- //mskOGroupDeviceID.BackColor = SystemColors.Control;
- String GroupDeviceType = itm.SubItems[1].Text;
- if (GroupDeviceType.Length > 0)
- {
- int pos = GroupDeviceType.IndexOf("-");
- if (pos != -1)
- {
- txtOGroupDeviceTypeCode.Text = GroupDeviceType.Substring(0, pos);
- txtOGroupDeviceTypeName.Text = GroupDeviceType.Substring(pos + 1);
- }
- }
- String GroupPostion = itm.SubItems[2].Text;
- if (GroupPostion.Length > 0)
- {
- int pos = GroupPostion.IndexOf("-");
- if (pos != -1)
- {
- txtOGroupPositionCode.Text = GroupPostion.Substring(0, pos);
- txtOGroupPositionName.Text = GroupPostion.Substring(pos + 1);
- }
- }
- txtOGroupDeviceMemo.Text = itm.SubItems[3].Text;
- //mskOGroupDeviceID.ReadOnly = true;
- //btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceSearch.Enabled = false;
- btnOGroupDeviceDel.Enabled = true;
- btnOGroupDeviceOK.Enabled = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOGroupCancel_Click(object sender, EventArgs e)
- {
- try
- {
- //VIEW모드로 변경한다.
- OGroup_cmd = QUERYMode.select;
- Util.GroupUIChange(panelOGroup, UIMode.cancel);
- OGroupSelectData(null);
- btnOGroupCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOGroupDeviceAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //출력모드로 변경한다.
- OGroupDevice_cmd = QUERYMode.insert;
- //Util.GroupControlChange(panelOGroupDevice, UIMode.Output);
- //mskOGroupDeviceID.ReadOnly = false;
- OGroupDeviceSelectData(null);
- btnOGroupDeviceSearch.Focus();
- btnOGroupDeviceAdd.Enabled = false;
- btnOGroupDeviceDel.Enabled = false;
- btnOGroupDeviceCancel.Visible = true;
- btnOGroupDeviceOK.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOGroupDeviceDel_Click(object sender, EventArgs e)
- {
- try
- {
- String GroupID = txtOGroupID.Text.Trim();
- String dev_id_s = mskOGroupDeviceID.Text.Trim();
- //MI-##-#-###-# :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- String msg = string.Format("{0}을/를 삭제하시겠습니까?", dev_id_s);
- OGroupDevice_cmd = QUERYMode.delete;
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Group_Device_Update(OGroupDevice_cmd, GroupID, mdi.myReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- //VIEW모드로 변경한다.
- OGroupDevice_cmd = QUERYMode.select;
- //Util.GroupControlChange(panelOGroupDevice, UIMode.cancel);
- //mskOGroupDeviceID.ReadOnly = true;
- //출력 CLEAR
- OGroupDeviceSelectData(null);
- //데이터 불러오기
- OGroupDevice_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnOGroupDeviceCancel_Click(object sender, EventArgs e)
- {
- try
- {
- //VIEW모드로 변경한다.
- OGroupDevice_cmd = QUERYMode.select;
- //Util.GroupControlChange(panelOGroupDevice, UIMode.cancel);
- //mskOGroupDeviceID.ReadOnly = true;
- OGroupDeviceSelectData(null);
- btnOGroupDeviceCancel.Visible = false;
- btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceSearch.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOGroupDeviceOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (OGroupDevice_cmd == QUERYMode.insert || OGroupDevice_cmd == QUERYMode.update)
- {
- Util.ChkTxtBox(mskOGroupDeviceID, "회로번호");
- String GroupID = txtOGroupID.Text.Trim();
- String dev_id_s = mskOGroupDeviceID.Text;
- //MI-##-#-##### :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Group_Device_Update(OGroupDevice_cmd, GroupID, mdi.myReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- OGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelOGroupDevice, UIMode.cancel);
- //mskOGroupDeviceID.ReadOnly = true;
- //데이터 불러오기
- OGroupDevice_getData();
- OGroupDeviceSelectData(null);
- btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void ListViewOGroupDevice_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- OGroupDevice_cmd = QUERYMode.update;
- //VIEW모드로 변경한다.[출력그룹]
- //Util.GroupControlChange(panelOGroupDevice, UIMode.Output);
- //mskOGroupDeviceID.ReadOnly = false;
- OGroupDeviceSelectData(itm);
- }
- else
- {
- OGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelOGroupDevice, UIMode.cancel);
- //mskOGroupDeviceID.ReadOnly = true;
- OGroupDeviceSelectData(null);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //회로검색버튼 클릭시
- private void btnOGroupDeviceSearch_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalDeviceList frm = new frmModalDeviceList(mdi); // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- SearchCodeVo vo = new SearchCodeVo(null);
- InputIDVo inputVo = new InputIDVo();
- inputVo.ReceiverID = this.mdi.myReceiverID;
- inputVo.InoutType = code_InOutType.Output;
- String dev_id_s = mskOGroupDeviceID.Text.Trim();
- if (dev_id_s.Length == 13)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-##(회로ID)
- MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- inputVo.BoardID = dev_id.Board_id;
- inputVo.CommID = dev_id.Comm_id;
- inputVo.LoopNo = dev_id.Loop_no;
- inputVo.DeviceID = dev_id.Device_id;
- }
- frm.SearchCode = vo;
- frm.InputVo = inputVo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- //inputVo = (InputIDVo)vo.SelectObject;
- InputIDVo[] inputVos = (InputIDVo[])vo.SelectObject;
- if (inputVos.Length > 0)
- {
- //if (inputVos.Length == 1)
- //{
- // MskDeviceIDString dev_id = new MskDeviceIDString(inputVos[0].CommID, inputVos[0].BoardID
- // , inputVos[0].LoopNo, inputVos[0].RepeaterID
- // , inputVos[0].DeviceID, inputVos[0].InoutType);
- // mskOGroupDeviceID.Text = dev_id.MskId;
- //}
- //else
- //{
- //String dev_id_s = mskOGroupDeviceID.Text;
- ////MI-##-#-##### :M(구분 M-중계기,I-출력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- //MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- String GroupID = txtOGroupID.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- for (int i = 0; i < inputVos.Length; i++)
- {
- //String dev_id_s = mskIGroupDeviceID.Text;
- ////MI-##-#-##### :M(구분 M-중계기,I-입력그룹)I,O(회로구분)-##(보드ID)-#(회로ID)
- //MskDeviceIDString dev_id = new MskDeviceIDString(dev_id_s);
- MskDeviceIDString dev_id = new MskDeviceIDString(inputVos[i].CommID, inputVos[i].BoardID
- , inputVos[i].LoopNo, inputVos[i].RepeaterID
- , inputVos[i].DeviceID, inputVos[i].InoutType);
- dacMap.Group_Device_Update(OGroupDevice_cmd, GroupID, mdi.myReceiverID, dev_id.Comm_id,
- dev_id.Board_id, dev_id.Loop_no, dev_id.Repeater_id, dev_id.Device_id, dev_id.Inout_type);
- }
- OGroupDevice_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- //Util.GroupControlChange(panelOGroupDevice, UIMode.cancel);
- //mskOGroupDeviceID.ReadOnly = true;
- //데이터 불러오기
- OGroupDevice_getData();
- OGroupDeviceSelectData(null);
- btnOGroupDeviceAdd.Enabled = true;
- btnOGroupDeviceCancel.Visible = false;
- //}
- }
- //MskDeviceIDString dev_id = new MskDeviceIDString(inputVo.CommID, inputVo.BoardID
- // , inputVo.LoopNo, inputVo.RepeaterID
- // , inputVo.DeviceID, inputVo.InoutType);
- //mskOGroupDeviceID.Text = dev_id.MskId;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //------------------------------------------------
- /*******************************************************
- * [맵] LISTVIEW에 데이터 불러오기
- ******************************************************/
- private void Map_getData()
- {
- try
- {
- MapSelectData(null);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacMap.Map_Select(0);
- ListViewMap.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- ListViewItem item = new ListViewItem(Convert.ToString(dr["MAP_NO"]));
- item.SubItems.Add(dr["MAP_ID"].ToString());
- item.SubItems.Add(dr["MAP_NAME"].ToString());
- ListViewMap.Items.Add(item);
- }
- }
- ListViewIMap.Items.Clear();
- ListViewOMap.Items.Clear();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //리스트VIEW에 맵선택시
- private void ListViewMap_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- Map_cmd = QUERYMode.update;
- //VIEW모드로 변경한다.[맵]
- Util.GroupUIChange(panelMap, UIMode.input);
- MapSelectData(itm);
- IMap_getData();
- OMap_getData();
- }
- else
- {
- Map_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelMap, UIMode.cancel);
- MapSelectData(null);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //맵표시
- //맵 데이터 표시
- private void MapSelectData(ListViewItem itm)
- {
- try
- {
- Map_selectItem = itm;
- if (itm == null)
- {
- txtMapNo.Text = "";
- txtMapID.Text = "";
- txtMapName.Text = "";
- if (Map_cmd == QUERYMode.insert)
- {
- txtMapNo.ReadOnly = false;
- txtMapNo.BackColor = Color.White;
- txtMapID.ReadOnly = false;
- txtMapName.ReadOnly = false;
- btnMapOK.Enabled = true;
- }
- else
- {
- txtMapNo.ReadOnly = true;
- txtMapNo.BackColor = SystemColors.Control;
- btnMapAdd.Enabled = true;
- btnMapDel.Enabled = false;
- btnMapOK.Enabled = false;
- }
- btnIMapGroupAdd.Enabled = false;
- btnIMapDeviceAdd.Enabled = false;
- btnIMapDel.Enabled = false;
- btnOMapGroupAdd.Enabled = false;
- btnOMapDeviceAdd.Enabled = false;
- btnOMapDel.Enabled = false;
- }
- else
- {
- txtMapNo.Text = itm.Text;
- txtMapNo.BackColor = SystemColors.Control;
- txtMapID.Text = itm.SubItems[1].Text;
- txtMapName.Text = itm.SubItems[2].Text;
- txtMapNo.ReadOnly = true;
- btnMapAdd.Enabled = true;
- btnMapDel.Enabled = true;
- btnMapOK.Enabled = true;
- btnIMapGroupAdd.Enabled = true;
- btnIMapDeviceAdd.Enabled = true;
- btnIMapDel.Enabled = false;
- btnOMapGroupAdd.Enabled = true;
- btnOMapDeviceAdd.Enabled = true;
- btnOMapDel.Enabled = false;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //맵추가
- private void btnMapAdd_Click(object sender, EventArgs e)
- {
- try
- {
- //입력모드로 변경한다.
- Map_cmd = QUERYMode.insert;
- Util.GroupUIChange(panelMap, UIMode.input);
- MapSelectData(null);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- txtMapNo.Text = string.Format("{0}", dacMap.Map_Max_Select());
- txtMapID.Text = "MAP";
- txtMapID.Focus();
- btnMapAdd.Enabled = false;
- btnMapDel.Enabled = false;
- btnMapCancel.Visible = true;
- btnMapOK.Enabled = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //맵저장
- private void btnMapOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (Map_cmd == QUERYMode.insert || Map_cmd == QUERYMode.update)
- {
- Util.ChkTxtBox(txtMapNo, "맵No");
- Util.ChkTxtBox(txtMapID, "맵ID");
- Util.ChkTxtBox(txtMapName, "맵명");
- int MapNo = Util.StrToInt(txtMapNo.Text, 0);
- String MapID = txtMapID.Text.Trim();
- String MapName = txtMapName.Text.Trim();
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Map_Update(Map_cmd, MapNo, MapID, MapName);
- }
- Map_cmd = QUERYMode.select;
- //VIEW모드로 변경한다.
- Util.GroupUIChange(panelMap, UIMode.cancel);
- //데이터 불러오기
- Map_getData();
- IMap_getData();
- OMap_getData();
- MapSelectData(null);
- btnMapCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- //맵삭제
- private void btnMapDel_Click(object sender, EventArgs e)
- {
- try
- {
- Map_cmd = QUERYMode.delete;
- int MapNo = Util.StrToInt(txtMapNo.Text, 0);
- String MapID = txtMapID.Text.Trim();
- String MapName = txtMapName.Text.Trim();
- String msg = string.Format("{0}[{1}]을/를 삭제하시겠습니까?", MapName, MapID);
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Map_Update(QUERYMode.delete, MapNo, MapID, MapName);
- }
- //VIEW모드로 변경한다.
- Map_cmd = QUERYMode.select;
- Util.GroupUIChange(panelMap, UIMode.cancel);
- //맵 CLEAR
- MapSelectData(null);
- //데이터 불러오기
- Map_getData();
- IMap_getData();
- OMap_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void txMapID_TextChanged(object sender, EventArgs e)
- {
- try
- {
- Util.ToUpper(txtMapID);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnMapCancel_Click(object sender, EventArgs e)
- {
- try
- {
- //VIEW모드로 변경한다.
- Map_cmd = QUERYMode.select;
- Util.GroupUIChange(panelMap, UIMode.cancel);
- MapSelectData(null);
- btnMapCancel.Visible = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- /*******************************************************
- * [입력맵 회로정보] LISTVIEW에 데이터 불러오기
- ******************************************************/
- private void IMap_getData()
- {
- try
- {
- int MapNo = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacMap.Map_Process_Select(MapNo, code_GroupIO.Input, 0);
- ListViewIMap.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-입력맵)I,O(회로구분)-##(보드ID)-##(회로ID)
- String process_type = dr["PROCESS_TYPE"].ToString();
- string process_id = "";
- if (process_type.Equals("D"))
- {
- MskDeviceIDString dev_s = new MskDeviceIDString(int.Parse(dr["COMM_ID"].ToString()), int.Parse(dr["BOARD_ID"].ToString()), int.Parse(dr["LOOP_NO"].ToString())
- , int.Parse(dr["REPEATER_ID"].ToString()), int.Parse(dr["DEVICE_ID"].ToString()), dr["INOUT_TYPE"].ToString());
- process_id = dev_s.MskId;
- }
- else
- {
- process_id = dr["GROUP_ID"].ToString();
- }
- ListViewItem item = new ListViewItem(dr["SEQ_NO"].ToString());
- item.SubItems.Add(dr["RECEIVER_ID"].ToString() + ":" + process_id); // cyim 2014.8.12 수신기 아이디까지 회로번호로 보이도록 수정
- item.SubItems.Add(dr["PROCESS_NAME"].ToString());
- ListViewIMap.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void ListViewIMap_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- //VIEW모드로 변경한다.[입력맵]
- btnIMapDel.Enabled = true;
- }
- else
- {
- //VIEW모드로 변경한다.
- btnIMapDel.Enabled = false;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnIMapDel_Click(object sender, EventArgs e)
- {
- try
- {
- if (ListViewIMap.SelectedItems.Count > 0)
- {
- ListViewItem itm = ListViewIMap.SelectedItems[0];
- int seq_no = Util.StrToInt(itm.Text, 0);
- String process_id = itm.SubItems[1].Text;
- String process_name = itm.SubItems[2].Text;
- String msg = string.Format("{0}[{1}]을/를 삭제하시겠습니까?", process_name, process_id);
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Map_Process_Update(QUERYMode.delete, map_no, code_GroupIO.Input, seq_no,
- "", null, 0, 0, 0, 0, 0, 0, null);
- btnIMapDel.Enabled = false;
- }
- }
- //데이터 불러오기
- IMap_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnIMapGroupAdd_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalGroupList frm = new frmModalGroupList(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- SearchCodeVo vo = new SearchCodeVo(code_GroupIO.Input);
- frm.SearchCode = vo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- int seq_no = dacMap.Map_Process_Seq_Max_Select(map_no, code_GroupIO.Input);
- dacMap.Map_Process_Update(QUERYMode.InsertAndUpdate, map_no, code_GroupIO.Input, seq_no,
- "G", vo.Code, this.mdi.myReceiverID, -1, -1, -1, -1, -1, null);
- IMap_getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnIMapDeviceAdd_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalDeviceList frm = new frmModalDeviceList(mdi); // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- SearchCodeVo vo = new SearchCodeVo(null);
- InputIDVo inputVo = new InputIDVo();
- inputVo.ReceiverID = this.mdi.myReceiverID;
- inputVo.InoutType = code_InOutType.Input;
- frm.SearchCode = vo;
- frm.InputVo = inputVo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- InputIDVo[] inputVos = (InputIDVo[])vo.SelectObject;
- if (inputVos.Length > 0)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- for (int i = 0; i < inputVos.Length; i++)
- {
- int seq_no = dacMap.Map_Process_Seq_Max_Select(map_no, code_GroupIO.Input);
- dacMap.Map_Process_Update(QUERYMode.InsertAndUpdate, map_no, code_GroupIO.Input, seq_no,
- "D", null, inputVos[i].ReceiverID, inputVos[i].CommID, inputVos[i].BoardID
- , inputVos[i].LoopNo, inputVos[i].RepeaterID, inputVos[i].DeviceID, inputVos[i].InoutType);
- }
- IMap_getData();
- }
- //inputVo = (InputIDVo)vo.SelectObject;
- //ListViewItem item = new ListViewItem(seq_no);
- //MskDeviceIDString dev_id = new MskDeviceIDString(inputVo.CommID, inputVo.BoardID
- // , inputVo.LoopNo, inputVo.RepeaterID
- // , inputVo.DeviceID, inputVo.InoutType);
- //item.SubItems.Add(dev_id.MskId);
- //ListViewIMap.Items.Add(item);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- /*******************************************************
- * [출력맵 회로정보] LISTVIEW에 데이터 불러오기
- ******************************************************/
- private void OMap_getData()
- {
- try
- {
- int MapNo = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacMap.Map_Process_Select(MapNo, code_GroupIO.Output, 0);
- ListViewOMap.Items.Clear();
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow dr in dt.Rows)
- {
- //MI-##-#-###-# :M(구분 M-중계기,I-입력맵)I,O(회로구분)-##(보드ID)-##(회로ID)
- String process_type = dr["PROCESS_TYPE"].ToString();
- string process_id = "";
- if (process_type.Equals("D"))
- {
- MskDeviceIDString dev_s = new MskDeviceIDString(int.Parse(dr["COMM_ID"].ToString()), int.Parse(dr["BOARD_ID"].ToString()), int.Parse(dr["LOOP_NO"].ToString())
- , int.Parse(dr["REPEATER_ID"].ToString()), int.Parse(dr["DEVICE_ID"].ToString()), dr["INOUT_TYPE"].ToString());
- process_id = dev_s.MskId;
- }
- else
- {
- process_id = dr["GROUP_ID"].ToString();
- }
- ListViewItem item = new ListViewItem(dr["SEQ_NO"].ToString());
- item.SubItems.Add(dr["RECEIVER_ID"].ToString() + ":" + process_id); // cyim 2014.8.12 수신기 아이디까지 회로번호로 보이도록 수정
- item.SubItems.Add(dr["PROCESS_NAME"].ToString());
- ListViewOMap.Items.Add(item);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void ListViewOMap_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- ListView lv = (ListView)sender;
- if (lv.SelectedItems.Count > 0)
- {
- ListViewItem itm = lv.SelectedItems[0];
- //VIEW모드로 변경한다.[출력맵]
- btnOMapDel.Enabled = true;
- }
- else
- {
- //VIEW모드로 변경한다.
- btnOMapDel.Enabled = false;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnOMapDel_Click(object sender, EventArgs e)
- {
- try
- {
- if (ListViewOMap.SelectedItems.Count > 0)
- {
- ListViewItem itm = ListViewOMap.SelectedItems[0];
- int seq_no = Util.StrToInt(itm.Text, 0);
- String process_id = itm.SubItems[1].Text;
- String process_name = itm.SubItems[2].Text;
- String msg = string.Format("{0}[{1}]을/를 삭제하시겠습니까?", process_name, process_id);
- if (MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- dacMap.Map_Process_Update(QUERYMode.delete, map_no, code_GroupIO.Output, seq_no,
- "", null, 0, 0, 0, 0, 0, 0, null);
- btnOMapDel.Enabled = false;
- }
- }
- //데이터 불러오기
- OMap_getData();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnOMapGroupAdd_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalGroupList frm = new frmModalGroupList(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- SearchCodeVo vo = new SearchCodeVo(code_GroupIO.Output);
- frm.SearchCode = vo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- int seq_no = dacMap.Map_Process_Seq_Max_Select(map_no, code_GroupIO.Output);
- dacMap.Map_Process_Update(QUERYMode.InsertAndUpdate, map_no, code_GroupIO.Output, seq_no,
- "G", vo.Code, this.mdi.myReceiverID, -1, -1, -1, -1, -1, null);
- OMap_getData();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnOMapDeviceAdd_Click(object sender, EventArgs e)
- {
- try
- {
- frmModalDeviceList frm = new frmModalDeviceList(mdi); // cyim 2016.12.07 : 수신기 모델별 내부 로직 변경
- SearchCodeVo vo = new SearchCodeVo(null);
- InputIDVo inputVo = new InputIDVo();
- inputVo.ReceiverID = this.mdi.myReceiverID;
- inputVo.InoutType = code_InOutType.Output;
- frm.SearchCode = vo;
- frm.InputVo = inputVo;
- frm.ShowDialog();
- vo = frm.SearchCode;
- //선택한 코드가 있다면
- if (vo.SearchOK)
- {
- int map_no = Util.StrToInt(txtMapNo.Text, 0);
- InputIDVo[] inputVos = (InputIDVo[])vo.SelectObject;
- if (inputVos.Length > 0)
- {
- DacMap dacMap = new DacMap(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- for (int i = 0; i < inputVos.Length; i++)
- {
- int seq_no = dacMap.Map_Process_Seq_Max_Select(map_no, code_GroupIO.Output);
- dacMap.Map_Process_Update(QUERYMode.InsertAndUpdate, map_no, code_GroupIO.Output, seq_no,
- "D", null, inputVos[i].ReceiverID, inputVos[i].CommID, inputVos[i].BoardID
- , inputVos[i].LoopNo, inputVos[i].RepeaterID, inputVos[i].DeviceID, inputVos[i].InoutType);
- }
- OMap_getData();
- }
- //inputVo = (InputIDVo)vo.SelectObject;
- //DacMap dacMap = new DacMap(mdi.myReceiverID);
- //int seq_no = dacMap.Map_Process_Seq_Max_Select(map_no, code_GroupIO.Output);
- //dacMap.Map_Process_Update(QUERYMode.InsertAndUpdate, map_no, code_GroupIO.Output, seq_no,
- // "D", null, inputVo.ReceiverID, inputVo.CommID, inputVo.BoardID, inputVo.LoopNo, inputVo.RepeaterID, inputVo.DeviceID, inputVo.InoutType);
- //OMap_getData();
- //ListViewItem item = new ListViewItem(seq_no);
- //MskDeviceIDString dev_id = new MskDeviceIDString(inputVo.CommID, inputVo.BoardID
- // , inputVo.LoopNo, inputVo.RepeaterID
- // , inputVo.DeviceID, inputVo.InoutType);
- //item.SubItems.Add(dev_id.MskId);
- //ListViewOMap.Items.Add(item);
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- //MessageBox.Show(ex.Message, Application.ProductName);
- //MessageBox.Show(string.Format("[{0}]\r\n{1}", ex.Message, ex.StackTrace), Application.ProductName);
- }
- }
- private void btnReset_Click(object sender, EventArgs e)
- {
- try
- {
- ////설정정보가 변경되었다면 다시 읽어라~~~~~~
- //if (ThisReceiverConfig_Change_Flag)
- //{
- this.Cursor = Cursors.WaitCursor;
- LFC.Log("타입: 수신기 조작 로그, 메세지: 맵설정-연동맵 적용");
- mdi.ui.ReceiverDBRead(); //설정정보 변경
- mdi.FireReset_Process(); //데몬 RESET 명령
- //}
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- throw ex;
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- //
- // cyim 2013.7.12 디자인개선작업 : 맵설정
- //
- private void button_Menu_Group_Click(object sender, EventArgs e)
- {
- button_Menu_Color_Init();
- this.tabControl1.SelectTab(0);
- this.button_Menu_Group.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- this.panel_Menu.Focus();
- }
- private void button_Menu_OperSet_Click(object sender, EventArgs e)
- {
- button_Menu_Color_Init();
- this.tabControl1.SelectTab(1);
- this.button_Menu_OperSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_주황_100_30;
- this.panel_Menu.Focus();
- }
- private void button_Menu_Color_Init()
- {
- this.button_Menu_Group.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
- this.button_Menu_OperSet.BackgroundImage = (Image)Properties.Resources.탭메뉴버튼_회색_100_30;
- }
- }
- }
|