QcmProblemHandlingFrm.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Judge.Commons;
  6. using Core.StlMes.Client.Judge.Models;
  7. using Core.StlMes.Client.YdmPipeReport.Tool;
  8. using CoreFS.CA06;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.ComponentModel;
  13. using System.Data;
  14. using System.Drawing;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Windows.Forms;
  18. namespace Core.StlMes.Client.Judge.Forms
  19. {
  20. public partial class QcmProblemHandlingFrm : FrmBase
  21. {
  22. public QcmProblemHandlingFrm()
  23. {
  24. InitializeComponent();
  25. }
  26. private Dal _d;
  27. private DataTable _dtPline = null;
  28. public override void ToolBar_Click(object sender, string ToolbarKey)
  29. {
  30. base.ToolBar_Click(sender, ToolbarKey);
  31. switch (ToolbarKey)
  32. {
  33. case "Query":
  34. Query();
  35. break;
  36. case "Add":
  37. doAdd();
  38. break;
  39. case "Update":
  40. doUpdate();
  41. break;
  42. break;
  43. case "Delete":
  44. doDelete();
  45. break;
  46. case "Confirm":
  47. doConfirm();
  48. break;
  49. }
  50. }
  51. private void doConfirm()
  52. {
  53. ultraGrid1.UpdateData();
  54. UltraGridRow row = this.ultraGrid1.ActiveRow;
  55. if (row == null)
  56. {
  57. return;
  58. }
  59. QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity;
  60. entity.ConfirmName = this.UserInfo.GetUserName();
  61. JSONFormat.Format(entity);
  62. CoreClientParam ccp = new CoreClientParam();
  63. ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling";
  64. ccp.MethodName = "updateConfirm";
  65. ccp.ServerParams = new object[] { JSONFormat.Format(entity) };
  66. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  67. if (ccp.ReturnCode != -1)
  68. {
  69. MessageUtil.ShowTips("确认成功!");
  70. Query();
  71. }
  72. }
  73. private void doDelete()
  74. {
  75. ultraGrid1.UpdateData();
  76. UltraGridRow row = this.ultraGrid1.ActiveRow;
  77. if (row == null)
  78. {
  79. return;
  80. }
  81. if (!string.IsNullOrEmpty(row.Cells["HandleName"].Value.ToString2()))
  82. {
  83. MessageUtil.ShowWarning("已有处理措施,无法撤销!");
  84. return;
  85. }
  86. QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity;
  87. entity.HandleName = this.UserInfo.GetUserName();
  88. JSONFormat.Format(entity);
  89. CoreClientParam ccp = new CoreClientParam();
  90. ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling";
  91. ccp.MethodName = "delete";
  92. ccp.ServerParams = new object[] { JSONFormat.Format(entity) };
  93. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  94. if (ccp.ReturnCode != -1)
  95. {
  96. MessageUtil.ShowTips("撤销成功!");
  97. Query();
  98. }
  99. }
  100. private void doUpdate()
  101. {
  102. ultraGrid1.UpdateData();
  103. UltraGridRow row = this.ultraGrid1.ActiveRow;
  104. if (row == null)
  105. {
  106. return;
  107. }
  108. if (!string.IsNullOrEmpty(row.Cells["ConfirmName"].Value.ToString2()))
  109. {
  110. MessageUtil.ShowWarning("已确认,无法修改!");
  111. return;
  112. }
  113. QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity;
  114. entity.HandleName = this.UserInfo.GetUserName();
  115. JSONFormat.Format(entity);
  116. CoreClientParam ccp = new CoreClientParam();
  117. ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling";
  118. ccp.MethodName = "update";
  119. ccp.ServerParams = new object[] { JSONFormat.Format(entity) };
  120. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  121. if (ccp.ReturnCode != -1)
  122. {
  123. MessageUtil.ShowTips("修改成功!");
  124. Query();
  125. }
  126. }
  127. private void doAdd()
  128. {
  129. ultraGrid1.UpdateData();
  130. UltraGridRow row = this.ultraGrid1.ActiveRow;
  131. if (row == null)
  132. {
  133. return;
  134. }
  135. QcmProblemHandlingEntity entity = this.ultraGrid1.ActiveRow.ListObject as QcmProblemHandlingEntity;
  136. entity.ApplyName = this.UserInfo.GetUserName();
  137. JSONFormat.Format(entity);
  138. CoreClientParam ccp = new CoreClientParam();
  139. ccp.ServerName = "com.steering.pss.qcm.DAL.QcmProblemHandling";
  140. ccp.MethodName = "add";
  141. ccp.ServerParams = new object[] { JSONFormat.Format(entity) };
  142. ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  143. if (ccp.ReturnCode != -1)
  144. {
  145. MessageUtil.ShowTips("提交成功!");
  146. Query();
  147. }
  148. }
  149. private void Query()
  150. {
  151. string judgeStoveNo = labelTextBox2.Checked ? labelTextBox2.Text.Trim() : "";
  152. string plines = ultraTextEditor3.Tag.ToString2();
  153. string timeB = labelDateTimePicker8.Checked ? labelDateTimePicker8.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  154. string timeE = labelDateTimePicker8.Checked ? labelDateTimePicker7.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
  155. List<QcmProblemHandlingEntity> listSource = null;
  156. if (this.CustomInfo.Equals("1"))
  157. {
  158. listSource = EntityHelper.GetData<QcmProblemHandlingEntity>(
  159. "com.steering.pss.qcm.DAL.QcmProblemHandling.query1", new object[] { judgeStoveNo, plines, timeB, timeE }, this.ob);
  160. }
  161. else {
  162. listSource = EntityHelper.GetData<QcmProblemHandlingEntity>(
  163. "com.steering.pss.qcm.DAL.QcmProblemHandling.query", new object[] { judgeStoveNo, plines, timeB, timeE }, this.ob);
  164. }
  165. qcmProblemHandlingEntityBindingSource.DataSource = listSource;
  166. }
  167. private void QcmProblemHandlingFrm_Load(object sender, EventArgs e)
  168. {
  169. EntityHelper.ShowGridCaption<QcmProblemHandlingEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  170. labelDateTimePicker8.DateTimePicker.Value = DateTime.Now.Date.AddDays(-3);
  171. labelDateTimePicker7.DateTimePicker.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  172. _d = new Dal(ob);
  173. string[] datePurviewIds = this.ValidDataPurviewIds;
  174. _dtPline = _d.GetTableByXmlId("ComBaseQuery.COMBASEPLINE", new object[] { new string[] { } });
  175. DataTable dtDeptPline = _d.GetTableByXmlId("JdgComBasePline.getPlineByDept", new object[] { datePurviewIds });
  176. for (int i = _dtPline.Rows.Count - 1; i >= 0; i--)
  177. {
  178. if (dtDeptPline.Select("plinecode = '" + _dtPline.Rows[i]["plinecode"].ToString() + "'").Length == 0)
  179. {
  180. _dtPline.Rows[i].Delete();
  181. }
  182. }
  183. _dtPline.AcceptChanges();
  184. string strPlineNames = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineName"].ToString()).ToArray());
  185. string strPineCodes = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineCode"].ToString()).ToArray());
  186. ultraTextEditor3.Text = strPlineNames;
  187. ultraTextEditor3.Tag = strPineCodes;
  188. if (this.CustomInfo.Equals("1"))
  189. {
  190. label1.Text = "提出时间";
  191. EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "HandleName", "HandleTime", "HandleDesc", "HandleResult", "ConfirmName", "ConfirmTime" }, false);
  192. EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "ProcessCodeNext" }, true);
  193. BaseHelper.setOtherColumnReadOnly(ultraGrid1, new string[] { "HandleDesc", "HandleResult" });
  194. ultraLabel4.Visible = false;
  195. ultraTextEditor3.Visible = false;
  196. }
  197. else {
  198. EntityHelper.setColumnShowOrHidden(ultraGrid1, new string[] { "HandleName", "HandleTime", "HandleDesc", "HandleResult", "ConfirmName", "ConfirmTime" }, true);
  199. ultraGrid1.DisplayLayout.Bands[0].Columns["processNextFlag"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128);
  200. ultraGrid1.DisplayLayout.Bands[0].Columns["ApplyDesc"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128);
  201. }
  202. }
  203. private void labelDateTimePicker8_CheckBox_CheckedChanged(object sender, EventArgs e)
  204. {
  205. labelDateTimePicker7.DateTimeEnabled = labelDateTimePicker8.Checked;
  206. }
  207. private void ultraTextEditor3_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  208. {
  209. ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraTextEditor3.Tag.ToString2(), _d.Ob);
  210. if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  211. {
  212. ultraTextEditor3.Text = frm.ChoicePlineName;
  213. ultraTextEditor3.Tag = frm.ChoicePlineCode;
  214. }
  215. }
  216. }
  217. }