HttReport.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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.Mcp.Treatment.Entity;
  5. using CoreFS.CA06;
  6. using Infragistics.Win;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Mcp.Treatment.HeatTreatment
  18. {
  19. public partial class HttReport : FrmBase
  20. {
  21. public HttReport()
  22. {
  23. InitializeComponent();
  24. }
  25. private string[] plineCode = null;
  26. private void HttReport_Load(object sender, EventArgs e)
  27. {
  28. EntityHelper.ShowGridCaption<HttReportEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  29. plineCode = Core.StlMes.Client.Mcp.Treatment.HeatTreatment.comm.GetPlineCode(ValidDataPurviewIds, this.CustomInfo, ob);
  30. comm.InitDropPlinePower(CustomInfo, txtPline, this.ValidDataPurviewIds, this.ob);
  31. if (CustomInfo.ToString2() == "G")
  32. {
  33. ultraGrid1.DisplayLayout.Bands[0].Columns["ReportType"].EditorComponent = reportTypeG;
  34. }
  35. QuerySinglePlan();
  36. }
  37. /// <summary>
  38. /// 重写基类方法
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="ToolbarKey"></param>
  42. public override void ToolBar_Click(object sender, string ToolbarKey)
  43. {
  44. switch (ToolbarKey)
  45. {
  46. case "DoQuery":
  47. QuerySinglePlan();
  48. break;
  49. //case "DoQueryInList":
  50. // doQueryInList();
  51. // break;
  52. case "DoSave":
  53. doSave();
  54. break;
  55. case "DoUpdate":
  56. doUpdate();
  57. break;
  58. case "DoDelete":
  59. cancelReport();
  60. break;
  61. //case "CancelPipe":
  62. // cancelPipe();
  63. // break;
  64. case "Close":
  65. this.Close();
  66. break;
  67. }
  68. }
  69. private void QuerySinglePlan()
  70. {
  71. List<HttReportEntity> listSource = EntityHelper.GetData<HttReportEntity>(
  72. "com.steering.mes.mcp.heatTreatment.HttReport.doQuery", new object[] { plineCode }, this.ob);
  73. HttReportEntitybindingSource1.DataSource = listSource;
  74. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  75. {
  76. ugr.Cells["PlineCode"].Appearance.BackColor = Color.Transparent;
  77. ugr.Cells["PlineCode"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  78. ugr.Cells["PlineCode"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  79. //ugr.Cells["ColGroup"].Appearance.BackColor = Color.Transparent;
  80. //ugr.Cells["ColGroup"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  81. //ugr.Cells["ColGroup"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  82. }
  83. }
  84. private void doSave()
  85. {
  86. this.ultraGrid1.UpdateData();
  87. ArrayList List = new ArrayList();
  88. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  89. if(checkRows.Count() == 0)
  90. {
  91. MessageUtil.ShowTips("请勾选需要新增的信息");
  92. return;
  93. }
  94. foreach (UltraGridRow row in checkRows)
  95. {
  96. HttReportEntity hrEntity = (HttReportEntity)row.ListObject;
  97. if(hrEntity.PlineCode.Equals(""))
  98. {
  99. MessageUtil.ShowTips("产线名称不能为空");
  100. return;
  101. }
  102. if(hrEntity.ReportNo.Equals(""))
  103. {
  104. MessageUtil.ShowTips("报表编号不能为空");
  105. return;
  106. }
  107. if (hrEntity.ReportNoNew.Equals(""))
  108. {
  109. MessageUtil.ShowTips("新报表编号不能为空");
  110. return;
  111. }
  112. if(hrEntity.ReportNoTime.Equals(""))
  113. {
  114. MessageUtil.ShowTips("新报表编号生效时间不能为空");
  115. return;
  116. }
  117. if (hrEntity.ReportName.Equals(""))
  118. {
  119. MessageUtil.ShowTips("报表名称不能为空");
  120. return;
  121. }
  122. if (hrEntity.ReportType.Equals(""))
  123. {
  124. MessageUtil.ShowTips("报表类型不能为空");
  125. return;
  126. }
  127. hrEntity.ColUser = this.UserInfo.GetUserID();
  128. string vrpEntity = JSONFormat.Format(hrEntity);
  129. List.Add(vrpEntity);
  130. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttReport.getSameData", new object[] { hrEntity.PlineCode, hrEntity.ReportName,hrEntity.ReportType,hrEntity.MachineNo }, ob);
  131. if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
  132. }
  133. CoreClientParam ccp = new CoreClientParam();
  134. ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport";
  135. ccp.MethodName = "doSave";
  136. ccp.ServerParams = new object[] { List };
  137. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  138. if (ccp.ReturnCode != -1)
  139. {
  140. if (ccp.ReturnInfo.Equals("新增成功!"))
  141. {
  142. QuerySinglePlan();
  143. MessageUtil.ShowTips(ccp.ReturnInfo);
  144. }
  145. else
  146. {
  147. MessageUtil.ShowTips(ccp.ReturnInfo);
  148. }
  149. }
  150. }
  151. private void doUpdate()
  152. {
  153. this.ultraGrid1.UpdateData();
  154. ArrayList List = new ArrayList();
  155. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  156. if (checkRows.Count() == 0)
  157. {
  158. MessageUtil.ShowTips("请勾选需要修改的信息");
  159. return;
  160. }
  161. foreach (UltraGridRow row in checkRows)
  162. {
  163. HttReportEntity hrEntity = (HttReportEntity)row.ListObject;
  164. if (hrEntity.PlineCode.Equals(""))
  165. {
  166. MessageUtil.ShowTips("产线名称不能为空");
  167. return;
  168. }
  169. if (hrEntity.ReportNo.Equals(""))
  170. {
  171. MessageUtil.ShowTips("报表编号不能为空");
  172. return;
  173. }
  174. if (hrEntity.ReportNoNew.Equals(""))
  175. {
  176. MessageUtil.ShowTips("新报表编号不能为空");
  177. return;
  178. }
  179. if (hrEntity.ReportNoTime.Equals(""))
  180. {
  181. MessageUtil.ShowTips("新报表编号生效时间不能为空");
  182. return;
  183. }
  184. if (hrEntity.ReportName.Equals(""))
  185. {
  186. MessageUtil.ShowTips("报表名称不能为空");
  187. return;
  188. }
  189. if (hrEntity.ReportType.Equals(""))
  190. {
  191. MessageUtil.ShowTips("报表类型不能为空");
  192. return;
  193. }
  194. //else if (hrEntity.ReportType.Equals("管体机探"))
  195. //{
  196. // hrEntity.ReportType = "0";
  197. //}
  198. //else
  199. //{
  200. // hrEntity.ReportType = "1";
  201. //}
  202. hrEntity.ColUser = this.UserInfo.GetUserID();
  203. string vrpEntity = JSONFormat.Format(hrEntity);
  204. List.Add(vrpEntity);
  205. }
  206. CoreClientParam ccp = new CoreClientParam();
  207. ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport";
  208. ccp.MethodName = "doUpdate";
  209. ccp.ServerParams = new object[] { List };
  210. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  211. if (ccp.ReturnCode != -1)
  212. {
  213. if (ccp.ReturnInfo.Equals("修改成功!"))
  214. {
  215. QuerySinglePlan();
  216. MessageUtil.ShowTips(ccp.ReturnInfo);
  217. }
  218. else
  219. {
  220. MessageUtil.ShowTips(ccp.ReturnInfo);
  221. }
  222. }
  223. }
  224. private void cancelReport()
  225. {
  226. this.ultraGrid1.UpdateData();
  227. ArrayList List = new ArrayList();
  228. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  229. if (checkRows.Count() == 0)
  230. {
  231. MessageUtil.ShowTips("请勾选需要修改的信息");
  232. return;
  233. }
  234. foreach (UltraGridRow row in checkRows)
  235. {
  236. HttReportEntity hrEntity = (HttReportEntity)row.ListObject;
  237. if (hrEntity.PlineCode.Equals(""))
  238. {
  239. MessageUtil.ShowTips("产线名称不能为空");
  240. return;
  241. }
  242. if (hrEntity.ReportName.Equals(""))
  243. {
  244. MessageUtil.ShowTips("报表名称不能为空");
  245. return;
  246. }
  247. if (hrEntity.ReportType.Equals(""))
  248. {
  249. MessageUtil.ShowTips("报表类型不能为空");
  250. return;
  251. }
  252. else if (hrEntity.ReportType.Equals("管体机探"))
  253. {
  254. hrEntity.ReportType = "0";
  255. }
  256. else
  257. {
  258. hrEntity.ReportType = "1";
  259. }
  260. string vrpEntity = JSONFormat.Format(hrEntity);
  261. List.Add(vrpEntity);
  262. }
  263. CoreClientParam ccp = new CoreClientParam();
  264. ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttReport";
  265. ccp.MethodName = "doCancel";
  266. ccp.ServerParams = new object[] { List };
  267. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  268. if (ccp.ReturnCode != -1)
  269. {
  270. if (ccp.ReturnInfo.Equals("删除成功!"))
  271. {
  272. QuerySinglePlan();
  273. MessageUtil.ShowTips(ccp.ReturnInfo);
  274. }
  275. else
  276. {
  277. MessageUtil.ShowTips(ccp.ReturnInfo);
  278. }
  279. }
  280. }
  281. }
  282. }