FrmSaleAccountQuery.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win;
  6. using Infragistics.Win.UltraWinEditors;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using System.Collections;
  16. namespace Core.StlMes.Client.SaleOrder.OrderForm
  17. {
  18. public partial class FrmSaleAccountQuery : FrmBase
  19. {
  20. public FrmSaleAccountQuery()
  21. {
  22. InitializeComponent();
  23. }
  24. private void FrmSaleAccountQuery_Load(object sender, EventArgs e)
  25. {
  26. InitCustomerData();
  27. }
  28. /// <summary>
  29. /// 是否具有权限查看
  30. /// </summary>
  31. bool flag = true;
  32. private void InitCustomerData()
  33. {
  34. UltraComboEditor uce = new UltraComboEditor();
  35. this.Controls.Add(uce);
  36. uce.Visible = false;
  37. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreSaleAccountQuery.initCustomerData", null, this.ob);
  38. uce.DataSource = dt;
  39. uce.ValueMember = "CUSTOMER_NO";
  40. uce.DisplayMember = "CUSTOMER_NM";
  41. gdAccount.DisplayLayout.Bands[0].Columns["BUYERCODE"].EditorComponent = uce;
  42. gdAccount.DisplayLayout.Bands[0].Columns["BUYERCODE"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  43. ValueList vl = new ValueList();
  44. string[] arr = this.ValidDataPurviewIds;
  45. if (arr.Length > 1)
  46. {
  47. if (arr.Contains("002001004"))
  48. {
  49. vl.ValueListItems.Add("100101", "销售公司");
  50. }
  51. }
  52. else if (arr.Length == 1)
  53. {
  54. if (arr[0].Substring(0, 9).Contains("002001004"))
  55. {
  56. vl.ValueListItems.Add("100101", "销售公司");
  57. }
  58. }
  59. if (arr.Length > 1)
  60. {
  61. if (arr.Contains("002001005"))
  62. {
  63. vl.ValueListItems.Add("100103", "钢贸公司");
  64. }
  65. }
  66. else if (arr.Length == 1)
  67. {
  68. if (arr[0].Substring(0, 9).Contains("002001005"))
  69. {
  70. vl.ValueListItems.Add("100103", "钢贸公司");
  71. }
  72. }
  73. //if (arr.Contains("002001005"))
  74. //{
  75. // vl.ValueListItems.Add("100103", "钢贸公司");
  76. //}
  77. cmbSaleOrg.ValueList = vl;
  78. if (vl == null || vl.ValueListItems.Count <= 0)
  79. {
  80. flag = false;
  81. }
  82. else
  83. {
  84. cmbSaleOrg.SelectedIndex = 0;
  85. }
  86. }
  87. public override void ToolBar_Click(object sender, string ToolbarKey)
  88. {
  89. switch (ToolbarKey)
  90. {
  91. case "Query":
  92. QueryData();
  93. break;
  94. case "Export":
  95. GridHelper.ulGridToExcel(gdAccount, "销售台帐");
  96. break;
  97. case "Close":
  98. this.Close();
  99. break;
  100. }
  101. }
  102. private void QueryData()
  103. {
  104. if (!flag)
  105. {
  106. MessageUtil.ShowWarning("您没有销售公司或者钢贸公司的权限,无法查看数据!");
  107. return;
  108. }
  109. if (dtInvoice.Value == null || StringUtil.IsNotDateTime(dtInvoice.Value.ToString()))
  110. {
  111. MessageUtil.ShowWarning("请选择结算年月!");
  112. return;
  113. }
  114. if (cmbSaleOrg.SelectedItem == null)
  115. {
  116. MessageUtil.ShowWarning("请选择销售组织!");
  117. return;
  118. }
  119. string time = dtInvoice.Value.ToString("yyyyMM");
  120. string saleOrg = cmbSaleOrg.Text.Trim();
  121. string[] arr = this.ValidDataPurviewIds;
  122. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreSaleAccountQuery.query", new object[] { time, saleOrg,arr }, this.ob);
  123. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  124. //GridHelper.RefreshAndAutoSize(gdAccount);
  125. }
  126. }
  127. }