FrmReportManage.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Infragistics.Win.UltraWinEditors;
  11. using Core.StlMes.Client.ZGMil.Signature;
  12. using Core.StlMes.Client.ZGMil.Entity;
  13. using Core.Mes.Client.Comm.Control;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Core.Mes.Client.Comm.Tool;
  16. using Core.Mes.Client.Comm.Server;
  17. using CoreFS.SA06;
  18. using System.Collections;
  19. using Infragistics.Win;
  20. using System.IO;
  21. namespace Core.StlMes.Client.ZGMil
  22. {
  23. public partial class FrmReportManage : FrmBase
  24. {
  25. private string departm = "";
  26. UltraComboEditor ucePline = new UltraComboEditor();//产线名称
  27. private string plineCode;
  28. public FrmReportManage()
  29. {
  30. InitializeComponent();
  31. }
  32. private void FrmTubeRollFileManage_Load(object sender, EventArgs e)
  33. {
  34. NativeMethodNew na = new NativeMethodNew(this.ob);
  35. departm = UserInfo.GetDepartment();
  36. plineCode = na.GetPCode(departm);//获取 用户 对应的产线
  37. //plineCode = na.GetPCodePline(this.ValidDataPurviewIds);//获取产线方法
  38. TubeRoll.InitComboEditorValue(ucePline, "com.steering.mes.signature.FrmTubeRollFileManage.queryPlineCode", "PLINE_CODE", this.ob, false, plineCode);
  39. TubeRoll.BindColumn(ucePline, "PLINE_CODE", this.Controls, this.ultraGrid1, 0);
  40. //ultraPlineCode.Items.Remove()
  41. DoQuery();
  42. }
  43. /// <summary>
  44. /// 重写基类方法
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="ToolbarKey"></param>
  48. public override void ToolBar_Click(object sender, string ToolbarKey)
  49. {
  50. switch (ToolbarKey)
  51. {
  52. case "Query":
  53. DoQuery();
  54. break;
  55. case "Add":
  56. DoAdd();
  57. break;
  58. case "Delete":
  59. DoDelete();
  60. break;
  61. case "Update":
  62. DoUpdare();
  63. break;
  64. case "Close":
  65. this.Close();
  66. break;
  67. }
  68. }
  69. /// <summary>
  70. /// 查询
  71. /// </summary>
  72. private void DoQuery()
  73. {
  74. DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmReportManage.queryReportManage", new Object[] { plineCode, this.UserInfo.GetUserName() }, ob);
  75. GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
  76. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  77. {
  78. ugr.Cells["PLINE_CODE"].Appearance.BackColor =Color.Transparent;
  79. ugr.Cells["PLINE_CODE"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  80. ugr.Cells["PLINE_CODE"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  81. //ugr.Cells["COL_GROUP"].Appearance.BackColor = Color.Transparent;
  82. //ugr.Cells["COL_GROUP"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  83. //ugr.Cells["COL_GROUP"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  84. }
  85. }
  86. /// <summary>
  87. /// 新增
  88. /// </summary>
  89. private void DoAdd()
  90. {
  91. ultraGrid1.UpdateData();
  92. ArrayList list1 = new ArrayList();
  93. string pline = "";
  94. string reportNo = "";
  95. string reportNoNew = "";
  96. string reportNoTime = "";
  97. //int count = 0;
  98. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  99. if (uGrid.Count() == 0)
  100. {
  101. MessageUtil.ShowTips("请选择要新增的数据!");
  102. return;
  103. }
  104. foreach (UltraGridRow ugr in uGrid)
  105. {
  106. pline = ugr.Cells["PLINE_CODE"].Value.ToString();
  107. reportNo = ugr.Cells["REPORT_NO"].Value.ToString();
  108. reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString();
  109. if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals(""))
  110. {
  111. MessageUtil.ShowTips("请选择生效日期!");
  112. return;
  113. }
  114. reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd");
  115. if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; }
  116. if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; }
  117. if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; }
  118. if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; }
  119. //if (ugr.Cells["PROCESS_NO"].Text.Trim()!= "") { //MessageUtil.ShowTips("工序名称不能为空!"); return;
  120. // gx = ugr.Cells["PROCESS_NO"].Value.ToString();
  121. //}
  122. //DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.queryMinStgnature2", new object[] {ugr.Cells["USER_ID"].Text.Trim()}, ob);
  123. //if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
  124. ArrayList list = new ArrayList();
  125. list.Add(pline);
  126. list.Add(reportNo);
  127. list.Add(reportNoNew);
  128. list.Add(reportNoTime);
  129. list.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
  130. list.Add(ugr.Cells["REMARK"].Text.Trim());
  131. list.Add(UserInfo.GetUserName());
  132. list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim());
  133. list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim());
  134. list.Add(ugr.Cells["SAVE_STATION"].Text.Trim());
  135. list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim());
  136. list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim());
  137. list1.Add(list);
  138. }
  139. //if (MessageUtil.ShowYesNoAndQuestion("是否保存签名?") == System.Windows.Forms.DialogResult.No) return;
  140. CoreClientParam ccp = new CoreClientParam();
  141. ccp.ServerName = "com.steering.mes.signature.FrmReportManage";
  142. ccp.MethodName = "addReportManage";
  143. ccp.ServerParams = new object[] { list1 };
  144. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  145. if (ccp.ReturnCode != -1)
  146. {
  147. MessageUtil.ShowTips(ccp.ReturnInfo);
  148. if (ccp.ReturnInfo.Equals("新增成功!"))
  149. {
  150. DoQuery();
  151. }
  152. }
  153. }
  154. /// <summary>
  155. /// 删除
  156. /// </summary>
  157. private void DoDelete()
  158. {
  159. ultraGrid1.UpdateData();
  160. ArrayList pram1 = new ArrayList();
  161. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  162. if (uGrid.Count() == 0)
  163. {
  164. MessageUtil.ShowTips("请选择要删除的数据!");
  165. return;
  166. }
  167. if (MessageUtil.ShowYesNoAndQuestion("是否确认删除信息?") == System.Windows.Forms.DialogResult.No)
  168. {
  169. return;
  170. }
  171. foreach (UltraGridRow ugr in uGrid)
  172. {
  173. ArrayList pram = new ArrayList();
  174. pram.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  175. pram.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
  176. pram1.Add(pram);
  177. }
  178. int countinsert = ServerHelper.SetData("com.steering.mes.signature.FrmReportManage.deleteReportManage", new Object[] { pram1 }, this.ob);
  179. if (countinsert > 0)
  180. {
  181. MessageUtil.ShowTips("删除成功!");
  182. }
  183. else
  184. {
  185. MessageUtil.ShowTips("删除失败!"); return;
  186. }
  187. DoQuery();
  188. }
  189. /// <summary>
  190. /// 修改
  191. /// </summary>
  192. private void DoUpdare()
  193. {
  194. ultraGrid1.UpdateData();
  195. string pline = "";
  196. string reportNo = "";
  197. string reportNoNew = "";
  198. string reportNoTime = "";
  199. //int count = 0;
  200. ArrayList pram1 = new ArrayList();
  201. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  202. if (uGrid.Count() == 0)
  203. {
  204. MessageUtil.ShowTips("请选择修改的数据!");
  205. return;
  206. }
  207. foreach (UltraGridRow ugr in uGrid)
  208. {
  209. pline = ugr.Cells["PLINE_CODE"].Value.ToString();
  210. reportNo = ugr.Cells["REPORT_NO"].Value.ToString();
  211. reportNoNew = ugr.Cells["REPORT_NO_NEW"].Value.ToString();
  212. if (ugr.Cells["REPORT_NO_TIME"].Value.ToString().Equals(""))
  213. {
  214. MessageUtil.ShowTips("请选择生效日期!");
  215. return;
  216. }
  217. reportNoTime = Convert.ToDateTime(ugr.Cells["REPORT_NO_TIME"].Value.ToString()).ToString("yyyyMMdd");
  218. if (pline == "") { MessageUtil.ShowTips("产线不能为空!"); return; }
  219. if (reportNo == "") { MessageUtil.ShowTips("报表不能为空!"); return; }
  220. if (reportNoNew == "") { MessageUtil.ShowTips("生效编号不能为空!"); return; }
  221. if (reportNo == "") { MessageUtil.ShowTips("旧编号不能为空!"); return; }
  222. ArrayList list = new ArrayList();
  223. list.Add(reportNo);
  224. list.Add(reportNoNew);
  225. list.Add(reportNoTime);
  226. list.Add(UserInfo.GetUserName());
  227. list.Add(ugr.Cells["REMARK"].Text.Trim());
  228. list.Add(ugr.Cells["GENERATE_STATION"].Text.Trim());
  229. list.Add(ugr.Cells["RECEIVING_STATION"].Text.Trim());
  230. list.Add(ugr.Cells["SAVE_STATION"].Text.Trim());
  231. list.Add(ugr.Cells["STORAGE_LIFE"].Text.Trim());
  232. list.Add(ugr.Cells["INTERMEDIARY"].Text.Trim());
  233. list.Add(pline);
  234. list.Add(ugr.Cells["REPORT_NAME"].Value.ToString());
  235. pram1.Add(list);
  236. }
  237. if (MessageUtil.ShowYesNoAndQuestion("是否修报表信息?") == System.Windows.Forms.DialogResult.No) return;
  238. CoreClientParam ccp = new CoreClientParam();
  239. ccp.ServerName = "com.steering.mes.signature.FrmReportManage";
  240. ccp.MethodName = "updateReportManage";
  241. ccp.ServerParams = new object[] { pram1 };
  242. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  243. if (ccp.ReturnCode != -1)
  244. {
  245. MessageUtil.ShowTips(ccp.ReturnInfo);
  246. if (ccp.ReturnInfo.Equals("修改成功!"))
  247. {
  248. DoQuery();
  249. }
  250. }
  251. }
  252. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  253. {
  254. try
  255. {
  256. ultraGrid1.UpdateData();
  257. foreach (UltraGridRow r in ultraGrid1.Rows)
  258. {
  259. r.Cells["CHK"].Value = r.Selected;
  260. }
  261. }
  262. catch { }
  263. }
  264. }
  265. }