| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
-
- /*******************************************************************************
- * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PC_1201.cs
- * 2.功能描述:模具库存结转一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2017/12/07 1.00 新建
- *******************************************************************************/
- using System;
- using System.Reflection;
- using System.Windows.Forms;
- 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.PCModule
- {
- /// <summary>
- /// 模具档案
- /// </summary>
- public partial class F_PC_1201 : DKDockPanelBase
- {
- #region 成员变量
- private static F_PC_1201 _instance = null;
- private bool _isSearch = false;
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PC_1201 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PC_1201();
- }
- return _instance;
- }
- }
- #endregion
- #region 构造函数
- /// <summary>
- ///
- /// </summary>
- public F_PC_1201()
- {
- InitializeComponent();
- this.Text = "模具库存结转";
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.dgvCarryOver.AutoGenerateColumns = false;
- this.dgvDetail.AutoGenerateColumns = false;
- }
- #endregion
- #region 控件事件
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_1001_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 画面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PC_1001_Load(object sender, System.EventArgs e)
- {
- try
- {
- FormPermissionManager.FormPermissionControl(this.Name, this,
- LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- this.dtpMonthEnd.Value = DateTime.Now.AddMonths(-1);
- this.dtpMonthBegin.Value = DateTime.Now.AddMonths(-7);
- }
- 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.dgvCarryOver.AutoResizeColumns();
- this.dgvDetail.AutoResizeColumns();
- }
- /// <summary>
- /// 清除查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClearCondition_Click(object sender, EventArgs e)
- {
- this.dtpMonthEnd.Value = DateTime.Now.AddMonths(-1);
- this.dtpMonthBegin.Value = DateTime.Now.AddMonths(-7);
- this.txtRemarks.Clear();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- this.QueryDataFromOther();
- }
- 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 dgvCarryOver_SelectionChanged(object sender, EventArgs e)
- {
- if (_isSearch || this.dgvCarryOver.CurrentRow == null || this.dgvCarryOver.CurrentRow.Index < 0)
- {
- return;
- }
- try
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "FPC1201";
- cre.Name = "GetFPC1201QueryDetailData";
- cre.Properties["YYYYMM"] = this.dgvCarryOver.CurrentRow.Cells["YYYYMM"].Value.ToString();
- this.dgvDetail.DataSource = null;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- // 查询成功
- this.dgvDetail.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 tsbtnAutoCarryover_Click(object sender, EventArgs e)
- {
- try
- {
- F_PC_1204 f1204 = new F_PC_1204();
- f1204.ShowDialog();
- }
- 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 tsbtnCarryover_Click(object sender, EventArgs e)
- {
- try
- {
- F_PC_1202 f1202 = F_PC_1202.Instance;
- f1202.Show();
- f1202.ActivateForm();
- f1202.BringToFront();
- }
- 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 tsbtnUndoCarryover_Click(object sender, EventArgs e)
- {
- if (this.dgvCarryOver.CurrentRow == null || this.dgvCarryOver.CurrentRow.Index < 0)
- {
- return;
- }
- try
- {
- string yyyymm = this.dgvCarryOver.CurrentRow.Cells["YYYYMM"].Value.ToString();
- DialogResult dialogResult =
- MessageBox.Show(string.Format("确定要对【{0}】及以后的库存结转进行反结转?", yyyymm),
- "模具库存反结转",
- MessageBoxButtons.OKCancel,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button2);
- if (dialogResult != System.Windows.Forms.DialogResult.OK)
- {
- return;
- }
- dialogResult =
- MessageBox.Show("反结转将会删除已结转数据,是否继续?",
- "模具库存反结转",
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Warning,
- MessageBoxDefaultButton.Button2);
- if (dialogResult != System.Windows.Forms.DialogResult.Yes)
- {
- return;
- }
- // 异步处理,获取系统参数信息
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "FPC1201";
- cre.Name = "SetFPC1203Data";
- cre.Properties["YYYYMM"] = yyyymm;
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "【" + yyyymm + "】及以后", "库存反结转"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "【" + yyyymm + "】及以后", "库存反结转"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- this.tsbtnSearch_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 tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 查询数据
- /// </summary>
- /// <returns>验证通过true,其他false</returns>
- private void QueryDataFromOther()
- {
- try
- {
- _isSearch = true;
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "FPC1201";
- cre.Name = "GetFPC1201QueryData";
- cre.Properties["DateBegin"] = this.dtpMonthBegin.Value.Value.ToString("yyyyMM");
- cre.Properties["DateEnd"] = this.dtpMonthEnd.Value.Value.ToString("yyyyMM");
- this.dgvCarryOver.DataSource = null;
- this.dgvDetail.DataSource = null;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PCModuleProxyNew.Service.HandleRequest(cre);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- // 查询成功
- this.dgvCarryOver.DataSource = sre.Data.Tables[0];
- this.dgvDetail.DataSource = sre.Data.Tables[1];
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- _isSearch = false;
- }
- }
- #endregion
- }
- }
|