| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PC_0104_1.cs
- * 2.功能描述:成型线管理
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/09/15 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- public partial class F_PC_0104_1 : DockPanelBase
- {
- #region 成员变量
- // 单例模式使用
- private static F_PC_0104_1 _instance;
- // 成型线集合
- private List<GroutingLineEntity> _groutingLineList = new List<GroutingLineEntity>();
- //选择的成型线状态
- private int? _mouldStatus;
- // 最后选择行
- private int _selecedRow;
- #endregion
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- public F_PC_0104_1()
- {
- InitializeComponent();
- // 为控件名赋值
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
- this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- // this.tsbtnQueryRecord.Text = ButtonText.TSBTN_QUERYRECORD;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE;
- this.Text = FormTitles.F_PC_0104;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PC_0104_1 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PC_0104_1();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 页面加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_0104_Load(object sender, System.EventArgs e)
- {
- try
- {
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- // 为成型线绑定数据源
- this.BindMouldType();
- // 设置日期控件不可用
- this.SetBeginTimePickerEnable(false);
- this.SetEndTimePickerEnable(false);
- }
- 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 tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGroutingLine.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 开始日期条件选中状态改变处理事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cbStartTime_CheckedChanged(object sender, EventArgs e)
- {
- this.SetBeginTimePickerEnable(this.cbStartTime.Checked);
- }
- /// <summary>
- /// 结束日期条件选中状态改变处理事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void cbEndTime_CheckedChanged(object sender, EventArgs e)
- {
- this.SetEndTimePickerEnable(this.cbEndTime.Checked);
- }
- /// <summary>
- /// 查询按钮按下处理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- this._mouldStatus = Convert.ToInt32(this.lstcbxGMouldStatus.SelectedValue);
- // if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
- DataSet dsGroutingLine = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return GetGroutingLine();
- }));
- if (dsGroutingLine != null && dsGroutingLine.Tables.Count > Constant.INT_IS_ZERO)
- {
- // 控制明细不查询
- this.Tag = false;
- this.dgvGroutingLine.DataSource = dsGroutingLine.Tables[0];
- if (dsGroutingLine.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
- {
- // 定位当前行
- if (this.dgvGroutingLine.Rows.Count > this._selecedRow)
- {
- this.dgvGroutingLine.Rows[this._selecedRow].Selected = true;
- this.dgvGroutingLine.CurrentCell =
- this.dgvGroutingLine.Rows[this._selecedRow].Cells["GroutingLineCode"];
- }
- else if (this.dgvGroutingLine.Rows.Count <= this._selecedRow)
- {
- this._selecedRow = dgvGroutingLine.Rows.Count - 1;
- this.dgvGroutingLine.CurrentCell =
- this.dgvGroutingLine.Rows[this.dgvGroutingLine.Rows.Count - 1].Cells["GroutingLineCode"];
- this.dgvGroutingLine.Rows[dgvGroutingLine.Rows.Count - 1].Selected = true;
- }
- this.Tag = true;
- // 查明细
- this.dgvGroutingLine_SelectionChanged(null, null);
- this.dgvGroutingLine.Focus();
- }
- else
- {
- // 清空明细中的数据
- this.dgvGroutingLineDetail.DataSource = null;
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- // 设置按钮可用状态
- }
- 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 btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtBuildingNo.Text = "";
- this.txtFloorNo.Text = "";
- this.txtGroutingLineNo.Text = "";
- this.lstcbxGMouldStatus.Text = "";
- this.lstcbxGMouldStatus.SelectedValue = "1";
- this.txtGroutingLineCode.Text = "";
- this.txtGroutingLineName.Text = "";
- this.cbStartTime.Checked = false;
- this.cbEndTime.Checked = false;
- this.txtBeginUsedDateStart.Enabled = false;
- this.txtBeginUsedDateEnd.Enabled = false;
- this.txtEndUsedDateStart.Enabled = false;
- this.txtEndUsedDateEnd.Enabled = false;
- this.txtRemarks.Text = "";
- this.txtGroutingUserCode.Text = "";
- this.txtBeginUsedDateStart.Value = DateTime.Now;
- this.txtBeginUsedDateEnd.Value = DateTime.Now;
- this.txtEndUsedDateStart.Value = DateTime.Now;
- this.txtEndUsedDateEnd.Value = DateTime.Now;
- this.scbGMouldType.ClearValue();
- this.chkEnable.Checked = true;
- this.chkDisable.Checked = false;
- }
- /// <summary>
- /// 窗体关闭事件处理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 窗体关闭后,释放单例模式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_0104_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 双击某成型线进行编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvGroutingLine_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- /// <summary>
- /// 添加新成型线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_PC_0102_1_1 frmFPC0102 = new F_PC_0102_1_1();
- DialogResult dialogresult = frmFPC0102.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvGroutingLine.DataSource = null;
- DataSet dsGroutingLine = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return GetGroutingLine();
- }));
- if (dsGroutingLine != null)
- {
- if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLine.DataSource = ((DataSet)dsGroutingLine).Tables[0];
- this.dgvGroutingLine.ReadOnly = 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 tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvGroutingLine.CurrentRow;
- if (currentRow != null)
- {
- int GroutingLineId = Convert.ToInt32(currentRow.Cells["GroutingLineId"].Value);
- F_PC_0103_1 frmFPC0103 = new F_PC_0103_1(GroutingLineId);
- DialogResult dialogresult = frmFPC0103.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- this.dgvGroutingLine.DataSource = null;
- object obResult = DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(GetGroutingLine));
- if (obResult != null)
- {
- DataSet dsGroutingLine = (DataSet)obResult;
- if (dsGroutingLine.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLine.DataSource = dsGroutingLine.Tables[0];
- this.dgvGroutingLine.ReadOnly = 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 dgvGroutingLine_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- try
- {
- if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE)
- {
- return;
- }
- int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[e.RowIndex].Cells["GroutingLineID"].Value);
- this.BindDetailInfo(GroutingLineID);
- this.dgvGroutingLine.Focus();
- }
- 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 tsbtnQueryRecord_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLine.CurrentCell != null)
- {
- int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
- string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
- F_PC_0105_1 frmFPC0105 = new F_PC_0105_1(GroutingLineID, GroutingLineCode);
- DialogResult dialogresult = frmFPC0105.ShowDialog();
- }
- else
- {
- F_PC_0105_1 frmFPC0105 = new F_PC_0105_1();
- DialogResult dialogresult = frmFPC0105.ShowDialog();
- }
- }
- 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 dgvGroutingLine_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- //try
- //{
- // if (this.dgvGroutingLine.SelectedRows.Count != Constant.INT_IS_ZERO)
- // {
- // int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.SelectedRows[0].Cells["GroutingLineID"].Value);
- // this.BindDetailInfo(GroutingLineID);
- // }
- //}
- //catch (Exception ex)
- //{
- // // 对异常进行共通处理
- // ExceptionManager.HandleEventException(this.ToString(),
- // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- //}
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 为页面的成型线类型绑定数据源
- /// </summary>
- private void BindMouldType()
- {
- try
- {
- //DataTable dtDataSourse = new DataTable();
- //dtDataSourse.Columns.Add("GMouldType", System.Type.GetType("System.String"));
- //dtDataSourse.Columns.Add("GMouldTypeName", System.Type.GetType("System.String"));
- //for (int i = 0; i < Constant.ConGMouldStatusCount; i++)
- //{
- // DataRow drRow = dtDataSourse.NewRow();
- // drRow["GMouldType"] = Constant.ConGMouldStatus[i, 0];
- // drRow["GMouldTypeName"] = Constant.ConGMouldStatus[i, 1];
- // dtDataSourse.Rows.Add(drRow);
- //}
- //this.lstcbxGMouldStatus.ListBox.DisplayMember = "GMouldTypeName";
- //this.lstcbxGMouldStatus.ListBox.ValueMember = "GMouldType";
- //this.lstcbxGMouldStatus.ListBox.DataSource = dtDataSourse;
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return PCModuleProxyNew.Service.GetFPC0101IData();
- }));
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[1].Rows.Count > Constant.INT_IS_ZERO)
- {
- DataRow dr = sre.Data.Tables[1].NewRow();
- dr["GMouldStatusName"] = "";
- dr["GMouldStatusID"] = -1;
- sre.Data.Tables[1].Rows.InsertAt(dr, 0);
- this.lstcbxGMouldStatus.DisplayMember = "GMouldStatusName";
- this.lstcbxGMouldStatus.ValueMember = "GMouldStatusID";
- this.lstcbxGMouldStatus.DataSource = sre.Data.Tables[1];
- this.lstcbxGMouldStatus.SelectedValue = "1";
- }
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 设置开始使用时间可用状态
- /// </summary>
- /// <param name="isEnable">
- /// false:不可用
- /// true:可用
- /// </param>
- private void SetBeginTimePickerEnable(bool isEnable)
- {
- this.txtBeginUsedDateStart.Enabled = isEnable;
- this.txtBeginUsedDateEnd.Enabled = isEnable;
- }
- /// <summary>
- /// 设置结束使用时间可用状态
- /// </summary>
- /// <param name="isEnable">
- /// false:不可用
- /// true:可用
- /// </param>
- private void SetEndTimePickerEnable(bool isEnable)
- {
- this.txtEndUsedDateStart.Enabled = isEnable;
- this.txtEndUsedDateEnd.Enabled = isEnable;
- }
- /// <summary>
- /// 根据条件取得成型线数据
- /// </summary>
- /// <returns></returns>
- private DataSet GetGroutingLine()
- {
- try
- {
- this.dgvGroutingLine.AutoGenerateColumns = false;
- GroutingLineEntity groutingLineEntity = new GroutingLineEntity();
- groutingLineEntity.VALUEFLAG = 1;
- groutingLineEntity.BUILDINGNO = this.txtBuildingNo.Text.Trim();
- groutingLineEntity.FLOORNO = this.txtFloorNo.Text.Trim();
- groutingLineEntity.GROUTINGLINENO = this.txtGroutingLineNo.Text.Trim();
- //if (this.lstcbxGMouldStatus.SelectedValue.ToString()!="-1")
- if (_mouldStatus != -1)
- {
- groutingLineEntity.MouldStatus = _mouldStatus;
- }
- groutingLineEntity.GROUTINGLINECODE = this.txtGroutingLineCode.Text.Trim();
- groutingLineEntity.GROUTINGLINENAME = this.txtGroutingLineName.Text.Trim();
- if (this.cbStartTime.Checked)
- {
- groutingLineEntity.BEGINUSEDDATE = Convert.ToDateTime(this.txtBeginUsedDateStart.Text.Trim());
- groutingLineEntity.BEGINUSEDDATEEND = Convert.ToDateTime(this.txtBeginUsedDateEnd.Text.Trim()).AddHours(23)
- .AddMinutes(59).AddSeconds(59);
- }
- if (this.cbEndTime.Checked)
- {
- groutingLineEntity.ENDUSEDDATE = Convert.ToDateTime(this.txtEndUsedDateStart.Text.Trim());
- groutingLineEntity.ENDUSEDDATEEND = Convert.ToDateTime(this.txtEndUsedDateEnd.Text.Trim()).AddHours(23)
- .AddMinutes(59).AddSeconds(59);
- }
- groutingLineEntity.REMARKS = this.txtRemarks.Text.Trim();
- if (scbGMouldType.SearchedPKMember != 0)
- {
- groutingLineEntity.MOULDTYPEID = this.scbGMouldType.SearchedPKMember;
- }
- groutingLineEntity.USERCODE = this.txtGroutingUserCode.Text.Trim();
- if (this.chkEnable.Checked == this.chkDisable.Checked)
- {
- groutingLineEntity.ValueFlag2 = "A";
- }
- else if (this.chkEnable.Checked)
- {
- groutingLineEntity.ValueFlag2 = "1";
- }
- else if (this.chkDisable.Checked)
- {
- groutingLineEntity.ValueFlag2 = "2";
- }
- return PCModuleProxy.Service.GetGroutingLine(groutingLineEntity);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 将成型线DataSet数据集转入集合中
- /// </summary>
- /// <param name="dsLine"></param>
- private void DataTableToListByLine(DataSet dsLine)
- {
- try
- {
- this._groutingLineList.Clear();
- foreach (DataRow drFor in dsLine.Tables[0].Rows)
- {
- GroutingLineEntity lineEntity = new GroutingLineEntity();
- lineEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
- lineEntity.BUILDINGNO = drFor["BUILDINGNO"].ToString();
- lineEntity.FLOORNO = drFor["FLOORNO"].ToString();
- lineEntity.GROUTINGLINENO = drFor["GROUTINGLINENO"].ToString();
- lineEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
- lineEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
- lineEntity.MOULDQUANTITY = Convert.ToDecimal(drFor["MOULDQUANTITY"]);
- lineEntity.MOULDTYPEID = Convert.ToInt32(drFor["GMOULDTYPEID"]);
- lineEntity.USERID = Convert.ToInt32(drFor["USERID"]);
- lineEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
- if (drFor["ENDUSEDDATE"].ToString() != string.Empty)
- {
- lineEntity.ENDUSEDDATE = Convert.ToDateTime(drFor["ENDUSEDDATE"].ToString());
- }
- lineEntity.MouldStatus = Convert.ToInt32(drFor["GMouldStatus"]);
- lineEntity.REMARKS = drFor["REMARKS"].ToString();
- lineEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
- lineEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
- lineEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
- lineEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
- lineEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
- lineEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
- lineEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
- lineEntity.MOULDTYPENAME = drFor["GMOULDTYPENAME"].ToString();
- this._groutingLineList.Add(lineEntity);
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 根据成型线ID获取明细信息
- /// </summary>
- private void BindDetailInfo(int GroutingLineID)
- {
- try
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- //DataSet dsDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- //{
- // return PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
- //}));
- DataSet dsDetail = PCModuleProxy.Service.GetGroutingLineDetailByMainId(GroutingLineID, null, 0);
- DataView dv = dsDetail.Tables[0].DefaultView;
- dv.RowFilter = "valueflag=1";
- dsDetail = new DataSet();
- dsDetail.Tables.Add(dv.ToTable());
- this.dgvGroutingLineDetail.DataSource = dsDetail.Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- /// <summary>
- /// 停用按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnDisable_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLine.CurrentCell != null)
- {
- int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
- int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
- if (valueflag == 0)
- return;
- // 提示用户确认停用
- DialogResult msgBoxResult = MessageBox.Show(
- string.Format(Messages.MSG_CMN_Q002, "成型线", "停用"), this.Text,
- MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (msgBoxResult == DialogResult.Yes)
- {
- int returnRow = (int)DoAsync(new AsyncMethod(() =>
- {
- return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 0);
- }));
- //修改成功
- if (returnRow > 0)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "停用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- btnSearch_Click(sender, e);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "停用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- 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 tsbtnStart_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLine.CurrentCell != null)
- {
- try
- {
- if (this.dgvGroutingLine.CurrentCell != null)
- {
- int valueflag = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GMouldStatus"].Value);
- int groutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["groutingLineID"].Value);
- if (valueflag == 1)
- return;
- // 提示用户确认停用
- DialogResult msgBoxResult = MessageBox.Show(
- string.Format(Messages.MSG_CMN_Q002, "成型线", "启用"), this.Text,
- MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (msgBoxResult == DialogResult.Yes)
- {
- int returnRow = (int)DoAsync(new AsyncMethod(() =>
- {
- return PCModuleProxy.Service.SaveGroutingLineValueFlag(groutingLineID, 1);
- }));
- //修改成功
- if (returnRow > 0)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "成型线", "启用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- btnSearch_Click(sender, e);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "成型线", "启用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- 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 tsbtnManager_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLine.CurrentCell != null)
- {
- int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value);
- string GroutingLineCode = this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineCode"].Value.ToString();
- F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
- frmFPC0101.ShowInDockPanel(this.DockPanel);
- frmFPC0101.SetGroutingLineIDAndGroutingLineCode(GroutingLineID, GroutingLineCode);
- //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1(GroutingLineID, GroutingLineCode);
- //DialogResult dialogresult = frmFPC0101.ShowDialog();
- }
- else
- {
- //F_PC_0101_1_1 frmFPC0101 = new F_PC_0101_1_1();
- //DialogResult dialogresult = frmFPC0101.ShowDialog();
- F_PC_0101_1_1 frmFPC0101 = F_PC_0101_1_1.Instance;
- frmFPC0101.ShowInDockPanel(this.DockPanel);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void dgvGroutingLine_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- // 在绑定总表时 不查询明细
- if (!Convert.ToBoolean(this.Tag)
- || this.dgvGroutingLine.CurrentCell == null)
- {
- return;
- }
- // 选中行时查询明细
- else
- {
- if (this.txtBuildingNo.ReadOnly)
- {
- return;
- }
- int GroutingLineID = Convert.ToInt32(this.dgvGroutingLine.Rows[this.dgvGroutingLine.CurrentCell.RowIndex].Cells["GroutingLineID"].Value.ToString());
- this.BindDetailInfo(GroutingLineID);
- this.dgvGroutingLine.Focus();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|