/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_0105.cs * 2.功能描述:查看覆历 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/10/06 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Text; 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.DataModels; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.PCModule { public partial class F_PC_0105_1 : FormBase { #region 成员常量 private static F_PC_0105_1 _instance; // 单例模式使用 //范围权限 private string _purview; #endregion #region 构造函数 public F_PC_0105_1() { InitializeComponent(); // this.Text = FormTitles.F_PC_0105; this.Text = "模具履历"; this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; } public F_PC_0105_1(int groutingLineID, string groutingLineCode) { InitializeComponent(); this.scbGroutingLine.SearchedPKMember = groutingLineID; this.scbGroutingLine.Text = groutingLineCode; //this.Text = FormTitles.F_PC_0105; this.Text = "模具履历"; this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PC_0105_1 Instance { get { if (_instance == null) { _instance = new F_PC_0105_1(); } return _instance; } } #endregion #region 事件处理 /// /// 查询 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { if (this.scbGroutingLine.SearchedPKMember == 0) { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.scbGroutingLine.Focus(); return; } GMouldRecordEntity entity = new GMouldRecordEntity(); entity.GROUTINGLINEID = this.scbGroutingLine.SearchedPKMember; if (chkStart.Checked) { entity.BEGINDATE = new DateTime(txtDateStart.Value.Year, txtDateStart.Value.Month, txtDateStart.Value.Day); entity.ENDDATE = new DateTime(txtDateEnd.Value.Year, txtDateEnd.Value.Month, txtDateEnd.Value.Day, 23, 59, 59); } if (chkEnd.Checked) { entity.BEGINDATE2 = new DateTime(txtDateStart2.Value.Year, txtDateStart2.Value.Month, txtDateStart2.Value.Day); entity.ENDDATE2 = new DateTime(txtDateEnd2.Value.Year, txtDateEnd2.Value.Month, txtDateEnd2.Value.Day, 23, 59, 59); } entity.GROUTINGMOULDCODE = this.txtGroutingMouldCode.Text.Trim(); if (this.cmbGMouldRecordType.SelectedValue.ToString() != "-1") { entity.GMouldRecordType = Convert.ToInt32(this.cmbGMouldRecordType.SelectedValue); } entity.REMARKS = this.txtRemarks.Text; DataSet dsMouldRecord = (DataSet)PCModuleProxy.Service.GetGMouldRecordInfoByMainId(entity); if (dsMouldRecord != null) { this.dgvMouldRecord.AutoGenerateColumns = false; this.dgvMouldRecord.DataSource = dsMouldRecord.Tables[0]; } else { this.dgvMouldRecord.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); } } /// /// 清空条件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.scbGroutingLine.ClearValue(); this.dgvMouldRecord.DataSource = null; this.txtDateStart.Value = DateTime.Now; this.txtDateEnd.Value = DateTime.Now; this.txtGroutingMouldCode.Text = ""; this.txtRemarks.Text = ""; this.cmbGMouldRecordType.SelectedValue = -1;//默认第一个 this.txtDateStart2.Value = DateTime.Now; this.txtDateEnd2.Value = DateTime.Now; this.chkStart.Checked = false; this.chkEnd.Checked = false; chkStart_CheckedChanged(sender, e); chkEnd_CheckedChanged(sender, e); } /// /// 窗体加载 /// /// /// private void F_PC_0105_Load(object sender, EventArgs e) { try { this.txtDateStart.Value = DateTime.Now; this.txtDateEnd.Value = DateTime.Now; this.txtDateStart2.Value = DateTime.Now; this.txtDateEnd2.Value = DateTime.Now; chkStart_CheckedChanged(sender, e); chkEnd_CheckedChanged(sender, e); //// 调用服务器端获取数据集 //ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() => //{ // return PCModuleProxyNew.Service.GetFPC0101IData(); //})); //if (sre.Status == Constant.ServiceResultStatus.Success) //{ // if (sre.Data.Tables[0].Rows.Count > Constant.INT_IS_ZERO) // { // DataRow dr = sre.Data.Tables[0].NewRow(); // dr["GMouldTypeName"] = ""; // dr["GMouldTypeID"] = -1; // sre.Data.Tables[0].Rows.InsertAt(dr, 0); // this.cmbGMouldRecordType.DataSource = sre.Data.Tables[0]; // this.cmbGMouldRecordType.DisplayMember = "GMouldTypeName"; // this.cmbGMouldRecordType.ValueMember = "GMouldTypeID"; // } //} //绑定履历类型 DataTable dtGMouldRecordType = new DataTable(); dtGMouldRecordType.Columns.Add("GMouldRecordTypeID"); dtGMouldRecordType.Columns.Add("GMouldRecordTypeName"); DataRow dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = -1; dr["GMouldRecordTypeName"] = ""; dtGMouldRecordType.Rows.Add(dr); dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = 0; dr["GMouldRecordTypeName"] = "停用"; dtGMouldRecordType.Rows.Add(dr); dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = 1; dr["GMouldRecordTypeName"] = "维修"; dtGMouldRecordType.Rows.Add(dr); dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = 3; dr["GMouldRecordTypeName"] = "换模"; dtGMouldRecordType.Rows.Add(dr); dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = 5; dr["GMouldRecordTypeName"] = "变产"; dtGMouldRecordType.Rows.Add(dr); dr = dtGMouldRecordType.NewRow(); dr["GMouldRecordTypeID"] = 6; dr["GMouldRecordTypeName"] = "整线变产"; dtGMouldRecordType.Rows.Add(dr); this.cmbGMouldRecordType.DataSource = dtGMouldRecordType; this.cmbGMouldRecordType.ValueMember = "GMouldRecordTypeID"; this.cmbGMouldRecordType.DisplayMember = "GMouldRecordTypeName"; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion #region 私有方法 /// /// 获取成型线权限 /// private void getPurview() { try { //StringBuilder sbPurview = new StringBuilder(); //DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(5, LogInUserInfo.CurrentUser.UserID); //if (dsPurview != null) //{ // foreach (DataRow dr in dsPurview.Tables[0].Rows) // { // sbPurview.Append(dr[0].ToString() + ","); // } // if (sbPurview.Length != Constant.INT_IS_ZERO) // { // this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1); // } //} //this.dkGrouting.Purview = _purview; //this.dkGrouting.IsEnablePurview = true; } catch (Exception ex) { throw ex; } } #endregion private void chkStart_CheckedChanged(object sender, EventArgs e) { txtDateStart.Enabled = chkStart.Checked; txtDateEnd.Enabled = chkStart.Checked; } private void chkEnd_CheckedChanged(object sender, EventArgs e) { txtDateStart2.Enabled = chkEnd.Checked; txtDateEnd2.Enabled = chkEnd.Checked; } } }