F_PC_1001.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_1001.cs
  5. * 2.功能描述:模具档案
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/12/07 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Reflection;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PCModule
  22. {
  23. /// <summary>
  24. /// 模具档案
  25. /// </summary>
  26. public partial class F_PC_1001 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. private static F_PC_1001 _instance = null;
  30. #endregion
  31. #region 单例模式
  32. /// <summary>
  33. /// 单例模式,防止重复创建窗体
  34. /// </summary>
  35. public static F_PC_1001 Instance
  36. {
  37. get
  38. {
  39. if (_instance == null)
  40. {
  41. _instance = new F_PC_1001();
  42. }
  43. return _instance;
  44. }
  45. }
  46. #endregion
  47. #region 构造函数
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. public F_PC_1001()
  52. {
  53. InitializeComponent();
  54. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  55. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  56. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  57. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  58. this.dgvMould.AutoGenerateColumns = false;
  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_1001_FormClosed(object sender, FormClosedEventArgs e)
  68. {
  69. _instance = null;
  70. }
  71. /// <summary>
  72. /// 画面加载
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. private void F_PC_1001_Load(object sender, System.EventArgs e)
  77. {
  78. try
  79. {
  80. FormPermissionManager.FormPermissionControl(this.Name, this,
  81. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  82. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  83. this.dtpPDateBegin.Value = DateTime.Now;
  84. this.dtpPDateEnd.Value = DateTime.Now;
  85. this.dtpScrapDateBegin.Value = DateTime.Now;
  86. this.dtpScrapDateEnd.Value = DateTime.Now;
  87. ClientRequestEntity cre = new ClientRequestEntity();
  88. cre.NameSpace = "FPC1001";
  89. cre.Name = "GetFPC1001LoadData";
  90. ServiceResultEntity sre = PCModuleProxyNew.Service.HandleRequest(cre);
  91. this.ckcMouldType.DataSource = sre.Data.Tables["MouldType"];
  92. this.ckcSuppliers.DataSource = sre.Data.Tables["Suppliers"];
  93. this.calMouldStatus.DataSource = sre.Data.Tables["MouldStatus"];
  94. this.calMouldStatus.SetItemCheckedByValue(true, 1m, 2m, 3m);
  95. this.dgvMould.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
  96. }
  97. catch (Exception ex)
  98. {
  99. // 对异常进行共通处理
  100. ExceptionManager.HandleEventException(this.ToString(),
  101. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  102. }
  103. }
  104. /// <summary>
  105. /// 生产日期
  106. /// </summary>
  107. /// <param name="sender"></param>
  108. /// <param name="e"></param>
  109. private void chkPDate_CheckedChanged(object sender, EventArgs e)
  110. {
  111. this.dtpPDateBegin.Enabled = this.chkPDate.Checked;
  112. this.dtpPDateEnd.Enabled = this.chkPDate.Checked;
  113. }
  114. /// <summary>
  115. /// 报废日期
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. private void chkScrapDate_CheckedChanged(object sender, EventArgs e)
  120. {
  121. this.dtpScrapDateBegin.Enabled = this.chkScrapDate.Checked;
  122. this.dtpScrapDateEnd.Enabled = this.chkScrapDate.Checked;
  123. }
  124. /// <summary>
  125. /// 清除查询条件
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  130. {
  131. this.txtModelBarcode.Clear();
  132. this.txtUserCode.Clear();
  133. this.txtGoodsCode.Clear();
  134. this.txtRemarks.Clear();
  135. this.ckcMouldType.ClearValue();
  136. this.ckcSuppliers.ClearValue();
  137. this.chkPDate.Checked = true;
  138. this.chkScrapDate.Checked = false;
  139. this.dtpPDateBegin.Value = DateTime.Now;
  140. this.dtpPDateEnd.Value = DateTime.Now;
  141. this.dtpScrapDateBegin.Value = DateTime.Now;
  142. this.dtpScrapDateEnd.Value = DateTime.Now;
  143. this.calMouldStatus.SetItemCheckedByValue(true, 1m, 2m, 3m);
  144. }
  145. /// <summary>
  146. /// 查询
  147. /// </summary>
  148. /// <param name="sender"></param>
  149. /// <param name="e"></param>
  150. private void tsbtnSearch_Click(object sender, EventArgs e)
  151. {
  152. try
  153. {
  154. this.QueryDataFromOther();
  155. this.dgvMould.IsSetInputColumnsColor = true;
  156. }
  157. catch (Exception ex)
  158. {
  159. // 对异常进行共通处理
  160. ExceptionManager.HandleEventException(this.ToString(),
  161. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  162. }
  163. }
  164. /// <summary>
  165. /// 排序
  166. /// </summary>
  167. /// <param name="sender"></param>
  168. /// <param name="e"></param>
  169. private void dgvMould_Sorted(object sender, EventArgs e)
  170. {
  171. this.dgvMould.IsSetInputColumnsColor = true;
  172. }
  173. /// <summary>
  174. /// 自适应列宽
  175. /// </summary>
  176. /// <param name="sender"></param>
  177. /// <param name="e"></param>
  178. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  179. {
  180. this.dgvMould.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  181. }
  182. /// <summary>
  183. /// 关闭画面
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. private void tsbtnClose_Click(object sender, EventArgs e)
  188. {
  189. this.Close();
  190. }
  191. /// <summary>
  192. /// 新建
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. private void tsbtnAdd_Click(object sender, EventArgs e)
  197. {
  198. try
  199. {
  200. F_PC_1002 fpc1002 = new F_PC_1002(0);
  201. if (fpc1002.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  202. {
  203. this.tsbtnSearch_Click(null, null);
  204. }
  205. }
  206. catch (Exception ex)
  207. {
  208. // 对异常进行共通处理
  209. ExceptionManager.HandleEventException(this.ToString(),
  210. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  211. }
  212. }
  213. /// <summary>
  214. /// 编辑
  215. /// </summary>
  216. /// <param name="sender"></param>
  217. /// <param name="e"></param>
  218. private void tsbtnEdit_Click(object sender, EventArgs e)
  219. {
  220. if (this.dgvMould.CurrentRow == null || this.dgvMould.CurrentRow.Index < 0)
  221. {
  222. return;
  223. }
  224. try
  225. {
  226. int mouldID = Convert.ToInt32(this.dgvMould.CurrentRow.Cells["MouldID"].Value);
  227. F_PC_1002 fpc1002 = new F_PC_1002(mouldID);
  228. if (fpc1002.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  229. {
  230. this.tsbtnSearch_Click(null, null);
  231. }
  232. }
  233. catch (Exception ex)
  234. {
  235. // 对异常进行共通处理
  236. ExceptionManager.HandleEventException(this.ToString(),
  237. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  238. }
  239. }
  240. /// <summary>
  241. /// 打印
  242. /// </summary>
  243. /// <param name="sender"></param>
  244. /// <param name="e"></param>
  245. private void tsbtnPrint_Click(object sender, EventArgs e)
  246. {
  247. if (this.dgvMould.CurrentRow == null || this.dgvMould.CurrentRow.Index < 0)
  248. {
  249. return;
  250. }
  251. try
  252. {
  253. string barcode = this.dgvMould.CurrentRow.Cells["MouldBarcode"].Value.ToString();
  254. F_MST_013006.PrintBarcode(barcode, 1, this);
  255. }
  256. catch (Exception ex)
  257. {
  258. // 对异常进行共通处理
  259. ExceptionManager.HandleEventException(this.ToString(),
  260. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  261. }
  262. }
  263. /// <summary>
  264. /// 双击编辑
  265. /// </summary>
  266. /// <param name="sender"></param>
  267. /// <param name="e"></param>
  268. private void dgvMould_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  269. {
  270. if (!this.tsbtnEdit.Visible || !this.tsbtnEdit.Enabled)
  271. {
  272. return;
  273. }
  274. if (e.ColumnIndex < 0 || e.RowIndex < 0 || "Sel" == dgvMould.Columns[e.ColumnIndex].Name)
  275. {
  276. return;
  277. }
  278. try
  279. {
  280. int mouldID = Convert.ToInt32(this.dgvMould.CurrentRow.Cells["MouldID"].Value);
  281. F_PC_1002 fpc1002 = new F_PC_1002(mouldID);
  282. if (fpc1002.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  283. {
  284. this.tsbtnSearch_Click(null, null);
  285. }
  286. }
  287. catch (Exception ex)
  288. {
  289. // 对异常进行共通处理
  290. ExceptionManager.HandleEventException(this.ToString(),
  291. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  292. }
  293. }
  294. /// <summary>
  295. /// 报废
  296. /// </summary>
  297. /// <param name="sender"></param>
  298. /// <param name="e"></param>
  299. private void tsbtnScrap_Click(object sender, EventArgs e)
  300. {
  301. try
  302. {
  303. DataTable dt = this.dgvMould.DataSource as DataTable;
  304. if (dt == null || dt.Rows.Count == 0)
  305. {
  306. return;
  307. }
  308. DataRow[] items = dt.Select("Sel = 1 and MouldStatus in (1,3)");
  309. if (items == null || items.Length == 0)
  310. {
  311. MessageBox.Show("没有选择任何模具,或所选模具不是【在库】、【待产】状态",
  312. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning,
  313. MessageBoxDefaultButton.Button1);
  314. return;
  315. }
  316. List<string> ids = new List<string>();
  317. foreach (DataRow item in items)
  318. {
  319. ids.Add(item["MouldID"].ToString());
  320. }
  321. F_PC_1004 fpc1004 = new F_PC_1004(string.Join(",", ids), Constant.MouldOperationType.InvToScrap);
  322. if (fpc1004.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  323. {
  324. this.tsbtnSearch_Click(null, null);
  325. }
  326. }
  327. catch (Exception ex)
  328. {
  329. // 对异常进行共通处理
  330. ExceptionManager.HandleEventException(this.ToString(),
  331. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  332. }
  333. }
  334. /// <summary>
  335. /// 撤销报废
  336. /// </summary>
  337. /// <param name="sender"></param>
  338. /// <param name="e"></param>
  339. private void tsbtnUndoScrap_Click(object sender, EventArgs e)
  340. {
  341. try
  342. {
  343. DataTable dt = this.dgvMould.DataSource as DataTable;
  344. if (dt == null || dt.Rows.Count == 0)
  345. {
  346. return;
  347. }
  348. DataRow[] items = dt.Select("Sel = 1 and MouldStatus = 4");
  349. if (items == null || items.Length == 0)
  350. {
  351. MessageBox.Show("没有选择任何模具,或所选模具不是【报废】状态",
  352. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning,
  353. MessageBoxDefaultButton.Button1);
  354. return;
  355. }
  356. List<string> ids = new List<string>();
  357. foreach (DataRow item in items)
  358. {
  359. ids.Add(item["MouldID"].ToString());
  360. }
  361. F_PC_1004 fpc1004 = new F_PC_1004(string.Join(",", ids), Constant.MouldOperationType.ScrapToInv);
  362. if (fpc1004.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  363. {
  364. this.tsbtnSearch_Click(null, null);
  365. }
  366. }
  367. catch (Exception ex)
  368. {
  369. // 对异常进行共通处理
  370. ExceptionManager.HandleEventException(this.ToString(),
  371. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  372. }
  373. }
  374. /// <summary>
  375. /// 领用
  376. /// </summary>
  377. /// <param name="sender"></param>
  378. /// <param name="e"></param>
  379. private void tsbtnOut_Click(object sender, EventArgs e)
  380. {
  381. try
  382. {
  383. DataTable dt = this.dgvMould.DataSource as DataTable;
  384. if (dt == null || dt.Rows.Count == 0)
  385. {
  386. return;
  387. }
  388. DataRow[] items = dt.Select("Sel = 1 and MouldStatus = 1");
  389. if (items == null || items.Length == 0)
  390. {
  391. MessageBox.Show("没有选择任何模具,或所选模具不是【在库】状态",
  392. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning,
  393. MessageBoxDefaultButton.Button1);
  394. return;
  395. }
  396. List<string> ids = new List<string>();
  397. foreach (DataRow item in items)
  398. {
  399. ids.Add(item["MouldID"].ToString());
  400. }
  401. F_PC_1004 fpc1004 = new F_PC_1004(string.Join(",", ids), Constant.MouldOperationType.InvToOut);
  402. if (fpc1004.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  403. {
  404. this.tsbtnSearch_Click(null, null);
  405. }
  406. }
  407. catch (Exception ex)
  408. {
  409. // 对异常进行共通处理
  410. ExceptionManager.HandleEventException(this.ToString(),
  411. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  412. }
  413. }
  414. /// <summary>
  415. /// 回收
  416. /// </summary>
  417. /// <param name="sender"></param>
  418. /// <param name="e"></param>
  419. private void tsbtnIn_Click(object sender, EventArgs e)
  420. {
  421. try
  422. {
  423. DataTable dt = this.dgvMould.DataSource as DataTable;
  424. if (dt == null || dt.Rows.Count == 0)
  425. {
  426. return;
  427. }
  428. DataRow[] items = dt.Select("Sel = 1 and MouldStatus = 3");
  429. if (items == null || items.Length == 0)
  430. {
  431. MessageBox.Show("没有选择任何模具,或所选模具不是【待产】状态",
  432. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning,
  433. MessageBoxDefaultButton.Button1);
  434. return;
  435. }
  436. List<string> ids = new List<string>();
  437. foreach (DataRow item in items)
  438. {
  439. ids.Add(item["MouldID"].ToString());
  440. }
  441. F_PC_1004 fpc1004 = new F_PC_1004(string.Join(",", ids), Constant.MouldOperationType.OutToInv);
  442. if (fpc1004.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  443. {
  444. this.tsbtnSearch_Click(null, null);
  445. }
  446. }
  447. catch (Exception ex)
  448. {
  449. // 对异常进行共通处理
  450. ExceptionManager.HandleEventException(this.ToString(),
  451. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  452. }
  453. }
  454. /// <summary>
  455. /// 替换条码
  456. /// </summary>
  457. /// <param name="sender"></param>
  458. /// <param name="e"></param>
  459. private void tsbtnChangeBarcode_Click(object sender, EventArgs e)
  460. {
  461. if (this.dgvMould.CurrentRow == null || this.dgvMould.CurrentRow.Index < 0)
  462. {
  463. return;
  464. }
  465. try
  466. {
  467. int mouldID = Convert.ToInt32(this.dgvMould.CurrentRow.Cells["MouldID"].Value);
  468. F_PC_1003 fpc1003 = new F_PC_1003(mouldID);
  469. if (fpc1003.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  470. {
  471. this.tsbtnSearch_Click(null, null);
  472. }
  473. }
  474. catch (Exception ex)
  475. {
  476. // 对异常进行共通处理
  477. ExceptionManager.HandleEventException(this.ToString(),
  478. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  479. }
  480. }
  481. /// <summary>
  482. /// 变更型号
  483. /// </summary>
  484. /// <param name="sender"></param>
  485. /// <param name="e"></param>
  486. private void tsbtnChangeGoodsCode_Click(object sender, EventArgs e)
  487. {
  488. try
  489. {
  490. DataTable dt = this.dgvMould.DataSource as DataTable;
  491. if(dt == null || dt.Rows.Count == 0)
  492. {
  493. return;
  494. }
  495. DataRow[] items = dt.Select("Sel = 1 and MouldStatus in (1,2,3)");
  496. if (items == null || items.Length == 0)
  497. {
  498. MessageBox.Show("没有选择任何模具,或所选模具不是【在库】、【在产】、【待产】状态",
  499. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning,
  500. MessageBoxDefaultButton.Button1);
  501. return;
  502. }
  503. List<string> ids = new List<string>();
  504. foreach (DataRow item in items)
  505. {
  506. ids.Add(item["MouldID"].ToString());
  507. }
  508. F_PC_1004 fpc1004 = new F_PC_1004(string.Join(",", ids), Constant.MouldOperationType.ChangeGoodsCode);
  509. if (fpc1004.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  510. {
  511. this.tsbtnSearch_Click(null, null);
  512. }
  513. }
  514. catch (Exception ex)
  515. {
  516. // 对异常进行共通处理
  517. ExceptionManager.HandleEventException(this.ToString(),
  518. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  519. }
  520. }
  521. /// <summary>
  522. ///
  523. /// </summary>
  524. /// <param name="sender"></param>
  525. /// <param name="e"></param>
  526. private void dgvMould_SelectionChanged(object sender, EventArgs e)
  527. {
  528. try
  529. {
  530. }
  531. catch (Exception ex)
  532. {
  533. // 对异常进行共通处理
  534. ExceptionManager.HandleEventException(this.ToString(),
  535. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  536. }
  537. }
  538. /// <summary>
  539. ///
  540. /// </summary>
  541. /// <param name="sender"></param>
  542. /// <param name="e"></param>
  543. private void dgvMould_CurrentCellDirtyStateChanged(object sender, EventArgs e)
  544. {
  545. if (dgvMould.CurrentCell == null ||
  546. dgvMould.CurrentCell.RowIndex < 0 ||
  547. dgvMould.CurrentCell.ColumnIndex < 0)
  548. {
  549. return;
  550. }
  551. try
  552. {
  553. if (dgvMould.Columns[dgvMould.CurrentCell.ColumnIndex].Name == "Sel")
  554. {
  555. this.dgvMould.CommitEdit(DataGridViewDataErrorContexts.Commit);
  556. this.dgvMould.EndEdit();
  557. DataRowView drv = (this.dgvMould.CurrentRow.DataBoundItem as DataRowView);
  558. if (drv != null)
  559. {
  560. drv.EndEdit();
  561. }
  562. }
  563. }
  564. catch (Exception ex)
  565. {
  566. // 对异常进行共通处理
  567. ExceptionManager.HandleEventException(this.ToString(),
  568. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  569. }
  570. }
  571. /// <summary>
  572. /// 全选
  573. /// </summary>
  574. /// <param name="sender"></param>
  575. /// <param name="e"></param>
  576. private void tsbtnSelectAll_Click(object sender, EventArgs e)
  577. {
  578. try
  579. {
  580. DataTable dt = this.dgvMould.DataSource as DataTable;
  581. if (dt == null || dt.DefaultView.Count == 0)
  582. {
  583. return;
  584. }
  585. foreach (DataRowView item in dt.DefaultView)
  586. {
  587. item["Sel"] = 1;
  588. item.EndEdit();
  589. }
  590. }
  591. catch (Exception ex)
  592. {
  593. // 对异常进行共通处理
  594. ExceptionManager.HandleEventException(this.ToString(),
  595. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  596. }
  597. }
  598. /// <summary>
  599. /// 不选
  600. /// </summary>
  601. /// <param name="sender"></param>
  602. /// <param name="e"></param>
  603. private void tsbtnUnSelect_Click(object sender, EventArgs e)
  604. {
  605. try
  606. {
  607. DataTable dt = this.dgvMould.DataSource as DataTable;
  608. if (dt == null || dt.Rows.Count == 0)
  609. {
  610. return;
  611. }
  612. foreach (DataRow item in dt.Rows)
  613. {
  614. item["Sel"] = 0;
  615. item.EndEdit();
  616. }
  617. }
  618. catch (Exception ex)
  619. {
  620. // 对异常进行共通处理
  621. ExceptionManager.HandleEventException(this.ToString(),
  622. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  623. }
  624. }
  625. /// <summary>
  626. /// 反选
  627. /// </summary>
  628. /// <param name="sender"></param>
  629. /// <param name="e"></param>
  630. private void tsbtnReSelect_Click(object sender, EventArgs e)
  631. {
  632. try
  633. {
  634. DataTable dt = this.dgvMould.DataSource as DataTable;
  635. if (dt == null || dt.DefaultView.Count == 0)
  636. {
  637. return;
  638. }
  639. foreach (DataRowView item in dt.DefaultView)
  640. {
  641. if (Convert.ToInt32(item["Sel"]) == 0)
  642. {
  643. item["Sel"] = 1;
  644. }
  645. else
  646. {
  647. item["Sel"] = 0;
  648. }
  649. item.EndEdit();
  650. }
  651. }
  652. catch (Exception ex)
  653. {
  654. // 对异常进行共通处理
  655. ExceptionManager.HandleEventException(this.ToString(),
  656. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  657. }
  658. }
  659. #endregion
  660. #region 私有方法
  661. /// <summary>
  662. /// 查询数据
  663. /// </summary>
  664. /// <returns>验证通过true,其他false</returns>
  665. private void QueryDataFromOther()
  666. {
  667. try
  668. {
  669. ClientRequestEntity cre = new ClientRequestEntity();
  670. cre.NameSpace = "FPC1001";
  671. cre.Name = "GetFPC1001QueryData";
  672. cre.Properties["MouldBarcode"] = this.txtModelBarcode.Text.Trim();
  673. cre.Properties["UserCode"] = this.txtUserCode.Text.Trim();
  674. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  675. cre.Properties["Remarks"] = this.txtRemarks.Text;
  676. cre.Properties["MouldTypes"] = this.ckcMouldType.CheckedValue;
  677. cre.Properties["Suppliers"] = this.ckcSuppliers.CheckedValue;
  678. if (this.chkPDate.Checked)
  679. {
  680. cre.Properties["PDateBegin"] = this.dtpPDateBegin.BeginTime;
  681. cre.Properties["PDateEnd"] = this.dtpPDateEnd.EndTime;
  682. }
  683. if (this.chkScrapDate.Checked)
  684. {
  685. cre.Properties["ScrapDateBegin"] = this.dtpScrapDateBegin.BeginTime;
  686. cre.Properties["ScrapDateEnd"] = this.dtpScrapDateEnd.EndTime;
  687. }
  688. cre.Properties["MouldStatus"] = this.calMouldStatus.CheckedValue;
  689. this.dgvMould.DataSource = null;
  690. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  691. {
  692. return PCModuleProxyNew.Service.HandleRequest(cre);
  693. }
  694. );
  695. if (sre.Status == Constant.ServiceResultStatus.Success)
  696. {
  697. // 查询成功
  698. this.dgvMould.DataSource = sre.Data.Tables[0];
  699. }
  700. }
  701. catch (Exception ex)
  702. {
  703. throw ex;
  704. }
  705. }
  706. #endregion
  707. }
  708. }