FrmSrmInfoSet.cs 5.3 KB

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