FrmAGVSet.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 FrmAGVSet : Form
  17. {
  18. public FrmAGVSet()
  19. {
  20. InitializeComponent();
  21. InitFrm();
  22. }
  23. private void InitFrm()
  24. {
  25. List<GridColumn> GCList = new List<GridColumn>()
  26. {
  27. SuperGridUtil.Get_GridColumn("WORKSHOP", "车间", 120),
  28. SuperGridUtil.Get_GridColumn("POSITION", "产线", 120),
  29. SuperGridUtil.Get_CheckBoxX_GridColumn("INENABLE", "入库启用", 100),
  30. SuperGridUtil.Get_CheckBoxX_GridColumn("OUTENABLE", "出库启用", 120),
  31. SuperGridUtil.Get_GridColumn("TASK_EDITUSERNO", "操作账号", 120),
  32. SuperGridUtil.Get_GridColumn("TASK_EDITDATETIME", "操作时间", 120),
  33. SuperGridUtil.Get_GridColumn("TASK_EDIT_FUNC", "操作方法", 120)
  34. };
  35. List<LayoutControlItem> LCIList = new List<LayoutControlItem>();
  36. LCIList.Add(LCItemUtil.Add_TextboxX("WORKSHOP", "车间:", 20, SubmitMethods, null));
  37. LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "WORKSHOP like '%{0}%'" };
  38. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QDB", "查询", 80, 30, SubmitMethods));
  39. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QClear", "重置", 80, 30, SubmitMethods));
  40. if (CurrentHelper.User.Use_RoleId == 1)
  41. {
  42. LCIList.Add(LCItemUtil.Add_Button("btn_InEnable", "入库启用", 80, 30, DevComponents.DotNetBar.eButtonColor.BlueWithBackground, SubmitMethods));
  43. LCIList.Add(LCItemUtil.Add_Button("btn_OutEnable", "出库启用", 80, 30, DevComponents.DotNetBar.eButtonColor.BlueWithBackground, SubmitMethods));
  44. LCIList.Add(LCItemUtil.Add_Button("btn_InStop", "入库停用", 80, 30, DevComponents.DotNetBar.eButtonColor.MagentaWithBackground, SubmitMethods));
  45. LCIList.Add(LCItemUtil.Add_Button("btn_OutStop", "出库停用", 80, 30, DevComponents.DotNetBar.eButtonColor.MagentaWithBackground, 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_AGV_Config] where 1=1 ";
  57. string _Orderby = "WORKSHOP 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_InEnable")
  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. int convNo = (int)dt.Rows[0]["WORKSHOP"];
  92. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]号车间确定要启用入库功能吗?", convNo));
  93. if (result == DialogResult.Yes)
  94. {
  95. string msg = BaseWorkflow.AgvSet(convNo, true, LCName);
  96. MessageUtil.ShowTips(msg);
  97. uC_QueryPage1.RefreshData(1, 0);
  98. }
  99. }
  100. else if (LCName == "btn_InStop")
  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. int convNo = (int)dt.Rows[0]["WORKSHOP"];
  109. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]号车间确定要禁用入库功能吗?", convNo));
  110. if (result == DialogResult.Yes)
  111. {
  112. string msg = BaseWorkflow.AgvSet(convNo, false, LCName);
  113. MessageUtil.ShowTips(msg);
  114. uC_QueryPage1.RefreshData(1, 0);
  115. }
  116. }
  117. else if (LCName == "btn_OutEnable")
  118. {
  119. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  120. if (dt == null || dt.Rows.Count == 0)
  121. {
  122. MessageUtil.ShowTips("请选择配置信息。");
  123. return;
  124. }
  125. int convNo = (int)dt.Rows[0]["WORKSHOP"];
  126. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]号车间确定要启用出库功能吗?", convNo));
  127. if (result == DialogResult.Yes)
  128. {
  129. string msg = BaseWorkflow.AgvSet(convNo, true, LCName);
  130. MessageUtil.ShowTips(msg);
  131. uC_QueryPage1.RefreshData(1, 0);
  132. }
  133. }
  134. else if (LCName == "btn_OutStop")
  135. {
  136. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  137. if (dt == null || dt.Rows.Count == 0)
  138. {
  139. MessageUtil.ShowTips("请选择配置信息。");
  140. return;
  141. }
  142. int convNo = (int)dt.Rows[0]["WORKSHOP"];
  143. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]号车间确定要禁用出库功能吗?", convNo));
  144. if (result == DialogResult.Yes)
  145. {
  146. string msg = BaseWorkflow.AgvSet(convNo, false, LCName);
  147. MessageUtil.ShowTips(msg);
  148. uC_QueryPage1.RefreshData(1, 0);
  149. }
  150. }
  151. }
  152. }
  153. }