| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2105.cs
- * 2.功能描述:注浆变更
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/06/19 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Reflection;
- 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.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_2105 : DKFormBase
- {
- #region 成员变量
- private int? _groutingDailyID; //注浆主表ID
- private DateTime? _groutingDate; //注浆日期
- private int? _groutingLineID; //成型线ID
- #endregion
- #region 构造函数
- public F_PM_2105()
- {
- InitializeComponent();
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- this.Text = FormTitles.F_PM_2105;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- this.btnReplace.Text = ButtonText.BTN_REPLACE;
- this.btnCancelBarCode.Text = ButtonText.BTN_CANCELBINDBARCODE;
- }
- #endregion
- #region 事件
- /// <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 F_PM_2105_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvGroutingDaily.AutoGenerateColumns = false;
- this.txtGroutingDate.Value = DateTime.Now;
- //this.dkGroutingLine.IsEnablePurview = true;
- //getPurviewLine();//获取成型线权限
- }
- 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 tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- #endregion
- /// <summary>
- /// 清空条件按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.scbGroutingLine.ClearValue();
- this.txtGroutingDate.Value = DateTime.Now;
- }
- /// <summary>
- /// 查询按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.scbGroutingLine.Text == string.Empty)
- {
- // 提示
- MessageBox.Show("请选择成型线", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.scbGroutingLine.Focus();
- return;
- }
- this.dgvGroutingDaily.DataSource = null;
- this.dgvGroutingDaily.DataSource = this.GetSearchData();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 根据界面查询条件获取数据集
- /// </summary>
- private DataTable GetSearchData()
- {
- try
- {
- GroutingDailyEntity se = new GroutingDailyEntity();
- se.GroutingLineID = this.scbGroutingLine.SearchedPKMember;
- se.GroutingDate = this.txtGroutingDate.Value;
- se.GroutingBatchNo = (this.txtGroutingBatchNo.DataValue.HasValue ? (int)this.txtGroutingBatchNo.DataValue : 1);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxy.Service.GetFPM2105Data(se);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[0].Rows.Count > 0)
- {
- this._groutingDailyID = Convert.ToInt32(sre.Data.Tables[0].Rows[0]["GroutingDailyID"]);
- this._groutingDate = Convert.ToDateTime(sre.Data.Tables[0].Rows[0]["GroutingDate"]);
- this._groutingLineID = Convert.ToInt32(sre.Data.Tables[0].Rows[0]["GroutingLineId"]);
- }
- return sre.Data.Tables[0];
- }
- return null;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 获取成型线权限
- /// </summary>
- protected void getPurviewLine()
- {
- try
- {
- //StringBuilder sbProcedurePurview = new StringBuilder();
- ////权限
- //DataSet dsProcedurePurview = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return SystemModuleProxy.Service.GetUserPurview(6, LogInUserInfo.CurrentUser.UserID);
- //}));
- //if (dsProcedurePurview != null)
- //{
- // foreach (DataRow dr in dsProcedurePurview.Tables[Constant.INT_IS_ZERO].Rows)
- // {
- // sbProcedurePurview.Append(dr[Constant.INT_IS_ZERO].ToString() + ",");
- // }
- // if (sbProcedurePurview.Length != Constant.INT_IS_ZERO)
- // {
- // this.dkGroutingLine.Purview = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
- // this.dkGroutingLine.GroutingLineIDS = sbProcedurePurview.ToString().Substring(Constant.INT_IS_ZERO, sbProcedurePurview.Length - 1);
- // }
- //}
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 全选按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkUserChoose_CheckedChanged(object sender, EventArgs e)
- {
- DataTable returnData = (DataTable)this.dgvGroutingDaily.DataSource;
- if (returnData != null)
- {
- int rightFlag = Convert.ToInt16(chkUserChoose.Checked);
- for (int i = 0; i < returnData.Rows.Count; i++)
- {
- returnData.Rows[i]["Sel"] = rightFlag;
- }
- }
- }
- /// <summary>
- /// 替换按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnReplace_Click(object sender, EventArgs e)
- {
- string groutingUserCode = this.txtGroutingUserCode.Text.Trim();
- int? goodsid = this.dkGoodsCode.GoodsID;
- try
- {
- if (this._groutingDailyID == null)
- {
- // 提示信息
- MessageBox.Show("请先查询注浆信息!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (string.IsNullOrWhiteSpace(groutingUserCode) && goodsid == null)
- {
- // 提示信息
- MessageBox.Show("成型工号与产品编码至少填写一项!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string GroutingDailyDetailIDs = "";
- DataTable dt = this.dgvGroutingDaily.DataSource as DataTable;
- if (dt != null && dt.Rows.Count > 0)
- {
- //dt.AcceptChanges();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (Convert.ToInt32(dt.Rows[i]["Sel"]) == 1)
- {
- GroutingDailyDetailIDs += dt.Rows[i]["GroutingDailyDetailID"].ToString() + ",";
- }
- }
- GroutingDailyDetailIDs = GroutingDailyDetailIDs.TrimEnd(',');
- }
- ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxy.Service.SetFPM2105Data(this._groutingLineID, this._groutingDailyID, GroutingDailyDetailIDs, Convert.ToDateTime(this._groutingDate), this.txtGroutingUserCode.Text.Trim(), this.dkGoodsCode.GoodsID);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- this.DialogResult = DialogResult.OK;
- this._groutingDailyID = null;
- this._groutingDate = null;
- this.dgvGroutingDaily.DataSource = null;
- this.txtGroutingUserCode.Text = string.Empty;
- this.dkGoodsCode.ClearControl();
- this.scbGroutingLine.ClearValue();
- this.txtGroutingDate.Value = DateTime.Now.Date;
- //this.Close();
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
- }
- }
- 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 btnCancelBarCode_Click(object sender, EventArgs e)
- {
- try
- {
- if (this._groutingDailyID == null)
- {
- // 提示信息
- MessageBox.Show("请先查询注浆信息!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string BarCodes = "";
- DataTable dt = this.dgvGroutingDaily.DataSource as DataTable;
- if (dt != null && dt.Rows.Count > 0)
- {
- //dt.AcceptChanges();
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (Convert.ToInt32(dt.Rows[i]["Sel"]) == 1 && dt.Rows[i]["BarCode"].ToString()!="")
- {
- BarCodes += dt.Rows[i]["BarCode"].ToString() + ",";
- }
- }
- BarCodes = BarCodes.TrimEnd(',');
- }
- if(BarCodes==string.Empty)
- {
- MessageBox.Show("请先选择取消绑定的条码!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxy.Service.SetFPM2105CancelBarCodeData(BarCodes);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- this.DialogResult = DialogResult.OK;
- this._groutingDailyID = null;
- this._groutingDate = null;
- this.dgvGroutingDaily.DataSource = null;
- this.txtGroutingUserCode.Text = string.Empty;
- this.dkGoodsCode.ClearControl();
- this.scbGroutingLine.ClearValue();
- this.txtGroutingDate.Value = DateTime.Now.Date;
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|