| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_1301.cs
- * 2.功能描述:产品档案
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 庄天威 2014/09/13 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- 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.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.SystemModule
- {
- /// <summary>
- /// 产品档案
- /// </summary>
- public partial class F_MST_1301 : DockPanelBase
- {
- #region 成员变量
- private static F_MST_1301 _instance; //单例模式
- #endregion
- #region 构造函数
- public F_MST_1301()
- {
- InitializeComponent();
- this.Text = "金蝶代码对应";
- // 按钮
- this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
- this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_MST_1301 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_MST_1301();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- private void F_MST_1301_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvGoosKingdeecode.AutoGenerateColumns = false;
- this.loadDataSource();
- this.ddlGlazeTypeID.ClearValue();
- this.ddlLogoName.ClearValue();
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- }
- 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 btnClearCondition_Click(object sender, EventArgs e)
- {
- this.goodscodetxt.Clear();
- this.goodsnametxt.Clear();
- this.ddlGlazeTypeID.ClearValue();
- this.ddlLogoName.ClearValue();
- this.txtKingdeeCode.Clear();
- }
- /// <summary>
- /// 查询事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- this.DataSource = this.GetSearchData();
- if (this.DataSource != null)
- {
- this.dgvGoosKingdeecode.DataSource = this.DataSource.Tables[0];
- }
- }
- 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 tsbtnAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_MST_1302 frmMST1302 = new F_MST_1302(Constant.FormMode.Add,"","","","");
- DialogResult dialogResult = frmMST1302.ShowDialog();
- // 重新加载GridView
- btnSearch_Click(sender, 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 tsbtnEdit_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
- {
- string KingdeeCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["KINGDEECODE"].Value.ToString();
- string logname= this.dgvGoosKingdeecode.SelectedRows[0].Cells["LOGONAME"].Value.ToString();
- string GLAZETYPE= this.dgvGoosKingdeecode.SelectedRows[0].Cells["GLAZETYPE"].Value.ToString();
- string GoodsCode = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GOODSCODE"].Value.ToString();
- F_MST_1302 frmFPC1302 = new F_MST_1302(Constant.FormMode.Edit, KingdeeCode, logname, GLAZETYPE, GoodsCode);
- DialogResult dialogresult = frmFPC1302.ShowDialog();
- btnSearch_Click(sender, 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 tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGoosKingdeecode.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_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- #region 私有方法
- private DataSet GetSearchData()
- {
- try
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "GetKingdeeCode";
- cre.Properties["GoodsCode"] = this.goodscodetxt.Text;
- cre.Properties["GoodsName"] = this.goodsnametxt.Text;
- cre.Properties["GlazeType"] = this.ddlGlazeTypeID.Text;
- cre.Properties["LogoName"] = this.ddlLogoName.Text;
- cre.Properties["KingdeeCode"] = this.txtKingdeeCode.Text;
- ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
- if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
- {
- return sre.Data;
- }
- return null;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 下拉框获取数据
- /// </summary>
- private void loadDataSource()
- {
- try
- {
- DataTable dtGlazeType = SystemModuleProxy.Service.GetDataDictionaryByType(Constant.DictionaryType.TPC002, Constant.INT_IS_ONE);
- if (dtGlazeType != null)
- {
- ddlGlazeTypeID.DisplayMember = "DictionaryValue";
- ddlGlazeTypeID.ValueMember = "DictionarylD";
- ddlGlazeTypeID.DataSource = dtGlazeType;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "GetLogoName";
- ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
- if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
- {
- DataTable dtLogoName = sre.Data.Tables[0];
- if (dtLogoName != null)
- {
- ddlLogoName.DisplayMember = "LogoNameCode";
- ddlLogoName.ValueMember = "LogoID";
- ddlLogoName.DataSource = dtLogoName;
- }
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- private void delBtn_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGoosKingdeecode.SelectedRows.Count != 0)
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "AddKingdeeCode";
- cre.Properties["FromStatus"] ="Delete";
- cre.Properties["GUID"] = this.dgvGoosKingdeecode.SelectedRows[0].Cells["GUID"].Value.ToString(); ;
- ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
- if (sre.OtherStatus > 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- }
- btnSearch_Click(sender, null);//删除后重新查询数据
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|