/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_1402.cs * 2.功能描述:在产产品更多条件 * 编辑履历: * 作者 日期 版本 修改内容 * 宋扬 2014/10/24 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService; namespace Dongke.IBOSS.PRD.Client.PMModule { /// /// 在产产品更多条件 /// public partial class F_PM_1402 : FormBase { # region 成员变量 //在产产品实体 private SearchInProductionEntity _searchInProductionEntity = new SearchInProductionEntity(); // 窗体的单例模式 private static F_PM_1402 _instance; #endregion #region 属性 /// /// 当前员工实体 /// public SearchInProductionEntity searchInProductionEntity { get { return _searchInProductionEntity; } set { _searchInProductionEntity = value; } } #endregion #region 构造函数 public F_PM_1402() { InitializeComponent(); SetFromTitleInfo(); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_1402 Instance { get { if (_instance == null || _instance.IsDisposed) { _instance = new F_PM_1402(); } return _instance; } } #endregion #region 事件处理 /// /// 确定按钮 /// /// /// private void btnOK_Click(object sender, EventArgs e) { try { SearchInProductionData(); this.DialogResult = System.Windows.Forms.DialogResult.OK; } catch (Exception ex) { throw ex; } } /// /// 窗体关闭事件 /// /// /// private void F_PM_1402_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 关闭按钮 /// /// /// private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } /// ///注浆日期 选中框变更事件 /// /// /// private void cBoxGroutingDate_CheckedChanged(object sender, EventArgs e) { if (this.cBoxGroutingDate.Checked) { this.dtPGroutingDateStart.Enabled = true; this.dtPGroutingDateEnd.Enabled = true; } else { this.dtPGroutingDateStart.Enabled = false; this.dtPGroutingDateEnd.Enabled = true; } } /// ///更新日期 选中框变更事件 /// /// /// private void cBoxUpdateTime_CheckedChanged(object sender, EventArgs e) { if (this.cBoxUpdateTime.Checked) { this.dtpUpdateTimeStart.Enabled = true; this.dtpUpdateTimeEnd.Enabled = true; } else { this.dtpUpdateTimeStart.Enabled = false; this.dtpUpdateTimeEnd.Enabled = false; } } #endregion #region 私有方法 /// /// 设置窗体按钮的文本信息 /// private void SetFromTitleInfo() { this.Text = FormTitles.F_PM_1402; this.btnOK.Text = ButtonText.BTN_OK; this.btnCancel.Text = ButtonText.BTN_CANCEL; #region 绑定工序模型 DataTable newdtb = new DataTable(); newdtb.Columns.Add("Id", typeof(int)); newdtb.Columns.Add("ProcedureModel", typeof(string)); for (int i = 1; i <= 2; i++) { DataRow newRow = newdtb.NewRow(); newRow["Id"] = i; if (i == 1) { newRow["ProcedureModel"] = "计件模型"; } else { newRow["ProcedureModel"] = "检验模型"; } newdtb.Rows.Add(newRow); } this.dropProcedureModel.DisplayMember = "ProcedureModel"; this.dropProcedureModel.ValueMember = "Id"; this.dropProcedureModel.DataSource = newdtb; #endregion } /// /// 搜索条件 /// private void SearchInProductionData() { #region 条件赋值 this.searchInProductionEntity.GroutingLineName = this.txtGroutingLineName.Text.Trim(); this.searchInProductionEntity.GroutingLineCode = this.txtGroutingLineCode.Text.Trim(); this.searchInProductionEntity.GMouldTypeName = this.txtGMouldTypeName.Text.Trim(); this.searchInProductionEntity.ReworkProcedureName = this.txtReworkProcedureName.Text.Trim(); this.searchInProductionEntity.ModelTypeName = this.txtModelType.Text.Trim(); this.searchInProductionEntity.GoodsLevelName = this.txtgoodsLevelName.Text.Trim(); this.searchInProductionEntity.GoodsLevelTypeName = this.txtgoodsLevelTypeName.Text.Trim(); this.searchInProductionEntity.GroutingMouldCode = this.txtGroutingMouldCode.Text.Trim(); this.searchInProductionEntity.Remarks = this.txtRemarks.Text.Trim(); if (this.cBoxGroutingDate.Checked) { string groutingDateStart = this.dtPGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0"; this.searchInProductionEntity.GroutingDateStart = Convert.ToDateTime(groutingDateStart); string groutingDateEnd = this.dtPGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 0:0:0"; this.searchInProductionEntity.GroutingDateEnd = Convert.ToDateTime(groutingDateEnd); } this.searchInProductionEntity.UpdateUserName = this.txtUpdateUserName.Text.Trim(); this.searchInProductionEntity.CreateUserName = this.txtCreateUserName.Text.Trim(); if (this.cBoxUpdateTime.Checked) { string updateTimeStart = this.dtpUpdateTimeStart.Value.ToString("yyyy-MM-dd") + " 0:0:0"; this.searchInProductionEntity.UpdateTimeStart = Convert.ToDateTime(updateTimeStart); string updateTimeEnd = this.dtpUpdateTimeEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59"; this.searchInProductionEntity.UpdateTimeEnd = Convert.ToDateTime(updateTimeEnd); } #region 是否公坯 object[] objPublicBody = this.statusIsPublicBody.SelectedValues; string publicBody = ""; for (int i = 0; i < objPublicBody.Length; i++) { publicBody += objPublicBody[i] + ","; } publicBody = publicBody.TrimEnd(','); this.searchInProductionEntity.IsPublicBody = publicBody; #endregion #region 是否重烧 object[] objIsReFire = this.statusIsReFire.SelectedValues; string reFire = ""; for (int i = 0; i < objIsReFire.Length; i++) { reFire += objIsReFire[i] + ","; } reFire = reFire.TrimEnd(','); this.searchInProductionEntity.IsReFire = reFire; #endregion #region 能否多次注浆 object[] objCanManyTimes = this.statusCanManyTimes.SelectedValues; string canManyTimes = string.Empty; for (int i = 0; i < objCanManyTimes.Length; i++) { canManyTimes += objCanManyTimes[i] + ","; } canManyTimes = canManyTimes.TrimEnd(','); this.searchInProductionEntity.CanManyTimes = canManyTimes; #endregion this.searchInProductionEntity.ProcedureModel = this.dropProcedureModel.SelectedValue.ToString(); #endregion } #endregion } }