F_PC_0105_1.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PCModule
  22. {
  23. public partial class F_PC_0105_1 : FormBase
  24. {
  25. #region 成员常量
  26. private static F_PC_0105_1 _instance; // 单例模式使用
  27. //范围权限
  28. private string _purview;
  29. #endregion
  30. #region 构造函数
  31. public F_PC_0105_1()
  32. {
  33. InitializeComponent();
  34. // this.Text = FormTitles.F_PC_0105;
  35. this.Text = "模具履历";
  36. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  37. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  38. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  39. }
  40. public F_PC_0105_1(int groutingLineID, string groutingLineCode)
  41. {
  42. InitializeComponent();
  43. this.scbGroutingLine.SearchedPKMember = groutingLineID;
  44. this.scbGroutingLine.Text = groutingLineCode;
  45. //this.Text = FormTitles.F_PC_0105;
  46. this.Text = "模具履历";
  47. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  48. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  49. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  50. }
  51. #endregion
  52. #region 单例模式
  53. /// <summary>
  54. /// 单例模式,防止重复创建窗体
  55. /// </summary>
  56. public static F_PC_0105_1 Instance
  57. {
  58. get
  59. {
  60. if (_instance == null)
  61. {
  62. _instance = new F_PC_0105_1();
  63. }
  64. return _instance;
  65. }
  66. }
  67. #endregion
  68. #region 事件处理
  69. /// <summary>
  70. /// 查询
  71. /// </summary>
  72. /// <param name="sender"></param>
  73. /// <param name="e"></param>
  74. private void btnSearch_Click(object sender, EventArgs e)
  75. {
  76. try
  77. {
  78. if (this.scbGroutingLine.SearchedPKMember == 0)
  79. {
  80. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
  81. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  82. this.scbGroutingLine.Focus();
  83. return;
  84. }
  85. GMouldRecordEntity entity = new GMouldRecordEntity();
  86. entity.GROUTINGLINEID = this.scbGroutingLine.SearchedPKMember;
  87. if (chkStart.Checked)
  88. {
  89. entity.BEGINDATE = new DateTime(txtDateStart.Value.Year, txtDateStart.Value.Month, txtDateStart.Value.Day);
  90. entity.ENDDATE = new DateTime(txtDateEnd.Value.Year, txtDateEnd.Value.Month, txtDateEnd.Value.Day, 23, 59, 59);
  91. }
  92. if (chkEnd.Checked)
  93. {
  94. entity.BEGINDATE2 = new DateTime(txtDateStart2.Value.Year, txtDateStart2.Value.Month, txtDateStart2.Value.Day);
  95. entity.ENDDATE2 = new DateTime(txtDateEnd2.Value.Year, txtDateEnd2.Value.Month, txtDateEnd2.Value.Day, 23, 59, 59);
  96. }
  97. entity.GROUTINGMOULDCODE = this.txtGroutingMouldCode.Text.Trim();
  98. if (this.cmbGMouldRecordType.SelectedValue.ToString() != "-1")
  99. {
  100. entity.GMouldRecordType = Convert.ToInt32(this.cmbGMouldRecordType.SelectedValue);
  101. }
  102. entity.REMARKS = this.txtRemarks.Text;
  103. DataSet dsMouldRecord = (DataSet)PCModuleProxy.Service.GetGMouldRecordInfoByMainId(entity);
  104. if (dsMouldRecord != null)
  105. {
  106. this.dgvMouldRecord.AutoGenerateColumns = false;
  107. this.dgvMouldRecord.DataSource = dsMouldRecord.Tables[0];
  108. }
  109. else
  110. {
  111. this.dgvMouldRecord.DataSource = null
  112. ;
  113. // 提示未查找到数据
  114. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  115. MessageBoxButtons.OK, MessageBoxIcon.Information);
  116. }
  117. }
  118. catch (Exception ex)
  119. {
  120. // 对异常进行共通处理
  121. ExceptionManager.HandleEventException(this.ToString(),
  122. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  123. }
  124. }
  125. /// <summary>
  126. /// 清空条件
  127. /// </summary>
  128. /// <param name="sender"></param>
  129. /// <param name="e"></param>
  130. private void btnClearCondition_Click(object sender, EventArgs e)
  131. {
  132. this.scbGroutingLine.ClearValue();
  133. this.dgvMouldRecord.DataSource = null;
  134. this.txtDateStart.Value = DateTime.Now;
  135. this.txtDateEnd.Value = DateTime.Now;
  136. this.txtGroutingMouldCode.Text = "";
  137. this.txtRemarks.Text = "";
  138. this.cmbGMouldRecordType.SelectedValue = -1;//默认第一个
  139. this.txtDateStart2.Value = DateTime.Now;
  140. this.txtDateEnd2.Value = DateTime.Now;
  141. this.chkStart.Checked = false;
  142. this.chkEnd.Checked = false;
  143. chkStart_CheckedChanged(sender, e);
  144. chkEnd_CheckedChanged(sender, e);
  145. }
  146. /// <summary>
  147. /// 窗体加载
  148. /// </summary>
  149. /// <param name="sender"></param>
  150. /// <param name="e"></param>
  151. private void F_PC_0105_Load(object sender, EventArgs e)
  152. {
  153. try
  154. {
  155. this.txtDateStart.Value = DateTime.Now;
  156. this.txtDateEnd.Value = DateTime.Now;
  157. this.txtDateStart2.Value = DateTime.Now;
  158. this.txtDateEnd2.Value = DateTime.Now;
  159. chkStart_CheckedChanged(sender, e);
  160. chkEnd_CheckedChanged(sender, e);
  161. //// 调用服务器端获取数据集
  162. //ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  163. //{
  164. // return PCModuleProxyNew.Service.GetFPC0101IData();
  165. //}));
  166. //if (sre.Status == Constant.ServiceResultStatus.Success)
  167. //{
  168. // if (sre.Data.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  169. // {
  170. // DataRow dr = sre.Data.Tables[0].NewRow();
  171. // dr["GMouldTypeName"] = "";
  172. // dr["GMouldTypeID"] = -1;
  173. // sre.Data.Tables[0].Rows.InsertAt(dr, 0);
  174. // this.cmbGMouldRecordType.DataSource = sre.Data.Tables[0];
  175. // this.cmbGMouldRecordType.DisplayMember = "GMouldTypeName";
  176. // this.cmbGMouldRecordType.ValueMember = "GMouldTypeID";
  177. // }
  178. //}
  179. //绑定履历类型
  180. DataTable dtGMouldRecordType = new DataTable();
  181. dtGMouldRecordType.Columns.Add("GMouldRecordTypeID");
  182. dtGMouldRecordType.Columns.Add("GMouldRecordTypeName");
  183. DataRow dr = dtGMouldRecordType.NewRow();
  184. dr["GMouldRecordTypeID"] = -1;
  185. dr["GMouldRecordTypeName"] = "";
  186. dtGMouldRecordType.Rows.Add(dr);
  187. dr = dtGMouldRecordType.NewRow();
  188. dr["GMouldRecordTypeID"] = 0;
  189. dr["GMouldRecordTypeName"] = "停用";
  190. dtGMouldRecordType.Rows.Add(dr);
  191. dr = dtGMouldRecordType.NewRow();
  192. dr["GMouldRecordTypeID"] = 1;
  193. dr["GMouldRecordTypeName"] = "维修";
  194. dtGMouldRecordType.Rows.Add(dr);
  195. dr = dtGMouldRecordType.NewRow();
  196. dr["GMouldRecordTypeID"] = 3;
  197. dr["GMouldRecordTypeName"] = "换模";
  198. dtGMouldRecordType.Rows.Add(dr);
  199. dr = dtGMouldRecordType.NewRow();
  200. dr["GMouldRecordTypeID"] = 5;
  201. dr["GMouldRecordTypeName"] = "变产";
  202. dtGMouldRecordType.Rows.Add(dr);
  203. dr = dtGMouldRecordType.NewRow();
  204. dr["GMouldRecordTypeID"] = 6;
  205. dr["GMouldRecordTypeName"] = "整线变产";
  206. dtGMouldRecordType.Rows.Add(dr);
  207. this.cmbGMouldRecordType.DataSource = dtGMouldRecordType;
  208. this.cmbGMouldRecordType.ValueMember = "GMouldRecordTypeID";
  209. this.cmbGMouldRecordType.DisplayMember = "GMouldRecordTypeName";
  210. }
  211. catch (Exception ex)
  212. {
  213. // 对异常进行共通处理
  214. ExceptionManager.HandleEventException(this.ToString(),
  215. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  216. }
  217. }
  218. #endregion
  219. #region 私有方法
  220. /// <summary>
  221. /// 获取成型线权限
  222. /// </summary>
  223. private void getPurview()
  224. {
  225. try
  226. {
  227. //StringBuilder sbPurview = new StringBuilder();
  228. //DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(5, LogInUserInfo.CurrentUser.UserID);
  229. //if (dsPurview != null)
  230. //{
  231. // foreach (DataRow dr in dsPurview.Tables[0].Rows)
  232. // {
  233. // sbPurview.Append(dr[0].ToString() + ",");
  234. // }
  235. // if (sbPurview.Length != Constant.INT_IS_ZERO)
  236. // {
  237. // this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
  238. // }
  239. //}
  240. //this.dkGrouting.Purview = _purview;
  241. //this.dkGrouting.IsEnablePurview = true;
  242. }
  243. catch (Exception ex)
  244. {
  245. throw ex;
  246. }
  247. }
  248. #endregion
  249. private void chkStart_CheckedChanged(object sender, EventArgs e)
  250. {
  251. txtDateStart.Enabled = chkStart.Checked;
  252. txtDateEnd.Enabled = chkStart.Checked;
  253. }
  254. private void chkEnd_CheckedChanged(object sender, EventArgs e)
  255. {
  256. txtDateStart2.Enabled = chkEnd.Checked;
  257. txtDateEnd2.Enabled = chkEnd.Checked;
  258. }
  259. }
  260. }