FrmSingleReview.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.YdmPipeManage;
  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.YdmPipeReport
  17. {
  18. public partial class FrmSingleReview : FrmBase
  19. {
  20. public FrmSingleReview()
  21. {
  22. InitializeComponent();
  23. }
  24. private void FrmSingleReview_Load(object sender, EventArgs e)
  25. {
  26. DateTime now = DateTime.Now;
  27. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  28. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  29. StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  30. EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  31. }
  32. public override void ToolBar_Click(object sender, string ToolbarKey)
  33. {
  34. switch (ToolbarKey)
  35. {
  36. case "Query":
  37. DoQuery();
  38. break;
  39. case "ReviewBy":
  40. DoReviewBy();
  41. break;
  42. case "AuditBy":
  43. DoAuditBy();
  44. break;
  45. case "Export"://导出
  46. DoExport();
  47. break;
  48. case "Close":
  49. this.Close();
  50. break;
  51. }
  52. }
  53. /// <summary>
  54. /// 查询
  55. /// </summary>
  56. private void DoQuery()
  57. {
  58. if (!CheckQuery()) return;
  59. string stratTime = "1999-01-01 00:00:00";
  60. string endTime = "2999-12-31 23:59:59";
  61. string orderNo = "";
  62. string orderNoReal = "";
  63. string orderStrats = "";
  64. if (chkDate.Checked)
  65. {
  66. stratTime = StartTime.Value.ToString();
  67. endTime = EndTime.Value.ToString();
  68. }
  69. if (chkOrder.Checked)
  70. {
  71. orderNo = cmbOrder.Text.Trim();
  72. }
  73. if (chkOrderNo.Checked)
  74. {
  75. orderNoReal = cmbOrderNo.Text.Trim();
  76. }
  77. if (chkOrderstatus.Checked)
  78. {
  79. orderStrats = Txtorderstatus.Value.ToString();
  80. }
  81. DataTable dt=new DataTable();
  82. dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmSingleReview.getDoQueryRev", new object[] { stratTime, endTime, orderNo, orderNoReal, orderStrats }, this.ob);
  83. GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
  84. if (dt.Rows.Count <= 0)
  85. {
  86. dt = new DataTable();
  87. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  88. }
  89. }
  90. /// <summary>
  91. /// 评审通过
  92. /// </summary>
  93. private void DoReviewBy()
  94. {
  95. UltraGridRow row = ultraGrid2.ActiveRow;
  96. if (row == null) return;
  97. ultraGrid2.UpdateData();
  98. int count = 0;
  99. ArrayList list = new ArrayList();
  100. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  101. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  102. {
  103. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  104. {
  105. count += 1;
  106. ArrayList list1 = new ArrayList();
  107. list1.Add(ugr.Cells["REVIEW_NO"].Value.ToString());
  108. list1.Add("X");
  109. list1.Add(this.UserInfo.GetUserName());
  110. list1.Add(time);
  111. list.Add(list1);
  112. }
  113. }
  114. if (count == 0)
  115. {
  116. MessageUtil.ShowTips("请选择评审单主信息!");
  117. return;
  118. }
  119. if (MessageUtil.ShowYesNoAndQuestion("是否评审通过?") == DialogResult.No)
  120. {
  121. return;
  122. }
  123. CoreClientParam ccp = new CoreClientParam();
  124. try
  125. {
  126. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  127. if (Constant.WaitingForm == null)
  128. {
  129. Constant.WaitingForm = new WaitingForm();
  130. }
  131. Constant.WaitingForm.ShowToUser = true;
  132. Constant.WaitingForm.Show();
  133. Constant.WaitingForm.Update();
  134. ccp.ServerName = "com.steering.pss.ydm.Report.FrmSingleReview";
  135. ccp.MethodName = "doReviewBy";
  136. ccp.ServerParams = new object[] { list };
  137. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  138. this.Cursor = Cursors.Default;
  139. Constant.WaitingForm.ShowToUser = false;
  140. Constant.WaitingForm.Close();
  141. Constant.WaitingForm = null;
  142. }
  143. catch (Exception ex)
  144. {
  145. this.Cursor = Cursors.Default;
  146. Constant.WaitingForm.ShowToUser = false;
  147. Constant.WaitingForm.Close();
  148. Constant.WaitingForm = null;
  149. }
  150. if (ccp.ReturnCode != -1)
  151. {
  152. MessageUtil.ShowTips(ccp.ReturnInfo);
  153. if (ccp.ReturnInfo.Equals("评审通过!"))
  154. {
  155. DoQuery();
  156. }
  157. }
  158. }
  159. /// <summary>
  160. /// 评审不通过
  161. /// </summary>
  162. private void DoAuditBy()
  163. {
  164. UltraGridRow row = ultraGrid2.ActiveRow;
  165. if (row == null) return;
  166. ultraGrid2.UpdateData();
  167. int count = 0;
  168. ArrayList list = new ArrayList();
  169. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  170. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  171. {
  172. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  173. {
  174. count += 1;
  175. ArrayList list1 = new ArrayList();
  176. list1.Add(ugr.Cells["REVIEW_NO"].Value.ToString());
  177. list1.Add("X");
  178. list1.Add(this.UserInfo.GetUserName());
  179. list1.Add(time);
  180. list.Add(list1);
  181. }
  182. }
  183. if (count == 0)
  184. {
  185. MessageUtil.ShowTips("请选择评审单主信息!");
  186. return;
  187. }
  188. if (MessageUtil.ShowYesNoAndQuestion("是否评审不通过?") == DialogResult.No)
  189. {
  190. return;
  191. }
  192. CoreClientParam ccp = new CoreClientParam();
  193. try
  194. {
  195. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  196. if (Constant.WaitingForm == null)
  197. {
  198. Constant.WaitingForm = new WaitingForm();
  199. }
  200. Constant.WaitingForm.ShowToUser = true;
  201. Constant.WaitingForm.Show();
  202. Constant.WaitingForm.Update();
  203. ccp.ServerName = "com.steering.pss.ydm.Report.FrmSingleReview";
  204. ccp.MethodName = "doAuditBy";
  205. ccp.ServerParams = new object[] { list };
  206. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  207. this.Cursor = Cursors.Default;
  208. Constant.WaitingForm.ShowToUser = false;
  209. Constant.WaitingForm.Close();
  210. Constant.WaitingForm = null;
  211. }
  212. catch (Exception ex)
  213. {
  214. this.Cursor = Cursors.Default;
  215. Constant.WaitingForm.ShowToUser = false;
  216. Constant.WaitingForm.Close();
  217. Constant.WaitingForm = null;
  218. }
  219. if (ccp.ReturnCode != -1)
  220. {
  221. MessageUtil.ShowTips(ccp.ReturnInfo);
  222. if (ccp.ReturnInfo.Equals("评审不通过成功!"))
  223. {
  224. DoQuery();
  225. }
  226. }
  227. }
  228. ///查询时验证必填项
  229. private bool CheckQuery()
  230. {
  231. if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0)
  232. {
  233. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  234. return false;
  235. }
  236. if (chkOrder.Checked && string.IsNullOrEmpty(cmbOrder.Text.Trim()))
  237. {
  238. MessageBox.Show("请输入评审单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  239. return false;
  240. }
  241. if (chkOrderstatus.Checked && string.IsNullOrEmpty(Txtorderstatus.Text.Trim()))
  242. {
  243. MessageBox.Show("请选择评审状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  244. return false;
  245. }
  246. return true;
  247. }
  248. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  249. {
  250. UltraGridRow urg = ultraGrid2.ActiveRow;
  251. DataTable dt;
  252. if (urg == null) return;
  253. dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmSingleReview.getDoQueryOrderRev", new object[] { urg.Cells["REVIEW_NO"].Value.ToString() }, this.ob);
  254. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  255. }
  256. private void DoExport()
  257. {
  258. GridHelper.ulGridToExcel(ultraGrid2, "合同注销评审主信息");
  259. }
  260. private void chkDate_CheckedChanged(object sender, EventArgs e)
  261. {
  262. if (chkDate.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; }
  263. if (chkOrder.Checked) { cmbOrder.Enabled = true; } else { cmbOrder.Enabled = false; }
  264. if (chkOrderstatus.Checked) { Txtorderstatus.Enabled = true; } else { Txtorderstatus.Enabled = false; }
  265. if (chkOrderNo.Checked) { cmbOrderNo.Enabled = true; } else { cmbOrderNo.Enabled = false; }
  266. }
  267. }
  268. }