F_PM_0105.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*******************************************************************************
  2. * Copyright(c) 2015 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0105.cs
  5. * 2.功能描述:能绑定条码的注浆登记选择画面
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 欧阳涛 2015/03/27 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  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.Controls;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.PMModule
  21. {
  22. /// <summary>
  23. /// 能绑定条码的注浆登记选择画面
  24. /// </summary>
  25. public partial class F_PM_0105 : DKFormBase
  26. {
  27. #region 成员变量
  28. int ScrapFlag;
  29. #endregion
  30. #region 构造函数
  31. /// <summary>
  32. /// 构造函数
  33. /// </summary>
  34. public F_PM_0105(int ScrapFlags)
  35. {
  36. this.InitializeComponent();
  37. // 为各个控件文本赋值
  38. this.InitializeControls();
  39. ScrapFlag = ScrapFlags;
  40. }
  41. #endregion
  42. #region 属性
  43. /// <summary>
  44. /// 注浆日报ID
  45. /// </summary>
  46. public int GroutingDailyID
  47. {
  48. get;
  49. private set;
  50. }
  51. /// <summary>
  52. /// 注浆日期
  53. /// </summary>
  54. public DateTime GroutingDate
  55. {
  56. get
  57. {
  58. return this.dtpGroutingDate.Value.Date;
  59. }
  60. set
  61. {
  62. this.dtpGroutingDate.Value = value;
  63. }
  64. }
  65. /// <summary>
  66. /// 是否在开模报损中使用
  67. /// </summary>
  68. public bool IsBarCodeScrapReasonUseFlag
  69. {
  70. get;
  71. set;
  72. }
  73. #endregion
  74. #region 控件事件
  75. /// <summary>
  76. /// 页面Load事件
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. private void F_PM_0105_Load(object sender, EventArgs e)
  81. {
  82. }
  83. /// <summary>
  84. /// 查询按钮按下事件
  85. /// </summary>
  86. /// <param name="sender"></param>
  87. /// <param name="e"></param>
  88. private void btnSearch_Click(object sender, System.EventArgs e)
  89. {
  90. try
  91. {
  92. FPM0104_SE se = new FPM0104_SE();
  93. se.GroutingDate = this.dtpGroutingDate.Value.Date;
  94. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  95. se.GroutingLineName = this.txtGroutingLineName.Text;
  96. se.GroutingUserCode = this.txtUserCode.Text;
  97. se.IsBarCodeScrapReasonUseFlag = IsBarCodeScrapReasonUseFlag;
  98. se.ScrapFlag = ScrapFlag;
  99. if (this.txtGroutingBatchNo.DataValue.HasValue)
  100. {
  101. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  102. }
  103. // 根据注浆日期、成型线获取所有可注浆模具信息
  104. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  105. {
  106. return PMModuleProxyNew.Service.GetFPM0105SData(se);
  107. }
  108. );
  109. this.dgvGroutingDaily.DataSource = null;
  110. // 异常情况处理
  111. if (sre.Status == Constant.ServiceResultStatus.Success)
  112. {
  113. this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
  114. }
  115. else if (sre.Status == Constant.ServiceResultStatus.Other)
  116. {
  117. if (sre.OtherStatus == -1)
  118. {
  119. MessageBox.Show(sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  120. }
  121. }
  122. }
  123. catch (Exception ex)
  124. {
  125. // 对异常进行共通处理
  126. ExceptionManager.HandleEventException(this.ToString(),
  127. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  128. }
  129. }
  130. /// <summary>
  131. /// 确定按钮按下事件
  132. /// </summary>
  133. /// <param name="sender"></param>
  134. /// <param name="e"></param>
  135. private void btnOK_Click(object sender, System.EventArgs e)
  136. {
  137. try
  138. {
  139. if (this.dgvGroutingDaily.CurrentRow == null)
  140. {
  141. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
  142. return;
  143. }
  144. this.GroutingDailyID = Convert.ToInt32(this.dgvGroutingDaily.CurrentRow.Cells["colGroutingDailyID"].Value);
  145. this.DialogResult = DialogResult.OK;
  146. this.Close();
  147. }
  148. catch (Exception ex)
  149. {
  150. // 对异常进行共通处理
  151. ExceptionManager.HandleEventException(this.ToString(),
  152. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  153. }
  154. }
  155. /// <summary>
  156. /// 双击单元格
  157. /// </summary>
  158. /// <param name="sender"></param>
  159. /// <param name="e"></param>
  160. private void dgvGroutingDaily_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  161. {
  162. try
  163. {
  164. if (this.dgvGroutingDaily.CurrentRow == null)
  165. {
  166. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
  167. return;
  168. }
  169. this.GroutingDailyID = Convert.ToInt32(this.dgvGroutingDaily.CurrentRow.Cells["colGroutingDailyID"].Value);
  170. this.DialogResult = DialogResult.OK;
  171. this.Close();
  172. }
  173. catch (Exception ex)
  174. {
  175. // 对异常进行共通处理
  176. ExceptionManager.HandleEventException(this.ToString(),
  177. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  178. }
  179. }
  180. /// <summary>
  181. /// 关闭按钮按下事件
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. private void btnClose_Click(object sender, System.EventArgs e)
  186. {
  187. this.DialogResult = DialogResult.Cancel;
  188. this.Close();
  189. }
  190. #endregion
  191. #region 私有方法/函数
  192. /// <summary>
  193. /// 初始化控件
  194. /// </summary>
  195. private void InitializeControls()
  196. {
  197. this.Text = FormTitles.F_PM_0105;
  198. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  199. this.btnOK.Text = ButtonText.BTN_OK;
  200. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  201. // 取客户端当天日期
  202. this.dtpGroutingDate.Value = DateTime.Now.Date;
  203. this.dgvGroutingDaily.AutoGenerateColumns = false;
  204. this.dgvGroutingDaily.ReadOnly = true;
  205. }
  206. #endregion
  207. private void btnClearCondition_Click(object sender, EventArgs e)
  208. {
  209. this.txtGroutingBatchNo.Clear();
  210. this.txtGroutingLineCode.Clear();
  211. this.txtUserCode.Clear();
  212. this.txtGroutingLineName.Clear();
  213. this.dtpGroutingDate.Value = DateTime.Now.Date;
  214. }
  215. private void btnAdaptive_Click(object sender, EventArgs e)
  216. {
  217. this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  218. }
  219. private void cbSelectAll_CheckedChanged(object sender, EventArgs e)
  220. {
  221. foreach (DataGridViewRow dataGridViewRow in this.dgvGroutingDaily.Rows)
  222. {
  223. dataGridViewRow.Cells["colGroutingDailyID"].Value = this.cbSelectAll.Checked ? 1 : 0;
  224. }
  225. }
  226. }
  227. }