| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.SAPDataModule.Hegii
- {
- public partial class F_SAP_HEGII_0111 : DKDockPanelBase
- {
- #region 成员变量
- private int _scrapid;
- #endregion
- #region 构造函数
- public F_SAP_HEGII_0111()
- {
- InitializeComponent();
- }
- public F_SAP_HEGII_0111(int scrapid)
- {
- InitializeComponent();
- if (scrapid == 0)
- {
- this.Text = "新建 ";
- }
- else
- {
- _scrapid = scrapid;
- this.Text = "编辑 ";
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 加载页面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_SAP_HEGII_0111_Load(object sender, EventArgs e)
- {
- try
- {
- //编辑加载数据
- if (_scrapid > 0)
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "GetIDNRKScrap";
- cre.Properties["scrapid"] = _scrapid;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- DataTable dt = sre.Data.Tables[0];
- if (dt != null && dt.Rows.Count > 0)
- {
- this.scbIdnrk.Text = dt.Rows[0]["idnrk"].ToString();
- this.txtIdnrkName.Text = dt.Rows[0]["idnrkname"].ToString();
- this.txtIdnrkOnlyCode.Text = dt.Rows[0]["idnrkonlycode"].ToString();
- this.txtMenge.Text = dt.Rows[0]["menge"].ToString();
- this.txtMeins.Text = dt.Rows[0]["meins"].ToString();
- this.txtCharg.Text = dt.Rows[0]["charg"].ToString();
- this.txtLgort.Text = dt.Rows[0]["lgort"].ToString();
- this.txtBarcode.Text = dt.Rows[0]["barcode"].ToString();
- this.txtMatnr.Text = dt.Rows[0]["matnr"].ToString();
- }
- }
- }
- }
- 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 btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- if (!CheckInputValidity())
- {
- return;
- }
- string IDNRK = this.scbIdnrk.Text.Trim();//组件编码
- string IDNRKNAME = this.txtIdnrkName.Text.Trim();//组件名称
- string MEINS = this.txtMeins.Text.Trim();//单位
- decimal MENGE = Convert.ToDecimal(this.txtMenge.Text.Trim());//数量
- string IDNRKONLYCODE = this.txtIdnrkOnlyCode.Text.Trim();//唯一编码
- string CHARG = this.txtCharg.Text.Trim();//批次
- string LGORT = this.txtLgort.Text.Trim();//库存地点
- string BARCODE = this.txtBarcode.Text.Trim();//产品条码
- string MATNR = this.txtMatnr.Text.Trim();//物料编码
- // 调用服务器端获取数据集
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- if (_scrapid > 0)
- {
- cre.Name = "UpdateIDNRKScrap";
- cre.Properties["scrapid"] = _scrapid;
- }
- else
- {
- cre.Name = "AddIDNRKScrap";
- }
- cre.Properties["IDNRK"] = IDNRK;
- cre.Properties["IDNRKNAME"] = IDNRKNAME;
- cre.Properties["MEINS"] = MEINS;
- cre.Properties["MENGE"] = MENGE;
- cre.Properties["IDNRKONLYCODE"] = IDNRKONLYCODE;
- cre.Properties["CHARG"] = CHARG;
- cre.Properties["LGORT"] = LGORT;
- cre.Properties["BARCODE"] = BARCODE;
- cre.Properties["MATNR"] = MATNR;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.OtherStatus > 0)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "组件报损", "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- }
- else
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
- return;
- }
- }
- }
- 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 scbIdnrk_TextValueChanged(object sender, WinForm.Controls.ScbSearchBox.TextChangeEventArgs e)
- {
- try
- {
- if (!string.IsNullOrEmpty(scbIdnrk.Text.Trim()))
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "GetIdnrkCode";
- cre.Properties["IDNRK"] = this.scbIdnrk.Text.Trim();
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- this.txtIdnrkName.Text = sre.Data.Tables[0].Rows[0]["IDNRKNAME"].ToString();
- this.txtMeins.Text = sre.Data.Tables[0].Rows[0]["MEINS"].ToString();
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 报存数据校验
- /// </summary>
- /// <returns></returns>
- private bool CheckInputValidity()
- {
- if (string.IsNullOrEmpty(this.scbIdnrk.Text.Trim()))
- {
- return false;
- }
- if (string.IsNullOrEmpty(this.txtMenge.Text.Trim()))
- {
- this.txtMenge.Focus();
- return false;
- }
- if (string.IsNullOrEmpty(this.txtLgort.Text.Trim()))
- {
- this.txtLgort.IsMustInput = true;
- this.txtLgort.Focus();
- return false;
- }
- this.txtLgort.IsMustInput = false;
- return true;
- }
- #endregion
- private void txtMenge_KeyPress_1(object sender, KeyPressEventArgs e)
- {
- //如果输入的不是退格和数字,则屏蔽输入
- if (!(e.KeyChar == 8 || (e.KeyChar >= 48 && e.KeyChar <= 57)))
- {
- e.Handled = true;
- }
- }
- }
- }
|