FrmAGVSet.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. using WCS_Client.Workflow;
  15. namespace WCS_Client.Frm
  16. {
  17. public partial class FrmAGVSet : Form
  18. {
  19. public FrmAGVSet()
  20. {
  21. InitializeComponent();
  22. InitFrm();
  23. }
  24. private void InitFrm()
  25. {
  26. List<GridColumn> GCList = new List<GridColumn>()
  27. {
  28. SuperGridUtil.Get_GridColumn("WORKSHOP", "车间", 120),
  29. SuperGridUtil.Get_GridColumn("POSITION", "产线", 120),
  30. SuperGridUtil.Get_CheckBoxX_GridColumn("INENABLE", "入库启用", 100),
  31. SuperGridUtil.Get_CheckBoxX_GridColumn("OUTENABLE", "出库启用", 120),
  32. };
  33. List<LayoutControlItem> LCIList = new List<LayoutControlItem>();
  34. LCIList.Add(LCItemUtil.Add_TextboxX("WORKSHOP", "车间:", 20, SubmitMethods, null));
  35. LCIList[LCIList.Count - 1].Tag = new LCWhereInfo() { QWhereText = "WORKSHOP like '%{0}%'" };
  36. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QDB", "查询", 80, 30, SubmitMethods));
  37. LCIList.Add(LCItemUtil.Add_ButtonX("btn_QClear", "重置", 80, 30, SubmitMethods));
  38. if (CurrentHelper.User.Use_RoleId == 1)
  39. {
  40. LCIList.Add(LCItemUtil.Add_Button("btn_InEnable", "入库启用", 80, 30, DevComponents.DotNetBar.eButtonColor.BlueWithBackground, SubmitMethods));
  41. LCIList.Add(LCItemUtil.Add_Button("btn_OutEnable", "出库启用", 80, 30, DevComponents.DotNetBar.eButtonColor.BlueWithBackground, SubmitMethods));
  42. LCIList.Add(LCItemUtil.Add_Button("btn_InStop", "入库停用", 80, 30, DevComponents.DotNetBar.eButtonColor.MagentaWithBackground, SubmitMethods));
  43. LCIList.Add(LCItemUtil.Add_Button("btn_OutStop", "出库停用", 80, 30, DevComponents.DotNetBar.eButtonColor.MagentaWithBackground, SubmitMethods));
  44. }
  45. uC_QueryPage1.Init_QueryPage(30, true, true, "", GCList, LCIList, QueryPageDataMethods, RefreshRoleMethods, DoubleClikMethod, null, null);
  46. uC_QueryPage1.ClearLCItemValue();
  47. CommonShow.ShowProcessing("正在处理中,请稍候...", this, (obj) =>
  48. {
  49. uC_QueryPage1.RefreshData(1, 0);
  50. }, null);
  51. }
  52. private PageData QueryPageDataMethods(int PageIndex, int PageSize)
  53. {
  54. string _SQLText = @"SELECT * FROM [WCS_OPP].[dbo].[WCS_AGV_Config] where 1=1 ";
  55. string _Orderby = "WORKSHOP asc";
  56. PageData pd = BaseWorkflow.QueryPageData(_SQLText, _Orderby, uC_QueryPage1.GetQueryWhere(), PageIndex, PageSize);
  57. return pd;
  58. }
  59. private void RefreshRoleMethods(bool ChkValue)
  60. {
  61. }
  62. private void DoubleClikMethod(DataRow dr)
  63. {
  64. //wcs_task_no = Convert.ToInt32(dr["TASK_NO"].ToString());
  65. //FrmWCS_TaskDIS_DTL Frm = new FrmWCS_TaskDIS_DTL(wcs_task_no);
  66. //Frm.Show();
  67. }
  68. private void SubmitMethods(string LCName)
  69. {
  70. if (LCName == "btn_QDB")
  71. {
  72. uC_QueryPage1.RefreshData();
  73. }
  74. else if (LCName == "btn_QClear")
  75. {
  76. uC_QueryPage1.ShowOpaqueLayer();
  77. uC_QueryPage1.ClearLCItemValue();
  78. uC_QueryPage1.RefreshData(1, 0);
  79. uC_QueryPage1.HideOpaqueLayer();
  80. }
  81. else if (LCName == "btn_InEnable")
  82. {
  83. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  84. if (dt == null || dt.Rows.Count == 0)
  85. {
  86. MessageUtil.ShowTips("请选择配置信息。");
  87. return;
  88. }
  89. string proLine = dt.Rows[0]["POSITION"].ToString();
  90. int convNo1 = (int)dt.Rows[0]["ID"];
  91. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]产线确定要启用入库功能吗?", proLine));
  92. if (result == DialogResult.Yes)
  93. {
  94. string msg = SystemConfigWorkflow.AgvSet(proLine, true, LCName);
  95. MessageUtil.ShowTips(msg);
  96. uC_QueryPage1.RefreshData(1, 0);
  97. }
  98. }
  99. else if (LCName == "btn_InStop")
  100. {
  101. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  102. if (dt == null || dt.Rows.Count == 0)
  103. {
  104. MessageUtil.ShowTips("请选择配置信息。");
  105. return;
  106. }
  107. //int convNo = (int)dt.Rows[0]["WORKSHOP"];
  108. string proLine = dt.Rows[0]["POSITION"].ToString();
  109. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]产线确定要禁用入库功能吗?", proLine));
  110. if (result == DialogResult.Yes)
  111. {
  112. string msg = SystemConfigWorkflow.AgvSet(proLine, 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. string proLine = dt.Rows[0]["POSITION"].ToString();
  127. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]号车间确定要启用出库功能吗?", proLine));
  128. if (result == DialogResult.Yes)
  129. {
  130. string msg = SystemConfigWorkflow.AgvSet(proLine, true, LCName);
  131. MessageUtil.ShowTips(msg);
  132. uC_QueryPage1.RefreshData(1, 0);
  133. }
  134. }
  135. else if (LCName == "btn_OutStop")
  136. {
  137. DataTable dt = this.uC_QueryPage1.SCGrid_GetChkRows();
  138. if (dt == null || dt.Rows.Count == 0)
  139. {
  140. MessageUtil.ShowTips("请选择配置信息。");
  141. return;
  142. }
  143. //int convNo = (int)dt.Rows[0]["WORKSHOP"];
  144. string proLine = dt.Rows[0]["POSITION"].ToString();
  145. var result = MessageUtil.ShowYesNoAndWarning(string.Format("[{0}]产线确定要禁用出库功能吗?", proLine));
  146. if (result == DialogResult.Yes)
  147. {
  148. string msg = SystemConfigWorkflow.AgvSet(proLine, false, LCName);
  149. MessageUtil.ShowTips(msg);
  150. uC_QueryPage1.RefreshData(1, 0);
  151. }
  152. }
  153. }
  154. }
  155. }