| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- /*******************************************************************************
- * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_RPT_030117.cs
- * 2.功能描述:产成品交接撤销汇总表
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 付斌 2015/08/08 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Basics.Library;
- 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.DataModels.PMModule;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.ReportModule
- {
- public partial class F_RPT_030117 : DKDockPanelBase
- {
- #region 成员变量
- private static F_RPT_030117 _instance; // 窗体的单例模式
- private SearchFinishedProductEntity _orderEntityBySearch; // 按钮查询条件实体类
- private SearchFinishedProductEntity _orderEntityByDouble; // 双击查询条件实体类
- #endregion
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- private F_RPT_030117()
- {
- InitializeComponent();
- // 控件赋值
- this.Text = FormTitles.F_RPT_030117;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- }
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_RPT_030117 Instance
- {
- get
- {
- if (_instance == null || _instance.IsDisposed)
- {
- _instance = new F_RPT_030117();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_RPT_030102_1_Load(object sender, EventArgs e)
- {
- try
- {
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- // 设置表格不自动创建列
- this.dgvUndoTotal.AutoGenerateColumns = false;
- this.dgvUndoDetail.AutoGenerateColumns = false;
- this.dtpStartTime.Value = DateTime.Now.Date;
- this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
- this.FHTimeStart.Value = DateTime.Now.Date;
- this.FHTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
- }
- 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 btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- // 设置查询实体类
- GetOrderEntityFromLayout();
- this.btnSearch.Enabled = false;
- this.btnClearCondition.Enabled = false;
- if (this.ckflag.Checked && !this.chkDateTime.Checked)
- {
- MessageBox.Show("已勾选【过滤撤销时间再交接产品】,请选择撤销时间", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return ;
- }
- // 汇总表查询
- if (this.tblUndo.SelectedIndex == Constant.INT_IS_ZERO)
- {
- this.dgvUndoTotal.DataSource = null;
- this.dgvUndoTotal.DataSource = this.GetSearchTotalData();
- }
- // 明细表查询
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_ONE)
- {
- this.dgvUndoDetail.DataSource = null;
- this.dgvUndoDetail.DataSource = this.GetSearchDetailData();
- }
- // 明细表查询
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_TWO)
- {
- this.dgvlc.DataSource = null;
- this.dgvlc.DataSource = this.GetlcSearchTotalData();
- }
- // 明细表查询
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_THREE)
- {
- this.dgvlcDetail.DataSource = null;
- this.dgvlcDetail.DataSource = this.GetlcSearchDetailData();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- }
- }
- /// <summary>
- /// 双击单元格事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvScrapTotalModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- // 判断是否为空
- if (this.dgvUndoTotal.CurrentRow == null)
- {
- return;
- }
- // 创建实体,获取数据信息
- this._orderEntityByDouble = new SearchFinishedProductEntity();
- DataGridViewRow dgvr = dgvUndoTotal.CurrentRow;
- string goodsModel = dgvr.Cells["GoodsModel"].Value.ToString();
- DateTime createTime = new DateTime();
- DateTime.TryParse(dgvr.Cells["CreateTime"].Value + "", out createTime);
- this.btnSearch.Enabled = false;
- this.btnClearCondition.Enabled = false;
- // 正常选择统计行
- if (!goodsModel.Equals("--"))
- {
- this.tblUndo.SelectTab(1);
- // 获取查询条件
- this._orderEntityByDouble.GoodsModel = goodsModel;
- this._orderEntityByDouble.UndoTimeStart = createTime;
- this._orderEntityByDouble.UndoTimeEnd = createTime.AddDays(1).AddMinutes(-1);
- this.dgvUndoDetail.DataSource = null;
- this.dgvUndoDetail.DataSource = GetSearchDetailDataByDouble();
- return;
- }
- // 小计行
- if (dgvr.Cells["CreateTime"].Value.ToString().StartsWith("小计"))
- {
- this.tblUndo.SelectTab(1);
- dgvr = dgvUndoTotal.Rows[this.dgvUndoTotal.CurrentCell.RowIndex - 1];
- // 获取查询条件
- createTime = Convert.ToDateTime(dgvr.Cells["CreateTime"].Value);
- this._orderEntityByDouble.UndoTimeStart = createTime;
- this._orderEntityByDouble.UndoTimeEnd = createTime.AddDays(1).AddMinutes(-1);
- // 导入上一次查询的商品规格的条件
- this._orderEntityByDouble.GoodsModel = _orderEntityBySearch.GoodsModel;
- this.dgvUndoDetail.DataSource = null;
- this.dgvUndoDetail.DataSource = GetSearchDetailDataByDouble();
- return;
- }
- // 合计行
- if (dgvr.Cells["CreateTime"].Value.ToString().StartsWith("合计"))
- {
- this.tblUndo.SelectTab(1);
- dgvr = dgvUndoTotal.Rows[this.dgvUndoTotal.CurrentCell.RowIndex - 2];
- // 获取查询条件
- this._orderEntityByDouble.UndoTimeStart = _orderEntityBySearch.UndoTimeStart;
- this._orderEntityByDouble.UndoTimeEnd = _orderEntityBySearch.UndoTimeEnd;
- this._orderEntityByDouble.GoodsModel = _orderEntityBySearch.GoodsModel;
- this.dgvUndoDetail.DataSource = null;
- this.dgvUndoDetail.DataSource = GetSearchDetailDataByDouble();
- return;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- }
- }
- /// <summary>
- /// 清空条件按钮点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.chkDateTime.Checked = true;
- this.dtpStartTime.Value = DateTime.Now.Date;
- this.dtpEndTime.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
- this.txtGoodsModel.Clear();
- }
- /// <summary>
- /// 复选框改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDateTime_CheckedChanged(object sender, EventArgs e)
- {
- this.dtpStartTime.Enabled = chkDateTime.Checked;
- this.dtpEndTime.Enabled = chkDateTime.Checked;
- }
- /// <summary>
- /// 自动适应列宽按钮点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- if (this.tblUndo.SelectedIndex == Constant.INT_IS_ZERO)
- {
- this.dgvUndoTotal.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_ONE)
- {
- this.dgvUndoDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_TWO)
- {
- this.dgvlc.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- else if (this.tblUndo.SelectedIndex == Constant.INT_IS_THREE)
- {
- this.dgvlcDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- }
- /// <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_RPT_030102_1_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 查询按钮搜索条件
- /// </summary>
- /// <returns></returns>
- private SearchFinishedProductEntity GetOrderEntityFromLayout()
- {
- this._orderEntityBySearch = new SearchFinishedProductEntity();
- if (this.chkDateTime.Checked)
- {
- this._orderEntityBySearch.UndoTimeStart = this.dtpStartTime.Value;
- this._orderEntityBySearch.UndoTimeEnd = this.dtpEndTime.Value;
- }
- if (this.FHCheckBox.Checked)
- {
- this._orderEntityBySearch.FHTimeStart = this.FHTimeStart.Value;
- this._orderEntityBySearch.FHTimeEnd = this.FHTimeEnd.Value;
- }
- this._orderEntityBySearch.GoodsModel = this.txtGoodsModel.Text.Trim();
- //过滤撤销时间再交接产品
- if (this.ckflag.Checked)
- {
- this._orderEntityBySearch.FhFlag = "1";
- }
- else
- {
- this._orderEntityBySearch.FhFlag = "0";
- }
- return this._orderEntityBySearch;
- }
- /// <summary>
- /// 查询汇总表
- /// </summary>
- private DataTable GetSearchTotalData()
- {
- try
- {
- // 异步处理,验证挂起条码
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_RPT_030117";
- cre.Name = "GetSearchTotalData";
- cre.Request = JsonHelper.ToJson(_orderEntityBySearch);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return ReportModuleProxy.Service.DoRequest(cre);
- }));
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- return sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- /// <summary>
- /// 查询明细表
- /// </summary>
- private DataTable GetSearchDetailData()
- {
- try
- {
- // 异步处理,验证挂起条码
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_RPT_030117";
- cre.Name = "GetSearchDetailData";
- cre.Request = JsonHelper.ToJson(_orderEntityBySearch);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return ReportModuleProxy.Service.DoRequest(cre);
- }));
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, tapUndoDetail.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- return sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- /// <summary>
- /// 查询明细表(通过汇总表双击事件)
- /// </summary>
- private DataTable GetSearchDetailDataByDouble()
- {
- try
- {
- // 异步处理,验证挂起条码
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_RPT_030117";
- cre.Name = "GetSearchDetailData";
- cre.Request = JsonHelper.ToJson(_orderEntityByDouble);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return ReportModuleProxy.Service.DoRequest(cre);
- }));
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, tapUndoDetail.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- return sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- /// <summary>
- /// 查询裸瓷汇总表
- /// </summary>
- private DataTable GetlcSearchTotalData()
- {
- try
- {
- // 异步处理,验证挂起条码
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_RPT_030117";
- cre.Name = "GetlcSearchTotalData";
- cre.Request = JsonHelper.ToJson(_orderEntityBySearch);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return ReportModuleProxy.Service.DoRequest(cre);
- }));
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- return sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- /// <summary>
- /// 查询裸瓷明细表
- /// </summary>
- private DataTable GetlcSearchDetailData()
- {
- try
- {
- // 异步处理,验证挂起条码
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_RPT_030117";
- cre.Name = "GetlcSearchDetailData";
- cre.Request = JsonHelper.ToJson(_orderEntityBySearch);
- // 调用服务器端获取数据集
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() =>
- {
- return ReportModuleProxy.Service.DoRequest(cre);
- }));
- if (sre.Status == Constant.ServiceResultStatus.NoSearchResults)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, tapUndoDetail.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- return sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- return null;
- }
- }
- #endregion
- }
- }
|