| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_0101.cs
- * 2.功能描述:注浆登记一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2015/03/25 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Reflection;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 注浆登记一览
- /// </summary>
- public partial class F_PM_0101 : DKDockPanelBase
- {
- #region 成员变量
- // 单例模式
- private static F_PM_0101 _instance;
- #endregion
- #region 构造函数
- /// <summary>
- /// 注浆日报一览窗体构造
- /// </summary>
- private F_PM_0101()
- {
- this.InitializeComponent();
- this.InitializeControls();
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_0101 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PM_0101();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- private void F_PM_0101_Load(object sender, EventArgs e)
- {
- try
- {
- // 按钮权限控制
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- // 获取成型线类型数据并绑定到控件上
- ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.GetFPM0101IData();
- }
- );
- if (sre.Data != null && sre.Data.Tables.Count > 0)
- {
- this.cboGroutingLineType.DataSource = sre.Data.Tables[0];
- }
- this.cboGroutingLineType.SelectedValue = null;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtRemarks.Clear();
- this.txtGoodsCode.Clear();
- this.txtGoodsName.Clear();
- this.txtGroutingLineCode.Clear();
- this.txtGroutingLineName.Clear();
- this.txtGroutingMouldCode.Clear();
- this.txtGroutingUser.Clear();
- this.chkGroutingFlag.AllItemCheck();
- this.chkScrapFlag.AllItemCheck();
- this.chkBarcodeFlag.AllItemCheck();
- this.txtGroutingDateBegin.Value = DateTime.Now.Date;
- this.txtGroutingDateEnd.Value = DateTime.Now.Date;
- this.cboGroutingLineType.SelectedValue = null;
- this.txtGroutingBatchNo.Clear();
- this.chkDeliverTime.Checked = false;
- this.chkDeliverFlag.ClearItemCheck();
- }
- /// <summary>
- /// 查询数据
- /// </summary>
- private void btnSearch_Click(object sender, System.EventArgs e)
- {
- try
- {
- this.dgvGroutingDaily.DataSource = null;
- this.dgvGroutingDaily.DataSource = this.GetSearchData();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- // 内存回收 241220
- finally
- {
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
- }
- /// <summary>
- /// 添加新注浆日报
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_0102 frmFPM0102 = new F_PM_0102();
- DialogResult dialogresult = frmFPM0102.ShowDialog();
- if (dialogresult == DialogResult.OK)
- {
- string groutingDailyIDs = frmFPM0102.GroutingDailyIDs;
- this.dgvGroutingDaily.DataSource = null;
- // 调用服务器端获取数据集
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.GetFPM0101SData(groutingDailyIDs);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
- }
- //this.btnSearch_Click(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 编辑注浆日报
- /// </summary>
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
- if (currentRow != null)
- {
- int dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
- F_PM_0102 frmFPM0102 = new F_PM_0102(dailyId);
- DialogResult dialogresult = frmFPM0102.ShowDialog();
- if (dialogresult == DialogResult.OK)
- {
- //this.btnSearch_Click(sender, e);
- string groutingDailyIDs = dailyId.ToString();// frmFPM0102.GroutingDailyIDs;
- this.dgvGroutingDaily.DataSource = null;
- // 调用服务器端获取数据集
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.GetFPM0101SData(groutingDailyIDs);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
- }
- }
- }
- else
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 编辑注浆日报
- /// </summary>
- private void dgvGroutingDaily_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex < 0 || e.ColumnIndex < 0)
- {
- return;
- }
- this.tsbtnEdit_Click(sender, null);
- }
- /// <summary>
- /// 绑定条码
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnBindBarCode_Click(object sender, EventArgs e)
- {
- try
- {
- //F_PM_0103 frmPM0103 = new F_PM_0103();
- //DialogResult dialogResult = frmPM0103.ShowDialog();
- //if (dialogResult == DialogResult.OK)
- //{
- // this.btnSearch_Click(sender, e);
- //}
- int dailyId = 0;
- DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
- if (currentRow != null)
- {
- dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
- }
- F_PM_0103 frmPM0103 = new F_PM_0103(dailyId);
- DialogResult dialogResult = frmPM0103.ShowDialog();
- //if (dialogResult == DialogResult.OK)
- //{
- // this.btnSearch_Click(sender, e);
- //}
- if (frmPM0103.GroutingDailyIDs != null && frmPM0103.GroutingDailyIDs.Count > 0)
- {
- string ids = string.Join(",", frmPM0103.GroutingDailyIDs);
- this.dgvGroutingDaily.DataSource = null;
- // 调用服务器端获取数据集
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.GetFPM0101SData(ids);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 关闭按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自动列宽事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 窗体关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 初始化控件
- /// </summary>
- private void InitializeControls()
- {
- this.Text = FormTitles.F_PM_0101;
- this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
- this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- this.chkGroutingFlag.AllItemCheck();
- this.chkScrapFlag.AllItemCheck();
- this.chkBarcodeFlag.AllItemCheck();
- this.dgvGroutingDaily.AutoGenerateColumns = false;
- this.dgvGroutingDaily.ReadOnly = true;
- }
- /// <summary>
- /// 根据界面查询条件获取数据集
- /// </summary>
- private DataTable GetSearchData()
- {
- try
- {
- FPM0101_SE se = new FPM0101_SE();
- se.GroutingLineCode = this.txtGroutingLineCode.Text;
- se.GroutingLineName = this.txtGroutingLineName.Text;
- se.GroutingMouldCode = this.txtGroutingMouldCode.Text;
- se.GoodsCode = this.txtGoodsCode.Text;
- se.GoodsName = this.txtGoodsName.Text;
- se.Remarks = this.txtRemarks.Text;
- se.GroutingDateBegin = this.txtGroutingDateBegin.Value.Date;
- se.GroutingDateEnd = this.txtGroutingDateEnd.Value.Date;
- if (this.txtGroutingBatchNo.DataValue.HasValue)
- {
- se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
- }
- if (this.cboGroutingLineType.SelectedValue != null)
- {
- se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue);
- }
- object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
- if (groutingFlags.Length == 1)
- {
- se.GroutingFlag = groutingFlags[0].ToString();
- }
- object[] scrapFlags = this.chkScrapFlag.SelectedValues;
- if (scrapFlags.Length == 1)
- {
- se.ScrapFlag = scrapFlags[0].ToString();
- }
- object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
- if (barcodeFlags.Length == 1)
- {
- se.BarCodeFlag = barcodeFlags[0].ToString();
- }
- se.GroutingUserCode = this.txtGroutingUser.Text;
- object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
- if (deliverFlag.Length == 1)
- {
- se.DeliverFlag = deliverFlag[0].ToString();
- }
- if (this.chkDeliverTime.Checked)
- {
- se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value;
- se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value;
- }
- // 调用服务器端获取数据集
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.GetFPM0101SData(se);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- return sre.Data.Tables[0];
- }
- return null;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
- {
- this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
- this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
- if (!this.chkDeliverTime.Checked)
- {
- this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
- this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
- }
- }
- private void tsbtnUnLast_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_0106 f_PM_0106 = new F_PM_0106();
- f_PM_0106.ShowDialog();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|