| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PAM_0402.cs
- * 2.功能描述:新建/编辑产品品质、品质考核
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/08/18 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels.PAMModule;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
- namespace Dongke.IBOSS.PRD.Client.PAMModule
- {
- public partial class F_PAM_0402 : FormBase
- {
- #region 成员变量
- // 窗体模式ID
- private Constant.FormMode _formType;
- // 操作实体ID(方案)
- private int? _entityId;
- // 工序
- private DataSet _dsProcedure = new DataSet();
- // 工种编码值
- //private string _GoodsCodeValue;
- //private bool _ShowFlag = true;
- // 数据源
- DataTable dt = null;
- // 当前工资方案ID
- //private int? _currentWagesTypeID = null;
- // 产品全部数据集
- //DataTable dtAllDataLeft = null;
- // 质量全部数据集
- DataTable dtAllDataRight = null;
- // 产品工价数据源
- DataTable _dtLeftDataSource = null;
- // 质量工价数据源
- DataTable _dtRightDataSource = null;
- // 当前行ID
- private int _selectedrow = -1;
- // 当前选定行
- private int _currentRowIndexFlag = 0;
- // 当前标准工价
- private int _currentStandardWages = 0;
- // 计件工资策略ID
- private int? _PieceTacticsID = null;
- #endregion
- #region 属性
- /// <summary>
- /// 产品工价数据源属性
- /// </summary>
- public DataTable DtLeftDataSource
- {
- set
- {
- this._dtLeftDataSource = value;
- }
- get
- {
- if (this._dtLeftDataSource == null)
- {
- this._dtLeftDataSource = new DataTable();
- this._dtLeftDataSource.Columns.Add("WagesTypeID", typeof(decimal)); //工价分类ID
- this._dtLeftDataSource.Columns.Add("RowIndexFlag"); //行标识
- return this._dtLeftDataSource;
- }
- else
- {
- return this._dtLeftDataSource;
- }
- }
- }
- /// <summary>
- /// 质量工价数据源属性
- /// </summary>
- public DataTable DtRightDataSource
- {
- set
- {
- this._dtRightDataSource = value;
- }
- get
- {
- if (this._dtRightDataSource == null)
- {
- this._dtRightDataSource = new DataTable();
- this._dtRightDataSource.Columns.Add("QualityRate", typeof(decimal)); //质量区间开始
- this._dtRightDataSource.Columns.Add("WagesTypeID", typeof(int)); //差额
- this._dtRightDataSource.Columns.Add("QualityReward"); //质量工价
- this._dtRightDataSource.Columns.Add("RowIndexFlag", typeof(int)); //行标识
- return this._dtRightDataSource;
- }
- else
- {
- return this._dtRightDataSource;
- }
- }
- }
- #endregion
- #region 构造函数
- /// <summary>
- /// 窗体构造
- /// </summary>
- /// <param name="formType">窗体打开模式</param>
- /// <param name="entityId">操作实体ID</param>
- public F_PAM_0402(Constant.FormMode formType, int entityId)
- {
- InitializeComponent();
- this._formType = formType;
- this._entityId = entityId;
- this._PieceTacticsID = entityId;
- // 窗体显示的Title
- if (this._formType == Constant.FormMode.Add)
- {
- this.Text = FormTitles.F_PAM_0402_ADD;
- }
- else if (this._formType == Constant.FormMode.Edit)
- {
- this.Text = FormTitles.F_PAM_0402_EDIT;
- }
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_0702_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvWages.AutoGenerateColumns = false;
- this.dgvQualityWages.AutoGenerateColumns = false;
- //BindPieceType();//绑定计件工序类型
- // 绑定工资方案数据源
- DataSet dsPayPlan = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetPayPlan();
- }));
- if (dsPayPlan != null && dsPayPlan.Tables[0].Rows.Count > 0)
- {
- DataRow dr = dsPayPlan.Tables[0].NewRow();
- dr["PayPlanName"] = "";
- dr["PayPlanID"] = -1;
- dsPayPlan.Tables[0].Rows.InsertAt(dr, 0);
- cmbPayPlan.DataSource = dsPayPlan.Tables[0];
- cmbPayPlan.DisplayMember = "PayPlanName";
- cmbPayPlan.ValueMember = "PayPlanID";
- }
- // 绑定工价分类数据源
- DataSet dsWagesType = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetAllWagesType();
- }));
- if (dsWagesType != null && dsWagesType.Tables[0].Rows.Count > 0)
- {
- //DataView dv = dsWagesType.Tables[0].DefaultView;
- //dv.RowFilter = "valueflag=1";
- //this.WagesTypeID.DataSource = dv.ToTable();
- //this.WagesTypeID.DisplayMember = "WagesTypeName";
- //this.WagesTypeID.ValueMember = "WagesTypeID";
- DataView dv = dsWagesType.Tables[0].DefaultView;
- dv.RowFilter = "valueflag=1";
- DataTable dtWagesType = dv.ToTable();
- this.WagesTypeID.DataSource = dtWagesType;
- this.WagesTypeID.DisplayMember = "WagesTypeName";
- this.WagesTypeID.ValueMember = "WagesTypeID";
- if (this._formType == Constant.FormMode.Add)
- {
- for (int i = 0; i < dtWagesType.Rows.Count; i++)
- {
- DataRow dr = DtLeftDataSource.NewRow();
- dr["WagesTypeID"] = dtWagesType.Rows[i]["WagesTypeID"].ToString();
- dr["RowIndexFlag"] = i;
- DtLeftDataSource.Rows.Add(dr);
- }
- }
- }
- // 加载缺陷扣罚管理数据
- this.GetAllDefectFine();
- //// 缺陷扣罚
- //DataSet dsDefectFine = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return SystemModuleProxy.Service.GetDictionaryData(0, "ASE002");
- //}));
- //this.cmbDefectFine.DisplayMember = "DictionaryValue";
- //this.cmbDefectFine.ValueMember = "DictionaryID";
- //this.cmbDefectFine.DataSource = dsDefectFine.Tables[0];
- //如果是修改,要绑定选中的信息
- if (this._formType == Constant.FormMode.Edit)
- {
- DataSet dsWagesType2 = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetAllWagesType();
- }));
- if (dsWagesType2 != null && dsWagesType2.Tables[0].Rows.Count > 0)
- {
- DataView dv = dsWagesType2.Tables[0].DefaultView;
- dv.RowFilter = "valueflag=1";
- DataTable dtWagesType = dv.ToTable();
- this.WagesTypeID.DataSource = dtWagesType;
- this.WagesTypeID.DisplayMember = "WagesTypeName";
- this.WagesTypeID.ValueMember = "WagesTypeID";
- }
- //BindJobsData();//编辑工种数据源
- BindData();//绑定工资工种数据源
- }
- //如果是新建,选项默认值设定
- else if (this._formType == Constant.FormMode.Add)
- {
- this.dgvWages.DataSource = DtLeftDataSource;
- this.dgvQualityWages.DataSource = DtRightDataSource.Copy(); ;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 获取缺陷扣罚管理的全部数据
- /// </summary>
- /// <param name="sUserInfo">用户信息</param>
- /// <returns></returns>
- /// <remarks>
- /// 2016.1.5 王鑫 新建
- /// </remarks>
- private void GetAllDefectFine()
- {
- try
- {
- DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return SystemModuleProxy.Service.GetAllDefectFine();
- }));
- if(dsResultAccount!=null && dsResultAccount.Tables[0].Rows.Count>0)
- {
- DataView dv = dsResultAccount.Tables[0].DefaultView;
- dv.RowFilter = "valueflag=1";
- this.cmbDefectFine.DisplayMember = "DefectFineCode";
- this.cmbDefectFine.ValueMember = "DefectFineID";
- this.cmbDefectFine.DataSource = dv.ToTable();
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 单元格开始编辑事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvGoods_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
- {
- }
- /// <summary>
- /// 选定项发生改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWagesType_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvWages.CurrentCell != null)
- {
- if (this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["RowIndexFlag"].Value.ToString() != string.Empty)
- {
- this._currentRowIndexFlag = Convert.ToInt32(this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["RowIndexFlag"].Value);
- if (this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["RowIndexFlag"].Value.ToString() != "")
- {
- //if (this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["StandardWages"].Value.ToString() != "")
- //{
- // this._currentStandardWages = Convert.ToInt32(this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["StandardWages"].Value);
- //}
- }
- DataTable dtJobs = this.DtRightDataSource;
- DataTable dtHistory = this.dgvQualityWages.DataSource as DataTable;//
- if (dtHistory != null)
- {
- dtHistory = dtHistory.Copy();
- }
- if (dtHistory != null && dtHistory.Rows.Count > 0)
- {
- if (dtHistory.Rows[0]["RowIndexFlag"].ToString() != "")
- {
- //DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + dtHistory.Rows[0]["RowIndexFlag"]);
- DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + (dtHistory.Rows[0]["RowIndexFlag"].ToString() == "" ? this._currentRowIndexFlag : Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"].ToString())));
- //先删除掉
- foreach (DataRow r in dr)
- {
- r.Delete();
- }
- //重新插入
- for (int i = 0; i < dtHistory.Rows.Count; i++)
- {
- if (dtHistory.Rows[i]["QualityRate"].ToString() != "" || dtHistory.Rows[i]["QualityReward"].ToString() != "")
- {
- DataRow drNew = DtRightDataSource.NewRow();
- drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
- drNew["QualityReward"] = dtHistory.Rows[i]["QualityReward"].ToString();
- drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString();
- DtRightDataSource.Rows.Add(drNew);
- }
- }
- }
- }
- if (dtJobs != null)
- {
- DataView dv = dtJobs.DefaultView;
- dv.RowFilter = "RowIndexFlag=" + this._currentRowIndexFlag;
- this.dgvQualityWages.DataSource = dv.ToTable();
- }
- }
- else
- {
- //this._selectedrow++;
- //int rowindex = this._selectedrow;
- //this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["RowIndexFlag"].Value = rowindex;
- //this._currentRowIndexFlag = rowindex;
- //this._currentStandardWages = 0;
- DataTable dtJobs = this.DtRightDataSource;
- DataTable dtHistory = this.dgvQualityWages.DataSource as DataTable;//
- if (dtHistory != null && dtHistory.Rows.Count > 0)
- {
- // DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + (dtHistory.Rows[0]["RowIndexFlag"].ToString() == "" ? "0" : dtHistory.Rows[0]["RowIndexFlag"].ToString()));
- DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + (dtHistory.Rows[0]["RowIndexFlag"].ToString() == "" ? this._currentRowIndexFlag : Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"].ToString())));
- //先删除掉
- foreach (DataRow r in dr)
- {
- r.Delete();
- }
- //重新插入
- for (int i = 0; i < dtHistory.Rows.Count; i++)
- {
- if (dtHistory.Rows[i]["QualityRate"].ToString() != "" || dtHistory.Rows[i]["QualityReward"].ToString() != "")
- {
- DataRow drNew = DtRightDataSource.NewRow();
- drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
- drNew["QualityReward"] = dtHistory.Rows[i]["QualityReward"].ToString();
- drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString();
- DtRightDataSource.Rows.Add(drNew);
- }
- }
- if (dtJobs != null)
- {
- DataView dv = dtJobs.DefaultView;
- //dv.RowFilter = "RowIndexFlag=" + this._currentRowIndexFlag;
- dv.RowFilter = "RowIndexFlag=-1";
- this.dgvQualityWages.DataSource = dv.ToTable();
- }
- //}
- }
- else
- {
- if (dtJobs != null)
- {
- DataView dv = dtJobs.DefaultView;
- dv.RowFilter = "RowIndexFlag=-1";
- this.dgvQualityWages.DataSource = dv.ToTable();
- }
- else
- {
- this.dgvQualityWages.DataSource = null;
- }
- }
- }
- }
- this.dgvQualityWages.IsSetInputColumnsColor = true;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click_1(object sender, EventArgs e)
- {
- try
- {
-
- if (string.IsNullOrEmpty(this.txtPayPlanName.Text))
- {
- // 提示信息
- MessageBox.Show("策略名称不能为空",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- DataTable dtLeft = this.dgvWages.DataSource as DataTable;
- DataView dv = dtLeft.DefaultView;
- dv.RowFilter = "WagesTypeID>0";
- dtLeft = dv.ToTable();
- dtLeft.AcceptChanges();
- if (dtLeft.Rows.Count == 0)
- {
- MessageBox.Show("请添写工价分类信息",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (this.DtRightDataSource != null && this.DtRightDataSource.Rows.Count == 0)
- {
- MessageBox.Show("请添写工价分类明细信息",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- QualityASS entity = new QualityASS();
- entity.QualityASSTacticsID = this._PieceTacticsID;
- if (cmbPayPlan.SelectedValue.ToString() != "-1")
- {
- entity.PayPlanID = Convert.ToInt32(cmbPayPlan.SelectedValue);
- }
- entity.DefectFine = Convert.ToInt32(this.cmbDefectFine.SelectedValue);
- //entity.QualityBaseProcedureIDS = this.dkQualityBaseProcedure.ProcedureIDS;//质量基数工序
- entity.QualityTacticsName = this.txtPayPlanName.Text;
- if (dtLeft != null && dtLeft.Rows.Count > 0)
- {
- List<WCF.DataModels.PAMModule.QualityGoods> qagesentitys = new List<WCF.DataModels.PAMModule.QualityGoods>();
- for (int i = 0; i < dtLeft.Rows.Count; i++)
- {
- WCF.DataModels.PAMModule.QualityGoods wageentity = new WCF.DataModels.PAMModule.QualityGoods();
- wageentity.WagesTypeID = Convert.ToInt32(dtLeft.Rows[i]["WagesTypeID"]);
- //质量工价
- if (this.DtRightDataSource != null && this.DtRightDataSource.Rows.Count > 0)
- {
- List<WCF.DataModels.PAMModule.QualityReward> qualityWagesEntitys = new List<WCF.DataModels.PAMModule.QualityReward>();
- //for (int j = 0; j < DtRightDataSource.Rows.Count; j++)
- //{
- // DataRow[] drWagesTypeID = dtLeft.Select("RowIndexFlag=" + DtRightDataSource.Rows[j]["RowIndexFlag".ToString()]);
- //if (drWagesTypeID.Length > 0)
- //{
- DataRow[] dr2 = DtRightDataSource.Select("RowIndexFlag=" + dtLeft.Rows[i]["RowIndexFlag".ToString()]);
- foreach (DataRow r in dr2)
- {
- WCF.DataModels.PAMModule.QualityReward qualityWagesEntity = new WCF.DataModels.PAMModule.QualityReward();
- qualityWagesEntity.WagesTypeID = Convert.ToInt32(dtLeft.Rows[i]["WagesTypeID"]);
- qualityWagesEntity.QualityRate = Convert.ToDecimal(r["QualityRate"].ToString() == "" ? 0 : r["QualityRate"]) / 100;
- qualityWagesEntity.QualityReward2 = Convert.ToDecimal(r["QualityReward"].ToString() == "" ? 0 : r["QualityReward"]);
- qualityWagesEntitys.Add(qualityWagesEntity);
- }
- // }
- // }
- wageentity.qualityReward = qualityWagesEntitys;
- }
- qagesentitys.Add(wageentity);
- }
- entity.qualityGoods = qagesentitys;
- }
- int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.SaveQualityASS(entity);
- }));
- if (returnValue >= 0) //等于O,表示未修改数据,影响行为0
- {
- // 提示信息
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- }
- else if (returnValue == -1)
- {
- // 提示信息
- MessageBox.Show("一个解决方案只能对应一个计件工资策略",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (returnValue == -2)
- {
- // 提示信息
- MessageBox.Show("工价分类不能重复在工资方案使用",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else if (returnValue == -3)
- {
- // 提示信息
- MessageBox.Show("质量区间不能重复",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 绑定编辑数据
- /// </summary>
- private void BindData()
- {
- try
- {
- DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetQualityASSByID(Convert.ToInt32(this._PieceTacticsID));
- }));
- if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
- {
- //绑定主信息
- if (dsResultAccount.Tables[0].Rows[0]["PayPlanID"].ToString() != "")
- {
- this.cmbPayPlan.SelectedValue = dsResultAccount.Tables[0].Rows[0]["PayPlanID"].ToString();
- }
- this.cmbDefectFine.SelectedValue = dsResultAccount.Tables[0].Rows[0]["DefectFine"].ToString();
- //this.dkQualityBaseProcedure.ProcedureID = Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedureID"]);
- //this.dkQualityBaseProcedure.Text = dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedure"].ToString();
- this.txtPayPlanName.Text = dsResultAccount.Tables[0].Rows[0]["QualityTacticsName"].ToString();
- //if (dsResultAccount.Tables[3].Rows.Count > 0)
- //{
- // string IDS = "";
- // string TextS = "";
- // foreach (DataRow r1 in dsResultAccount.Tables[3].Rows)
- // {
- // TextS += r1["ProcedureName"].ToString() + ",";
- // IDS += r1["ProcedureID"].ToString() + ",";
- // }
- // IDS = IDS.Trim(',');
- // TextS = TextS.Trim(',');
- // if (IDS != "")
- // {
- // //this.dkQualityBaseProcedure.Text = TextS;
- // //this.dkQualityBaseProcedure.ProcedureIDS = IDS;
- // }
- //}
- if (dsResultAccount != null && dsResultAccount.Tables[1].Rows.Count > 0)
- {
- //产品工价
- this._selectedrow = dsResultAccount.Tables[1].Rows.Count;
- for (int i = 0; i < dsResultAccount.Tables[1].Rows.Count; i++)
- {
- DataRow dr = this.DtLeftDataSource.NewRow();
- dr["WagesTypeID"] = dsResultAccount.Tables[1].Rows[i]["WagesTypeID"];
- dr["RowIndexFlag"] = i;
- this.DtLeftDataSource.Rows.Add(dr);
- //this._selectedrow++;//用于过滤边条件
- if (dsResultAccount != null && dsResultAccount.Tables[2].Rows.Count > 0)
- {
- DataRow[] r = dsResultAccount.Tables[2].Select("WagesTypeID=" + dsResultAccount.Tables[1].Rows[i]["WagesTypeID"]);
- if (r.Length > 0)
- {
- foreach (DataRow rr in r)
- {
- DataRow dr2 = this.DtRightDataSource.NewRow();
- dr2["QualityRate"] = Convert.ToDecimal(rr["QualityRate"]) * 100;
- dr2["WagesTypeID"] = rr["WagesTypeID"];
- dr2["QualityReward"] = rr["QualityReward"];
- dr2["RowIndexFlag"] = i;
- this.DtRightDataSource.Rows.Add(dr2);
- }
- }
- }
- }
- }
- DataView dv = this.DtRightDataSource.DefaultView;
- dv.RowFilter = "RowIndexFlag=0";
- this.dgvQualityWages.DataSource = dv.ToTable();// DtRightDataSource;
- this.dgvWages.DataSource = DtLeftDataSource;
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- /// <summary>
- /// 删除行时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvGoods_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
- {
- }
- /// <summary>
- /// 产品工价添加行事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWages_UserAddedRow(object sender, DataGridViewRowEventArgs e)
- {
- try
- {
- if (e.Row.Index != -1)
- {
- if (this.dgvWages.CurrentCell != null)
- {
- this._selectedrow++;//用于过滤边条件
- this._currentRowIndexFlag = this._selectedrow;
- this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["RowIndexFlag"].Value = this._selectedrow;
- }
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- private void dgvQualityWages_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
- {
-
- }
- private void F_PAM_0402_Shown(object sender, EventArgs e)
- {
- this.dgvQualityWages.IsSetInputColumnsColor = true;
- }
- private void dgvQualityWages_CellValidated(object sender, DataGridViewCellEventArgs e)
- {
- if ((e.ColumnIndex == 0 || e.ColumnIndex == 1) && e.RowIndex != -Constant.INT_IS_ONE)
- {
- this.dgvQualityWages.Rows[this.dgvQualityWages.CurrentCell.RowIndex].Cells["RowIndexFlag1"].Value = this._currentRowIndexFlag;
- }
- }
- }
- }
|