frmMatCompanyInfo.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using com.hnshituo.core.webapp.vo;
  2. using Common;
  3. using Infragistics.Win.UltraWinGrid;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace CarRemoteMeter
  14. {
  15. public partial class frmMatCompanyInfo : Form
  16. {
  17. public frmMatCompanyInfo()
  18. {
  19. InitializeComponent();
  20. }
  21. private void btnCancel_Click(object sender, EventArgs e)
  22. {
  23. this.Close();
  24. }
  25. private void btnSave_Click(object sender, EventArgs e)
  26. {
  27. if (string.IsNullOrEmpty(strMatCode))
  28. {
  29. MessageBox.Show("请勾选物料");
  30. return;
  31. }
  32. if (string.IsNullOrEmpty(strForCode))
  33. {
  34. MessageBox.Show("请勾选发货单位");
  35. return;
  36. }
  37. if (string.IsNullOrEmpty(strRecCode))
  38. {
  39. MessageBox.Show("请勾选收货单位");
  40. return;
  41. }
  42. this.DialogResult = DialogResult.OK;
  43. PreNo = strMatCode + strForCode + strRecCode;
  44. this.Close();
  45. }
  46. private void frmMatCompanyInfo_Load(object sender, EventArgs e)
  47. {
  48. string sql = @"select t.matter_no, t.matter_name, t.meter_code
  49. from meter_base_matter_info t
  50. where t.meter_nature_name like '%中控%'
  51. and t.valid_flag = '1'
  52. and t.meter_code is not null
  53. order by t.matter_name";
  54. PbModelDbService<List<matCls>> pbModelDbService = new PbModelDbService<List<matCls>>();
  55. RESTfulResult<List<matCls>> rES = pbModelDbService.executeSqlDataWf(sql);
  56. if (rES.Succeed)
  57. {
  58. if (rES.Data != null && rES.Data.Count > 0)
  59. {
  60. DataTable dt = rES.Data.ListToDataTable<matCls>();
  61. ClsControlPack.CopyDataToDatatable(ref dt, ref this.dtMat, true);
  62. ClsControlPack.RefreshAndAutoSize(ultraGridMat);
  63. ClsControlPack.SetUltraGridRowFilter(ref ultraGridMat,true);
  64. }
  65. }
  66. sql = @"select t.load_point_no, t.load_point_name, t.meter_code
  67. from meter_base_load_point t
  68. where t.valid_flag = '1'
  69. and t.meter_code is not null";
  70. PbModelDbService<List<compCls>> pbModelDbCService = new PbModelDbService<List<compCls>>();
  71. RESTfulResult<List<compCls>> resComp = pbModelDbCService.executeSqlDataWf(sql);
  72. if (resComp.Succeed)
  73. {
  74. if (resComp.Data != null && resComp.Data.Count > 0)
  75. {
  76. DataTable dt1 = resComp.Data.ListToDataTable<compCls>();
  77. ClsControlPack.CopyDataToDatatable(ref dt1, ref this.dtForW, true);
  78. ClsControlPack.RefreshAndAutoSize(ultraGridFow);
  79. ClsControlPack.SetUltraGridRowFilter(ref ultraGridFow, true);
  80. DataTable dt2 = resComp.Data.ListToDataTable<compCls>();
  81. ClsControlPack.CopyDataToDatatable(ref dt2, ref this.dtRec, true);
  82. ClsControlPack.RefreshAndAutoSize(ultraGridRec);
  83. ClsControlPack.SetUltraGridRowFilter(ref ultraGridRec, true);
  84. }
  85. }
  86. }
  87. public string PreNo = "";
  88. string strMatCode = "", strForCode = "", strRecCode = "";
  89. private void ultraGridMat_AfterRowActivate(object sender, EventArgs e)
  90. {
  91. strMatCode = "";
  92. UltraGridRow ugr = ultraGridMat.ActiveRow;
  93. if (ugr != null)
  94. {
  95. foreach (UltraGridRow ug in ultraGridMat.Rows)
  96. {
  97. ug.Appearance.BackColor = Color.White;
  98. }
  99. strMatCode = ugr.Cells["meter_code"].Text.Trim();
  100. if (!string.IsNullOrEmpty(strMatCode))
  101. {
  102. ugr.Appearance.BackColor = Color.Red;
  103. }
  104. }
  105. }
  106. private void ultraGridFow_AfterRowActivate(object sender, EventArgs e)
  107. {
  108. strForCode = "";
  109. UltraGridRow ugr = ultraGridFow.ActiveRow;
  110. if (ugr != null)
  111. {
  112. foreach (UltraGridRow ug in ultraGridFow.Rows)
  113. {
  114. ug.Appearance.BackColor = Color.White;
  115. }
  116. strForCode = ugr.Cells["meter_code"].Text.Trim();
  117. if (!string.IsNullOrEmpty(strForCode))
  118. {
  119. ugr.Appearance.BackColor = Color.Red;
  120. }
  121. }
  122. }
  123. private void ultraGridRec_AfterRowActivate(object sender, EventArgs e)
  124. {
  125. strRecCode = "";
  126. UltraGridRow ugr = ultraGridRec.ActiveRow;
  127. if (ugr != null)
  128. {
  129. foreach (UltraGridRow ug in ultraGridRec.Rows)
  130. {
  131. ug.Appearance.BackColor = Color.White;
  132. }
  133. strRecCode = ugr.Cells["meter_code"].Text.Trim();
  134. if (!string.IsNullOrEmpty(strRecCode))
  135. {
  136. ugr.Appearance.BackColor = Color.Red;
  137. }
  138. //ClsControlPack.RefreshAndAutoSize(ultraGridMat);
  139. }
  140. }
  141. }
  142. public class matCls
  143. {
  144. public string matter_no { get; set; }
  145. public string matter_name { get; set; }
  146. public string meter_code { get; set; }
  147. }
  148. public class compCls
  149. {
  150. public string load_point_no { get; set; }
  151. public string load_point_name { get; set; }
  152. public string meter_code { get; set; }
  153. }
  154. }