F_PC_0108.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0108.cs
  5. * 2.功能描述:成型线明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/09/15 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
  20. namespace Dongke.IBOSS.PRD.Client.PCModule
  21. {
  22. public partial class F_PC_0108 : DockPanelBase
  23. {
  24. #region 成员变量
  25. // 单例模式使用
  26. private static F_PC_0108 _instance;
  27. // 成型线集合
  28. private List<GroutingLineEntity> _groutingLineList = new List<GroutingLineEntity>();
  29. //选择的成型线状态
  30. private int? _mouldStatus;
  31. // 最后选择行
  32. private int _selecedRow;
  33. #endregion
  34. #region 构造函数
  35. /// <summary>
  36. /// 构造函数
  37. /// </summary>
  38. public F_PC_0108()
  39. {
  40. InitializeComponent();
  41. // 为控件名赋值
  42. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  43. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  44. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  45. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  46. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  47. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  48. // this.tsbtnQueryRecord.Text = ButtonText.TSBTN_QUERYRECORD;
  49. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  50. this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE;
  51. this.Text = "成型线明细表";
  52. }
  53. #endregion
  54. #region 单例模式
  55. /// <summary>
  56. /// 单例模式,防止重复创建窗体
  57. /// </summary>
  58. public static F_PC_0108 Instance
  59. {
  60. get
  61. {
  62. if (_instance == null)
  63. {
  64. _instance = new F_PC_0108();
  65. }
  66. return _instance;
  67. }
  68. }
  69. #endregion
  70. #region 事件处理
  71. /// <summary>
  72. /// 页面加载事件
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. private void F_PC_0104_Load(object sender, System.EventArgs e)
  77. {
  78. try
  79. {
  80. // 加载权限
  81. FormPermissionManager.FormPermissionControl(this.Name, this,
  82. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  83. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  84. // 为成型线绑定数据源
  85. this.BindMouldType();
  86. // 设置日期控件不可用
  87. this.SetBeginTimePickerEnable(false);
  88. this.SetEndTimePickerEnable(false);
  89. }
  90. catch (Exception ex)
  91. {
  92. // 对异常进行共通处理
  93. ExceptionManager.HandleEventException(this.ToString(),
  94. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  95. }
  96. }
  97. /// <summary>
  98. /// 自动列宽按钮按下处理
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  103. {
  104. this.dgvGroutingLine.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  105. this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  106. }
  107. /// <summary>
  108. /// 开始日期条件选中状态改变处理事件
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void cbStartTime_CheckedChanged(object sender, EventArgs e)
  113. {
  114. this.SetBeginTimePickerEnable(this.cbStartTime.Checked);
  115. }
  116. /// <summary>
  117. /// 结束日期条件选中状态改变处理事件
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void cbEndTime_CheckedChanged(object sender, EventArgs e)
  122. {
  123. this.SetEndTimePickerEnable(this.cbEndTime.Checked);
  124. }
  125. /// <summary>
  126. /// 查询按钮按下处理
  127. /// </summary>
  128. /// <param name="sender"></param>
  129. /// <param name="e"></param>
  130. private void btnSearch_Click(object sender, EventArgs e)
  131. {
  132. try
  133. {
  134. this._mouldStatus = Convert.ToInt32(this.lstcbxGMouldStatus.SelectedValue);
  135. // if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
  136. DataSet dsGroutingLine = (DataSet)DoAsync(new AsyncMethod(() =>
  137. {
  138. return GetGroutingLine();
  139. }));
  140. if (dsGroutingLine != null && dsGroutingLine.Tables.Count > Constant.INT_IS_ZERO)
  141. {
  142. // 控制明细不查询
  143. this.Tag = false;
  144. this.dgvGroutingLine.DataSource = dsGroutingLine.Tables[0];
  145. if (dsGroutingLine.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  146. {
  147. // 定位当前行
  148. if (this.dgvGroutingLine.Rows.Count > this._selecedRow)
  149. {
  150. this.dgvGroutingLine.Rows[this._selecedRow].Selected = true;
  151. this.dgvGroutingLine.CurrentCell =
  152. this.dgvGroutingLine.Rows[this._selecedRow].Cells["GroutingLineCode"];
  153. }
  154. else if (this.dgvGroutingLine.Rows.Count <= this._selecedRow)
  155. {
  156. this._selecedRow = dgvGroutingLine.Rows.Count - 1;
  157. this.dgvGroutingLine.CurrentCell =
  158. this.dgvGroutingLine.Rows[this.dgvGroutingLine.Rows.Count - 1].Cells["GroutingLineCode"];
  159. this.dgvGroutingLine.Rows[dgvGroutingLine.Rows.Count - 1].Selected = true;
  160. }
  161. this.Tag = true;
  162. // 查明细
  163. this.dgvGroutingLine_SelectionChanged(null, null);
  164. this.dgvGroutingLine.Focus();
  165. }
  166. else
  167. {
  168. // 清空明细中的数据
  169. this.dgvGroutingLineDetail.DataSource = null;
  170. // 提示未查找到数据
  171. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  172. MessageBoxButtons.OK, MessageBoxIcon.Information);
  173. }
  174. }
  175. // 设置按钮可用状态
  176. }
  177. catch (Exception ex)
  178. {
  179. // 对异常进行共通处理
  180. ExceptionManager.HandleEventException(this.ToString(),
  181. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  182. }
  183. }
  184. /// <summary>
  185. /// 清空查询条件处理
  186. /// </summary>
  187. /// <param name="sender"></param>
  188. /// <param name="e"></param>
  189. private void btnClearCondition_Click(object sender, EventArgs e)
  190. {
  191. this.txtBuildingNo.Text = "";
  192. this.txtFloorNo.Text = "";
  193. this.txtGroutingLineNo.Text = "";
  194. this.lstcbxGMouldStatus.Text = "";
  195. this.lstcbxGMouldStatus.SelectedValue = "1";
  196. this.txtGroutingLineCode.Text = "";
  197. this.txtGroutingLineName.Text = "";
  198. this.cbStartTime.Checked = false;
  199. this.cbEndTime.Checked = false;
  200. this.txtBeginUsedDateStart.Enabled = false;
  201. this.txtBeginUsedDateEnd.Enabled = false;
  202. this.txtEndUsedDateStart.Enabled = false;
  203. this.txtEndUsedDateEnd.Enabled = false;
  204. this.txtRemarks.Text = "";
  205. this.txtGroutingUserCode.Text = "";
  206. this.txtBeginUsedDateStart.Value = DateTime.Now;
  207. this.txtBeginUsedDateEnd.Value = DateTime.Now;
  208. this.txtEndUsedDateStart.Value = DateTime.Now;
  209. this.txtEndUsedDateEnd.Value = DateTime.Now;
  210. this.scbGMouldType.ClearValue();
  211. }
  212. /// <summary>
  213. /// 窗体关闭事件处理
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="e"></param>
  217. private void tsbtnClose_Click(object sender, System.EventArgs e)
  218. {
  219. this.Close();
  220. }
  221. /// <summary>
  222. /// 窗体关闭后,释放单例模式
  223. /// </summary>
  224. /// <param name="sender"></param>
  225. /// <param name="e"></param>
  226. private void F_PC_0104_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  227. {
  228. _instance = null;
  229. }
  230. /// <summary>
  231. /// 双击某成型线进行编辑
  232. /// </summary>
  233. /// <param name="sender"></param>
  234. /// <param name="e"></param>
  235. private void dgvGroutingLine_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  236. {
  237. }
  238. /// <summary>
  239. /// 添加新成型线
  240. /// </summary>
  241. /// <param name="sender"></param>
  242. /// <param name="e"></param>
  243. private void tsbtnAdd_Click(object sender, EventArgs e)
  244. {
  245. try
  246. {
  247. F_PC_0102_1_1 frmFPC0102 = new F_PC_0102_1_1();
  248. DialogResult dialogresult = frmFPC0102.ShowDialog();
  249. if (dialogresult.Equals(DialogResult.OK))
  250. {
  251. this.dgvGroutingLine.DataSource = null;
  252. DataSet dsGroutingLine = (DataSet)DoAsync(new AsyncMethod(() =>
  253. {
  254. return GetGroutingLine();
  255. }));
  256. if (dsGroutingLine != null)
  257. {
  258. if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
  259. {
  260. this.dgvGroutingLine.DataSource = ((DataSet)dsGroutingLine).Tables[0];
  261. this.dgvGroutingLine.ReadOnly = true;
  262. }
  263. }
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. // 对异常进行共通处理
  269. ExceptionManager.HandleEventException(this.ToString(),
  270. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  271. }
  272. }
  273. /// <summary>
  274. /// 编辑选中成型线
  275. /// </summary>
  276. /// <param name="sender"></param>
  277. /// <param name="e"></param>
  278. private void tsbtnEdit_Click(object sender, EventArgs e)
  279. {
  280. try
  281. {
  282. DataGridViewRow currentRow = this.dgvGroutingLine.CurrentRow;
  283. if (currentRow != null)
  284. {
  285. int GroutingLineId = Convert.ToInt32(currentRow.Cells["GroutingLineId"].Value);
  286. F_PC_0103_1 frmFPC0103 = new F_PC_0103_1(GroutingLineId);
  287. DialogResult dialogresult = frmFPC0103.ShowDialog();
  288. if (dialogresult.Equals(DialogResult.OK))
  289. {
  290. this.dgvGroutingLine.DataSource = null;
  291. object obResult = DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(GetGroutingLine));
  292. if (obResult != null)
  293. {
  294. DataSet dsGroutingLine = (DataSet)obResult;
  295. if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
  296. {
  297. this.dgvGroutingLine.DataSource = dsGroutingLine.Tables[0];
  298. this.dgvGroutingLine.ReadOnly = true;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. catch (Exception ex)
  305. {
  306. // 对异常进行共通处理
  307. ExceptionManager.HandleEventException(this.ToString(),
  308. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  309. }
  310. }
  311. /// <summary>
  312. /// 选择某成型线查看模具明细
  313. /// </summary>
  314. /// <param name="sender"></param>
  315. /// <param name="e"></param>
  316. private void dgvGroutingLine_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  317. {
  318. try
  319. {
  320. if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE)
  321. {
  322. return;
  323. }
  324. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[e.RowIndex].Cells["GroutingLineID"].Value);
  325. this.BindDetailInfo(GroutingLineID);
  326. this.dgvGroutingLine.Focus();
  327. }
  328. catch (Exception ex)
  329. {
  330. // 对异常进行共通处理
  331. ExceptionManager.HandleEventException(this.ToString(),
  332. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  333. }
  334. }
  335. /// <summary>
  336. /// 打开履历查询界面
  337. /// </summary>
  338. /// <param name="sender"></param>
  339. /// <param name="e"></param>
  340. private void tsbtnQueryRecord_Click(object sender, EventArgs e)
  341. {
  342. try
  343. {
  344. if (this.dgvGroutingLine.CurrentCell != null)
  345. {
  346. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
  347. string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
  348. F_PC_0105_1 frmFPC0105 = new F_PC_0105_1(GroutingLineID, GroutingLineCode);
  349. DialogResult dialogresult = frmFPC0105.ShowDialog();
  350. }
  351. else
  352. {
  353. F_PC_0105_1 frmFPC0105 = new F_PC_0105_1();
  354. DialogResult dialogresult = frmFPC0105.ShowDialog();
  355. }
  356. }
  357. catch (Exception ex)
  358. {
  359. // 对异常进行共通处理
  360. ExceptionManager.HandleEventException(this.ToString(),
  361. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  362. }
  363. }
  364. /// <summary>
  365. /// 成型线列头点击事件
  366. /// </summary>
  367. /// <param name="sender"></param>
  368. /// <param name="e"></param>
  369. private void dgvGroutingLine_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  370. {
  371. //try
  372. //{
  373. // if (this.dgvGroutingLine.SelectedRows.Count != Constant.INT_IS_ZERO)
  374. // {
  375. // int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.SelectedRows[0].Cells["GroutingLineID"].Value);
  376. // this.BindDetailInfo(GroutingLineID);
  377. // }
  378. //}
  379. //catch (Exception ex)
  380. //{
  381. // // 对异常进行共通处理
  382. // ExceptionManager.HandleEventException(this.ToString(),
  383. // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  384. //}
  385. }
  386. /// <summary>
  387. /// 停用按钮事件
  388. /// </summary>
  389. /// <param name="sender"></param>
  390. /// <param name="e"></param>
  391. private void tsbtnDisable_Click(object sender, EventArgs e)
  392. {
  393. try
  394. {
  395. if (this.dgvGroutingLine.CurrentCell != null)
  396. {
  397. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  398. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  399. if (valueflag == 0)
  400. return;
  401. // 提示用户确认停用
  402. DialogResult msgBoxResult = MessageBox.Show(
  403. string.Format(Messages.MSG_CMN_Q002, "成型线", "停用"), this.Text,
  404. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  405. if (msgBoxResult == DialogResult.Yes)
  406. {
  407. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  408. {
  409. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 0);
  410. }));
  411. //修改成功
  412. if (returnRow > 0)
  413. {
  414. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "停用"),
  415. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  416. btnSearch_Click(sender, e);
  417. }
  418. else
  419. {
  420. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "停用"),
  421. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  422. }
  423. }
  424. }
  425. }
  426. catch (Exception ex)
  427. {
  428. // 对异常进行共通处理
  429. ExceptionManager.HandleEventException(this.ToString(),
  430. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  431. }
  432. }
  433. /// <summary>
  434. /// 启用按钮事件
  435. /// </summary>
  436. /// <param name="sender"></param>
  437. /// <param name="e"></param>
  438. private void tsbtnStart_Click(object sender, EventArgs e)
  439. {
  440. try
  441. {
  442. if (this.dgvGroutingLine.CurrentCell != null)
  443. {
  444. try
  445. {
  446. if (this.dgvGroutingLine.CurrentCell != null)
  447. {
  448. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  449. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  450. if (valueflag == 1)
  451. return;
  452. // 提示用户确认停用
  453. DialogResult msgBoxResult = MessageBox.Show(
  454. string.Format(Messages.MSG_CMN_Q002, "成型线", "启用"), this.Text,
  455. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  456. if (msgBoxResult == DialogResult.Yes)
  457. {
  458. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  459. {
  460. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 1);
  461. }));
  462. //修改成功
  463. if (returnRow > 0)
  464. {
  465. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "启用"),
  466. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  467. btnSearch_Click(sender, e);
  468. }
  469. else
  470. {
  471. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "启用"),
  472. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  473. }
  474. }
  475. }
  476. }
  477. catch (Exception ex)
  478. {
  479. // 对异常进行共通处理
  480. ExceptionManager.HandleEventException(this.ToString(),
  481. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  482. }
  483. }
  484. }
  485. catch (Exception ex)
  486. {
  487. // 对异常进行共通处理
  488. ExceptionManager.HandleEventException(this.ToString(),
  489. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  490. }
  491. }
  492. /// <summary>
  493. /// 模具管理按钮事件
  494. /// </summary>
  495. /// <param name="sender"></param>
  496. /// <param name="e"></param>
  497. private void tsbtnManager_Click(object sender, EventArgs e)
  498. {
  499. try
  500. {
  501. if (this.dgvGroutingLine.CurrentCell != null)
  502. {
  503. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
  504. string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
  505. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  506. frmFPC0101.ShowInDockPanel(this.DockPanel);
  507. frmFPC0101.SetGroutingLineIDAndGroutingLineCode(GroutingLineID, GroutingLineCode);
  508. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1(GroutingLineID, GroutingLineCode);
  509. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  510. }
  511. else
  512. {
  513. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1();
  514. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  515. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  516. frmFPC0101.ShowInDockPanel(this.DockPanel);
  517. }
  518. }
  519. catch (Exception ex)
  520. {
  521. // 对异常进行共通处理
  522. ExceptionManager.HandleEventException(this.ToString(),
  523. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  524. }
  525. }
  526. private void dgvGroutingLine_SelectionChanged(object sender, EventArgs e)
  527. {
  528. try
  529. {
  530. // 在绑定总表时 不查询明细
  531. if (!Convert.ToBoolean(this.Tag)
  532. || this.dgvGroutingLine.CurrentCell == null)
  533. {
  534. return;
  535. }
  536. // 选中行时查询明细
  537. else
  538. {
  539. if (this.txtBuildingNo.ReadOnly)
  540. {
  541. return;
  542. }
  543. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value.ToString());
  544. this.BindDetailInfo(GroutingLineID);
  545. this.dgvGroutingLine.Focus();
  546. }
  547. }
  548. catch (Exception ex)
  549. {
  550. // 对异常进行共通处理
  551. ExceptionManager.HandleEventException(this.ToString(),
  552. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  553. }
  554. }
  555. #endregion
  556. #region 私有方法
  557. /// <summary>
  558. /// 为页面的成型线类型绑定数据源
  559. /// </summary>
  560. private void BindMouldType()
  561. {
  562. try
  563. {
  564. //DataTable dtDataSourse = new DataTable();
  565. //dtDataSourse.Columns.Add("GMouldType", System.Type.GetType("System.String"));
  566. //dtDataSourse.Columns.Add("GMouldTypeName", System.Type.GetType("System.String"));
  567. //for (int i = 0; i < Constant.ConGMouldStatusCount; i++)
  568. //{
  569. // DataRow drRow = dtDataSourse.NewRow();
  570. // drRow["GMouldType"] = Constant.ConGMouldStatus[i, 0];
  571. // drRow["GMouldTypeName"] = Constant.ConGMouldStatus[i, 1];
  572. // dtDataSourse.Rows.Add(drRow);
  573. //}
  574. //this.lstcbxGMouldStatus.ListBox.DisplayMember = "GMouldTypeName";
  575. //this.lstcbxGMouldStatus.ListBox.ValueMember = "GMouldType";
  576. //this.lstcbxGMouldStatus.ListBox.DataSource = dtDataSourse;
  577. // 调用服务器端获取数据集
  578. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
  579. {
  580. return PCModuleProxyNew.Service.GetFPC0101IData();
  581. }));
  582. if (sre.Status == Constant.ServiceResultStatus.Success)
  583. {
  584. if (sre.Data.Tables[1].Rows.Count > Constant.INT_IS_ZERO)
  585. {
  586. DataRow dr = sre.Data.Tables[1].NewRow();
  587. dr["GMouldStatusName"] = "";
  588. dr["GMouldStatusID"] = -1;
  589. sre.Data.Tables[1].Rows.InsertAt(dr, 0);
  590. this.lstcbxGMouldStatus.DisplayMember = "GMouldStatusName";
  591. this.lstcbxGMouldStatus.ValueMember = "GMouldStatusID";
  592. this.lstcbxGMouldStatus.DataSource = sre.Data.Tables[1];
  593. this.lstcbxGMouldStatus.SelectedValue = "1";
  594. }
  595. }
  596. }
  597. catch (Exception ex)
  598. {
  599. throw ex;
  600. }
  601. }
  602. /// <summary>
  603. /// 设置开始使用时间可用状态
  604. /// </summary>
  605. /// <param name="isEnable">
  606. /// false:不可用
  607. /// true:可用
  608. /// </param>
  609. private void SetBeginTimePickerEnable(bool isEnable)
  610. {
  611. this.txtBeginUsedDateStart.Enabled = isEnable;
  612. this.txtBeginUsedDateEnd.Enabled = isEnable;
  613. }
  614. /// <summary>
  615. /// 设置结束使用时间可用状态
  616. /// </summary>
  617. /// <param name="isEnable">
  618. /// false:不可用
  619. /// true:可用
  620. /// </param>
  621. private void SetEndTimePickerEnable(bool isEnable)
  622. {
  623. this.txtEndUsedDateStart.Enabled = isEnable;
  624. this.txtEndUsedDateEnd.Enabled = isEnable;
  625. }
  626. /// <summary>
  627. /// 根据条件取得成型线数据
  628. /// </summary>
  629. /// <returns></returns>
  630. private DataSet GetGroutingLine()
  631. {
  632. try
  633. {
  634. this.dgvGroutingLine.AutoGenerateColumns = false;
  635. GroutingLineEntity groutingLineEntity = new GroutingLineEntity();
  636. groutingLineEntity.Purview = ((int)Constant.PurviewType.ViewGroutingLine).ToString();
  637. groutingLineEntity.VALUEFLAG = 1;
  638. groutingLineEntity.BUILDINGNO = this.txtBuildingNo.Text.Trim();
  639. groutingLineEntity.FLOORNO = this.txtFloorNo.Text.Trim();
  640. groutingLineEntity.GROUTINGLINENO = this.txtGroutingLineNo.Text.Trim();
  641. //if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
  642. if (_mouldStatus != -1)
  643. {
  644. groutingLineEntity.MouldStatus = _mouldStatus;
  645. }
  646. groutingLineEntity.GROUTINGLINECODE = this.txtGroutingLineCode.Text.Trim();
  647. groutingLineEntity.GROUTINGLINENAME = this.txtGroutingLineName.Text.Trim();
  648. if (this.cbStartTime.Checked)
  649. {
  650. groutingLineEntity.BEGINUSEDDATE = Convert.ToDateTime(this.txtBeginUsedDateStart.Text.Trim());
  651. groutingLineEntity.BEGINUSEDDATEEND = Convert.ToDateTime(this.txtBeginUsedDateEnd.Text.Trim()).AddHours(23)
  652. .AddMinutes(59).AddSeconds(59);
  653. }
  654. if (this.cbEndTime.Checked)
  655. {
  656. groutingLineEntity.ENDUSEDDATE = Convert.ToDateTime(this.txtEndUsedDateStart.Text.Trim());
  657. groutingLineEntity.ENDUSEDDATEEND = Convert.ToDateTime(this.txtEndUsedDateEnd.Text.Trim()).AddHours(23)
  658. .AddMinutes(59).AddSeconds(59);
  659. }
  660. groutingLineEntity.REMARKS = this.txtRemarks.Text.Trim();
  661. if (this.scbGMouldType.SearchedPKMember != 0)
  662. {
  663. groutingLineEntity.MOULDTYPEID = this.scbGMouldType.SearchedPKMember;
  664. }
  665. groutingLineEntity.USERCODE = this.txtGroutingUserCode.Text.Trim();
  666. return PCModuleProxy.Service.GetGroutingLine(groutingLineEntity);
  667. }
  668. catch (Exception ex)
  669. {
  670. throw ex;
  671. }
  672. }
  673. /// <summary>
  674. /// 将成型线DataSet数据集转入集合中
  675. /// </summary>
  676. /// <param name="dsLine"></param>
  677. private void DataTableToListByLine(DataSet dsLine)
  678. {
  679. try
  680. {
  681. this._groutingLineList.Clear();
  682. foreach (DataRow drFor in dsLine.Tables[0].Rows)
  683. {
  684. GroutingLineEntity lineEntity = new GroutingLineEntity();
  685. lineEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  686. lineEntity.BUILDINGNO = drFor["BUILDINGNO"].ToString();
  687. lineEntity.FLOORNO = drFor["FLOORNO"].ToString();
  688. lineEntity.GROUTINGLINENO = drFor["GROUTINGLINENO"].ToString();
  689. lineEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
  690. lineEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
  691. lineEntity.MOULDQUANTITY = Convert.ToDecimal(drFor["MOULDQUANTITY"]);
  692. lineEntity.MOULDTYPEID = Convert.ToInt32(drFor["GMOULDTYPEID"]);
  693. lineEntity.USERID = Convert.ToInt32(drFor["USERID"]);
  694. lineEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  695. if (drFor["ENDUSEDDATE"].ToString() != string.Empty)
  696. {
  697. lineEntity.ENDUSEDDATE = Convert.ToDateTime(drFor["ENDUSEDDATE"].ToString());
  698. }
  699. lineEntity.MouldStatus = Convert.ToInt32(drFor["GMouldStatus"]);
  700. lineEntity.REMARKS = drFor["REMARKS"].ToString();
  701. lineEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  702. lineEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  703. lineEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  704. lineEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  705. lineEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  706. lineEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  707. lineEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  708. lineEntity.MOULDTYPENAME = drFor["GMOULDTYPENAME"].ToString();
  709. this._groutingLineList.Add(lineEntity);
  710. }
  711. }
  712. catch (Exception ex)
  713. {
  714. throw ex;
  715. }
  716. }
  717. /// <summary>
  718. /// 根据成型线ID获取明细信息
  719. /// </summary>
  720. private void BindDetailInfo(int GroutingLineID)
  721. {
  722. try
  723. {
  724. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  725. DataSet dsDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  726. {
  727. return PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  728. }));
  729. DataView dv = dsDetail.Tables[0].DefaultView;
  730. dv.RowFilter = "valueflag=1";
  731. dsDetail = new DataSet();
  732. dsDetail.Tables.Add(dv.ToTable());
  733. this.dgvGroutingLineDetail.DataSource = dsDetail.Tables[0];
  734. this.dgvGroutingLineDetail.ReadOnly = true;
  735. }
  736. catch (Exception ex)
  737. {
  738. throw ex;
  739. }
  740. }
  741. #endregion
  742. }
  743. }