F_PC_0101_1.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0101.cs
  5. * 2.功能描述:成型线一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2015/04/22 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.BaseResources;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Client.Controls;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.PCModule
  21. {
  22. /// <summary>
  23. /// 成型线一览
  24. /// </summary>
  25. public partial class F_PC_0101_1 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 单例模式使用
  29. private static F_PC_0101_1 _instance;
  30. // 在查询成型线时,不通过成型线去查询模具信息
  31. private bool _isSelecting = false;
  32. // 当前模具信息的成型线ID
  33. private int _lineID = 0;
  34. #endregion
  35. #region 构造函数
  36. /// <summary>
  37. /// 成型线一览
  38. /// </summary>
  39. public F_PC_0101_1()
  40. {
  41. this.InitializeComponent();
  42. this.InitializeControls();
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_PC_0101_1 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null)
  54. {
  55. _instance = new F_PC_0101_1();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件处理
  62. /// <summary>
  63. /// 页面加载事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void F_PC_0101_Load(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. // 按钮权限控制
  72. FormPermissionManager.FormPermissionControl(this.Name, this,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  74. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  75. // 获取成型线类型数据并绑定到控件上
  76. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  77. {
  78. return PCModuleProxyNew.Service.GetFPC0101IData();
  79. }
  80. );
  81. if (sre.Data != null && sre.Data.Tables.Count > 1)
  82. {
  83. this.cboGMouldType.DataSource = sre.Data.Tables[0];
  84. this.cboGMouldStatus.DataSource = sre.Data.Tables[1];
  85. }
  86. this.cboGMouldType.SelectedValue = null;
  87. this.cboGMouldStatus.SelectedValue = null;
  88. }
  89. catch (Exception ex)
  90. {
  91. // 对异常进行共通处理
  92. ExceptionManager.HandleEventException(this.ToString(),
  93. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  94. }
  95. }
  96. /// <summary>
  97. /// 自动列宽按钮按下处理
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  102. {
  103. this.dgvGroutingLine.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  104. this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  105. }
  106. /// <summary>
  107. /// 开始日期条件选中状态改变处理事件
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void chkBeginDate_CheckedChanged(object sender, EventArgs e)
  112. {
  113. this.dtpBeginUsedDateBegin.Enabled = this.chkBeginDate.Checked;
  114. this.dtpBeginUsedDateEnd.Enabled = this.chkBeginDate.Checked;
  115. if (!this.chkBeginDate.Checked)
  116. {
  117. this.dtpBeginUsedDateBegin.Value = DateTime.Now.Date;
  118. this.dtpBeginUsedDateEnd.Value = DateTime.Now.Date;
  119. }
  120. }
  121. /// <summary>
  122. /// 结束日期条件选中状态改变处理事件
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void chkEndDate_CheckedChanged(object sender, EventArgs e)
  127. {
  128. this.dtpEndUsedDateBegin.Enabled = this.chkEndDate.Checked;
  129. this.dtpEndUsedDateEnd.Enabled = this.chkEndDate.Checked;
  130. if (!this.chkEndDate.Checked)
  131. {
  132. this.dtpEndUsedDateBegin.Value = DateTime.Now.Date;
  133. this.dtpEndUsedDateEnd.Value = DateTime.Now.Date;
  134. }
  135. }
  136. /// <summary>
  137. /// 查询按钮按下处理
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void btnSearch_Click(object sender, EventArgs e)
  142. {
  143. try
  144. {
  145. this._isSelecting = true;
  146. this._lineID = 0;
  147. this.dgvGroutingLine.DataSource = null;
  148. this.dgvGroutingLineDetail.DataSource = null;
  149. DataSet dataSet = this.GetSearchData();
  150. if (dataSet != null)
  151. {
  152. if (dataSet.Tables.Count > 0)
  153. {
  154. this.dgvGroutingLine.DataSource = dataSet.Tables[0];
  155. this._lineID = Convert.ToInt32(dataSet.Tables[0].Rows[0]["GroutingLineID"]);
  156. }
  157. if (dataSet.Tables.Count > 1)
  158. {
  159. this.dgvGroutingLineDetail.DataSource = dataSet.Tables[1];
  160. }
  161. }
  162. this._isSelecting = false;
  163. }
  164. catch (Exception ex)
  165. {
  166. this._isSelecting = false;
  167. // 对异常进行共通处理
  168. ExceptionManager.HandleEventException(this.ToString(),
  169. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  170. }
  171. }
  172. /// <summary>
  173. /// 显示明细数据
  174. /// </summary>
  175. /// <param name="sender"></param>
  176. /// <param name="e"></param>
  177. private void dgvGroutingLine_RowEnter(object sender, DataGridViewCellEventArgs e)
  178. {
  179. if (this._isSelecting || e.RowIndex < 0 || e.ColumnIndex < 0)
  180. {
  181. return;
  182. }
  183. try
  184. {
  185. object id = this.dgvGroutingLine.Rows[e.RowIndex].Cells["GroutingLineID"].Value;
  186. if (id == null || id == DBNull.Value)
  187. {
  188. this.dgvGroutingLineDetail.DataSource = null;
  189. return;
  190. }
  191. int lineID = Convert.ToInt32(id);
  192. if (this._lineID != lineID)
  193. {
  194. this._lineID = lineID;
  195. this.dgvGroutingLineDetail.DataSource = null;
  196. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  197. {
  198. return PCModuleProxyNew.Service.GetFPC0101SDData(this._lineID);
  199. }
  200. );
  201. if (sre.Status == Constant.ServiceResultStatus.Success)
  202. {
  203. this.dgvGroutingLineDetail.DataSource = sre.Data.Tables[0];
  204. }
  205. }
  206. }
  207. catch (Exception ex)
  208. {
  209. // 对异常进行共通处理
  210. ExceptionManager.HandleEventException(this.ToString(),
  211. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  212. }
  213. }
  214. /// <summary>
  215. /// 清空查询条件处理
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. private void btnClearCondition_Click(object sender, EventArgs e)
  220. {
  221. this.txtBuildingNo.Clear();
  222. this.txtFloorNo.Clear();
  223. this.txtGroutingLineNo.Clear();
  224. this.txtGroutingLineCode.Clear();
  225. this.txtGroutingLineName.Clear();
  226. this.txtGUserCode.Clear();
  227. this.txtGoodsCode.Clear();
  228. this.txtRemarks.Clear();
  229. this.cboGMouldType.SelectedValue = null;
  230. this.cboGMouldStatus.SelectedValue = null;
  231. this.chkBeginDate.Checked = false;
  232. this.chkEndDate.Checked = false;
  233. }
  234. /// <summary>
  235. /// 新建
  236. /// </summary>
  237. /// <param name="sender"></param>
  238. /// <param name="e"></param>
  239. private void tsbtnAdd_Click(object sender, EventArgs e)
  240. {
  241. try
  242. {
  243. }
  244. catch (Exception ex)
  245. {
  246. // 对异常进行共通处理
  247. ExceptionManager.HandleEventException(this.ToString(),
  248. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  249. }
  250. }
  251. /// <summary>
  252. /// 编辑
  253. /// </summary>
  254. /// <param name="sender"></param>
  255. /// <param name="e"></param>
  256. private void tsbtnEdit_Click(object sender, EventArgs e)
  257. {
  258. try
  259. {
  260. }
  261. catch (Exception ex)
  262. {
  263. // 对异常进行共通处理
  264. ExceptionManager.HandleEventException(this.ToString(),
  265. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  266. }
  267. }
  268. /// <summary>
  269. /// 窗体关闭事件处理
  270. /// </summary>
  271. /// <param name="sender"></param>
  272. /// <param name="e"></param>
  273. private void tsbtnClose_Click(object sender, System.EventArgs e)
  274. {
  275. this.Close();
  276. }
  277. /// <summary>
  278. /// 窗体关闭后,释放单例模式
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. private void F_PC_0101_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  283. {
  284. _instance = null;
  285. }
  286. /// <summary>
  287. /// 双击某成型线进行编辑
  288. /// </summary>
  289. /// <param name="sender"></param>
  290. /// <param name="e"></param>
  291. private void dgvGroutingLine_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  292. {
  293. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  294. {
  295. return;
  296. }
  297. try
  298. {
  299. this.tsbtnEdit_Click(sender, e);
  300. }
  301. catch (Exception ex)
  302. {
  303. // 对异常进行共通处理
  304. ExceptionManager.HandleEventException(this.ToString(),
  305. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  306. }
  307. }
  308. #endregion
  309. #region 私有方法
  310. /// <summary>
  311. /// 初始化控件
  312. /// </summary>
  313. private void InitializeControls()
  314. {
  315. this.Text = FormTitles.F_PC_0101_1;
  316. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  317. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  318. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  319. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  320. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  321. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  322. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  323. }
  324. /// <summary>
  325. /// 根据界面查询条件获取数据集
  326. /// </summary>
  327. private DataSet GetSearchData()
  328. {
  329. try
  330. {
  331. FPC0101_SE se = new FPC0101_SE();
  332. se.BuildingNo = this.txtBuildingNo.Text;
  333. se.FloorNo = this.txtFloorNo.Text;
  334. se.GroutingLineNo = this.txtGroutingLineNo.Text;
  335. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  336. se.GroutingLineName = this.txtGroutingLineName.Text;
  337. se.GUserCode = this.txtGUserCode.Text;
  338. se.GoodsCode = this.txtGoodsCode.Text;
  339. if(this.cboGMouldType.SelectedValue != null)
  340. {
  341. se.GMouldTypeID = Convert.ToInt32(this.cboGMouldType.SelectedValue);
  342. }
  343. if (this.cboGMouldStatus.SelectedValue != null)
  344. {
  345. se.GMouldStatus = Convert.ToInt32(this.cboGMouldStatus.SelectedValue);
  346. }
  347. if(this.chkBeginDate.Checked)
  348. {
  349. se.BeginUsedDateBegin = this.dtpBeginUsedDateBegin.Value;
  350. se.BeginUsedDateEnd = this.dtpBeginUsedDateEnd.Value;
  351. }
  352. if (this.chkEndDate.Checked)
  353. {
  354. se.EndUsedDateBegin = this.dtpEndUsedDateBegin.Value;
  355. se.EndUsedDateEnd = this.dtpEndUsedDateEnd.Value;
  356. }
  357. se.Remarks = this.txtRemarks.Text;
  358. // 调用服务器端获取数据集
  359. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  360. {
  361. return PCModuleProxyNew.Service.GetFPC0101SData(se);
  362. }
  363. );
  364. if (sre.Status == Constant.ServiceResultStatus.Success)
  365. {
  366. return sre.Data;
  367. }
  368. return null;
  369. }
  370. catch (Exception ex)
  371. {
  372. throw ex;
  373. }
  374. }
  375. #endregion
  376. }
  377. }