FrmTPRecall.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Infragistics.Win.UltraWinEditors;
  16. using System.Text.RegularExpressions;
  17. namespace Core.StlMes.Client.MilCount
  18. {
  19. public partial class FrmTPRecall : FrmBase
  20. {
  21. public FrmTPRecall()
  22. {
  23. InitializeComponent();
  24. }
  25. public override void ToolBar_Click(object sender, string ToolbarKey)
  26. {
  27. switch (ToolbarKey)
  28. {
  29. case "doQuery":
  30. doQuery();
  31. break;
  32. case "doModify":
  33. Update();
  34. break;
  35. //case "doDelete":
  36. // this.doDeleteOrResume(true);
  37. // break;
  38. //case "doResume":
  39. // this.doDeleteOrResume(false);
  40. // break;
  41. //case "Close":
  42. // this.Close();
  43. //break;
  44. }
  45. }
  46. private void doQuery()
  47. {
  48. string titleName = "";
  49. if (ultraCheckEditor2.Checked)
  50. {
  51. titleName = txt_lcode.Text.Trim();
  52. DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.coretpreacll.getLineList", new Object[] { titleName }, this.ob);
  53. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  54. }
  55. else
  56. {
  57. DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.coretpreacll.getLineList_all", null, this.ob);
  58. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  59. }
  60. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  61. }
  62. String Tzhi = "";
  63. String Tdun = "";
  64. private void Update()
  65. {
  66. ultraGrid1.UpdateData();
  67. ArrayList list = new ArrayList();
  68. ArrayList list1 = new ArrayList();
  69. ArrayList list2 = new ArrayList();
  70. String ordernum = "";
  71. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
  72. {
  73. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  74. {
  75. ordernum = row.Cells["FPZhi"].Value.ToString();
  76. }
  77. }
  78. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
  79. {
  80. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  81. {
  82. ordernum = row.Cells["FPZhi"].Value.ToString();
  83. }
  84. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  85. {
  86. String Tzhi = row.Cells["FPZhi"].Value.ToString();
  87. list1.Add(Tzhi);
  88. String Tdun = row.Cells["FPDun"].Value.ToString();
  89. list2.Add(Tdun);
  90. String r = row.Cells["ID"].Value.ToString();
  91. String r1 = row.Cells["GPLode"].Value.ToString();
  92. String r2 = row.Cells["ZGLode"].Value.ToString();
  93. list.Add(r+r1+r2);
  94. }
  95. }
  96. ServerHelper.SetData("com.steering.mes.fprecall.coretpreacll.setLineList_all", new Object[] { txt_lh.Text, list, list1, list2 }, this.ob);
  97. }
  98. private void ultraTextEditor1_TextChanged(object sender, EventArgs e)
  99. {
  100. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
  101. {
  102. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  103. {
  104. Tzhi = row.Cells["上料合计单倍尺支"].Value.ToString();
  105. Tdun = row.Cells["上料合计单倍尺吨"].Value.ToString();
  106. }
  107. }
  108. if (txt_Tz.Text == "")
  109. {
  110. txt_Tz.Text = "0";
  111. }
  112. decimal dun = Int16.Parse(txt_Tz.Text) * (decimal.Parse(Tdun) / Int16.Parse(Tzhi));
  113. dun = Math.Round(dun, 3);
  114. txt_Td.Text = dun.ToString();
  115. }
  116. String ordernum = "";
  117. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  118. {
  119. ultraGrid1.UpdateData();
  120. if (e.Cell.Column.Key == "CHK")
  121. {
  122. UltraGridRow[] rows = ultraGrid1.Rows.AsQueryable().Where(a=> a.Cells["CHK"].Value.ToString() == "True"
  123. && a.Cells["ORDERNO"].Value.ToString() != e.Cell.Row.Cells["ORDERNO"].Value.ToString()).ToArray();
  124. if (rows.Length > 0)
  125. {
  126. if (rows[0].Cells["ORDERNO"].Value.ToString() != e.Cell.Row.Cells["ORDERNO"].Value.ToString())
  127. {
  128. e.Cell.Value = false;
  129. }
  130. }
  131. }
  132. }
  133. }
  134. }