FrmBuyDCYB.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. 
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Control;
  13. using Infragistics.Win.UltraWinGrid;
  14. using System.Net;
  15. using System.Collections;
  16. using CoreFS.SA06;
  17. namespace Core.StlMes.Client.BuyBillet
  18. {
  19. public partial class FrmBuyDCYB : FrmBase
  20. {
  21. private new CoreFS.CA06.OpeBase ob = new OpeBase();
  22. public string OrderID { get; set; }
  23. public FrmBuyDCYB(OpeBase ops)
  24. {
  25. ob = ops;
  26. InitializeComponent();
  27. }
  28. private void FrmBuyDCYB_Load(object sender, EventArgs e)
  29. {
  30. Initial_Data();
  31. }
  32. private void Initial_Data()
  33. {
  34. txt_dhrq.Value = DateTime.Now.ToString("yyyy-MM-dd");
  35. txt_order_no.Text = OrderID;
  36. Bind_Grid();
  37. RefreshAndAutoSize(this.ultraGrid1);
  38. }
  39. private void ultraNumericEditor1_ValueChanged(object sender, EventArgs e)
  40. {
  41. }
  42. private void txt_count_ValueChanged(object sender, EventArgs e)
  43. {
  44. }
  45. private void ultraButton1_Click(object sender, EventArgs e)
  46. {
  47. string stove_no = txt_stove.Value.ToString();
  48. string judge_stove_no = txt_judge_stove.Value.ToString();
  49. string plan_count = txt_count.Value.ToString();
  50. string plan_weight = txt_weight.Value.ToString();
  51. string dhrq = txt_dhrq.Text.ToString();
  52. string create_name = this.UserInfo.GetUserName();
  53. string ord_pk = this.OrderID;
  54. ServerHelper.SetData("com.steering.pss.buybillet.Buybillet.insertBUY_CGP_DCYB",
  55. new object[] { stove_no,judge_stove_no,plan_count,plan_weight,dhrq,create_name,ord_pk }, this.ob);
  56. MessageBox.Show("新增成功!");
  57. Bind_Grid();
  58. clear_Form();
  59. RefreshAndAutoSize(this.ultraGrid1);
  60. }
  61. private void Bind_Grid()
  62. {
  63. DataTable dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.getBUY_CGP_DCYB", new object[] { OrderID }, this.ob);
  64. DataTable dt3 = dataSet1.Tables[0];
  65. GridHelper.CopyDataToDatatable(dt, dt3, true);
  66. }
  67. public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid)
  68. {
  69. try
  70. {
  71. ultraGrid.DataBind();
  72. foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in ultraGrid.DisplayLayout.Bands)
  73. {
  74. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in band.Columns)
  75. {
  76. column.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand);
  77. }
  78. }
  79. ultraGrid.Refresh();
  80. }
  81. catch { }
  82. }
  83. private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
  84. {
  85. UltraGridRow row = ultraGrid1.ActiveRow;
  86. SetRowValueToForm(row);
  87. }
  88. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  89. {
  90. }
  91. private void SetRowValueToForm(UltraGridRow row)
  92. {
  93. txt_stove.Text = row.Cells["炉号"].Value.ToString();
  94. txt_judge_stove.Text = row.Cells["判定炉号"].Value.ToString();
  95. txt_count.Value = row.Cells["支数"].Value;
  96. txt_weight.Value = row.Cells["吨数"].Value;
  97. txt_dhrq.Value = row.Cells["到货日期"].Value;
  98. txt_dcyb_pk.Text = row.Cells["DCYB_PK"].Value.ToString() ;
  99. }
  100. private void btn_update_Click(object sender, EventArgs e)
  101. {
  102. string stove_no = txt_stove.Value.ToString();
  103. string judge_stove_no = txt_judge_stove.Value.ToString();
  104. string plan_count = txt_count.Value.ToString();
  105. string plan_weight = txt_weight.Value.ToString();
  106. string dhrq = txt_dhrq.Text.ToString();
  107. string create_name = this.UserInfo.GetUserName();
  108. string dcyb_pk = txt_dcyb_pk.Text;
  109. ServerHelper.SetData("com.steering.pss.buybillet.Buybillet.updateBUY_CGP_DCYB",
  110. new object[] { stove_no, judge_stove_no, plan_count, plan_weight, dhrq, create_name, dcyb_pk }, this.ob);
  111. MessageBox.Show("保存成功!");
  112. Bind_Grid();
  113. clear_Form();
  114. }
  115. private void btn_delete_Click(object sender, EventArgs e)
  116. {
  117. string dcyb_pk = txt_dcyb_pk.Text;
  118. string stove_no = txt_stove.Text;
  119. if (MessageBox.Show("删除炉号 "+stove_no+"?","删除确认", MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK)
  120. {
  121. ServerHelper.SetData("com.steering.pss.buybillet.Buybillet.deleteBUY_CGP_DCYB",
  122. new object[] { dcyb_pk }, this.ob);
  123. MessageBox.Show("删除成功!");
  124. Bind_Grid();
  125. clear_Form();
  126. }
  127. }
  128. private void clear_Form()
  129. {
  130. txt_judge_stove.Text = string.Empty;
  131. txt_stove.Text = string.Empty;
  132. txt_weight.Value = null;
  133. txt_count.Value = null;
  134. }
  135. private void ultraGrid1_Click(object sender, EventArgs e)
  136. {
  137. UltraGridRow row = ultraGrid1.ActiveRow;
  138. SetRowValueToForm(row);
  139. }
  140. }
  141. }