F_MST_0903.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_0903.cs
  5. * 2.功能描述:设置缺陷对应缺陷扣罚及扣除数
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/1/5 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.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels.PAMModule;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
  23. namespace Dongke.IBOSS.PRD.Client.SystemModule
  24. {
  25. public partial class F_MST_0903 : FormBase
  26. {
  27. #region 成员变量
  28. // 窗体模式ID
  29. //private Constant.FormMode _formType;
  30. // 操作实体ID(方案)
  31. //private int? _entityId;
  32. // 工序
  33. private DataSet _dsProcedure = new DataSet();
  34. // 工种编码值
  35. //private string _GoodsCodeValue;
  36. //private bool _ShowFlag = true;
  37. // 数据源
  38. //DataTable dt = null;
  39. // 当前工资方案ID
  40. //private int? _currentWagesTypeID = null;
  41. // 产品全部数据集
  42. //DataTable dtAllDataLeft = null;
  43. // 质量全部数据集
  44. //DataTable dtAllDataRight = null;
  45. // 产品工价数据源
  46. DataTable _dtLeftDataSource = null;
  47. // 质量工价数据源
  48. DataTable _dtRightDataSource = null;
  49. // 当前行ID
  50. private int _selectedrow = -1;
  51. // 当前选定行
  52. private int _currentRowIndexFlag = 0;
  53. // 当前标准工价
  54. private int _currentStandardWages = 0;
  55. // 计件工资策略ID
  56. private int? _PieceTacticsID = null;
  57. // 缺陷扣罚数据源
  58. private DataTable _dtDefectFine = null;
  59. // 缺陷扣除数数据源
  60. private DataTable _dtDefectDeduction = null;
  61. // 临时数据源
  62. private DataTable _dtTempSource = null;
  63. //上次临时标记
  64. //private string _tempRowIndex = "";
  65. // 临时扣除数数据源
  66. private DataTable _dtTempSource2 = null;
  67. #endregion
  68. #region 属性
  69. /// <summary>
  70. /// 产品工价数据源属性
  71. /// </summary>
  72. public DataTable DtLeftDataSource
  73. {
  74. set
  75. {
  76. this._dtLeftDataSource = value;
  77. }
  78. get
  79. {
  80. if (this._dtLeftDataSource == null)
  81. {
  82. this._dtLeftDataSource = new DataTable();
  83. this._dtLeftDataSource.Columns.Add("WagesTypeID", typeof(decimal)); //工价分类ID
  84. this._dtLeftDataSource.Columns.Add("RowIndexFlag"); //行标识
  85. return this._dtLeftDataSource;
  86. }
  87. else
  88. {
  89. return this._dtLeftDataSource;
  90. }
  91. }
  92. }
  93. /// <summary>
  94. /// 质量工价数据源属性
  95. /// </summary>
  96. public DataTable DtRightDataSource
  97. {
  98. set
  99. {
  100. this._dtRightDataSource = value;
  101. }
  102. get
  103. {
  104. if (this._dtRightDataSource == null)
  105. {
  106. this._dtRightDataSource = new DataTable();
  107. this._dtRightDataSource.Columns.Add("QualityRate", typeof(decimal)); //质量区间开始
  108. this._dtRightDataSource.Columns.Add("WagesTypeID", typeof(int)); //差额
  109. this._dtRightDataSource.Columns.Add("QualityReward"); //质量工价
  110. this._dtRightDataSource.Columns.Add("RowIndexFlag", typeof(int)); //行标识
  111. return this._dtRightDataSource;
  112. }
  113. else
  114. {
  115. return this._dtRightDataSource;
  116. }
  117. }
  118. }
  119. #endregion
  120. #region 构造函数
  121. /// <summary>
  122. /// 窗体构造
  123. /// </summary>
  124. /// <param name="formType">窗体打开模式</param>
  125. /// <param name="entityId">操作实体ID</param>
  126. public F_MST_0903()
  127. {
  128. InitializeComponent();
  129. this.Text = FormTitles.F_MST_0903;
  130. this.btnSave.Text = ButtonText.BTN_SAVE;
  131. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  132. }
  133. #endregion
  134. #region 事件处理
  135. /// <summary>
  136. /// 窗体加载
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. private void F_MST_0903_Load(object sender, EventArgs e)
  141. {
  142. try
  143. {
  144. this.dgvDefect.AutoGenerateColumns = false;
  145. this.dgvDefectFine.AutoGenerateColumns = false;
  146. this.dgvDefectDeduction.AutoGenerateColumns = false;
  147. #region 加载缺陷扣罚数据源
  148. DataSet dsDefectFine = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  149. {
  150. return SystemModuleProxy.Service.GetAllDefectFineRelation();
  151. }));
  152. //if (dsDefectFine != null && dsDefectFine.Tables[0].Rows.Count > 0)
  153. //{
  154. _dtDefectFine = dsDefectFine.Tables[0];
  155. //}
  156. #endregion
  157. #region 加载缺陷扣除数数据源
  158. DataSet dsDefectDeduction = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  159. {
  160. return SystemModuleProxy.Service.GetAllDefectDeductionRelation();
  161. }));
  162. //if (dsDefectDeduction != null && dsDefectDeduction.Tables[0].Rows.Count > 0)
  163. //{
  164. _dtDefectDeduction = dsDefectDeduction.Tables[0]; ;
  165. //}
  166. #endregion
  167. #region 加载缺陷数据源
  168. DataSet defectds = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  169. {
  170. return SystemModuleProxy.Service.GetDefectData(1);
  171. }));
  172. if (defectds != null
  173. && defectds.Tables.Count > Constant.INT_IS_ZERO
  174. && defectds.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
  175. {
  176. defectds.Tables[0].DefaultView.RowFilter = "valueflag =1";
  177. this.dgvDefect.DataSource = defectds.Tables[0].DefaultView.ToTable();
  178. }
  179. #endregion
  180. #region 加载缺陷扣罚下拉数据源
  181. DataSet dsDefectFineDDL = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  182. {
  183. return SystemModuleProxy.Service.GetAllDefectFine();
  184. }));
  185. if (dsDefectFineDDL != null && dsDefectFineDDL.Tables[0].Rows.Count > 0)
  186. {
  187. defectfineID2.DataSource = dsDefectFineDDL.Tables[0];
  188. defectfineID2.DisplayMember = "DefectFineCode";
  189. defectfineID2.ValueMember = "DefectFineID";
  190. }
  191. #endregion
  192. #region 加载缺陷扣除数下拉数据源
  193. DataSet dsDefectDeductionDDL = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  194. {
  195. return SystemModuleProxy.Service.GetAllDefectDeduction();
  196. }));
  197. if (dsDefectDeductionDDL != null && dsDefectDeductionDDL.Tables[0].Rows.Count > 0)
  198. {
  199. DefectDeductionID.DataSource = dsDefectDeductionDDL.Tables[0];
  200. DefectDeductionID.DisplayMember = "DefectDeductionNum";
  201. DefectDeductionID.ValueMember = "DefectDeductionID";
  202. }
  203. #endregion
  204. }
  205. catch (Exception ex)
  206. {
  207. // 对异常进行共通处理
  208. ExceptionManager.HandleEventException(this.ToString(),
  209. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  210. }
  211. }
  212. /// <summary>
  213. /// 单元格开始编辑事件
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="e"></param>
  217. private void dgvGoods_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
  218. {
  219. }
  220. /// <summary>
  221. /// 选定项发生改变事件
  222. /// </summary>
  223. /// <param name="sender"></param>
  224. /// <param name="e"></param>
  225. private void dgvDefect_SelectionChanged(object sender, EventArgs e)
  226. {
  227. try
  228. {
  229. if (this.dgvDefect.CurrentCell != null)
  230. {
  231. if (this.dgvDefect.Rows[this.dgvDefect.CurrentCell.RowIndex].Cells["defectid"].Value.ToString() != string.Empty)
  232. {
  233. DataTable dtJobs = this._dtDefectFine;
  234. DataTable dtJobs2 = this._dtDefectDeduction;
  235. DataTable dtHistory = this.dgvDefectFine.DataSource as DataTable;//
  236. if (dtHistory != null)
  237. {
  238. _dtTempSource = dtHistory;
  239. }
  240. DataTable dtHistory2 = this.dgvDefectDeduction.DataSource as DataTable;//
  241. if (dtHistory2 != null)
  242. {
  243. _dtTempSource2 = dtHistory2;
  244. }
  245. this._currentRowIndexFlag = Convert.ToInt32(this.dgvDefect.Rows[this.dgvDefect.CurrentCell.RowIndex].Cells["defectid"].Value);
  246. //if(this._dtDefectFine!=null)
  247. //{
  248. // DataView dvDefectFine = this._dtDefectFine.DefaultView;
  249. // dvDefectFine.RowFilter = "defectid=" + this._currentRowIndexFlag;
  250. // this.dgvDefectFine.DataSource = dvDefectFine.ToTable();
  251. //}
  252. //if(this._dtDefectDeduction!=null)
  253. //{
  254. // DataView dvDefectDeduction = this._dtDefectDeduction.DefaultView;
  255. // dvDefectDeduction.RowFilter = "defectid=" + this._currentRowIndexFlag;
  256. // this.dgvDefectDeduction.DataSource = dvDefectDeduction.ToTable();
  257. //}
  258. if (_dtTempSource != null && _dtTempSource.Rows.Count > 0)
  259. {
  260. if (_dtTempSource.Rows[0]["defectid"].ToString() != "")
  261. {
  262. DataRow[] dr = dtJobs.Select("defectid=" + _dtTempSource.Rows[0]["defectid"].ToString());//this._currentRowIndexFlag
  263. //先删除掉
  264. foreach (DataRow r in dr)
  265. {
  266. r.Delete();
  267. }
  268. //重新插入
  269. for (int i = 0; i < _dtTempSource.Rows.Count; i++)
  270. {
  271. if (_dtTempSource.Rows[i]["DefectID"].ToString() != "" && _dtTempSource.Rows[i]["DefectFineID"].ToString() != "")
  272. {
  273. DataRow drNew = dtJobs.NewRow();
  274. drNew["DefectID"] = _dtTempSource.Rows[i]["DefectID"].ToString();
  275. drNew["DefectFineID"] = _dtTempSource.Rows[i]["DefectFineID"].ToString();
  276. dtJobs.Rows.Add(drNew);
  277. }
  278. }
  279. _dtTempSource = null;
  280. }
  281. }
  282. if (dtJobs != null)
  283. {
  284. DataView dv = dtJobs.DefaultView;
  285. dv.RowFilter = "defectid=" + this._currentRowIndexFlag;
  286. this.dgvDefectFine.DataSource = dv.ToTable();
  287. }
  288. if (_dtTempSource2 != null && _dtTempSource2.Rows.Count > 0)
  289. {
  290. if (_dtTempSource2.Rows[0]["defectid"].ToString() != "")
  291. {
  292. DataRow[] dr = dtJobs2.Select("defectid=" + _dtTempSource2.Rows[0]["defectid"].ToString());//this._currentRowIndexFlag
  293. //先删除掉
  294. foreach (DataRow r in dr)
  295. {
  296. r.Delete();
  297. }
  298. //重新插入
  299. for (int i = 0; i < _dtTempSource2.Rows.Count; i++)
  300. {
  301. if (_dtTempSource2.Rows[i]["DefectID"].ToString() != "" && _dtTempSource2.Rows[i]["DefectDeductionID"].ToString() != "")
  302. {
  303. DataRow drNew = dtJobs2.NewRow();
  304. drNew["DefectID"] = _dtTempSource2.Rows[i]["DefectID"].ToString();
  305. drNew["DefectDeductionID"] = _dtTempSource2.Rows[i]["DefectDeductionID"].ToString();
  306. dtJobs2.Rows.Add(drNew);
  307. }
  308. }
  309. _dtTempSource2 = null;
  310. }
  311. }
  312. if (dtJobs2 != null)
  313. {
  314. DataView dv = dtJobs2.DefaultView;
  315. dv.RowFilter = "defectid=" + this._currentRowIndexFlag;
  316. this.dgvDefectDeduction.DataSource = dv.ToTable();
  317. }
  318. }
  319. else
  320. {
  321. //DataTable dtJobs = this.DtRightDataSource;
  322. //DataTable dtHistory = this.dgvDefectFine.DataSource as DataTable;//
  323. //if (dtHistory != null && dtHistory.Rows.Count > 0)
  324. //{
  325. // // DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + (dtHistory.Rows[0]["RowIndexFlag"].ToString() == "" ? "0" : dtHistory.Rows[0]["RowIndexFlag"].ToString()));
  326. // DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + (dtHistory.Rows[0]["RowIndexFlag"].ToString() == "" ? this._currentRowIndexFlag : Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"].ToString())));
  327. // //先删除掉
  328. // foreach (DataRow r in dr)
  329. // {
  330. // r.Delete();
  331. // }
  332. // //重新插入
  333. // for (int i = 0; i < dtHistory.Rows.Count; i++)
  334. // {
  335. // if (dtHistory.Rows[i]["QualityRate"].ToString() != "" || dtHistory.Rows[i]["QualityReward"].ToString() != "")
  336. // {
  337. // DataRow drNew = DtRightDataSource.NewRow();
  338. // drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
  339. // drNew["QualityReward"] = dtHistory.Rows[i]["QualityReward"].ToString();
  340. // drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString();
  341. // DtRightDataSource.Rows.Add(drNew);
  342. // }
  343. // }
  344. // if (dtJobs != null)
  345. // {
  346. // DataView dv = dtJobs.DefaultView;
  347. // //dv.RowFilter = "RowIndexFlag=" + this._currentRowIndexFlag;
  348. // dv.RowFilter = "RowIndexFlag=-1";
  349. // this.dgvDefectFine.DataSource = dv.ToTable();
  350. // }
  351. // //}
  352. //}
  353. //else
  354. //{
  355. // if (dtJobs != null)
  356. // {
  357. // DataView dv = dtJobs.DefaultView;
  358. // dv.RowFilter = "RowIndexFlag=-1";
  359. // this.dgvDefectFine.DataSource = dv.ToTable();
  360. // }
  361. // else
  362. // {
  363. // this.dgvDefectFine.DataSource = null;
  364. // }
  365. //}
  366. }
  367. }
  368. this.dgvDefectFine.IsSetInputColumnsColor = true;
  369. }
  370. catch (Exception ex)
  371. {
  372. // 对异常进行共通处理
  373. ExceptionManager.HandleEventException(this.ToString(),
  374. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  375. }
  376. }
  377. /// <summary>
  378. /// 保存按钮事件
  379. /// </summary>
  380. /// <param name="sender"></param>
  381. /// <param name="e"></param>
  382. private void btnSave_Click_1(object sender, EventArgs e)
  383. {
  384. try
  385. {
  386. dgvDefect_SelectionChanged(null, null);
  387. if (this._dtDefectFine == null || this._dtDefectFine.Rows.Count == 0)
  388. {
  389. return;
  390. }
  391. if (this._dtDefectDeduction == null || this._dtDefectDeduction.Rows.Count == 0)
  392. {
  393. return;
  394. }
  395. //// 获取缺陷数据源,校验是否有重重的数据
  396. //DataTable dtDefect = this.dgvDefect.DataSource as DataTable;
  397. //bool isError = false;
  398. //int ErrorIndex = 0;
  399. //for (int i = 0; i < dtDefect.Rows.Count; i++)
  400. //{
  401. // DataRow[] dr = _dtDefectFine.Select("defectid=" + dtDefect.Rows[i]["defectid"]);
  402. // if(dr.Length>1)
  403. // {
  404. // ErrorIndex = i;
  405. // isError = true;
  406. // break;
  407. // }
  408. //}
  409. //if(isError)
  410. //{
  411. // this.dgvDefect.Rows[ErrorIndex].Selected = true;
  412. // // 提示信息
  413. // MessageBox.Show("当前缺陷有重复的缺陷扣罚",
  414. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  415. // return;
  416. //}
  417. //for (int i = 0; i < dtDefect.Rows.Count; i++)
  418. //{
  419. // DataRow[] dr = _dtDefectDeduction.Select("defectid=" + dtDefect.Rows[i]["defectid"]);
  420. // if (dr.Length > 1)
  421. // {
  422. // ErrorIndex = i;
  423. // isError = true;
  424. // break;
  425. // }
  426. //}
  427. //if (isError)
  428. //{
  429. // this.dgvDefect.Rows[ErrorIndex].Selected = true;
  430. // // 提示信息
  431. // MessageBox.Show("当前缺陷有重复的缺陷扣除数",
  432. // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  433. // return;
  434. //}
  435. int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
  436. {
  437. return SystemModuleProxy.Service.SaveDefectRelation(this._dtDefectFine, this._dtDefectDeduction);
  438. }));
  439. if (returnValue >= 0) //等于O,表示未修改数据,影响行为0
  440. {
  441. // 提示信息
  442. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
  443. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  444. }
  445. else if (returnValue == -1)
  446. {
  447. // 提示信息
  448. MessageBox.Show("保存失败",
  449. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  450. }
  451. }
  452. catch (Exception ex)
  453. {
  454. // 对异常进行共通处理
  455. ExceptionManager.HandleEventException(this.ToString(),
  456. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  457. }
  458. }
  459. #endregion
  460. #region 私有方法
  461. /// <summary>
  462. /// 绑定编辑数据
  463. /// </summary>
  464. private void BindData()
  465. {
  466. try
  467. {
  468. DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  469. {
  470. return PAMModuleProxy.Service.GetQualityASSByID(Convert.ToInt32(this._PieceTacticsID));
  471. }));
  472. if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
  473. {
  474. //绑定主信息
  475. //////if (dsResultAccount.Tables[0].Rows[0]["PayPlanID"].ToString() != "")
  476. //////{
  477. ////// this.cmbPayPlan.SelectedValue = dsResultAccount.Tables[0].Rows[0]["PayPlanID"].ToString();
  478. //////}
  479. //////this.cmbDefectFine.SelectedValue = dsResultAccount.Tables[0].Rows[0]["DefectFine"].ToString();
  480. ////////this.dkQualityBaseProcedure.ProcedureID = Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedureID"]);
  481. ////////this.dkQualityBaseProcedure.Text = dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedure"].ToString();
  482. //////this.txtPayPlanName.Text = dsResultAccount.Tables[0].Rows[0]["QualityTacticsName"].ToString();
  483. //if (dsResultAccount.Tables[3].Rows.Count > 0)
  484. //{
  485. // string IDS = "";
  486. // string TextS = "";
  487. // foreach (DataRow r1 in dsResultAccount.Tables[3].Rows)
  488. // {
  489. // TextS += r1["ProcedureName"].ToString() + ",";
  490. // IDS += r1["ProcedureID"].ToString() + ",";
  491. // }
  492. // IDS = IDS.Trim(',');
  493. // TextS = TextS.Trim(',');
  494. // if (IDS != "")
  495. // {
  496. // //this.dkQualityBaseProcedure.Text = TextS;
  497. // //this.dkQualityBaseProcedure.ProcedureIDS = IDS;
  498. // }
  499. //}
  500. if (dsResultAccount != null && dsResultAccount.Tables[1].Rows.Count > 0)
  501. {
  502. //产品工价
  503. this._selectedrow = dsResultAccount.Tables[1].Rows.Count;
  504. for (int i = 0; i < dsResultAccount.Tables[1].Rows.Count; i++)
  505. {
  506. DataRow dr = this.DtLeftDataSource.NewRow();
  507. dr["WagesTypeID"] = dsResultAccount.Tables[1].Rows[i]["WagesTypeID"];
  508. dr["RowIndexFlag"] = i;
  509. this.DtLeftDataSource.Rows.Add(dr);
  510. //this._selectedrow++;//用于过滤边条件
  511. if (dsResultAccount != null && dsResultAccount.Tables[2].Rows.Count > 0)
  512. {
  513. DataRow[] r = dsResultAccount.Tables[2].Select("WagesTypeID=" + dsResultAccount.Tables[1].Rows[i]["WagesTypeID"]);
  514. if (r.Length > 0)
  515. {
  516. foreach (DataRow rr in r)
  517. {
  518. DataRow dr2 = this.DtRightDataSource.NewRow();
  519. dr2["QualityRate"] = Convert.ToDecimal(rr["QualityRate"]) * 100;
  520. dr2["WagesTypeID"] = rr["WagesTypeID"];
  521. dr2["QualityReward"] = rr["QualityReward"];
  522. dr2["RowIndexFlag"] = i;
  523. this.DtRightDataSource.Rows.Add(dr2);
  524. }
  525. }
  526. }
  527. }
  528. }
  529. DataView dv = this.DtRightDataSource.DefaultView;
  530. dv.RowFilter = "RowIndexFlag=0";
  531. this.dgvDefectFine.DataSource = dv.ToTable();// DtRightDataSource;
  532. this.dgvDefect.DataSource = DtLeftDataSource;
  533. }
  534. }
  535. catch (Exception ex)
  536. {
  537. throw ex;
  538. }
  539. }
  540. #endregion
  541. /// <summary>
  542. /// 删除行时
  543. /// </summary>
  544. /// <param name="sender"></param>
  545. /// <param name="e"></param>
  546. private void dgvGoods_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
  547. {
  548. }
  549. private void dgvQualityWages_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
  550. {
  551. }
  552. private void F_PAM_0402_Shown(object sender, EventArgs e)
  553. {
  554. this.dgvDefectFine.IsSetInputColumnsColor = true;
  555. }
  556. private void dgvDefectFine_CellValidated(object sender, DataGridViewCellEventArgs e)
  557. {
  558. if ((e.ColumnIndex == 0 || e.ColumnIndex == 1) && e.RowIndex != -Constant.INT_IS_ONE)
  559. {
  560. this.dgvDefectFine.Rows[this.dgvDefectFine.CurrentCell.RowIndex].Cells["defectid1"].Value = this._currentRowIndexFlag;
  561. }
  562. }
  563. private void dgvDefectDeduction_CellValidated(object sender, DataGridViewCellEventArgs e)
  564. {
  565. if ((e.ColumnIndex == 0 || e.ColumnIndex == 1) && e.RowIndex != -Constant.INT_IS_ONE)
  566. {
  567. this.dgvDefectDeduction.Rows[this.dgvDefectDeduction.CurrentCell.RowIndex].Cells["defectid2"].Value = this._currentRowIndexFlag;
  568. }
  569. }
  570. }
  571. }