FrmCloutRetrieve.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Lims.Data.PipeAndOutdec.封装类.实体类;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec
  17. {
  18. public partial class FrmCloutRetrieve : FrmBase
  19. {
  20. PipeCloutRetrieveEntity entity;
  21. public PipeCloutRetrieveEntity Entity
  22. {
  23. get { return entity; }
  24. set { entity = value; }
  25. }
  26. public FrmCloutRetrieve()
  27. {
  28. InitializeComponent();
  29. EntityHelper.ShowGridCaption<PipeCloutRetrieveEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  30. }
  31. public override void ToolBar_Click(object sender, string ToolbarKey)
  32. {
  33. switch (ToolbarKey)
  34. {
  35. case "Query":
  36. Query();
  37. break;
  38. case "Add":
  39. Add();
  40. break;
  41. case "Update":
  42. Update();
  43. break;
  44. case "Nullify":
  45. Delete();
  46. break;
  47. case "Recover":
  48. Recovery();
  49. break;
  50. case "Close":
  51. this.Close();
  52. break;
  53. }
  54. }
  55. private void Recovery()
  56. {
  57. this.ultraGrid1.UpdateData();
  58. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  59. ArrayList parms = new ArrayList();
  60. foreach (UltraGridRow row in checkRows)
  61. {
  62. PipeCloutRetrieveEntity parm = row.ListObject as PipeCloutRetrieveEntity;
  63. parm.UpdateName = this.UserInfo.GetUserName();
  64. parms.Add(JSONFormat.Format(parm));
  65. }
  66. if (MessageUtil.ShowYesNoAndQuestion("是否确认恢复记录?") == DialogResult.No)
  67. {
  68. return;
  69. }
  70. List<string> jsons = new List<string>();
  71. CoreClientParam ccp = new CoreClientParam();
  72. ccp.ServerName = "com.steering.lims.data.pipe.FrmCloutRetrieve";
  73. ccp.MethodName = "UpdateValidflag";
  74. ccp.ServerParams = new object[] { parms, "1" };
  75. ccp.IfShowErrMsg = false;
  76. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  77. if (ccp != null)
  78. {
  79. if (ccp.ReturnCode == -1)
  80. {
  81. MessageUtil.ShowWarning(ccp.ReturnInfo);
  82. return;
  83. }
  84. MessageUtil.ShowTips("恢复成功!");
  85. Query();
  86. }
  87. }
  88. private void Delete()
  89. {
  90. this.ultraGrid1.UpdateData();
  91. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  92. ArrayList parms = new ArrayList();
  93. foreach (UltraGridRow row in checkRows)
  94. {
  95. PipeCloutRetrieveEntity parm = row.ListObject as PipeCloutRetrieveEntity;
  96. parm.DeleteName = this.UserInfo.GetUserName();
  97. parms.Add(JSONFormat.Format(parm));
  98. }
  99. if (MessageUtil.ShowYesNoAndQuestion("是否确认作废记录?") == DialogResult.No)
  100. {
  101. return;
  102. }
  103. List<string> jsons = new List<string>();
  104. CoreClientParam ccp = new CoreClientParam();
  105. ccp.ServerName = "com.steering.lims.data.pipe.FrmCloutRetrieve";
  106. ccp.MethodName = "UpdateValidflag";
  107. ccp.ServerParams = new object[] { parms, "0" };
  108. ccp.IfShowErrMsg = false;
  109. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  110. if (ccp != null)
  111. {
  112. if (ccp.ReturnCode == -1)
  113. {
  114. MessageUtil.ShowWarning(ccp.ReturnInfo);
  115. return;
  116. }
  117. MessageUtil.ShowTips("作废成功!");
  118. Query();
  119. }
  120. }
  121. private void Update()
  122. {
  123. this.ultraGrid1.UpdateData();
  124. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  125. ArrayList parms = new ArrayList();
  126. foreach (UltraGridRow row in checkRows)
  127. {
  128. PipeCloutRetrieveEntity parm = row.ListObject as PipeCloutRetrieveEntity;
  129. parm.Steelcode = row.Cells["Steelcode"].Value.ToString2();
  130. parm.Steelname = row.Cells["Steelcode"].Text.ToString2();
  131. parm.CloutType = row.Cells["CloutType"].Text.ToString2();
  132. parm.UpdateName = this.UserInfo.GetUserName();
  133. parms.Add(JSONFormat.Format(parm));
  134. }
  135. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改记录?") == DialogResult.No)
  136. {
  137. return;
  138. }
  139. List<string> jsons = new List<string>();
  140. CoreClientParam ccp = new CoreClientParam();
  141. ccp.ServerName = "com.steering.lims.data.pipe.FrmCloutRetrieve";
  142. ccp.MethodName = "Update";
  143. ccp.ServerParams = new object[] { parms };
  144. ccp.IfShowErrMsg = false;
  145. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  146. if (ccp != null)
  147. {
  148. if (ccp.ReturnCode == -1)
  149. {
  150. MessageUtil.ShowWarning(ccp.ReturnInfo);
  151. return;
  152. }
  153. MessageUtil.ShowTips("修改成功!");
  154. Query();
  155. }
  156. }
  157. private void Add()
  158. {
  159. this.ultraGrid1.UpdateData();
  160. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  161. ArrayList parms = new ArrayList();
  162. foreach (UltraGridRow row in checkRows)
  163. {
  164. PipeCloutRetrieveEntity parm = row.ListObject as PipeCloutRetrieveEntity;
  165. parm.Steelcode = row.Cells["Steelcode"].Value.ToString2();
  166. parm.Steelname = row.Cells["Steelcode"].Text.ToString2();
  167. parm.CloutType = row.Cells["CloutType"].Text.ToString2();
  168. parm.CreateName = this.UserInfo.GetUserName();
  169. parms.Add(JSONFormat.Format(parm));
  170. }
  171. if (MessageUtil.ShowYesNoAndQuestion("是否确认新增记录?") == DialogResult.No)
  172. {
  173. return;
  174. }
  175. List<string> jsons = new List<string>();
  176. CoreClientParam ccp = new CoreClientParam();
  177. ccp.ServerName = "com.steering.lims.data.pipe.FrmCloutRetrieve";
  178. ccp.MethodName = "Insert";
  179. ccp.ServerParams = new object[] { parms };
  180. //ccp.IfShowErrMsg = false;
  181. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  182. if (ccp != null)
  183. {
  184. if (ccp.ReturnCode == -1)
  185. {
  186. MessageUtil.ShowWarning(ccp.ReturnInfo);
  187. return;
  188. }
  189. MessageUtil.ShowTips("新增成功!");
  190. Query();
  191. }
  192. }
  193. private void Query()
  194. {
  195. string steelName = labelTextBox1.CheckBox.Checked ? labelTextBox1.Text.Trim() : "";
  196. string flag = ultraCheckEditor1.Checked ? "0" : "1";
  197. List<PipeCloutRetrieveEntity> listSource = EntityHelper.GetData<PipeCloutRetrieveEntity>(
  198. "com.steering.lims.data.pipe.FrmCloutRetrieve.Query", new object[] { steelName, flag }, this.ob);
  199. pipeCloutRetrieveEntityBindingSource.DataSource = listSource;
  200. }
  201. private void FrmCloutRetrieve_Load(object sender, EventArgs e)
  202. {
  203. // 查询钢种
  204. DataTable dt = ServerHelper.GetData("com.steering.lims.data.pipe.FrmCheckConsignAdd.queryGrade", null, this.ob);
  205. Steel_S.DataSource = dt;
  206. Steel_S.DisplayMember = "GRADENAME";
  207. Steel_S.ValueMember = "GRADECODE";
  208. Steel_S.DataBind();
  209. Query();
  210. }
  211. }
  212. }