华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
4.0 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using DevExpress.XtraEditors;
  9. using System.Data.SqlClient;
  10. using ICSSoft.Frame.Data.BLL;
  11. using ICSSoft.Base.Language.Tool;
  12. using ICSSoft.Base.UserControl.MessageControl;
  13. using ICSSoft.Base.Report.Filter;
  14. using ICSSoft.Base.Config.DBHelper;
  15. using ICSSoft.Base.UserControl.FormControl;
  16. using ICSSoft.Base.ReferForm.AppReferForm;
  17. using ICSSoft.Base.Lable.PrintTool;
  18. using ICSSoft.Base.Config.AppConfig;
  19. using ICSSoft.Base.Report.GridReport;
  20. using ICSSoft.Frame.APP.Entity;
  21. using ICSSoft.Frame.APP;
  22. using ICSSoft.Frame.Data.Entity;
  23. using System.Configuration;
  24. namespace ICSSoft.Frame.APP
  25. {
  26. public partial class FormICSVenDorChoose: DevExpress.XtraEditors.XtraForm
  27. {
  28. public string Vencode;
  29. public string VenName;
  30. string VenView= ConfigurationManager.AppSettings["VendorView"];
  31. string EntId = ConfigurationManager.AppSettings["WorkHourEntId"];
  32. string CompanyId = ConfigurationManager.AppSettings["WorkHourCompanyId"];
  33. public FormICSVenDorChoose()
  34. {
  35. InitializeComponent();
  36. init();
  37. }
  38. private void btnOK_Click(object sender, EventArgs e)
  39. {
  40. try
  41. {
  42. if (string.IsNullOrEmpty(txtVendorCode.Text))
  43. {
  44. ICSBaseSimpleCode.AppshowMessageBox("请选择供应商!");
  45. return;
  46. }
  47. this.Vencode = txtVendorCode.EditValue.ToString();
  48. this.VenName = txtVendorName.Text.ToString();
  49. this.DialogResult = DialogResult.OK;
  50. this.Close();
  51. }
  52. catch (Exception ex) {
  53. MessageBox.Show(ex.Message);
  54. }
  55. }
  56. #region 关闭
  57. private void btnCancle_Click(object sender, EventArgs e)
  58. {
  59. this.Close();
  60. this.DialogResult = DialogResult.Cancel;
  61. }
  62. private void btnClose_Click(object sender, EventArgs e)
  63. {
  64. this.Close();
  65. this.DialogResult = DialogResult.Cancel;
  66. }
  67. #endregion
  68. private void gluItemCode_EditValueChanged(object sender, EventArgs e)
  69. {
  70. var o = txtVendorCode.Properties.GetRowByKeyValue(txtVendorCode.EditValue);
  71. if (o is DataRowView)
  72. {
  73. DataRowView RowView = o as DataRowView;
  74. txtVendorName.Text = RowView.Row["供应商名称"].ToString();
  75. }
  76. }
  77. #region 初始化查询条件
  78. private void init()
  79. {
  80. #region 供应商
  81. string sql = "select 交易对象编号 as 供应商编码,交易对象全名 as 供应商名称 from OPENQUERY(ORADJ,'select * from erp_mes_pmaauc_v WHERE 企业编号=''{0}'' AND 营运据点=''{1}''')"; sql = string.Format(sql,EntId,CompanyId);
  82. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  83. txtVendorCode.Properties.ValueMember = "供应商编码";
  84. txtVendorCode.Properties.DisplayMember = "供应商编码";
  85. txtVendorCode.Properties.DataSource = dt;
  86. txtVendorCode.Properties.NullText = "";//空时的值
  87. txtVendorCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  88. txtVendorCode.Properties.ValidateOnEnterKey = true;//回车确认
  89. txtVendorCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  90. txtVendorCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  91. //自适应宽度
  92. txtVendorCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  93. #endregion
  94. }
  95. #endregion
  96. }
  97. }