F_PC_0104_1.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0104_1.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_0104_1 : DockPanelBase
  23. {
  24. #region 成员变量
  25. // 单例模式使用
  26. private static F_PC_0104_1 _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_0104_1()
  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 = FormTitles.F_PC_0104;
  52. }
  53. #endregion
  54. #region 单例模式
  55. /// <summary>
  56. /// 单例模式,防止重复创建窗体
  57. /// </summary>
  58. public static F_PC_0104_1 Instance
  59. {
  60. get
  61. {
  62. if (_instance == null)
  63. {
  64. _instance = new F_PC_0104_1();
  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. this.chkEnable.Checked = true;
  212. this.chkDisable.Checked = false;
  213. }
  214. /// <summary>
  215. /// 窗体关闭事件处理
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. private void tsbtnClose_Click(object sender, System.EventArgs e)
  220. {
  221. this.Close();
  222. }
  223. /// <summary>
  224. /// 窗体关闭后,释放单例模式
  225. /// </summary>
  226. /// <param name="sender"></param>
  227. /// <param name="e"></param>
  228. private void F_PC_0104_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  229. {
  230. _instance = null;
  231. }
  232. /// <summary>
  233. /// 双击某成型线进行编辑
  234. /// </summary>
  235. /// <param name="sender"></param>
  236. /// <param name="e"></param>
  237. private void dgvGroutingLine_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  238. {
  239. }
  240. /// <summary>
  241. /// 添加新成型线
  242. /// </summary>
  243. /// <param name="sender"></param>
  244. /// <param name="e"></param>
  245. private void tsbtnAdd_Click(object sender, EventArgs e)
  246. {
  247. try
  248. {
  249. F_PC_0102_1_1 frmFPC0102 = new F_PC_0102_1_1();
  250. DialogResult dialogresult = frmFPC0102.ShowDialog();
  251. if (dialogresult.Equals(DialogResult.OK))
  252. {
  253. this.dgvGroutingLine.DataSource = null;
  254. DataSet dsGroutingLine = (DataSet)DoAsync(new AsyncMethod(() =>
  255. {
  256. return GetGroutingLine();
  257. }));
  258. if (dsGroutingLine != null)
  259. {
  260. if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
  261. {
  262. this.dgvGroutingLine.DataSource = ((DataSet)dsGroutingLine).Tables[0];
  263. this.dgvGroutingLine.ReadOnly = true;
  264. }
  265. }
  266. }
  267. }
  268. catch (Exception ex)
  269. {
  270. // 对异常进行共通处理
  271. ExceptionManager.HandleEventException(this.ToString(),
  272. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  273. }
  274. }
  275. /// <summary>
  276. /// 编辑选中成型线
  277. /// </summary>
  278. /// <param name="sender"></param>
  279. /// <param name="e"></param>
  280. private void tsbtnEdit_Click(object sender, EventArgs e)
  281. {
  282. try
  283. {
  284. DataGridViewRow currentRow = this.dgvGroutingLine.CurrentRow;
  285. if (currentRow != null)
  286. {
  287. int GroutingLineId = Convert.ToInt32(currentRow.Cells["GroutingLineId"].Value);
  288. F_PC_0103_1 frmFPC0103 = new F_PC_0103_1(GroutingLineId);
  289. DialogResult dialogresult = frmFPC0103.ShowDialog();
  290. if (dialogresult.Equals(DialogResult.OK))
  291. {
  292. this.dgvGroutingLine.DataSource = null;
  293. object obResult = DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(GetGroutingLine));
  294. if (obResult != null)
  295. {
  296. DataSet dsGroutingLine = (DataSet)obResult;
  297. if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
  298. {
  299. this.dgvGroutingLine.DataSource = dsGroutingLine.Tables[0];
  300. this.dgvGroutingLine.ReadOnly = true;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. catch (Exception ex)
  307. {
  308. // 对异常进行共通处理
  309. ExceptionManager.HandleEventException(this.ToString(),
  310. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  311. }
  312. }
  313. /// <summary>
  314. /// 选择某成型线查看模具明细
  315. /// </summary>
  316. /// <param name="sender"></param>
  317. /// <param name="e"></param>
  318. private void dgvGroutingLine_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  319. {
  320. try
  321. {
  322. if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE)
  323. {
  324. return;
  325. }
  326. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[e.RowIndex].Cells["GroutingLineID"].Value);
  327. this.BindDetailInfo(GroutingLineID);
  328. this.dgvGroutingLine.Focus();
  329. }
  330. catch (Exception ex)
  331. {
  332. // 对异常进行共通处理
  333. ExceptionManager.HandleEventException(this.ToString(),
  334. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  335. }
  336. }
  337. /// <summary>
  338. /// 打开履历查询界面
  339. /// </summary>
  340. /// <param name="sender"></param>
  341. /// <param name="e"></param>
  342. private void tsbtnQueryRecord_Click(object sender, EventArgs e)
  343. {
  344. try
  345. {
  346. if (this.dgvGroutingLine.CurrentCell != null)
  347. {
  348. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
  349. string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
  350. F_PC_0105_1 frmFPC0105 = new F_PC_0105_1(GroutingLineID, GroutingLineCode);
  351. DialogResult dialogresult = frmFPC0105.ShowDialog();
  352. }
  353. else
  354. {
  355. F_PC_0105_1 frmFPC0105 = new F_PC_0105_1();
  356. DialogResult dialogresult = frmFPC0105.ShowDialog();
  357. }
  358. }
  359. catch (Exception ex)
  360. {
  361. // 对异常进行共通处理
  362. ExceptionManager.HandleEventException(this.ToString(),
  363. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  364. }
  365. }
  366. /// <summary>
  367. /// 成型线列头点击事件
  368. /// </summary>
  369. /// <param name="sender"></param>
  370. /// <param name="e"></param>
  371. private void dgvGroutingLine_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  372. {
  373. //try
  374. //{
  375. // if (this.dgvGroutingLine.SelectedRows.Count != Constant.INT_IS_ZERO)
  376. // {
  377. // int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.SelectedRows[0].Cells["GroutingLineID"].Value);
  378. // this.BindDetailInfo(GroutingLineID);
  379. // }
  380. //}
  381. //catch (Exception ex)
  382. //{
  383. // // 对异常进行共通处理
  384. // ExceptionManager.HandleEventException(this.ToString(),
  385. // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  386. //}
  387. }
  388. #endregion
  389. #region 私有方法
  390. /// <summary>
  391. /// 为页面的成型线类型绑定数据源
  392. /// </summary>
  393. private void BindMouldType()
  394. {
  395. try
  396. {
  397. //DataTable dtDataSourse = new DataTable();
  398. //dtDataSourse.Columns.Add("GMouldType", System.Type.GetType("System.String"));
  399. //dtDataSourse.Columns.Add("GMouldTypeName", System.Type.GetType("System.String"));
  400. //for (int i = 0; i < Constant.ConGMouldStatusCount; i++)
  401. //{
  402. // DataRow drRow = dtDataSourse.NewRow();
  403. // drRow["GMouldType"] = Constant.ConGMouldStatus[i, 0];
  404. // drRow["GMouldTypeName"] = Constant.ConGMouldStatus[i, 1];
  405. // dtDataSourse.Rows.Add(drRow);
  406. //}
  407. //this.lstcbxGMouldStatus.ListBox.DisplayMember = "GMouldTypeName";
  408. //this.lstcbxGMouldStatus.ListBox.ValueMember = "GMouldType";
  409. //this.lstcbxGMouldStatus.ListBox.DataSource = dtDataSourse;
  410. // 调用服务器端获取数据集
  411. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
  412. {
  413. return PCModuleProxyNew.Service.GetFPC0101IData();
  414. }));
  415. if (sre.Status == Constant.ServiceResultStatus.Success)
  416. {
  417. if (sre.Data.Tables[1].Rows.Count > Constant.INT_IS_ZERO)
  418. {
  419. DataRow dr = sre.Data.Tables[1].NewRow();
  420. dr["GMouldStatusName"] = "";
  421. dr["GMouldStatusID"] = -1;
  422. sre.Data.Tables[1].Rows.InsertAt(dr, 0);
  423. this.lstcbxGMouldStatus.DisplayMember = "GMouldStatusName";
  424. this.lstcbxGMouldStatus.ValueMember = "GMouldStatusID";
  425. this.lstcbxGMouldStatus.DataSource = sre.Data.Tables[1];
  426. this.lstcbxGMouldStatus.SelectedValue = "1";
  427. }
  428. }
  429. }
  430. catch (Exception ex)
  431. {
  432. throw ex;
  433. }
  434. }
  435. /// <summary>
  436. /// 设置开始使用时间可用状态
  437. /// </summary>
  438. /// <param name="isEnable">
  439. /// false:不可用
  440. /// true:可用
  441. /// </param>
  442. private void SetBeginTimePickerEnable(bool isEnable)
  443. {
  444. this.txtBeginUsedDateStart.Enabled = isEnable;
  445. this.txtBeginUsedDateEnd.Enabled = isEnable;
  446. }
  447. /// <summary>
  448. /// 设置结束使用时间可用状态
  449. /// </summary>
  450. /// <param name="isEnable">
  451. /// false:不可用
  452. /// true:可用
  453. /// </param>
  454. private void SetEndTimePickerEnable(bool isEnable)
  455. {
  456. this.txtEndUsedDateStart.Enabled = isEnable;
  457. this.txtEndUsedDateEnd.Enabled = isEnable;
  458. }
  459. /// <summary>
  460. /// 根据条件取得成型线数据
  461. /// </summary>
  462. /// <returns></returns>
  463. private DataSet GetGroutingLine()
  464. {
  465. try
  466. {
  467. this.dgvGroutingLine.AutoGenerateColumns = false;
  468. GroutingLineEntity groutingLineEntity = new GroutingLineEntity();
  469. groutingLineEntity.VALUEFLAG = 1;
  470. groutingLineEntity.BUILDINGNO = this.txtBuildingNo.Text.Trim();
  471. groutingLineEntity.FLOORNO = this.txtFloorNo.Text.Trim();
  472. groutingLineEntity.GROUTINGLINENO = this.txtGroutingLineNo.Text.Trim();
  473. //if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
  474. if (_mouldStatus != -1)
  475. {
  476. groutingLineEntity.MouldStatus = _mouldStatus;
  477. }
  478. groutingLineEntity.GROUTINGLINECODE = this.txtGroutingLineCode.Text.Trim();
  479. groutingLineEntity.GROUTINGLINENAME = this.txtGroutingLineName.Text.Trim();
  480. if (this.cbStartTime.Checked)
  481. {
  482. groutingLineEntity.BEGINUSEDDATE = Convert.ToDateTime(this.txtBeginUsedDateStart.Text.Trim());
  483. groutingLineEntity.BEGINUSEDDATEEND = Convert.ToDateTime(this.txtBeginUsedDateEnd.Text.Trim()).AddHours(23)
  484. .AddMinutes(59).AddSeconds(59);
  485. }
  486. if (this.cbEndTime.Checked)
  487. {
  488. groutingLineEntity.ENDUSEDDATE = Convert.ToDateTime(this.txtEndUsedDateStart.Text.Trim());
  489. groutingLineEntity.ENDUSEDDATEEND = Convert.ToDateTime(this.txtEndUsedDateEnd.Text.Trim()).AddHours(23)
  490. .AddMinutes(59).AddSeconds(59);
  491. }
  492. groutingLineEntity.REMARKS = this.txtRemarks.Text.Trim();
  493. if (scbGMouldType.SearchedPKMember != 0)
  494. {
  495. groutingLineEntity.MOULDTYPEID = this.scbGMouldType.SearchedPKMember;
  496. }
  497. groutingLineEntity.USERCODE = this.txtGroutingUserCode.Text.Trim();
  498. if (this.chkEnable.Checked == this.chkDisable.Checked)
  499. {
  500. groutingLineEntity.ValueFlag2 = "A";
  501. }
  502. else if (this.chkEnable.Checked)
  503. {
  504. groutingLineEntity.ValueFlag2 = "1";
  505. }
  506. else if (this.chkDisable.Checked)
  507. {
  508. groutingLineEntity.ValueFlag2 = "2";
  509. }
  510. return PCModuleProxy.Service.GetGroutingLine(groutingLineEntity);
  511. }
  512. catch (Exception ex)
  513. {
  514. throw ex;
  515. }
  516. }
  517. /// <summary>
  518. /// 将成型线DataSet数据集转入集合中
  519. /// </summary>
  520. /// <param name="dsLine"></param>
  521. private void DataTableToListByLine(DataSet dsLine)
  522. {
  523. try
  524. {
  525. this._groutingLineList.Clear();
  526. foreach (DataRow drFor in dsLine.Tables[0].Rows)
  527. {
  528. GroutingLineEntity lineEntity = new GroutingLineEntity();
  529. lineEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  530. lineEntity.BUILDINGNO = drFor["BUILDINGNO"].ToString();
  531. lineEntity.FLOORNO = drFor["FLOORNO"].ToString();
  532. lineEntity.GROUTINGLINENO = drFor["GROUTINGLINENO"].ToString();
  533. lineEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
  534. lineEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
  535. lineEntity.MOULDQUANTITY = Convert.ToDecimal(drFor["MOULDQUANTITY"]);
  536. lineEntity.MOULDTYPEID = Convert.ToInt32(drFor["GMOULDTYPEID"]);
  537. lineEntity.USERID = Convert.ToInt32(drFor["USERID"]);
  538. lineEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  539. if (drFor["ENDUSEDDATE"].ToString() != string.Empty)
  540. {
  541. lineEntity.ENDUSEDDATE = Convert.ToDateTime(drFor["ENDUSEDDATE"].ToString());
  542. }
  543. lineEntity.MouldStatus = Convert.ToInt32(drFor["GMouldStatus"]);
  544. lineEntity.REMARKS = drFor["REMARKS"].ToString();
  545. lineEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  546. lineEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  547. lineEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  548. lineEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  549. lineEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  550. lineEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  551. lineEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  552. lineEntity.MOULDTYPENAME = drFor["GMOULDTYPENAME"].ToString();
  553. this._groutingLineList.Add(lineEntity);
  554. }
  555. }
  556. catch (Exception ex)
  557. {
  558. throw ex;
  559. }
  560. }
  561. /// <summary>
  562. /// 根据成型线ID获取明细信息
  563. /// </summary>
  564. private void BindDetailInfo(int GroutingLineID)
  565. {
  566. try
  567. {
  568. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  569. //DataSet dsDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  570. //{
  571. // return PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  572. //}));
  573. DataSet dsDetail = PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  574. DataView dv = dsDetail.Tables[0].DefaultView;
  575. dv.RowFilter = "valueflag=1";
  576. dsDetail = new DataSet();
  577. dsDetail.Tables.Add(dv.ToTable());
  578. this.dgvGroutingLineDetail.DataSource = dsDetail.Tables[0];
  579. this.dgvGroutingLineDetail.ReadOnly = true;
  580. }
  581. catch (Exception ex)
  582. {
  583. throw ex;
  584. }
  585. }
  586. #endregion
  587. /// <summary>
  588. /// 停用按钮事件
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. private void tsbtnDisable_Click(object sender, EventArgs e)
  593. {
  594. try
  595. {
  596. if (this.dgvGroutingLine.CurrentCell != null)
  597. {
  598. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  599. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  600. if (valueflag == 0)
  601. return;
  602. // 提示用户确认停用
  603. DialogResult msgBoxResult = MessageBox.Show(
  604. string.Format(Messages.MSG_CMN_Q002, "成型线", "停用"), this.Text,
  605. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  606. if (msgBoxResult == DialogResult.Yes)
  607. {
  608. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  609. {
  610. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 0);
  611. }));
  612. //修改成功
  613. if (returnRow > 0)
  614. {
  615. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "停用"),
  616. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  617. btnSearch_Click(sender, e);
  618. }
  619. else
  620. {
  621. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "停用"),
  622. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  623. }
  624. }
  625. }
  626. }
  627. catch (Exception ex)
  628. {
  629. // 对异常进行共通处理
  630. ExceptionManager.HandleEventException(this.ToString(),
  631. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  632. }
  633. }
  634. /// <summary>
  635. /// 启用按钮事件
  636. /// </summary>
  637. /// <param name="sender"></param>
  638. /// <param name="e"></param>
  639. private void tsbtnStart_Click(object sender, EventArgs e)
  640. {
  641. try
  642. {
  643. if (this.dgvGroutingLine.CurrentCell != null)
  644. {
  645. try
  646. {
  647. if (this.dgvGroutingLine.CurrentCell != null)
  648. {
  649. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  650. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  651. if (valueflag == 1)
  652. return;
  653. // 提示用户确认停用
  654. DialogResult msgBoxResult = MessageBox.Show(
  655. string.Format(Messages.MSG_CMN_Q002, "成型线", "启用"), this.Text,
  656. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  657. if (msgBoxResult == DialogResult.Yes)
  658. {
  659. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  660. {
  661. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 1);
  662. }));
  663. //修改成功
  664. if (returnRow > 0)
  665. {
  666. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "启用"),
  667. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  668. btnSearch_Click(sender, e);
  669. }
  670. else
  671. {
  672. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "启用"),
  673. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  674. }
  675. }
  676. }
  677. }
  678. catch (Exception ex)
  679. {
  680. // 对异常进行共通处理
  681. ExceptionManager.HandleEventException(this.ToString(),
  682. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  683. }
  684. }
  685. }
  686. catch (Exception ex)
  687. {
  688. // 对异常进行共通处理
  689. ExceptionManager.HandleEventException(this.ToString(),
  690. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  691. }
  692. }
  693. /// <summary>
  694. /// 模具管理按钮事件
  695. /// </summary>
  696. /// <param name="sender"></param>
  697. /// <param name="e"></param>
  698. private void tsbtnManager_Click(object sender, EventArgs e)
  699. {
  700. try
  701. {
  702. if (this.dgvGroutingLine.CurrentCell != null)
  703. {
  704. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
  705. string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
  706. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  707. frmFPC0101.ShowInDockPanel(this.DockPanel);
  708. frmFPC0101.SetGroutingLineIDAndGroutingLineCode(GroutingLineID, GroutingLineCode);
  709. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1(GroutingLineID, GroutingLineCode);
  710. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  711. }
  712. else
  713. {
  714. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1();
  715. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  716. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  717. frmFPC0101.ShowInDockPanel(this.DockPanel);
  718. }
  719. }
  720. catch (Exception ex)
  721. {
  722. // 对异常进行共通处理
  723. ExceptionManager.HandleEventException(this.ToString(),
  724. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  725. }
  726. }
  727. private void dgvGroutingLine_SelectionChanged(object sender, EventArgs e)
  728. {
  729. try
  730. {
  731. // 在绑定总表时 不查询明细
  732. if (!Convert.ToBoolean(this.Tag)
  733. || this.dgvGroutingLine.CurrentCell == null)
  734. {
  735. return;
  736. }
  737. // 选中行时查询明细
  738. else
  739. {
  740. if (this.txtBuildingNo.ReadOnly)
  741. {
  742. return;
  743. }
  744. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value.ToString());
  745. this.BindDetailInfo(GroutingLineID);
  746. this.dgvGroutingLine.Focus();
  747. }
  748. }
  749. catch (Exception ex)
  750. {
  751. // 对异常进行共通处理
  752. ExceptionManager.HandleEventException(this.ToString(),
  753. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  754. }
  755. }
  756. }
  757. }