using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; namespace Core.StlMes.Client.SaleOrder.OrderForm { public partial class FrmSaleAccountQuery : FrmBase { public FrmSaleAccountQuery() { InitializeComponent(); } private void FrmSaleAccountQuery_Load(object sender, EventArgs e) { InitCustomerData(); } /// /// 是否具有权限查看 /// bool flag = true; private void InitCustomerData() { UltraComboEditor uce = new UltraComboEditor(); this.Controls.Add(uce); uce.Visible = false; DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreSaleAccountQuery.initCustomerData", null, this.ob); uce.DataSource = dt; uce.ValueMember = "CUSTOMER_NO"; uce.DisplayMember = "CUSTOMER_NM"; gdAccount.DisplayLayout.Bands[0].Columns["BUYERCODE"].EditorComponent = uce; gdAccount.DisplayLayout.Bands[0].Columns["BUYERCODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList; ValueList vl = new ValueList(); string[] arr = this.ValidDataPurviewIds; if (arr.Length > 1) { if (arr.Contains("002001004")) { vl.ValueListItems.Add("100101", "销售公司"); } } else if (arr.Length == 1) { if (arr[0].Substring(0, 9).Contains("002001004")) { vl.ValueListItems.Add("100101", "销售公司"); } } if (arr.Length > 1) { if (arr.Contains("002001005")) { vl.ValueListItems.Add("100103", "钢贸公司"); } } else if (arr.Length == 1) { if (arr[0].Substring(0, 9).Contains("002001005")) { vl.ValueListItems.Add("100103", "钢贸公司"); } } //if (arr.Contains("002001005")) //{ // vl.ValueListItems.Add("100103", "钢贸公司"); //} cmbSaleOrg.ValueList = vl; if (vl == null || vl.ValueListItems.Count <= 0) { flag = false; } else { cmbSaleOrg.SelectedIndex = 0; } } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryData(); break; case "Export": GridHelper.ulGridToExcel(gdAccount, "销售台帐"); break; case "Close": this.Close(); break; } } private void QueryData() { if (!flag) { MessageUtil.ShowWarning("您没有销售公司或者钢贸公司的权限,无法查看数据!"); return; } if (dtInvoice.Value == null || StringUtil.IsNotDateTime(dtInvoice.Value.ToString())) { MessageUtil.ShowWarning("请选择结算年月!"); return; } if (cmbSaleOrg.SelectedItem == null) { MessageUtil.ShowWarning("请选择销售组织!"); return; } string time = dtInvoice.Value.ToString("yyyyMM"); string saleOrg = cmbSaleOrg.Text.Trim(); string[] arr = this.ValidDataPurviewIds; DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreSaleAccountQuery.query", new object[] { time, saleOrg,arr }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); //GridHelper.RefreshAndAutoSize(gdAccount); } } }