| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_GoodsImage.cs
- * 2.功能描述:产品线性图
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 冯林勇 2024-04-15 1.00 一览
- *******************************************************************************/
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.WinForm.Controls;
- using System;
- using System.Reflection;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.Controls
- {
- public partial class F_MST_GoodsImage : DKDockPanelBase
- {
- #region 静态变量
-
- #endregion
- #region 成员变量
- // 窗体单例模式
- private static F_MST_GoodsImage _instance = null;
- #endregion
- #region 构造函数
- public F_MST_GoodsImage()
- {
- InitializeComponent();
- // 工具栏按钮文本赋值
- this.tsbtnAddInvoice.Text = ButtonText.TSBTN_ADD;
- this.tsbtnDelete.Text = ButtonText.TSBTN_DELETE;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- // 查询、清空条件按钮文本赋值
- this.tsbtnSearch.Text = ButtonText.BTN_SEARCH;
- this.tsbtnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- // 设置表格不自动创建列
- this.dgvGoodsImage.AutoGenerateColumns = false;
- // 删除
- this.tsbtnDelete.Enabled = false;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_MST_GoodsImage Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_MST_GoodsImage();
- }
- return _instance;
- }
- }
- #endregion
- #region 控件事件
- /// <summary>
- /// 画面打开
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_GoodsImage_Load(object sender, EventArgs e)
- {
- try
- {
- }
- 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 F_MST_GoodsImage_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <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 tsbtnClearCondition_Click(object sender, EventArgs e)
- {
- try
- {
- this.txtMATNR.Text = "";
- }
- 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 tsbtnAddInvoice_Click(object sender, System.EventArgs e)
- {
- try
- {
- F_MST_GoodsImageAdd frmGoodAdd = new F_MST_GoodsImageAdd(String.Empty, String.Empty);
- DialogResult dialogresult = frmGoodAdd.ShowDialog();
- if (DialogResult.OK == dialogresult)
- {
- QueryDataFromOther();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #region 编辑(目前不考虑,删除重新上传)
- /// <summary>
- /// 点击编辑按钮,编辑现有票据基本信息
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- // 获取活动行
- DataGridViewRow currentRow = this.dgvGoodsImage.CurrentRow;
- string winStatus = "Edit";
- string matnr = currentRow.Cells["MATERIALCODE"].Value.ToString();
- F_MST_GoodsImageAdd frmGoodAdd = new F_MST_GoodsImageAdd(winStatus, matnr);
- DialogResult dialogresult = frmGoodAdd.ShowDialog();
- if (DialogResult.OK == dialogresult)
- {
- QueryDataFromOther();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 预览后期添加 本期预留
- /// <summary>
- /// 预览票据按钮按下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnPreviewInvoice_Click(object sender, EventArgs e)
- {
- try
- {
- //// 获取活动行
- //DataGridViewRow currentRow = this.dgvGoodsImage.CurrentRow;
- //if (currentRow != null)
- //{
- // // 给票据预览画面赋值,并打开
- // F_MST_012005 frm012005 = new F_MST_012005();
- // frm012005.LayoutID = Convert.ToInt32(currentRow.Cells["InvoiceLayoutID"].Value);
- // frm012005.ShowDialog();
- //}
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- /// <summary>
- /// 点击删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnDelete_Click(object sender, EventArgs e)
- {
- try
- {
- // 获取活动行
- DataGridViewRow currentRow = this.dgvGoodsImage.CurrentRow;
- if (currentRow != null)
- {
- DialogResult dr = MessageBox.Show("是否删除当前选择数据。", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dr != System.Windows.Forms.DialogResult.Yes)
- {
- return;
- }
- string materialcode = currentRow.Cells["materialcode"].Value.ToString();
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_GoodsImage";
- cre.Name = "DeleteGoodsImage";
- cre.Properties["MATERIALCODE"] = materialcode;
- return SystemModuleProxy.Service.DoRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(string.Format("{0}的{1}操作成功完成了。", "产品线性图", "删除"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- QueryDataFromOther();
- }
- }
- else
- {
- MessageBox.Show("没有选择任何数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnAdaptive_Click(object sender, System.EventArgs e)
- {
- this.dgvGoodsImage.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 dgvInvoice_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGoodsImage.CurrentCell == null
- || this.dgvGoodsImage.SelectedRows.Count == 0)
- {
-
- this.tsbtnDelete.Enabled = false;
- }
- else
- {
- this.tsbtnDelete.Enabled = true;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 重写方法
- /// <summary>
- /// 查询数据
- /// </summary>
- /// <returns>验证通过true,其他false</returns>
- private void QueryDataFromOther()
- {
- try
- {
- this.dgvGoodsImage.DataSource = null;
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_GoodsImage";
- cre.Name = "getGoodsImage";
- cre.Properties["MATNR"] = this.txtMATNR.TextValue;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return SystemModuleProxy.Service.DoRequest(cre);
- });
-
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- // 查询成功
- this.dgvGoodsImage.DataSource = sre.Data.Tables[0];
- if (sre.Data.Tables[0].Rows.Count > 0)
- {
- this.dgvGoodsImage.Rows[0].Selected = true;
- }
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- #region 私有方法
-
- #endregion
- }
- }
|