123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- // cyim 2015.7.13 설비연동 주석 정리
- // 설비연동 소스가 너무 주석과 내용이 틀리고 엉망이다. 이전 작업자가 작업한 코드를 모두 정리하고
- // 불필요한 코드는 다 제거한다
- namespace FPER
- {
- public partial class frmControlWrite : Form
- {
- // 설비 연동 창 클래스
- MDIParent mdi = null;
- controlWriteDevType[] devTypes = null;
- delegate void deleFormInit();
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- public bool ProcessEnableStatus = false;
- // cyim 2015.8.18 주경종정지 기능 추가
- public bool InitMainSoundStop = false;
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- public int InitEquipmentAllOperationStatus = 0;
- public System.Windows.Forms.Timer timer = new Timer();
- // 생성자
- public frmControlWrite(bool MainSoundStop, int EquipmentAllOperationStatus)
- {
- InitializeComponent();
- // 초기화
- ProcessEnableStatus = false;
- // cyim 2015.8.18 주경종정지 기능 추가 : 만약 수신반에서 주경종 정지 기능을 사용하려고 했다면 화면이 준비되는 순간 마지막에 주경종 정지 명령을 날린다
- InitMainSoundStop = MainSoundStop;
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- InitEquipmentAllOperationStatus = EquipmentAllOperationStatus;
- timer.Interval = 3000;
- timer.Tick += new EventHandler(timer_Tick);
- }
- // 창 데이터 초기화 함수
- public void Form_Init()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(Form_Init);
- this.Invoke(d, new object[] { });
- }
- else
- {
- getData();
- this.mdi.SetLikageBtnStatus();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 버튼 이미지 로딩 함수
- private Image ImgLoad(string path)
- {
- Image ret = null;
- try
- {
- ret = Image.FromFile(path);
- }
- catch (Exception e)
- {
- Util.UErrorMessage(e, 0, 0);
- }
- return ret;
- }
- private Image ImageLoadingPanelRed()
- {
- // cyim : 디자인개선
- //return (Image)Properties.Resources.panel_430_52_R;
- return (Image)Properties.Resources.버튼_개별정지_420_77;
- }
- private Image ImageLoadingPanelBlue()
- {
- // cyim : 디자인 개선
- //return (Image)Properties.Resources.panel_430_52_B;
- return (Image)Properties.Resources.버튼_개별연동_420_77;
- }
- private controlWriteDevType findControlDevType(string dev_type)
- {
- controlWriteDevType devType = null;
- try
- {
- foreach (controlWriteDevType devtp in devTypes)
- {
- if (devtp.Dev_type.Equals(dev_type))
- {
- devType = devtp;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return devType;
- }
- private void frmControlWrite_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);
- this.Cursor = Cursors.WaitCursor;
- init();
- this.Cursor = Cursors.Default;
- // cyim 2015.8.18 주경종정지 기능 추가
- if (InitMainSoundStop == true)
- MainSoundStop();
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- if (InitEquipmentAllOperationStatus != 0)
- timer.Start();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- public void timer_Tick(object sender, EventArgs e)
- {
- // 2초후에 루틴
- if (InitEquipmentAllOperationStatus != 0) // 0 Default, 1 : 전체정지, 2 : 전체연동
- {
- getData();
- }
- timer.Stop();
- }
- private void frmControlWrite_Activated(object sender, EventArgs e)
- {
- try
- {
- this.mdi.SelectMenuIndex = 1;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmControlWrite_Disposed(object sender, EventArgs e)
- {
- try
- {
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- timer.Tick -= new EventHandler(timer_Tick);
- this.mdi.SelectMenuIndex = 0;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 데이터 초기화 함수
- private void init()
- {
- this.SetLDeviceTypeConfig();
- }
- // 설정 데이터 갱신 함수
- private void getData()
- {
- try
- {
- if (this.InvokeRequired)
- {
- deleFormInit d = new deleFormInit(getData);
- this.Invoke(d, new object[] { });
- }
- else
- {
- this.UpdateLDeviceTypeConfig();
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 버튼 상태 변경 함수
- private void DoChangeBTNSet(Button btnYes, Button btnNo, bool set)
- {
- try
- {
- if (set) // 사용
- {
- btnYes.Enabled = false;
- btnNo.Enabled = true;
- btnYes.BackColor = Color.Blue;
- btnNo.BackColor = Color.Red;
- btnYes.ForeColor = Color.White;
- btnNo.ForeColor = Color.White;
- }
- else // 차단
- {
- btnYes.Enabled = true;
- btnNo.Enabled = false;
- btnYes.BackColor = Color.Blue;
- btnNo.BackColor = Color.Red;
- btnYes.ForeColor = Color.White;
- btnNo.ForeColor = Color.White;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 종료하기
- private void btnWinClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- //명령 쓰기 완료--종료.
- bool lock_cmd = false;
- // 설비 연동 상태 갱신 함수
- private void DoChangeDeviceLinkage2(object sender, EventArgs e)
- {
- try
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- if (ProcessEnableStatus == true || mdi.CommDaemon_ComStatus == false) return;
- if (sender is Control)
- {
- Control Ctl = (Control)sender;
- if (Ctl.Tag is CDeviceTypeConfig)
- {
- if (!lock_cmd)
- {
- lock_cmd = true;
- this.Cursor = Cursors.WaitCursor;
- timer_check.Enabled = true;
- progress_dot = -2;
- progress_end = false;
- timer_progress.Enabled = true;
- CDeviceTypeConfig dtc = (CDeviceTypeConfig)Ctl.Tag;
- string devTypeString = dtc.deviceType;
- int Use_flag = (dtc.use ? 1 : 0);
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = (Use_flag == 0 ? 1 : 0); //사용여부 0-비사용,1-사용
- cmd.SubType = devTypeString.Substring(1);
- cmd.CommId = 1;
- cmd.loopNo = 0;
- //명령 생성
- dCommandResponse d = new dCommandResponse(command_complete);
- cmd.dEvent = d;
- // cyim 2015.2.10 설비연동 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [{0},{1}]", dtc.deviceName, (cmd.Status == 0 ? "Disable" : "Enable")));
- this.mdi.ui.runCommand(cmd);
- }
- }
- }
- }
- catch (Exception ex)
- {
- progress_end = true;
- lock_cmd = false;
- this.Cursor = Cursors.Default;
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2015.8.18 주경종정지 기능 추가
- public void MainSoundStop()
- {
- try
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- if (ProcessEnableStatus == true || mdi.CommDaemon_ComStatus == false) return;
- //if (sender is Control)
- {
- //Control Ctl = (Control)sender;
- //if (Ctl.Tag is CDeviceTypeConfig)
- {
- if (!lock_cmd)
- {
- lock_cmd = true;
- this.Cursor = Cursors.WaitCursor;
- timer_check.Enabled = true;
- progress_dot = -2;
- progress_end = false;
- timer_progress.Enabled = true;
- //CDeviceTypeConfig dtc = (CDeviceTypeConfig)Ctl.Tag;
- //string devTypeString = dtc.deviceType;
- string devTypeString = "OA";
- //int Use_flag = (dtc.use ? 1 : 0);
- int Use_flag = 1; // 무조건 정지
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = (Use_flag == 0 ? 1 : 0); //사용여부 0-비사용,1-사용
- cmd.SubType = devTypeString.Substring(1);
- cmd.CommId = 1;
- cmd.loopNo = 0;
- //명령 생성
- dCommandResponse d = new dCommandResponse(command_complete);
- cmd.dEvent = d;
-
- // cyim 2015.2.10 설비연동 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [{0},{1}]", "주경종"/*dtc.deviceName*/, (cmd.Status == 0 ? "Disable" : "Enable")));
- this.mdi.ui.runCommand(cmd);
- }
- }
- }
- }
- catch (Exception ex)
- {
- progress_end = true;
- lock_cmd = false;
- this.Cursor = Cursors.Default;
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cmd 리턴 받으면 실행 함수
- public void command_complete(CmdInfo resInfo)
- {
- try
- {
- this.Cursor = Cursors.Default;
- timer_check.Enabled = false;
- progress_end = true;
- getData();
- //this.mdi.SetLikageBtnStatus(); // cyim 2015.7.7 속도개선작업 : 설비연동화면 종료할때만 최종 결과를 반영하자 (MDIParent 가 실행될때 이미 시작은 미리 되었음) 통신에서 이렇게 데이타베이스를 가져오지 않아도된다
- if (resInfo != null)
- {
- if (resInfo.ErrResponse)
- {
- }
- else
- {
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 체크 타이머 함수
- private void timer_check_Tick(object sender, EventArgs e)
- {
- this.command_complete(null);
- }
- int progress_dot = -2;
- bool progress_end = false;
- // 진행 창 설정 타이머
- private void timer_progress_Tick(object sender, EventArgs e)
- {
- try
- {
- if (progress_dot == -100)
- {
- panel_LabelMessage.Visible = false; // cyim 2013.7.31 진행중 팝업창 디자인변경
- lbl_message.Visible = false;
- timer_progress.Enabled = false;
- lock_cmd = false;
- }
- progress_dot++;
- if (progress_dot > 4)
- {
- progress_dot = 0;
- }
- if (progress_dot >= 0)
- {
- panel_LabelMessage.Visible = true; // cyim 2013.7.31 진행중 팝업창 디자인변경
- lbl_message.Text = "진 행 중";
- lbl_message.Visible = true;
- // cyim 2013.7.31 진행중 팝업창 디자인변경
- //lbl_message.Width = 450;
- //lbl_message.Height = 250;
- lbl_message.Text = "진 행 중\n";
- // cyim 2013.7.31 진행중 팝업창 디자인변경 : 텍스트 삭제
- //if (progress_dot == 0) {
- // lbl_message.Text = lbl_message.Text + " ";
- //}
- //else if (progress_dot == 1) {
- // lbl_message.Text = lbl_message.Text + ". ";
- //}
- //else if (progress_dot == 2) {
- // lbl_message.Text = lbl_message.Text + ". . ";
- //}
- //else if (progress_dot == 3) {
- // lbl_message.Text = lbl_message.Text + ". . . ";
- //}
- //else if (progress_dot == 4) {
- // lbl_message.Text = lbl_message.Text + ". . . .";
- //}
- }
- if (progress_end)
- {
- progress_dot = -100;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void frmControlWrite_FormClosing(object sender, FormClosingEventArgs e)
- {
- // 창 닫는 함수
- this.mdi.SetLikageBtnStatus();
- }
- List<CDeviceTypeConfig> LDeviceTypeConfig = new List<CDeviceTypeConfig>();
- List<Panel> LDeviceTypePanel = new List<Panel>();
- // 설비 연동 버튼 설정 함수
- void SetDeviceTypePanel()
- {
- this.LDeviceTypePanel.Clear();
- int iPanelGab = 650 / ((LDeviceTypeConfig.Count + 1) / 2);
- foreach (CDeviceTypeConfig dtc in this.LDeviceTypeConfig)
- {
- Panel panel = new Panel();
- panel.Parent = this.groupBox1;
- panel.Size = new Size(420, 60); // cyim : 디자인개선 (430, 52) -> (420, 60)
- int positionX = 0;
- int positionY = 0;
- if ((this.LDeviceTypePanel.Count + 1) % 2 == 1)
- {// 버튼 줄 설정, 왼쪽
- positionX = 80; // cyim : 디자인개선 40 -> 80
- positionY = 50 + iPanelGab * ((this.LDeviceTypePanel.Count + 1) / 2);
- }
- else
- {// 오른쪽
- positionX = 570; // cyim : 디자인개선 530 -> 500
- positionY = 50 + iPanelGab * ((this.LDeviceTypePanel.Count) / 2);
- }
- panel.Location = new Point(positionX, positionY);
- panel.BackgroundImage = this.ImageLoadingPanelRed();
- Label labelName = new Label();
- labelName.Parent = panel;
- labelName.AutoSize = true;
- labelName.Location = new Point(37, 17); // cyim : 디자인개선 (37, 13) -> (37, 17)
- labelName.Font = new Font("굴림", 20F, System.Drawing.FontStyle.Bold);
- labelName.BackColor = Color.Transparent;
- labelName.ForeColor = Color.White; // cyim : 디자인개선
- Label labelStatus = new Label();
- labelStatus.Parent = panel;
- labelStatus.AutoSize = true;
- labelStatus.Location = new Point(304, 17); // cyim : 디자인개선 (311, 13) -> (304, 17)
- labelStatus.Font = new Font("굴림", 20F, System.Drawing.FontStyle.Bold);
- labelStatus.BackColor = Color.Transparent;
- labelStatus.ForeColor = Color.White; // cyim : 디자인개선
- panel.MouseClick += new MouseEventHandler(DoChangeDeviceLinkage2);
- labelName.MouseClick += new MouseEventHandler(DoChangeDeviceLinkage2);
- labelStatus.MouseClick += new MouseEventHandler(DoChangeDeviceLinkage2);
- labelName.Text = dtc.deviceName;
- panel.BackgroundImage = (dtc.use ? this.ImageLoadingPanelBlue() : this.ImageLoadingPanelRed());
- labelStatus.Text = (dtc.use ? "연 동" : "정 지");
- panel.Tag = dtc;
- labelName.Tag = dtc;
- labelStatus.Tag = dtc;
- this.LDeviceTypePanel.Add(panel);
- }
- this.UpdateDeviceTypePanel();
- }
- // 버튼 갱신 함수
- void UpdateDeviceTypePanel()
- {
- foreach (Panel panel in this.LDeviceTypePanel)
- {
- CDeviceTypeConfig dtc = (CDeviceTypeConfig)panel.Tag;
- Label labelName = (Label)panel.Controls[0];
- Label labelStatus = (Label)panel.Controls[1];
- if ((labelStatus.Text == "연 동") != dtc.use)
- {
- panel.BackgroundImage = (dtc.use ? this.ImageLoadingPanelBlue() : this.ImageLoadingPanelRed());
- labelStatus.Text = (dtc.use ? "연 동" : "정 지");
- }
- }
- // cyim 2013.10.1 : 화면 갱신
- this.Update();
- }
- // 설비연동 데이터 재설정 함수
- int SetLDeviceTypeConfig()
- {
- this.LDeviceTypeConfig.Clear();
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(mdi.myReceiverID); // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacDeviceConfig.Device_type_Select(code_InOutType.Output, null);
- foreach (DataRow dr in dt.Rows)
- {
- // cyim 2014.11.25 주경종 허용
- //if (dr["DEVICE_TYPE"].ToString() != "OA" && dr["SEQ_NO"].ToString() != "0")
- if (dr["SEQ_NO"].ToString() != "0")
- {
- this.LDeviceTypeConfig.Add(new CDeviceTypeConfig(dr["SYMBOL_TYPE"].ToString(), dr["DEVICE_TYPE"].ToString(),
- dr["DEVICE_TYPE_NAME"].ToString(), dr["USE_FLAG"].ToString()));
- }
- }
- this.SetDeviceTypePanel();
- return this.LDeviceTypeConfig.Count;
- }
- // 설비 연동 데이터 갱신 함수
- int UpdateLDeviceTypeConfig()
- {
- DacDeviceConfig dacDeviceConfig = new DacDeviceConfig(mdi.myReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dt = dacDeviceConfig.Device_type_Select(code_InOutType.Output, null);
- foreach (DataRow dr in dt.Rows)
- {
- // cyim 2014.11.25 주경종 허용
- //if (dr["DEVICE_TYPE"].ToString() != "OA" && dr["SEQ_NO"].ToString() != "0")
- if (dr["SEQ_NO"].ToString() != "0")
- {
- bool add = true;
- foreach (CDeviceTypeConfig cd in this.LDeviceTypeConfig)
- {
- if (cd.deviceType == dr["DEVICE_TYPE"].ToString())
- {
- cd.UpdateData(dr["USE_FLAG"].ToString());
- add = false;
- break;
- }
- }
- if (add)
- {
- this.LDeviceTypeConfig.Add(new CDeviceTypeConfig(dr["SYMBOL_TYPE"].ToString(), dr["DEVICE_TYPE"].ToString(),
- dr["DEVICE_TYPE_NAME"].ToString(), dr["USE_FLAG"].ToString()));
- }
- }
- }
- this.UpdateDeviceTypePanel();
- return this.LDeviceTypeConfig.Count;
- }
- // 설비연동 데이터 클래스
- class CDeviceTypeConfig
- {
- public string symbolType = "";
- public string deviceType = "";
- public string deviceName = "";
- public bool use = false;
- public CDeviceTypeConfig(string symbolType, string deviceType, string deviceName, string useFlag)
- {
- this.symbolType = symbolType;
- this.deviceType = deviceType;
- this.deviceName = deviceName;
- this.use = (useFlag == "Y" ? true : false);
- }
- public void UpdateData(string useFlag)
- {
- this.use = (useFlag == "Y" ? true : false);
- }
- }
- private int indexDisableDeviceAll = 0;
- private int indexEnableDeviceAll = 0;
- // 모두 정지 버튼
- private void btnDisableAll_Click(object sender, EventArgs e)
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- if (ProcessEnableStatus == true || mdi.CommDaemon_ComStatus == false) return;
- ProcessEnableStatus = true;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58_black;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58_black;
- try
- {
- if (this.lock_cmd == false)
- {
- this.lock_cmd = true;
- this.Cursor = Cursors.WaitCursor;
- timer_check.Enabled = true;
- progress_dot = -2;
- progress_end = false;
- timer_progress.Enabled = true;
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- if (mdi.ReceiverModel == "IFC3300")
- {
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "ED";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = 0; //사용여부 0-비사용,1-사용
- cmd.SubType = "B";// strDevice;
- cmd.CommId = 1;
- cmd.loopNo = 0;
- // cyim 2015.2.10 설비연동 모두정지 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [모두정지]"));
- dCommandResponse d = new dCommandResponse(DisableDeviceAll);//명령 생성
- cmd.dEvent = d;
- this.mdi.ui.runCommand(cmd);
- }
- else
- {
- this.DisableDeviceAll(null);
- }
- }
- else
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Util.UErrorMessage(ex, 0, 0);
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- this.progress_end = true;
- this.lock_cmd = false;
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- }
- // 모드 정지 함수
- public void DisableDeviceAll(CmdInfo resInfo)
- {
- try
- {
- this.getData();
- // 갱신 마지막
- if (this.indexDisableDeviceAll >= this.LDeviceTypeConfig.Count)
- {
- this.Cursor = Cursors.Default;
- this.timer_check.Enabled = false;
- this.progress_end = true;
- lock_cmd = false;
- //this.mdi.SetLikageBtnStatus(); // cyim 2015.7.7 속도개선작업 : 설비연동화면 종료할때만 최종 결과를 반영하자 (MDIParent 가 실행될때 이미 시작은 미리 되었음)
- this.indexDisableDeviceAll = 0;
-
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- else
- {
- //start
- if (resInfo == null)
- {
- this.indexDisableDeviceAll = 0;
- }
- // 갱신 중간
- if (this.LDeviceTypeConfig.Count > this.indexDisableDeviceAll)
- {
- CDeviceTypeConfig devTypeConfig = this.LDeviceTypeConfig[this.indexDisableDeviceAll];
- string strDevice = devTypeConfig.deviceType.Substring(1, 1);
- this.indexDisableDeviceAll++;
- this.DisableDevice(strDevice);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 설비 연동 정지 함수
- private void DisableDevice(string strDevice)
- {
- try
- {
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = 0; //사용여부 0-비사용,1-사용
- cmd.SubType = strDevice;
- cmd.CommId = 1;
- cmd.loopNo = 0;
- dCommandResponse d = new dCommandResponse(DisableDeviceAll);//명령 생성
- cmd.dEvent = d;
- this.mdi.ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 모두 연동 버튼
- private void btnEnableAll_Click(object sender, EventArgs e)
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- if (ProcessEnableStatus == true || mdi.CommDaemon_ComStatus == false) return;
- ProcessEnableStatus = true;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58_black;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58_black;
- try
- {
- if (this.lock_cmd == false)
- {
- this.lock_cmd = true;
- this.Cursor = Cursors.WaitCursor;
- timer_check.Enabled = true;
- progress_dot = -2;
- progress_end = false;
- timer_progress.Enabled = true;
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- if (mdi.ReceiverModel == "IFC3300")
- {
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "ED";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = 1; //사용여부 0-비사용,1-사용
- cmd.SubType = "B";//strDevice;
- cmd.CommId = 1;
- cmd.loopNo = 0;
- // cyim 2015.2.10 설비연동 모두연동 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [모두연동]"));
- dCommandResponse d = new dCommandResponse(EnableDeviceAll);//명령 생성 EnableDeviceAll_BigReceiver
- cmd.dEvent = d;
- this.mdi.ui.runCommand(cmd);
- }
- else
- {
- this.EnableDeviceAll(null);
- }
- }
- else
- {
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Util.UErrorMessage(ex, 0, 0);
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- this.progress_end = true;
- this.lock_cmd = false;
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- //Util.UDebugMessage("-btnEnableAll_Click", 0, 0);
- }
- // 모두 설비 연동 함수
- public void EnableDeviceAll(CmdInfo resInfo)
- {
- try
- {
- this.getData();
- // 갱신 마지막
- if (this.indexEnableDeviceAll >= this.LDeviceTypeConfig.Count)
- {
- this.Cursor = Cursors.Default;
- this.timer_check.Enabled = false;
- this.progress_end = true;
- this.lock_cmd = false;
- //this.mdi.SetLikageBtnStatus(); // cyim 2015.7.7 속도개선작업 : 설비연동화면 종료할때만 최종 결과를 반영하자 (MDIParent 가 실행될때 이미 시작은 미리 되었음)
- this.indexEnableDeviceAll = 0;
-
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- else
- {
- //start
- if (resInfo == null)
- {
- this.indexEnableDeviceAll = 0;
- }
- // 갱신 중간
- if (this.LDeviceTypeConfig.Count > this.indexEnableDeviceAll)
- {
- CDeviceTypeConfig devTypeConfig = this.LDeviceTypeConfig[this.indexEnableDeviceAll];
- string strDevice = devTypeConfig.deviceType.Substring(1, 1);
- this.indexEnableDeviceAll++;
- this.EnableDevice(strDevice);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // 설비 연동 설정 함수
- private void EnableDevice(string strDevice)
- {
- try
- {
- CmdInfo cmd = new CmdInfo(prt_cmd_define.read_command_status, mdi.myReceiverID, 1, 0, 0, null);
- cmd.CommandType = "DC";
- cmd.ApplyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
- cmd.Status = 1; //사용여부 0-비사용,1-사용
- cmd.SubType = strDevice;
- cmd.CommId = 1;
- cmd.loopNo = 0;
- dCommandResponse d = new dCommandResponse(EnableDeviceAll);//명령 생성
- cmd.dEvent = d;
- this.mdi.ui.runCommand(cmd);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- public void DisableDeviceAll_BigReceiver(CmdInfo resInfo)
- {
- this.getData();
- // 갱신 마지막
- if (this.indexDisableDeviceAll >= this.LDeviceTypeConfig.Count)
- {
- this.Cursor = Cursors.Default;
- this.timer_check.Enabled = false;
- this.progress_end = true;
- lock_cmd = false;
- //this.mdi.SetLikageBtnStatus(); // cyim 2015.7.7 속도개선작업 : 설비연동화면 종료할때만 최종 결과를 반영하자 (MDIParent 가 실행될때 이미 시작은 미리 되었음)
- this.indexDisableDeviceAll = 0;
- // cyim 2015.2.10 설비연동 모두정지 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [모두정지]"));
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- }
- // cyim 2016.12.09 : IFC3300에서는 예비전원버튼 -> 설비전체연동조작버튼
- public void EnableDeviceAll_BigReceiver(CmdInfo resInfo)
- {
- this.getData();
- this.Cursor = Cursors.Default;
- this.timer_check.Enabled = false;
- this.progress_end = true;
- this.lock_cmd = false;
- //this.mdi.SetLikageBtnStatus(); // cyim 2015.7.7 속도개선작업 : 설비연동화면 종료할때만 최종 결과를 반영하자 (MDIParent 가 실행될때 이미 시작은 미리 되었음)
- this.indexEnableDeviceAll = 0;
- // cyim 2015.2.10 설비연동 모두연동 실행
- mdi.CommandLog(MappingStatus.Log, string.Format("설비연동 실행 [모두연동]"));
- // cyim 2015.2.10 설비연동의 경우 실행이 완료되어야 다른 버튼이 눌려진다
- ProcessEnableStatus = false;
- this.btnEnableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체연동_139_58;
- this.btnDisableAll.BackgroundImage = (Image)Properties.Resources.버튼_전체정지_139_58;
- }
- }
- public class controlWriteDevType
- {
- private string dev_type; //연동타입
- private bool use_flag; //사용여부
- private bool change_flag; //변경여부
- public controlWriteDevType(string dev_type)
- {
- try
- {
- this.dev_type = dev_type;
- this.use_flag = false;
- this.change_flag = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public string Dev_type { get { return this.dev_type; } }
- public bool Use_flag { get { return this.use_flag; } set { this.use_flag = value; } }
- public void ChangeFlagReset()
- {
- try
- {
- this.change_flag = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public Boolean ChangeFlag
- {
- get { return this.change_flag; }
- set
- {
- bool use_flag = value;
- //차단설정데이터 변경여부를 저장한다.
- if (this.use_flag != use_flag) this.change_flag = true;
- this.use_flag = value;
- }
- }
- }
- }
|