F_PC_0105.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0105.cs
  5. * 2.功能描述:查看覆历
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/10/06 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.PCModule
  20. {
  21. /// <summary>
  22. /// 查看覆历
  23. /// </summary>
  24. public partial class F_PC_0105 : FormBase
  25. {
  26. #region 成员常量
  27. private static F_PC_0105 _instance; // 单例模式使用
  28. //范围权限
  29. private string _purview;
  30. #endregion
  31. #region 构造函数
  32. public F_PC_0105()
  33. {
  34. InitializeComponent();
  35. this.Text = FormTitles.F_PC_0105;
  36. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  37. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  38. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  39. }
  40. #endregion
  41. #region 单例模式
  42. /// <summary>
  43. /// 单例模式,防止重复创建窗体
  44. /// </summary>
  45. public static F_PC_0105 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null)
  50. {
  51. _instance = new F_PC_0105();
  52. }
  53. return _instance;
  54. }
  55. }
  56. #endregion
  57. #region 事件处理
  58. /// <summary>
  59. /// 查询
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. private void btnSearch_Click(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. if (this.dkGrouting.GroutingLineID == null)
  68. {
  69. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  70. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  71. this.dkGrouting.Focus();
  72. return;
  73. }
  74. DateTime? TimeStart = null;
  75. DateTime? TimeEnd = null;
  76. if (this.cbTime.Checked == true)
  77. {
  78. TimeStart = Convert.ToDateTime(this.txtDateStart.Text);
  79. TimeEnd = Convert.ToDateTime(this.txtDateEnd.Text).AddHours(23).AddMinutes(59).AddSeconds(59);
  80. }
  81. DataSet dsMouldRecord = (DataSet)PCModuleProxy.Service.GetMouldRecordByMainId(this.dkGrouting.GroutingLineID, null, TimeStart, TimeEnd);
  82. DataSet dsMouldHistory = (DataSet)PCModuleProxy.Service.GetMouldHistoryByMainId(this.dkGrouting.GroutingLineID, null, TimeStart, TimeEnd);
  83. if (dsMouldRecord != null)
  84. {
  85. this.dgvMouldRecord.AutoGenerateColumns = false;
  86. this.dgvMouldRecord.DataSource = dsMouldRecord.Tables[0];
  87. }
  88. if (dsMouldHistory != null)
  89. {
  90. this.dgvMouldHistory.AutoGenerateColumns = false;
  91. this.dgvMouldHistory.DataSource = dsMouldHistory.Tables[0];
  92. }
  93. }
  94. catch (Exception ex)
  95. {
  96. // 对异常进行共通处理
  97. ExceptionManager.HandleEventException(this.ToString(),
  98. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  99. }
  100. }
  101. /// <summary>
  102. /// 清空条件
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void btnClearCondition_Click(object sender, EventArgs e)
  107. {
  108. this.dkGrouting.GroutingLineID = null;
  109. this.dkGrouting.Text = "";
  110. this.cbTime.Checked = false;
  111. this.dgvMouldHistory.DataSource = null;
  112. this.dgvMouldRecord.DataSource = null;
  113. }
  114. /// <summary>
  115. /// 窗体加载
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. private void F_PC_0105_Load(object sender, EventArgs e)
  120. {
  121. try
  122. {
  123. getPurview();
  124. }
  125. catch (Exception ex)
  126. {
  127. // 对异常进行共通处理
  128. ExceptionManager.HandleEventException(this.ToString(),
  129. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  130. }
  131. }
  132. #endregion
  133. #region 私有方法
  134. /// <summary>
  135. /// 获取成型线权限
  136. /// </summary>
  137. private void getPurview()
  138. {
  139. try
  140. {
  141. StringBuilder sbPurview = new StringBuilder();
  142. DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(5, LogInUserInfo.CurrentUser.UserID);
  143. if (dsPurview != null)
  144. {
  145. foreach (DataRow dr in dsPurview.Tables[0].Rows)
  146. {
  147. sbPurview.Append(dr[0].ToString() + ",");
  148. }
  149. if (sbPurview.Length != Constant.INT_IS_ZERO)
  150. {
  151. this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
  152. }
  153. }
  154. this.dkGrouting.Purview = _purview;
  155. this.dkGrouting.IsEnablePurview = true;
  156. }
  157. catch (Exception ex)
  158. {
  159. throw ex;
  160. }
  161. }
  162. #endregion
  163. }
  164. }