FrmSrmInfoSet.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using DevComponents.DotNetBar.Layout;
  2. using DevComponents.DotNetBar.SuperGrid;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Windows.Forms;
  6. using WCS_Client.UC;
  7. using WCS_Client.Utility;
  8. using WCS_Client.Workflow;
  9. namespace WCS_Client.Frm
  10. {
  11. public partial class FrmSrmInfoSet : Form
  12. {
  13. public FrmSrmInfoSet()
  14. {
  15. InitializeComponent();
  16. InitFrm();
  17. }
  18. private void InitFrm()
  19. {
  20. List<GridColumn> GCList = new List<GridColumn>()
  21. {
  22. SuperGridUtil.Get_GridColumn("DEVICECODE", "设备名", 120),
  23. SuperGridUtil.Get_GridColumn("Code", "所属设备名", 120),
  24. SuperGridUtil.Get_GridColumn("TUNNEL", "巷道", 120),
  25. SuperGridUtil.Get_GridColumn("Direction", "出入口类型", 120),
  26. //SuperGridUtil.Get_GridColumn("SRMOUTIN_SEQUENCE", "出入口顺序",120),
  27. //SuperGridUtil.Get_GridColumn("SRMOUTIN_PRIORITY", "出入口优先级", 120),
  28. SuperGridUtil.Get_CheckBoxX_GridColumn("ENABLED", "是否停用", 100),
  29. //SuperGridUtil.Get_CheckBoxX_GridColumn("SRMOUTIN_ISUPDATE", "是否更新", 120),
  30. SuperGridUtil.Get_GridColumn("Describe", "备注", 120)
  31. };
  32. List<LayoutControlItem> LCIList = new List<LayoutControlItem>();
  33. LCIList.Add(LCItemUtil.Add_TextboxX("Code", "所属设备:", 20, SubmitMethods, null));
  34. LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "Code like '%{0}%'" };
  35. LCIList.Add(LCItemUtil.Add_TextboxX("Describe", "备注:", 20, SubmitMethods, null));
  36. LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "Describe like '%{0}%'" };
  37. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QDB", "查询", 80, 30, SubmitMethods));
  38. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QClear", "重置", 80, 30, SubmitMethods));
  39. if (CurrentHelper.User.Use_RoleId == 1)
  40. {
  41. LCIList.Add(LCItemUtil.Add_ButtonX("btn_Enable", "启用", 80, 30, SubmitMethods));
  42. LCIList.Add(LCItemUtil.Add_ButtonX("btn_Stop", "停用", 80, 30, SubmitMethods));
  43. }
  44. uC_QueryPage1.Init_QueryPage(30, true, true, "", GCList, LCIList, QueryPageDataMethods, RefreshRoleMethods, DoubleClikMethod, null, null);
  45. uC_QueryPage1.ClearLCItemValue();
  46. CommonShow.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
  47. {
  48. uC_QueryPage1.RefreshData(1, 0);
  49. }, null);
  50. }
  51. private PageData QueryPageDataMethods(int PageIndex, int PageSize)
  52. {
  53. string _SQLText = @"SELECT * FROM [dbo].[WCS_SystemConfig] where 1=1 ";
  54. string _Orderby = "Code asc";
  55. PageData pd = BaseWorkflow.QueryPageData(_SQLText, _Orderby, uC_QueryPage1.GetQueryWhere(), PageIndex, PageSize);
  56. return pd;
  57. }
  58. private void RefreshRoleMethods(bool ChkValue)
  59. {
  60. }
  61. private void DoubleClikMethod(DataRow dr)
  62. {
  63. //wcs_task_no = Convert.ToInt32(dr["TASK_NO"].ToString());
  64. //FrmWCS_TaskDIS_DTL Frm = new FrmWCS_TaskDIS_DTL(wcs_task_no);
  65. //Frm.Show();
  66. }
  67. private void SubmitMethods(string LCName)
  68. {
  69. if (LCName == "btn_QDB")
  70. {
  71. uC_QueryPage1.RefreshData();
  72. }
  73. else if (LCName == "btn_QClear")
  74. {
  75. uC_QueryPage1.ShowOpaqueLayer();
  76. uC_QueryPage1.ClearLCItemValue();
  77. uC_QueryPage1.RefreshData(1, 0);
  78. uC_QueryPage1.HideOpaqueLayer();
  79. }
  80. else if (LCName == "btn_Enable")
  81. {
  82. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  83. if (dt == null || dt.Rows.Count == 0)
  84. {
  85. MessageUtil.ShowTips("请选择配置信息。");
  86. return;
  87. }
  88. string convNo = dt.Rows[0]["DEVICECODE"].ToString();
  89. var result = MessageUtil.ShowYesNoAndWarning(string.Format("出入口[{0}]确定要启用吗?", convNo));
  90. if (result == DialogResult.Yes)
  91. {
  92. string msg = SystemConfigWorkflow.SystemConfigSet(convNo, true);
  93. MessageUtil.ShowTips(msg);
  94. uC_QueryPage1.RefreshData(1, 0);
  95. }
  96. }
  97. else if (LCName == "btn_Stop")
  98. {
  99. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  100. if (dt == null || dt.Rows.Count == 0)
  101. {
  102. MessageUtil.ShowTips("请选择配置信息。");
  103. return;
  104. }
  105. string convNo = dt.Rows[0]["DEVICECODE"].ToString();
  106. var result = MessageUtil.ShowYesNoAndWarning(string.Format("出入口[{0}]确定要禁用吗?", convNo));
  107. if (result == DialogResult.Yes)
  108. {
  109. string msg = SystemConfigWorkflow.SystemConfigSet(convNo, false);
  110. MessageUtil.ShowTips(msg);
  111. uC_QueryPage1.RefreshData(1, 0);
  112. }
  113. }
  114. }
  115. }
  116. }