| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2101.cs
- * 2.功能描述:在产盘点一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/05/13 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.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 在产盘点一览
- /// </summary>
- public partial class F_PM_2101 : DockPanelBase
- {
- #region 成员变量
- // 窗体的单例模式
- private static F_PM_2101 _instance;
- // 当前选择的行
- private int _selectedRowIndex;
- #endregion
- #region 构造函数
- public F_PM_2101()
- {
- InitializeComponent();
- this.Text = "在产盘点";//FormTitles.F_PM_2101;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- this.tsbtnClearData.Text = ButtonText.TSBTN_CLEARDATAINCHECKED;
- this.tsbtnAll.Text = ButtonText.TSBTN_ALL;
- this.tsbtnUnAll.Text = ButtonText.TSBTN_UNALL;
- this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- }
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_2101 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PM_2101();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 新建按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_2102 frmPM2102 = new F_PM_2102();
- DialogResult dialogResult = frmPM2102.ShowDialog();
- // 重新加载GridView
- if (dialogResult == DialogResult.OK)
- {
- // 数据量大时,查询明细会卡顿。
- //InCheckedEntity requestEntity = CreatesearchInCheckedRequestEntity();
- //DataSet dtInChecked = (DataSet)DoAsync(new AsyncMethod(() =>
- //{
- // return PMModuleProxy.Service.GetAllInChecked(requestEntity);
- //}));
- //if (dtInChecked != null && dtInChecked.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
- //{
- // this.dgvInChecked.DataSource = null;
- // this.dgvInChecked.DataSource = dtInChecked.Tables[0];
- // this.dgvInChecked.Rows[this.dgvInChecked.CurrentCell.RowIndex].Selected = true;
- // this.dgvInChecked.CurrentCell = this.dgvInChecked.Rows[this.dgvInChecked.CurrentCell.RowIndex].Cells["InCheckedNo"];
- // // 设置ToolStripButton按钮状态
- // this.tsbtnInChecked.Enabled = true;
- // this.tsbtnDisable.Enabled = true;
- // this.dgvInChecked.ReadOnly = true;
- // //btnSearch_Click(null, null);
- //}
- }
- }
- 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 tsbtnInChecked_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_2103 frmPM2103 = null;
- if (this.dgvInChecked.CurrentCell != null)
- {
- int InCheckedID = Convert.ToInt32(
- this.dgvInChecked.Rows[this._selectedRowIndex].Cells["InCheckedID"].Value);
- string InCheckedNO =
- this.dgvInChecked.Rows[this._selectedRowIndex].Cells["InCheckedNo"].Value.ToString();
- frmPM2103 = new F_PM_2103(InCheckedID, InCheckedNO);
- DialogResult dialogResult = frmPM2103.ShowDialog();
- // 重新加载GridView
- if (dialogResult == DialogResult.OK)
- {
- //btnSearch_Click(sender, e);
- dgvInChecked_SelectionChanged(null, null);
- }
- }
- }
- 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 tsbtnDisable_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvInChecked.CurrentCell != null)
- {
- DialogResult dialogResult
- = MessageBox.Show(string.Format(Messages.MSG_CMN_Q002, "盘点单", "停用"),
- this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dialogResult.Equals(DialogResult.No))
- {
- return;
- }
- int InCheckedID = Convert.ToInt32(
- this.dgvInChecked.Rows[this._selectedRowIndex].Cells["InCheckedID"].Value);
- // 停用
- int result = (int)DoAsync(() =>
- {
- return PMModuleProxy.Service.DisableInChecked(InCheckedID);
- });
- if (result > Constant.INT_IS_ZERO)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "盘点单", "停用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 刷新窗口数据
- this.btnSearch_Click(sender, e);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "盘点单", "停用"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- }
- 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 F_PM_2101_Load(object sender, EventArgs e)
- {
- try
- {
- // 绑定权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- this.dgvInChecked.AutoGenerateColumns = false;
- this.dgvInCheckedNoDetail.AutoGenerateColumns = false;
- this.dgvInCheckededDetail.AutoGenerateColumns = false;
- this.dgvInCheckedWinDetail.AutoGenerateColumns = false;
- this.dgvInCheckedNoDetail.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;
- // 初始化时间控件为当前日期
- this.dtpStartTime.Value = DateTime.Now.Date;
- this.dtpEndTime.Value = DateTime.Now.Date;
- }
- 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 F_PM_2101_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 清空按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtInCheckedNo.Clear();
- this.txtCheckedName.Clear();
- // 初始化时间控件为当前日期
- this.dtpStartTime.Value = DateTime.Now.Date;
- this.dtpEndTime.Value = DateTime.Now.Date;
- }
- /// <summary>
- /// 选定项改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvInChecked_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- // 在绑定总表时 不查询明细
- if (!Convert.ToBoolean(this.Tag)
- || this.dgvInChecked.CurrentCell == null)
- {
- return;
- }
- // 选中行时查询明细
- else
- {
- if (this.txtInCheckedNo.ReadOnly)
- {
- return;
- }
- this.dgvInChecked.Enabled = false;
- this._selectedRowIndex = this.dgvInChecked.CurrentCell.RowIndex;
- this.dgvInCheckedNoDetail.DataSource = null;
- this.dgvInCheckededDetail.DataSource = null;
- this.dgvInCheckedWinDetail.DataSource = null;
- this.dgvFunctionUsers.DataSource = null;
- int InCheckedID = Convert.ToInt32(this.dgvInChecked.Rows[_selectedRowIndex].Cells["InCheckedID"].Value.ToString());
- DataSet dsProductionDefect = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PMModuleProxy.Service.GetAllInCheckedDetail(InCheckedID);
- }));
- if (dsProductionDefect != null && dsProductionDefect.Tables.Count > Constant.INT_IS_ZERO)
- {
- //DataRow[] drInCheckedNo = dsProductionDefect.Tables[0].Select("InCheckedFlag=" + Constant.InCheckedFlag.InCheckedNo.GetHashCode());
- //if (drInCheckedNo.Length > 0)
- //{
- // this.dgvInCheckedNoDetail.DataSource = drInCheckedNo.CopyToDataTable();
- //}
- //DataRow[] drInCheckeded = dsProductionDefect.Tables[0].Select("InCheckedFlag=" + Constant.InCheckedFlag.InCheckeded.GetHashCode());
- //if (drInCheckeded.Length > 0)
- //{
- // this.dgvInCheckededDetail.DataSource = drInCheckeded.CopyToDataTable();
- //}
- //DataRow[] drInCheckedWin = dsProductionDefect.Tables[0].Select("InCheckedFlag=" + Constant.InCheckedFlag.InCheckedWin.GetHashCode());
- //if (drInCheckedWin.Length > 0)
- //{
- // this.dgvInCheckedWinDetail.DataSource = drInCheckedWin.CopyToDataTable();
- //}
- //if(dsProductionDefect.Tables[1].Rows.Count>0)
- //{
- // this.dgvFunctionUsers.DataSource = dsProductionDefect.Tables[1];
- //}
- this.dgvInCheckedNoDetail.DataSource = dsProductionDefect.Tables[0];
- this.dgvInCheckededDetail.DataSource = dsProductionDefect.Tables[1];
- this.dgvInCheckedWinDetail.DataSource = dsProductionDefect.Tables[2];
- this.dgvFunctionUsers.DataSource = dsProductionDefect.Tables[3];
- this.dgvInCheckedNoDetail.IsSetInputColumnsColor = true;
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- this.dgvInChecked.Enabled = true;
- this.dgvInChecked.Focus();
- }
- }
- /// <summary>
- /// 搜索按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- // 记录当前选中行
- int selectRowIndex = this._selectedRowIndex;
- // 控制明细不查询
- this.Tag = false;
- // 异步处理
- this.btnSearch.Enabled = false;
- this.btnClearCondition.Enabled = false;
- this.dgvInChecked.DataSource = null;
- this.dgvFunctionUsers.DataSource = null;
- this.dgvInCheckededDetail.DataSource = null;
- this.dgvInCheckedNoDetail.DataSource = null;
- this.dgvInCheckedWinDetail.DataSource = null;
- InCheckedEntity requestEntity = CreatesearchInCheckedRequestEntity();
- DataSet dsInChecked = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PMModuleProxy.Service.GetAllInChecked(requestEntity);
- }));
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- if (dsInChecked != null)
- {
- base.DataSource = dsInChecked;
- if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
- {
- tsbtnInChecked.Enabled = true;
- tsbtnDisable.Enabled = true;
- this.dgvInChecked.DataSource = this.DataSource.Tables[0];
- selectRowIndex = 0;
- if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
- {
- tsbtnInChecked.Enabled = false;
- tsbtnDisable.Enabled = false;
- this.dgvInCheckedNoDetail.DataSource = null;
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- if (selectRowIndex >= Constant.INT_IS_ZERO)
- {
- //if (selectRowIndex >= dsInChecked.Tables[0].Rows.Count)
- //{
- // this.dgvInChecked.Rows[this.dgvInChecked.Rows.Count - 1].Selected = true;
- // this.dgvInChecked.CurrentCell = this.dgvInChecked.Rows[this.dgvInChecked.Rows.Count - 1].Cells["InCheckedNo"];
- //}
- //else
- //{
- // this.dgvInChecked.Rows[selectRowIndex].Selected = true;
- // this.dgvInChecked.CurrentCell = this.dgvInChecked.Rows[selectRowIndex].Cells["InCheckedNo"];
- //}
- this.Tag = true;
- dgvInChecked_SelectionChanged(null, null);
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- this.tsrOperate.Enabled = true;
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 控制明细不查询
- this.Tag = true;
- }
- }
- /// <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.dgvInChecked.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvInCheckedNoDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvInCheckededDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvInCheckedWinDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvFunctionUsers.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 搜索条件
- /// </summary>
- /// <returns></returns>
- private InCheckedEntity CreatesearchInCheckedRequestEntity()
- {
- InCheckedEntity result = new InCheckedEntity();
- result.InCheckedNo = this.txtInCheckedNo.Text.Trim();
- result.InCheckedName = this.txtCheckedName.Text.Trim();
- result.BeginDate = this.dtpStartTime.Value;
- result.EndDate = this.dtpEndTime.Value.AddDays(1);
- return result;
- }
- #endregion
- /// <summary>
- /// 清除未盘点数据按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClearData_Click(object sender, EventArgs e)
- {
- bool hasSearch = false;
- try
- {
- DataTable dt = this.dgvInCheckedNoDetail.DataSource as DataTable;
- if (dt == null)
- {
- MessageBox.Show("没有未盘点的数据",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- dt.AcceptChanges();
- DataRow[] dr = dt.Select("Sel=1");
- if (dr.Length == 0)
- {
- if (this.dgvInChecked.CurrentCell != null)
- {
- int InCheckedID = Convert.ToInt32(this.dgvInChecked.Rows[this.dgvInChecked.CurrentCell.RowIndex].Cells["InCheckedID"].Value);
- string InCheckedNo = this.dgvInChecked.Rows[this.dgvInChecked.CurrentCell.RowIndex].Cells["InCheckedNo"].Value.ToString();
- F_PM_2117 frmPM2117 = new F_PM_2117(InCheckedID, InCheckedNo);
- DialogResult dialogResult2 = frmPM2117.ShowDialog();
- // 重新加载GridView
- if (dialogResult2 == DialogResult.OK)
- {
- //btnSearch_Click(sender, e);
- dgvInChecked_SelectionChanged(null, null);
- }
- }
- return;
- }
- DialogResult dialogResult
- = MessageBox.Show("是否清除选择未盘点产品?",
- this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dialogResult.Equals(DialogResult.No))
- {
- return;
- }
- int incheckID = Convert.ToInt32(dr[0]["InCheckedID"]);
- string barcodes = "";
- foreach (DataRow r in dr)
- {
- barcodes += r["barcode"].ToString() + ",";
- }
- barcodes = barcodes.TrimEnd(',');
- // 清除
- int result = (int)DoAsync(() =>
- {
- return PMModuleProxy.Service.SaveClearInChecked(incheckID, barcodes);
- });
- if (result > Constant.INT_IS_ZERO)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "盘点产品", "清除数据"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 刷新窗口数据
- this.btnSearch_Click(sender, e);
- hasSearch = true;
- }
- else if (result == -Constant.INT_IS_ONE)
- {
- MessageBox.Show("返工产品不允许清除",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else if (result == -Constant.INT_IS_TWO)
- {
- MessageBox.Show("报损待审产品不允许清除",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "盘点产品", "清除数据"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- if (!hasSearch)
- {
- this.dgvInCheckedNoDetail.IsSetInputColumnsColor = true;
- }
- }
- }
- private void dgvInCheckedNoDetail_CurrentCellDirtyStateChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvInCheckedNoDetail.CurrentRow != null && this.dgvInCheckedNoDetail.IsCurrentCellDirty)
- {
- if ("Sel".Equals(this.dgvInCheckedNoDetail.Columns
- [this.dgvInCheckedNoDetail.CurrentCell.ColumnIndex].Name))
- {
- this.dgvInCheckedNoDetail.CommitEdit(DataGridViewDataErrorContexts.Commit);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnAll_Click(object sender, EventArgs e)
- {
- DataTable returnData = (DataTable)this.dgvInCheckedNoDetail.DataSource;
- if (returnData != null)
- {
- //for (int i = 0; i < returnData.Rows.Count; i++)
- //{
- // returnData.Rows[i]["Sel"] = 1;
- //}
- for (int i = 0; i < returnData.DefaultView.Count; i++)
- {
- returnData.DefaultView[i]["Sel"] = 1;
- returnData.DefaultView[i].EndEdit();
- }
- }
- }
- private void tsbtnUnAll_Click(object sender, EventArgs e)
- {
- DataTable returnData = (DataTable)this.dgvInCheckedNoDetail.DataSource;
- if (returnData != null)
- {
- for (int i = 0; i < returnData.Rows.Count; i++)
- {
- returnData.Rows[i]["Sel"] = 0;
- returnData.Rows[i].EndEdit();
- }
- }
- }
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvInChecked.CurrentRow;
- if (currentRow != null)
- {
- int InCheckedID = Convert.ToInt32(currentRow.Cells["InCheckedID"].Value);
- F_PM_2102 frm2102 = new F_PM_2102(InCheckedID, currentRow.Cells["Remarks"].Value.ToString(), currentRow.Cells["Incheckname"].Value.ToString());
- DialogResult dialogresult = frm2102.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- btnSearch_Click(sender, e);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void dgvInChecked_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (-1 < e.RowIndex && -1 < e.ColumnIndex && this.tsbtnEdit.Enabled && this.tsbtnEdit.Visible)
- {
- this.tsbtnEdit_Click(sender, e);
- }
- }
- private void dgvInCheckedNoDetail_Sorted(object sender, EventArgs e)
- {
- this.dgvInCheckedNoDetail.IsSetInputColumnsColor = true;
- }
- private void tsbtnCheckData_Click(object sender, EventArgs e)
- {
- bool hasSearch = false;
- try
- {
- DataTable dt = this.dgvInCheckedNoDetail.DataSource as DataTable;
- if (dt == null)
- {
- MessageBox.Show("没有未盘点的数据。",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- dt.AcceptChanges();
- DataRow[] dr = dt.Select("Sel=1");
- if (dr.Length == 0)
- {
- if (this.dgvInChecked.CurrentCell != null)
- {
- int inCheckedID = Convert.ToInt32(this.dgvInChecked.Rows[this.dgvInChecked.CurrentCell.RowIndex].Cells["InCheckedID"].Value);
- DialogResult dialogResultAll = MessageBox.Show("是否盘点所有未盘点产品?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- if (dialogResultAll == System.Windows.Forms.DialogResult.Yes)
- {
- ServiceResultEntity resultAll = (ServiceResultEntity)DoAsync(() =>
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "InChecked";
- cre.Name = "CheckBarcodes";
- cre.Properties["CheckedID"] = inCheckedID;
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- this.dgvInChecked_SelectionChanged(null, null);
- }
- }
- return;
- }
-
- DialogResult dialogResult = MessageBox.Show("是否盘点选中的产品?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- if (dialogResult == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- int incheckID = Convert.ToInt32(dr[0]["InCheckedID"]);
- string barcodes = "";
- foreach (DataRow r in dr)
- {
- barcodes += r["barcode"].ToString() + ",";
- }
- barcodes = barcodes.TrimEnd(',');
- ServiceResultEntity result = (ServiceResultEntity)DoAsync(() =>
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "InChecked";
- cre.Name = "CheckBarcodes";
- cre.Properties["CheckedID"] = incheckID;
- cre.Properties["Barcodes"] = barcodes;
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- this.dgvInChecked_SelectionChanged(null, null);
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- if (!hasSearch)
- {
- this.dgvInCheckedNoDetail.IsSetInputColumnsColor = true;
- }
- }
- }
- }
- }
|