using DevComponents.DotNetBar.Layout; using DevComponents.DotNetBar.SuperGrid; using System.Collections.Generic; using System.Data; using System.Windows.Forms; using WCS_Client.UC; using WCS_Client.Utility; using WCS_Client.Workflow; namespace WCS_Client.Frm { public partial class FrmSrmInfoSet : Form { public FrmSrmInfoSet() { InitializeComponent(); InitFrm(); } private void InitFrm() { List GCList = new List() { SuperGridUtil.Get_GridColumn("DEVICECODE", "设备名", 120), SuperGridUtil.Get_GridColumn("Code", "所属设备名", 120), SuperGridUtil.Get_GridColumn("TUNNEL", "巷道", 120), SuperGridUtil.Get_GridColumn("Direction", "出入口类型", 120), //SuperGridUtil.Get_GridColumn("SRMOUTIN_SEQUENCE", "出入口顺序",120), //SuperGridUtil.Get_GridColumn("SRMOUTIN_PRIORITY", "出入口优先级", 120), SuperGridUtil.Get_CheckBoxX_GridColumn("ENABLED", "是否停用", 100), //SuperGridUtil.Get_CheckBoxX_GridColumn("SRMOUTIN_ISUPDATE", "是否更新", 120), SuperGridUtil.Get_GridColumn("Describe", "备注", 120) }; List LCIList = new List(); LCIList.Add(LCItemUtil.Add_TextboxX("Code", "所属设备:", 20, SubmitMethods, null)); LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "Code like '%{0}%'" }; LCIList.Add(LCItemUtil.Add_TextboxX("Describe", "备注:", 20, SubmitMethods, null)); LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "Describe like '%{0}%'" }; LCIList.Add(LCItemUtil.Add_ButtonX("btn_QDB", "查询", 80, 30, SubmitMethods)); LCIList.Add(LCItemUtil.Add_ButtonX("btn_QClear", "重置", 80, 30, SubmitMethods)); if (CurrentHelper.User.Use_RoleId == 1) { LCIList.Add(LCItemUtil.Add_ButtonX("btn_Enable", "启用", 80, 30, SubmitMethods)); LCIList.Add(LCItemUtil.Add_ButtonX("btn_Stop", "停用", 80, 30, SubmitMethods)); } uC_QueryPage1.Init_QueryPage(30, true, true, "", GCList, LCIList, QueryPageDataMethods, RefreshRoleMethods, DoubleClikMethod, null, null); uC_QueryPage1.ClearLCItemValue(); CommonShow.ShowProcessing("正在处理中,请稍候...", this, (obj) => { uC_QueryPage1.RefreshData(1, 0); }, null); } private PageData QueryPageDataMethods(int PageIndex, int PageSize) { string _SQLText = @"SELECT * FROM [dbo].[WCS_SystemConfig] where 1=1 "; string _Orderby = "Code asc"; PageData pd = BaseWorkflow.QueryPageData(_SQLText, _Orderby, uC_QueryPage1.GetQueryWhere(), PageIndex, PageSize); return pd; } private void RefreshRoleMethods(bool ChkValue) { } private void DoubleClikMethod(DataRow dr) { //wcs_task_no = Convert.ToInt32(dr["TASK_NO"].ToString()); //FrmWCS_TaskDIS_DTL Frm = new FrmWCS_TaskDIS_DTL(wcs_task_no); //Frm.Show(); } private void SubmitMethods(string LCName) { if (LCName == "btn_QDB") { uC_QueryPage1.RefreshData(); } else if (LCName == "btn_QClear") { uC_QueryPage1.ShowOpaqueLayer(); uC_QueryPage1.ClearLCItemValue(); uC_QueryPage1.RefreshData(1, 0); uC_QueryPage1.HideOpaqueLayer(); } else if (LCName == "btn_Enable") { DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows(); if (dt == null || dt.Rows.Count == 0) { MessageUtil.ShowTips("请选择配置信息。"); return; } string convNo = dt.Rows[0]["DEVICECODE"].ToString(); var result = MessageUtil.ShowYesNoAndWarning(string.Format("出入口[{0}]确定要启用吗?", convNo)); if (result == DialogResult.Yes) { string msg = SystemConfigWorkflow.SystemConfigSet(convNo, true); MessageUtil.ShowTips(msg); uC_QueryPage1.RefreshData(1, 0); } } else if (LCName == "btn_Stop") { DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows(); if (dt == null || dt.Rows.Count == 0) { MessageUtil.ShowTips("请选择配置信息。"); return; } string convNo = dt.Rows[0]["DEVICECODE"].ToString(); var result = MessageUtil.ShowYesNoAndWarning(string.Format("出入口[{0}]确定要禁用吗?", convNo)); if (result == DialogResult.Yes) { string msg = SystemConfigWorkflow.SystemConfigSet(convNo, false); MessageUtil.ShowTips(msg); uC_QueryPage1.RefreshData(1, 0); } } } } }