| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PAM_0203.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_0302 : 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 decimal _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("StandardWages", typeof(decimal)); //标准工价
- this._dtLeftDataSource.Columns.Add("DamageSubsidyRate", typeof(decimal)); //损坯补贴系数
- this._dtLeftDataSource.Columns.Add("DamageSubsidy", typeof(decimal)); //损坯补贴
- this._dtLeftDataSource.Columns.Add("RSuperiorCoefficient", typeof(decimal)); //干补正品系数
- this._dtLeftDataSource.Columns.Add("RQualifiedCoefficient", typeof(decimal)); //干补副品系数
- this._dtLeftDataSource.Columns.Add("RepairSubsidyRate", typeof(decimal)); //干补补贴系数
- this._dtLeftDataSource.Columns.Add("RepairSubsidy", typeof(decimal)); //干补补贴
- 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("Balance", typeof(decimal)); //差额
- this._dtRightDataSource.Columns.Add("QualityWages", typeof(decimal)); //质量工价
- 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_0302(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_0302_ADD;
- }
- else if (this._formType == Constant.FormMode.Edit)
- {
- this.Text = FormTitles.F_PAM_0302_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";
- //}
- //如果是修改,要绑定选中的信息
- if (this._formType == Constant.FormMode.Edit)
- {
- //BindJobsData();//编辑工种数据源
- 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";
- DataTable dtWagesType = dv.ToTable();
- this.WagesTypeID.DataSource = dtWagesType;
- this.WagesTypeID.DisplayMember = "WagesTypeName";
- this.WagesTypeID.ValueMember = "WagesTypeID";
- }
- BindData();//绑定工资工种数据源
- }
- //如果是新建,选项默认值设定
- else if (this._formType == Constant.FormMode.Add)
- {
- // 绑定工价分类数据源
- 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";
- DataTable dtWagesType = dv.ToTable();
- this.WagesTypeID.DataSource = dtWagesType;
- this.WagesTypeID.DisplayMember = "WagesTypeName";
- this.WagesTypeID.ValueMember = "WagesTypeID";
- for (int i = 0; i < dtWagesType.Rows.Count; i++)
- {
- DataRow dr = DtLeftDataSource.NewRow();
- dr["WagesTypeID"] = dtWagesType.Rows[i]["WagesTypeID"].ToString();
- dr["StandardWages"] = 0;
- dr["DamageSubsidyRate"] = 1;
- dr["DamageSubsidy"] = 0;
- dr["RSuperiorCoefficient"] = 1;
- dr["RQualifiedCoefficient"] = 1;
- dr["RepairSubsidyRate"] = 1;
- dr["RepairSubsidy"] = 0;
- dr["RowIndexFlag"] = i;
- DtLeftDataSource.Rows.Add(dr);
- }
- }
- this.dgvWages.DataSource = DtLeftDataSource;
- this.dgvQualityWages.DataSource = DtRightDataSource;
- }
- }
- 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 btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 窗体释放
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_0702_FormClosed(object sender, FormClosedEventArgs e)
- {
- this.Dispose();
- }
- /// <summary>
- /// 数据统计工序变更
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvGoods_CellValueChanged(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- if (this.dgvQualityWages.Rows.Count <= 1)
- {
- return;
- }
- DataGridViewRow rowItem = this.dgvQualityWages.Rows[e.RowIndex];
- DataGridViewColumn columnItem = this.dgvQualityWages.Columns[e.ColumnIndex];
- // 用编号获取产品信息
- if ("GoodsCode".Equals(columnItem.Name))
- {
- string GoodsID = "";
- if (this.dgvQualityWages.Rows[e.RowIndex].Cells["GoodsID"].Value != null)
- {
- GoodsID = this.dgvQualityWages.Rows[e.RowIndex].Cells["GoodsID"].Value.ToString();
- }
- DataTable dtDataSource = FormUtility.BindGoodsRowDataSource(this.dgvQualityWages,
- e.RowIndex, columnItem.Name, _GoodsCodeValue);
- int row = e.RowIndex;
- // 返回多少行,进而给每个单元格传值,为的以后多个工资方案进行筛选
- if (dtDataSource != null && dtDataSource.Rows.Count > 0)
- {
- for (int i = 0; i < dtDataSource.Rows.Count; i++)
- {
- //this.dgvGoods.Rows[row].Cells["WagesTypeID1"].Value = this._currentWagesTypeID;
- //DataRow dr = this.dtAllData.NewRow();
- //dr["GoodsID"] = dtDataSource.Rows[i]["GoodsID"];
- //dr["GoodsCode"] = dtDataSource.Rows[i]["GoodsCode"];
- //dr["GoodsName"] = dtDataSource.Rows[i]["GoodsName"];
- //dr["WagesTypeID"] = this._currentWagesTypeID;
- //dtAllData.Rows.Add(dr);
- //row++;
- //如果存在数据集中,此列标记删除
- this.dgvQualityWages.Rows[row].Cells["WagesTypeID1"].Value = this._currentWagesTypeID;
- if (dtAllDataRight != null && GoodsID != "")
- {
- DataRow[] drSel = dtAllDataRight.Select(string.Format("WagesTypeID={0} and GoodsID={1}", this._currentWagesTypeID, GoodsID));
- if (drSel.Length > 0) //存在,需要更把此行删除
- {
- drSel[0].Delete();
- }
- }
- if (GoodsID == "") //新增的时候,是否存在相同的工种编码
- {
- //DataRow[] drSel = dtAllData.Select(string.Format("WagesTypeID={0} and GoodsID='{1}'", this._currentWagesTypeID, GoodsID));
- //if (drSel.Length == 0) //不存在,把此行添加进来
- //{
- DataRow dr = this.dtAllDataRight.NewRow();
- dr["GoodsID"] = dtDataSource.Rows[i]["GoodsID"];
- dr["GoodsCode"] = dtDataSource.Rows[i]["GoodsCode"];
- dr["GoodsName"] = dtDataSource.Rows[i]["GoodsName"];
- dr["WagesTypeID"] = this._currentWagesTypeID;
- dtAllDataRight.Rows.Add(dr);
- row++;
- // }
- }
- else
- {
- DataRow dr = this.dtAllDataRight.NewRow();
- dr["GoodsID"] = dtDataSource.Rows[i]["GoodsID"];
- dr["GoodsCode"] = dtDataSource.Rows[i]["GoodsCode"];
- dr["GoodsName"] = dtDataSource.Rows[i]["GoodsName"];
- dr["WagesTypeID"] = this._currentWagesTypeID;
- dtAllDataRight.Rows.Add(dr);
- row++;
- }
- }
- this.dgvQualityWages.Rows[e.RowIndex].Selected = true;
- }
- // 设置可输入单元格的颜色
- 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 dgvGoods_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
- {
- //try
- //{
- // if (this.dgvQualityWages.Rows.Count <= 1 || !_ShowFlag)
- // {
- // return;
- // }
- // DataGridViewColumn columnItem = this.dgvQualityWages.Columns[e.ColumnIndex];
- // //if ("GoodsCode".Equals(columnItem.Name))
- // //{
- // //_ShowFlag = false;
- // //_GoodsCodeValue = this.dgvQualityWages.Rows[e.RowIndex].Cells[columnItem.Name].Value + "";
- // this.dgvQualityWages.Rows[e.RowIndex].Cells["RowIndexFlag1"].Value = this._currentRowIndexFlag;
- // // }
- // _ShowFlag = true;
- //}
- //catch (Exception ex)
- //{
- // _ShowFlag = true;
- // // 对异常进行共通处理
- // ExceptionManager.HandleEventException(this.ToString(),
- // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- //}
- }
- /// <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.ToDecimal(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.Rows.Count > 0)
- {
- 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]["Balance"].ToString() != "")
- {
- DataRow drNew = DtRightDataSource.NewRow();
- drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
- drNew["Balance"] = dtHistory.Rows[i]["Balance"].ToString();
- drNew["QualityWages"] = dtHistory.Rows[i]["QualityWages"].ToString();
- drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString() == "" ? Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"]) : Convert.ToInt32(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() == "" ? 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]["Balance"].ToString() != "")
- {
- DataRow drNew = DtRightDataSource.NewRow();
- drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
- drNew["Balance"] = dtHistory.Rows[i]["Balance"].ToString();
- drNew["QualityWages"] = dtHistory.Rows[i]["QualityWages"].ToString();
- drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString() == "" ? Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"]) : Convert.ToInt32(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 (this.dkPieceProcedure.ProcedureIDS == null)
- {
- // 提示信息
- MessageBox.Show("计件工序不能为空",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (this.txtPayPlanName.Text.Trim() == "")
- {
- // 提示信息
- MessageBox.Show("策略名称不能为空",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (this.dkQualityBaseProcedure.ProcedureIDS == null)
- {
- // 提示信息
- MessageBox.Show("质量基数工序不能为空",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- PieceworkEntity entity = new PieceworkEntity();
- entity.PieceTacticsID = this._PieceTacticsID;
- if (cmbPayPlan.SelectedValue.ToString() != "-1")
- {
- entity.PayPlanID = Convert.ToInt32(cmbPayPlan.SelectedValue);
- }
- entity.PieceType = Convert.ToInt32(cmbPieceType.SelectedValue);
- entity.PayPlanName = this.txtPayPlanName.Text.Trim();
- entity.QualityBaseProcedureIDS = this.dkQualityBaseProcedure.ProcedureIDS;//质量基数工序
- entity.DamageCoefficient = this.txtDamageCoefficient.Text.Trim() == "" ? 1 : Convert.ToDecimal(this.txtDamageCoefficient.Text.Trim());
- entity.UnqualifiedCoefficient = this.txtUnqualifiedCoefficient.Text.Trim() == "" ? 1 : Convert.ToDecimal(this.txtUnqualifiedCoefficient.Text.Trim());
- entity.QualifiedCoefficient = this.txtQualifiedCoefficient.Text.Trim() == "" ? 1 : Convert.ToDecimal(this.txtQualifiedCoefficient.Text.Trim());
- //损坯
- entity.DamageFlag = chkDamageFlag.Checked ? "1" : "0";
- entity.UnqualifiedFlag = chkUnqualifiedFlag.Checked ? "1" : "0";
- entity.QualifiedFlag = chkQualifiedFlag.Checked ? "1" : "0";
- entity.PieceProcedureIDS = this.dkPieceProcedure.ProcedureIDS;//计件工序
- entity.PieceCoefficient = this.txtPieceCoefficient.Text.Trim() == "" ? 1 : Convert.ToDecimal(this.txtPieceCoefficient.Text.Trim());
- DataTable dtLeft = this.dgvWages.DataSource as DataTable;
- //DataView dv = dtLeft.DefaultView;
- //dv.RowFilter = "WagesTypeID>0";
- //dtLeft = dv.ToTable();
- //dtLeft.AcceptChanges();
- 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() == "" ? 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]["Balance"].ToString() != "")
- {
- DataRow drNew = DtRightDataSource.NewRow();
- drNew["QualityRate"] = dtHistory.Rows[i]["QualityRate"].ToString();
- drNew["Balance"] = dtHistory.Rows[i]["Balance"].ToString();
- drNew["QualityWages"] = dtHistory.Rows[i]["QualityWages"].ToString();
- drNew["RowIndexFlag"] = dtHistory.Rows[i]["RowIndexFlag"].ToString() == "" ? Convert.ToInt32(dtHistory.Rows[0]["RowIndexFlag"]) : Convert.ToInt32(dtHistory.Rows[i]["RowIndexFlag"].ToString());
- DtRightDataSource.Rows.Add(drNew);
- }
- }
- }
- if (dtLeft != null && dtLeft.Rows.Count > 0)
- {
- List<WCF.DataModels.PAMModule.WagesEntity> wagesentitys = new List<WCF.DataModels.PAMModule.WagesEntity>();
- for (int i = 0; i < dtLeft.Rows.Count; i++)
- {
- WCF.DataModels.PAMModule.WagesEntity wageentity = new WCF.DataModels.PAMModule.WagesEntity();
- wageentity.WagesTypeID = Convert.ToInt32(dtLeft.Rows[i]["WagesTypeID"]);
- wageentity.StandardWages = Convert.ToDecimal(dtLeft.Rows[i]["StandardWages"].ToString() == "" ? 0 : dtLeft.Rows[i]["StandardWages"]);
- wageentity.DamageSubsidyRate = Convert.ToDecimal(dtLeft.Rows[i]["DamageSubsidyRate"].ToString() == "" ? 1 : dtLeft.Rows[i]["DamageSubsidyRate"]);
- wageentity.DamageSubsidy = Convert.ToDecimal(dtLeft.Rows[i]["DamageSubsidy"].ToString() == "" ? 0 : dtLeft.Rows[i]["DamageSubsidy"]);
- wageentity.RSuperiorCoefficient = Convert.ToDecimal(dtLeft.Rows[i]["RSuperiorCoefficient"].ToString() == "" ? 1 : dtLeft.Rows[i]["RSuperiorCoefficient"]);
- wageentity.RQualifiedCoefficient = Convert.ToDecimal(dtLeft.Rows[i]["RQualifiedCoefficient"].ToString() == "" ? 1 : dtLeft.Rows[i]["RQualifiedCoefficient"]);
- wageentity.RepairSubsidyRate = Convert.ToDecimal(dtLeft.Rows[i]["RepairSubsidyRate"].ToString() == "" ? 1 : dtLeft.Rows[i]["RepairSubsidyRate"]);
- wageentity.RepairSubsidy = Convert.ToDecimal(dtLeft.Rows[i]["RepairSubsidy"].ToString() == "" ? 0 : dtLeft.Rows[i]["RepairSubsidy"]);
- //质量工价
- if (this.DtRightDataSource != null && this.DtRightDataSource.Rows.Count > 0)
- {
- List<WCF.DataModels.PAMModule.QualityWagesEntity> qualityWagesEntitys = new List<WCF.DataModels.PAMModule.QualityWagesEntity>();
- //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.QualityWagesEntity qualityWagesEntity = new WCF.DataModels.PAMModule.QualityWagesEntity();
- qualityWagesEntity.WagesTypeID = Convert.ToInt32(dtLeft.Rows[i]["WagesTypeID"]);
- qualityWagesEntity.QualityRate = Convert.ToDecimal(r["QualityRate"].ToString() == "" ? 0 : r["QualityRate"]) / 100;
- qualityWagesEntity.Balance = Convert.ToDecimal(r["Balance"].ToString() == "" ? 0 : r["Balance"]);
- qualityWagesEntity.QualityWages = Convert.ToDecimal(r["QualityWages"].ToString() == "" ? 0 : r["QualityWages"]);
- qualityWagesEntitys.Add(qualityWagesEntity);
- }
- // }
- // }
- wageentity.qualitywagesentity = qualityWagesEntitys;
- }
- wagesentitys.Add(wageentity);
- }
- entity.wagesentity = wagesentitys;
- }
- int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.SavePiecework(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)
- {
- PieceworkEntity pieceworkEndit = new PieceworkEntity();
- pieceworkEndit.PayPlanName = "";
- DataSet dsProductionData = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetPieceworkData(pieceworkEndit);
- }));
- DataRow[] dr = dsProductionData.Tables[0].Select("PayPlanID=" + this.cmbPayPlan.SelectedValue.ToString());
- string errorMessage = string.Format("工资方案【{0}】已属于计件工资策略【{1}】,不能再被选择。", this.cmbPayPlan.Text, dr[0]["PieceTacticsName"].ToString());
- // 提示信息
- MessageBox.Show(errorMessage,
- 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.GetPieceworkByID(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.txtPayPlanName.Text = dsResultAccount.Tables[0].Rows[0]["PieceTacticsName"].ToString();
- this.txtDamageCoefficient.Text = dsResultAccount.Tables[0].Rows[0]["DamageCoefficient"].ToString();
- this.chkDamageFlag.Checked = Convert.ToBoolean(Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["DamageFlag"]));
- //this.dkPieceProcedure.ProcedureID = Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["PieceProcedureID"]);
- //this.dkPieceProcedure.Text = dsResultAccount.Tables[0].Rows[0]["PieceProcedureName"].ToString();
- this.cmbPieceType.SelectedValue = Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["PieceType"]);
- this.txtUnqualifiedCoefficient.Text = dsResultAccount.Tables[0].Rows[0]["UnqualifiedCoefficient"].ToString();
- this.chkUnqualifiedFlag.Checked = Convert.ToBoolean(Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["UnqualifiedFlag"]));
- this.txtPieceCoefficient.Text = dsResultAccount.Tables[0].Rows[0]["PieceCoefficient"].ToString();
- this.chkQualifiedFlag.Checked = Convert.ToBoolean(Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["QualifiedFlag"]));
- //this.dkQualityBaseProcedure.ProcedureID = Convert.ToInt32(dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedureID"]);
- //this.dkQualityBaseProcedure.Text = dsResultAccount.Tables[0].Rows[0]["QualityBaseProcedure"].ToString();
- this.txtQualifiedCoefficient.Text = dsResultAccount.Tables[0].Rows[0]["QualifiedCoefficient"].ToString();
- if (dsResultAccount.Tables[3].Rows.Count > 0)
- {
- DataRow[] dr1 = dsResultAccount.Tables[3].Select("ProcedureFlag=1");
- string IDS = "";
- string TextS = "";
- foreach (DataRow r1 in dr1)
- {
- TextS += r1["ProcedureName"].ToString() + ",";
- IDS += r1["ProcedureID"].ToString() + ",";
- }
- IDS = IDS.Trim(',');
- TextS = TextS.Trim(',');
- if (IDS != "")
- {
- this.dkPieceProcedure.Text = TextS;
- this.dkPieceProcedure.ProcedureIDS = IDS;
- }
- IDS = "";
- TextS = "";
- // 质量工序
- dr1 = dsResultAccount.Tables[3].Select("ProcedureFlag=2");
- foreach (DataRow r1 in dr1)
- {
- 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["StandardWages"] = dsResultAccount.Tables[1].Rows[i]["StandardWages"];
- dr["DamageSubsidyRate"] = dsResultAccount.Tables[1].Rows[i]["DamageSubsidyRate"];
- dr["DamageSubsidy"] = dsResultAccount.Tables[1].Rows[i]["DamageSubsidy"];
- dr["RSuperiorCoefficient"] = dsResultAccount.Tables[1].Rows[i]["RSuperiorCoefficient"];
- dr["RQualifiedCoefficient"] = dsResultAccount.Tables[1].Rows[i]["RQualifiedCoefficient"];
- dr["RepairSubsidyRate"] = dsResultAccount.Tables[1].Rows[i]["RepairSubsidyRate"];
- dr["RepairSubsidy"] = dsResultAccount.Tables[1].Rows[i]["RepairSubsidy"];
- dr["RowIndexFlag"] = i;
- this.DtLeftDataSource.Rows.Add(dr);
- //this._selectedrow++;//用于过滤边条件
- if (dsResultAccount != null && dsResultAccount.Tables[2].Rows.Count > 0)
- {
- if (dsResultAccount.Tables[1].Rows[i]["WagesTypeID"].ToString() != "")
- {
- 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["Balance"] = rr["Balance"];
- dr2["QualityWages"] = rr["QualityWages"];
- dr2["RowIndexFlag"] = i;
- this.DtRightDataSource.Rows.Add(dr2);
- }
- }
- }
- //else
- //{
- // DataRow dr2 = this.DtRightDataSource.NewRow();
- // dr2["QualityRate"] = "";
- // dr2["Balance"] = "";
- // dr2["QualityWages"] = "";
- // dr2["RowIndexFlag"] = i;
- // this.DtRightDataSource.Rows.Add(dr2);
- //}
- }
- }
- //this._currentRowIndexFlag = this._selectedrow;
- }
- DataView dv = this.DtRightDataSource.DefaultView;
- dv.RowFilter = "RowIndexFlag=0";
- this.dgvQualityWages.DataSource = dv.ToTable();// DtRightDataSource;
- this.dgvWages.DataSource = DtLeftDataSource;
- //this.dgvWages.DataSource = DtLeftDataSource;
- //this.dgvQualityWages.DataSource = DtRightDataSource.Copy();
- // this.dgvWages.Rows[DtLeftDataSource.Rows.Count - 1].Selected = true;
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 绑定工种工资方案数据源
- /// </summary>
- private void BindJobsData()
- {
- try
- {
- DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetJobsPayPlanInfo(Convert.ToInt32(this._entityId));
- }));
- if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
- {
- this.dgvQualityWages.DataSource = dsResultAccount.Tables[0];
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- /// <summary>
- /// 删除行时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvGoods_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
- {
- //try
- //{
- // if (e.Row.Index != -1)
- // {
- // if (this.dgvQualityWages.CurrentCell != null)
- // {
- // string JobsID = this.dgvQualityWages.Rows[e.Row.Index].Cells["GoodsID"].Value.ToString();
- // DataRow[] drSel = dtAllDataRight.Select(string.Format("WagesTypeID={0} and GoodsID={1}", this._currentWagesTypeID, JobsID));
- // if (drSel.Length > 0) //存在,需要更把此行删除
- // {
- // drSel[0].Delete();
- // }
- // }
- // }
- //}
- //catch (Exception ex)
- //{
- // throw ex;
- //}
- }
- /// <summary>
- /// 产品工价添加行事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWages_UserAddedRow(object sender, DataGridViewRowEventArgs e)
- {
-
- }
- /// <summary>
- /// 产品单元格验证事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWages_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
- {
- }
- private void dgvQualityWages_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
- {
- }
- /// <summary>
- /// 绑定计件工序类型
- /// </summary>
- private void BindPieceType()
- {
- DataTable dtPieceType = new DataTable();
- dtPieceType.Columns.Add("PieceTypeID");
- dtPieceType.Columns.Add("PieceType");
- DataRow dr = dtPieceType.NewRow();
- dr["PieceTypeID"] = 0;
- dr["PieceType"] = "工序计件";
- dtPieceType.Rows.Add(dr);
- dr = dtPieceType.NewRow();
- dr["PieceTypeID"] = 1;
- dr["PieceType"] = "经过工序计件";
- dtPieceType.Rows.Add(dr);
- this.cmbPieceType.DataSource = dtPieceType;
- this.cmbPieceType.DisplayMember = "PieceType";
- this.cmbPieceType.ValueMember = "PieceTypeID";
- }
- private void dgvQualityWages_CurrentCellDirtyStateChanged(object sender, EventArgs e)
- {
- }
- private void F_PAM_0302_Shown(object sender, EventArgs e)
- {
- this.dgvQualityWages.IsSetInputColumnsColor = true;
- this.dgvWages.IsSetInputColumnsColor = true;
- }
- private void dgvWages_CellValidated(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- if (e.RowIndex < 0)
- {
- return;
- }
- DataGridViewRow rowItem = dgvWages.Rows[e.RowIndex];
- DataGridViewColumn columnItem = dgvWages.Columns[e.ColumnIndex];
- if ("StandardWages" == columnItem.Name)
- {
- object StandardWages = rowItem.Cells[e.ColumnIndex].FormattedValue;
- // 计算补贴
- if (StandardWages == null || StandardWages.ToString() == string.Empty)
- {
- StandardWages = 0;
- rowItem.Cells["StandardWages"].Value = 0;
- }
- // 2.损坯补贴系数
- object DamageSubsidyRate = rowItem.Cells["DamageSubsidyRate"].Value;
- if (DamageSubsidyRate == null || DamageSubsidyRate.ToString() == string.Empty)
- {
- DamageSubsidyRate = 1;
- rowItem.Cells["DamageSubsidyRate"].Value = 1;
- }
- rowItem.Cells["DamageSubsidy"].Value = Convert.ToDecimal(StandardWages.ToString()) * Convert.ToDecimal(DamageSubsidyRate.ToString());
- // 3.干补补贴系数
- object RepairSubsidyRate = rowItem.Cells["RepairSubsidyRate"].Value;
- if (RepairSubsidyRate == null || RepairSubsidyRate.ToString() == string.Empty)
- {
- RepairSubsidyRate = 1;
- rowItem.Cells["RepairSubsidyRate"].Value = 1;
- }
- rowItem.Cells["RepairSubsidy"].Value = Convert.ToDecimal(StandardWages.ToString()) * Convert.ToDecimal(RepairSubsidyRate.ToString());
- //this.dgvWages.Rows[this.dgvWages.CurrentCell.RowIndex].Cells["StandardWages"].Value = StandardWages;
- this._currentStandardWages = Convert.ToDecimal(StandardWages);
- // 计算补贴 end
- //更改标准价格的时候,遍历子表修改质量工价
- // 1.获取当前标识行信息
- object objRowIndexFlag = rowItem.Cells["RowIndexFlag"].Value;
- if (objRowIndexFlag != null || objRowIndexFlag.ToString() != "")
- {
- DataRow[] dr = this.DtRightDataSource.Select("RowIndexFlag=" + objRowIndexFlag);
- if (dr.Length > 0) //表示有质量工价
- {
- int rowIndex = 0;
- foreach (DataRow r in dr)
- {
- r["QualityWages"] = Convert.ToDecimal(StandardWages) + (r["Balance"].ToString() == "" ? 0 : Convert.ToDecimal(r["Balance"]));
- this.dgvQualityWages.Rows[rowIndex].Cells["QualityWages"].Value = r["QualityWages"];
- rowIndex++;
- }
- this.DtRightDataSource.AcceptChanges();
- }
- }
- }
- if ("DamageSubsidyRate" == columnItem.Name)
- {
- object DamageSubsidyRate = rowItem.Cells[e.ColumnIndex].FormattedValue;
- // 损坯补贴系数
- if (DamageSubsidyRate == null || DamageSubsidyRate.ToString() == string.Empty)
- {
- DamageSubsidyRate = 1;
- rowItem.Cells["DamageSubsidyRate"].Value = 1;
- }
- // 2.标准工价
- object StandardWages = rowItem.Cells["StandardWages"].Value;
- if (StandardWages == null || StandardWages.ToString() == string.Empty)
- {
- StandardWages = 0;
- rowItem.Cells["StandardWages"].Value = 0;
- }
- rowItem.Cells["DamageSubsidy"].Value = Convert.ToDecimal(StandardWages.ToString()) * Convert.ToDecimal(DamageSubsidyRate.ToString());
- // 计算补贴 end
- //rowItem.Cells["DamageSubsidyRate"].Value = DamageSubsidyRate;
- }
- if ("RepairSubsidyRate" == columnItem.Name)
- {
- object RepairSubsidyRate = rowItem.Cells[e.ColumnIndex].FormattedValue;
- // 计算补贴
- if (RepairSubsidyRate == null || RepairSubsidyRate.ToString() == string.Empty)
- {
- RepairSubsidyRate = 1;
- rowItem.Cells["RepairSubsidyRate"].Value = 1;
- }
- // 2.标准工价
- object StandardWages = rowItem.Cells["StandardWages"].Value;
- if (StandardWages == null || StandardWages.ToString() == string.Empty)
- {
- StandardWages = 0;
- rowItem.Cells["StandardWages"].Value = 0;
- }
- rowItem.Cells["RepairSubsidy"].Value = Convert.ToDecimal(StandardWages.ToString()) * Convert.ToDecimal(RepairSubsidyRate.ToString());
- // 计算补贴 end
- //rowItem.Cells["RepairSubsidyRate"].Value = RepairSubsidyRate;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void dgvQualityWages_CellValidated(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- if (e.RowIndex < 0)
- {
- return;
- }
- DataGridViewRow rowItem = dgvQualityWages.Rows[e.RowIndex];
- DataGridViewColumn columnItem = dgvQualityWages.Columns[e.ColumnIndex];
- if ((e.ColumnIndex == 0 || e.ColumnIndex == 1) && e.RowIndex != -Constant.INT_IS_ONE)
- {
- rowItem.Cells["RowIndexFlag1"].Value = this._currentRowIndexFlag;
- }
- if ("Balance" == columnItem.Name)
- {
- object Balance = rowItem.Cells[columnItem.Name].FormattedValue;
- if (Balance == null || Balance.ToString() == string.Empty)
- {
- Balance = 0;
- rowItem.Cells["Balance"].Value = 0;
- }
- rowItem.Cells["QualityWages"].Value = this._currentStandardWages + Convert.ToDecimal(Balance);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|