F_PC_0104_1.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  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. //2022年3月25日 17:03:00 by feiy 增加成型线类别查询条件(1:试验线 0:普通线)
  411. // 绑定数据源
  412. this.TestFlag.DataSource = GetTestFlagTable();
  413. // 默认选中有效数据
  414. object[] checkValueFlags = new object[] { Constant.INT_IS_ZERO };
  415. this.TestFlag.SelectedValues = checkValueFlags;
  416. // 调用服务器端获取数据集
  417. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
  418. {
  419. return PCModuleProxyNew.Service.GetFPC0101IData();
  420. }));
  421. if (sre.Status == Constant.ServiceResultStatus.Success)
  422. {
  423. if (sre.Data.Tables[1].Rows.Count > Constant.INT_IS_ZERO)
  424. {
  425. DataRow dr = sre.Data.Tables[1].NewRow();
  426. dr["GMouldStatusName"] = "";
  427. dr["GMouldStatusID"] = -1;
  428. sre.Data.Tables[1].Rows.InsertAt(dr, 0);
  429. this.lstcbxGMouldStatus.DisplayMember = "GMouldStatusName";
  430. this.lstcbxGMouldStatus.ValueMember = "GMouldStatusID";
  431. this.lstcbxGMouldStatus.DataSource = sre.Data.Tables[1];
  432. this.lstcbxGMouldStatus.SelectedValue = "1";
  433. }
  434. }
  435. }
  436. catch (Exception ex)
  437. {
  438. throw ex;
  439. }
  440. }
  441. /// <summary>
  442. /// 设置开始使用时间可用状态
  443. /// </summary>
  444. /// <param name="isEnable">
  445. /// false:不可用
  446. /// true:可用
  447. /// </param>
  448. private void SetBeginTimePickerEnable(bool isEnable)
  449. {
  450. this.txtBeginUsedDateStart.Enabled = isEnable;
  451. this.txtBeginUsedDateEnd.Enabled = isEnable;
  452. }
  453. /// <summary>
  454. /// 设置结束使用时间可用状态
  455. /// </summary>
  456. /// <param name="isEnable">
  457. /// false:不可用
  458. /// true:可用
  459. /// </param>
  460. private void SetEndTimePickerEnable(bool isEnable)
  461. {
  462. this.txtEndUsedDateStart.Enabled = isEnable;
  463. this.txtEndUsedDateEnd.Enabled = isEnable;
  464. }
  465. /// <summary>
  466. /// 根据条件取得成型线数据
  467. /// </summary>
  468. /// <returns></returns>
  469. private DataSet GetGroutingLine()
  470. {
  471. try
  472. {
  473. this.dgvGroutingLine.AutoGenerateColumns = false;
  474. GroutingLineEntity groutingLineEntity = new GroutingLineEntity();
  475. groutingLineEntity.VALUEFLAG = 1;
  476. groutingLineEntity.BUILDINGNO = this.txtBuildingNo.Text.Trim();
  477. groutingLineEntity.FLOORNO = this.txtFloorNo.Text.Trim();
  478. groutingLineEntity.GROUTINGLINENO = this.txtGroutingLineNo.Text.Trim();
  479. //if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
  480. if (_mouldStatus != -1)
  481. {
  482. groutingLineEntity.MouldStatus = _mouldStatus;
  483. }
  484. groutingLineEntity.GROUTINGLINECODE = this.txtGroutingLineCode.Text.Trim();
  485. groutingLineEntity.GROUTINGLINENAME = this.txtGroutingLineName.Text.Trim();
  486. if (this.cbStartTime.Checked)
  487. {
  488. groutingLineEntity.BEGINUSEDDATE = Convert.ToDateTime(this.txtBeginUsedDateStart.Text.Trim());
  489. groutingLineEntity.BEGINUSEDDATEEND = Convert.ToDateTime(this.txtBeginUsedDateEnd.Text.Trim()).AddHours(23)
  490. .AddMinutes(59).AddSeconds(59);
  491. }
  492. if (this.cbEndTime.Checked)
  493. {
  494. groutingLineEntity.ENDUSEDDATE = Convert.ToDateTime(this.txtEndUsedDateStart.Text.Trim());
  495. groutingLineEntity.ENDUSEDDATEEND = Convert.ToDateTime(this.txtEndUsedDateEnd.Text.Trim()).AddHours(23)
  496. .AddMinutes(59).AddSeconds(59);
  497. }
  498. groutingLineEntity.REMARKS = this.txtRemarks.Text.Trim();
  499. if (scbGMouldType.SearchedPKMember != 0)
  500. {
  501. groutingLineEntity.MOULDTYPEID = this.scbGMouldType.SearchedPKMember;
  502. }
  503. groutingLineEntity.USERCODE = this.txtGroutingUserCode.Text.Trim();
  504. if (this.chkEnable.Checked == this.chkDisable.Checked)
  505. {
  506. groutingLineEntity.ValueFlag2 = "A";
  507. }
  508. else if (this.chkEnable.Checked)
  509. {
  510. groutingLineEntity.ValueFlag2 = "1";
  511. }
  512. else if (this.chkDisable.Checked)
  513. {
  514. groutingLineEntity.ValueFlag2 = "2";
  515. }
  516. groutingLineEntity.TestFlags = this.TestFlag.SelectedValues;
  517. return PCModuleProxy.Service.GetGroutingLine(groutingLineEntity);
  518. }
  519. catch (Exception ex)
  520. {
  521. throw ex;
  522. }
  523. }
  524. /// <summary>
  525. /// 将成型线DataSet数据集转入集合中
  526. /// </summary>
  527. /// <param name="dsLine"></param>
  528. private void DataTableToListByLine(DataSet dsLine)
  529. {
  530. try
  531. {
  532. this._groutingLineList.Clear();
  533. foreach (DataRow drFor in dsLine.Tables[0].Rows)
  534. {
  535. GroutingLineEntity lineEntity = new GroutingLineEntity();
  536. lineEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
  537. lineEntity.BUILDINGNO = drFor["BUILDINGNO"].ToString();
  538. lineEntity.FLOORNO = drFor["FLOORNO"].ToString();
  539. lineEntity.GROUTINGLINENO = drFor["GROUTINGLINENO"].ToString();
  540. lineEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
  541. lineEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
  542. lineEntity.MOULDQUANTITY = Convert.ToDecimal(drFor["MOULDQUANTITY"]);
  543. lineEntity.MOULDTYPEID = Convert.ToInt32(drFor["GMOULDTYPEID"]);
  544. lineEntity.USERID = Convert.ToInt32(drFor["USERID"]);
  545. lineEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
  546. if (drFor["ENDUSEDDATE"].ToString() != string.Empty)
  547. {
  548. lineEntity.ENDUSEDDATE = Convert.ToDateTime(drFor["ENDUSEDDATE"].ToString());
  549. }
  550. lineEntity.MouldStatus = Convert.ToInt32(drFor["GMouldStatus"]);
  551. lineEntity.REMARKS = drFor["REMARKS"].ToString();
  552. lineEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
  553. lineEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
  554. lineEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
  555. lineEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
  556. lineEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
  557. lineEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
  558. lineEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
  559. lineEntity.MOULDTYPENAME = drFor["GMOULDTYPENAME"].ToString();
  560. this._groutingLineList.Add(lineEntity);
  561. }
  562. }
  563. catch (Exception ex)
  564. {
  565. throw ex;
  566. }
  567. }
  568. /// <summary>
  569. /// 根据成型线ID获取明细信息
  570. /// </summary>
  571. private void BindDetailInfo(int GroutingLineID)
  572. {
  573. try
  574. {
  575. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  576. //DataSet dsDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  577. //{
  578. // return PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  579. //}));
  580. DataSet dsDetail = PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
  581. DataView dv = dsDetail.Tables[0].DefaultView;
  582. dv.RowFilter = "valueflag=1";
  583. dsDetail = new DataSet();
  584. dsDetail.Tables.Add(dv.ToTable());
  585. this.dgvGroutingLineDetail.DataSource = dsDetail.Tables[0];
  586. this.dgvGroutingLineDetail.ReadOnly = true;
  587. }
  588. catch (Exception ex)
  589. {
  590. throw ex;
  591. }
  592. }
  593. #endregion
  594. /// <summary>
  595. /// 停用按钮事件
  596. /// </summary>
  597. /// <param name="sender"></param>
  598. /// <param name="e"></param>
  599. private void tsbtnDisable_Click(object sender, EventArgs e)
  600. {
  601. try
  602. {
  603. if (this.dgvGroutingLine.CurrentCell != null)
  604. {
  605. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  606. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  607. if (valueflag == 0)
  608. return;
  609. // 提示用户确认停用
  610. DialogResult msgBoxResult = MessageBox.Show(
  611. string.Format(Messages.MSG_CMN_Q002, "成型线", "停用"), this.Text,
  612. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  613. if (msgBoxResult == DialogResult.Yes)
  614. {
  615. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  616. {
  617. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 0);
  618. }));
  619. //修改成功
  620. if (returnRow > 0)
  621. {
  622. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "停用"),
  623. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  624. btnSearch_Click(sender, e);
  625. }
  626. else
  627. {
  628. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "停用"),
  629. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  630. }
  631. }
  632. }
  633. }
  634. catch (Exception ex)
  635. {
  636. // 对异常进行共通处理
  637. ExceptionManager.HandleEventException(this.ToString(),
  638. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  639. }
  640. }
  641. /// <summary>
  642. /// 启用按钮事件
  643. /// </summary>
  644. /// <param name="sender"></param>
  645. /// <param name="e"></param>
  646. private void tsbtnStart_Click(object sender, EventArgs e)
  647. {
  648. try
  649. {
  650. if (this.dgvGroutingLine.CurrentCell != null)
  651. {
  652. try
  653. {
  654. if (this.dgvGroutingLine.CurrentCell != null)
  655. {
  656. int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
  657. int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
  658. if (valueflag == 1)
  659. return;
  660. // 提示用户确认停用
  661. DialogResult msgBoxResult = MessageBox.Show(
  662. string.Format(Messages.MSG_CMN_Q002, "成型线", "启用"), this.Text,
  663. MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  664. if (msgBoxResult == DialogResult.Yes)
  665. {
  666. int returnRow = (int)DoAsync(new AsyncMethod(() =>
  667. {
  668. return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 1);
  669. }));
  670. //修改成功
  671. if (returnRow > 0)
  672. {
  673. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "启用"),
  674. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  675. btnSearch_Click(sender, e);
  676. }
  677. else
  678. {
  679. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "启用"),
  680. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  681. }
  682. }
  683. }
  684. }
  685. catch (Exception ex)
  686. {
  687. // 对异常进行共通处理
  688. ExceptionManager.HandleEventException(this.ToString(),
  689. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  690. }
  691. }
  692. }
  693. catch (Exception ex)
  694. {
  695. // 对异常进行共通处理
  696. ExceptionManager.HandleEventException(this.ToString(),
  697. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  698. }
  699. }
  700. /// <summary>
  701. /// 模具管理按钮事件
  702. /// </summary>
  703. /// <param name="sender"></param>
  704. /// <param name="e"></param>
  705. private void tsbtnManager_Click(object sender, EventArgs e)
  706. {
  707. try
  708. {
  709. if (this.dgvGroutingLine.CurrentCell != null)
  710. {
  711. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
  712. string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
  713. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  714. frmFPC0101.ShowInDockPanel(this.DockPanel);
  715. frmFPC0101.SetGroutingLineIDAndGroutingLineCode(GroutingLineID, GroutingLineCode);
  716. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1(GroutingLineID, GroutingLineCode);
  717. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  718. }
  719. else
  720. {
  721. //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1();
  722. //DialogResult dialogresult = frmFPC0101.ShowDialog();
  723. F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
  724. frmFPC0101.ShowInDockPanel(this.DockPanel);
  725. }
  726. }
  727. catch (Exception ex)
  728. {
  729. // 对异常进行共通处理
  730. ExceptionManager.HandleEventException(this.ToString(),
  731. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  732. }
  733. }
  734. private void dgvGroutingLine_SelectionChanged(object sender, EventArgs e)
  735. {
  736. try
  737. {
  738. // 在绑定总表时 不查询明细
  739. if (!Convert.ToBoolean(this.Tag)
  740. || this.dgvGroutingLine.CurrentCell == null)
  741. {
  742. return;
  743. }
  744. // 选中行时查询明细
  745. else
  746. {
  747. if (this.txtBuildingNo.ReadOnly)
  748. {
  749. return;
  750. }
  751. int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value.ToString());
  752. this.BindDetailInfo(GroutingLineID);
  753. this.dgvGroutingLine.Focus();
  754. }
  755. }
  756. catch (Exception ex)
  757. {
  758. // 对异常进行共通处理
  759. ExceptionManager.HandleEventException(this.ToString(),
  760. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  761. }
  762. }
  763. #region 构造有效标识的数据源
  764. /// <summary>
  765. /// 构造有效标识的数据源
  766. /// </summary>
  767. /// <returns></returns>
  768. public static DataTable GetTestFlagTable()
  769. {
  770. DataTable dtValueFlag = new DataTable();
  771. dtValueFlag.Columns.Add("TestFlag");
  772. dtValueFlag.Columns.Add("TestFlagName");
  773. DataRow drow = dtValueFlag.NewRow();
  774. drow["TestFlag"] = Constant.INT_IS_ZERO;
  775. drow["TestFlagName"] = "普通线";
  776. dtValueFlag.Rows.Add(drow);
  777. drow = dtValueFlag.NewRow();
  778. drow["TestFlag"] = Constant.INT_IS_ONE;
  779. drow["TestFlagName"] = "试验线";
  780. dtValueFlag.Rows.Add(drow);
  781. return dtValueFlag;
  782. }
  783. #endregion
  784. }
  785. }