8ce516543e460a6a098458b3346670d658ebdf7b.svn-base 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. namespace Core.LZMes.Client.UIM
  11. {
  12. public partial class UIM010030 : FrmBase
  13. {
  14. public UIM010030()
  15. {
  16. InitializeComponent();
  17. }
  18. public override void ToolBar_Click(object sender, string ToolbarKey)
  19. {
  20. switch (ToolbarKey)
  21. {
  22. case "Query":
  23. this.DoQuery();
  24. break;
  25. case "Add":
  26. this.DoAdd();
  27. break;
  28. case "Update":
  29. this.DoUpdate();
  30. break;
  31. case "Delete":
  32. this.DoDelete();
  33. break;
  34. }
  35. }
  36. private void DoQuery()
  37. {
  38. try
  39. {
  40. string areaType = "1";
  41. this.dataSet1.Tables[0].Clear();
  42. CoreClientParam ccp = new CoreClientParam();
  43. //ccp.InvokeID = "C06010103";
  44. ccp.ServerName = "UIM.UIM010030";
  45. ccp.MethodName = "queryYardStd";
  46. ccp.ServerParams = new object[] { areaType };
  47. ccp.SourceDataTable = this.dataSet1.Tables[0];
  48. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  49. Console.WriteLine(this.dataSet1.Tables[0].ToString());
  50. }
  51. catch (Exception EX)
  52. {
  53. MessageBox.Show(EX.ToString());
  54. }
  55. }
  56. /// <summary>
  57. /// 添加堆垛原则
  58. /// </summary>
  59. private void DoAdd()
  60. {
  61. string yardKind = this.textBox1.Text;
  62. if (null == yardKind || "".Equals(yardKind))
  63. {
  64. MessageBox.Show("仓库类型不能为空!");
  65. this.textBox1.Focus();
  66. return;
  67. }
  68. string areaKind = this.textBox2.Text;
  69. if (null == areaKind || "".Equals(areaKind))
  70. {
  71. MessageBox.Show("区域类型不能为空!");
  72. this.textBox2.Focus();
  73. return;
  74. }
  75. string yardAddr = this.textBox3.Text;
  76. if (null == yardAddr || "".Equals(yardAddr))
  77. {
  78. MessageBox.Show("堆放区域不能为空!");
  79. this.textBox3.Focus();
  80. return;
  81. }
  82. string fromStlGrd = this.textBox4.Text;
  83. string toStlGrd = this.textBox5.Text;
  84. string stlGrd1 = this.textBox6.Text;
  85. string stlGrd2 = this.textBox7.Text;
  86. string stlGrd3 = this.textBox8.Text;
  87. string stlGrd4 = this.textBox9.Text;
  88. string stlGrd5 = this.textBox10.Text;
  89. string stlGrd6 = this.textBox11.Text;
  90. string stlGrd7 = this.textBox12.Text;
  91. CoreClientParam ccp = new CoreClientParam();
  92. ccp.ServerName = "UIM.UIM010030";
  93. ccp.MethodName = "addYardRule";
  94. ccp.ServerParams = new object[] { yardKind, areaKind, yardAddr, fromStlGrd, toStlGrd,
  95. stlGrd1, stlGrd2, stlGrd3, stlGrd4, stlGrd5, stlGrd6, stlGrd7 };
  96. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  97. if (0 != ccp.ReturnCode) return;
  98. DataRow dr = dataTable1.NewRow();
  99. dr["yard_kind"] = yardKind;
  100. dr["area_kind"] = areaKind;
  101. dr["yard_addr"] = yardAddr;
  102. dr["from_stl_grd"] = fromStlGrd;
  103. dr["to_stl_grd"] = toStlGrd;
  104. dr["stl_grd1"] = stlGrd1;
  105. dr["stl_grd2"] = stlGrd2;
  106. dr["stl_grd3"] = stlGrd3;
  107. dr["stl_grd4"] = stlGrd4;
  108. dr["stl_grd5"] = stlGrd5;
  109. dr["stl_grd6"] = stlGrd6;
  110. dr["stl_grd7"] = stlGrd7;
  111. MessageBox.Show("新增成功!");
  112. }
  113. /// <summary>
  114. /// 修改堆垛原则
  115. /// </summary>
  116. public void DoUpdate()
  117. {
  118. //string yardKind = this.textBox1.Text;
  119. //if (null == yardKind || "".Equals(yardKind))
  120. //{
  121. // MessageBox.Show("仓库类型不能为空!");
  122. // return;
  123. //}
  124. //string areaKind = this.textBox2.Text;
  125. //if (null == areaKind || "".Equals(areaKind))
  126. //{
  127. // MessageBox.Show("区域类型不能为空!");
  128. // return;
  129. //}
  130. //string yardAddr = this.textBox3.Text;
  131. //if (null == yardAddr || "".Equals(yardAddr))
  132. //{
  133. // MessageBox.Show("堆放区域不能为空!");
  134. //}
  135. string fromStlGrd = this.textBox4.Text;
  136. string toStlGrd = this.textBox5.Text;
  137. string stlGrd1 = this.textBox6.Text;
  138. string stlGrd2 = this.textBox7.Text;
  139. string stlGrd3 = this.textBox8.Text;
  140. string stlGrd4 = this.textBox9.Text;
  141. string stlGrd5 = this.textBox10.Text;
  142. string stlGrd6 = this.textBox11.Text;
  143. string stlGrd7 = this.textBox12.Text;
  144. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  145. CoreClientParam ccp = new CoreClientParam();
  146. ccp.ServerName = "UIM.UIM010030";
  147. ccp.MethodName = "updateYardRule";
  148. ccp.ServerParams = new object[] { uRow.Cells["yard_kind"].Text, uRow.Cells["area_kind"].Text, uRow.Cells["yard_addr"].Text, fromStlGrd, toStlGrd,
  149. stlGrd1, stlGrd2, stlGrd3, stlGrd4, stlGrd5, stlGrd6, stlGrd7 };
  150. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  151. if (0 != ccp.ReturnCode) return;
  152. MessageBox.Show("修改成功!");
  153. this.DoQuery();
  154. }
  155. /// <summary>
  156. /// 删除堆垛原则
  157. /// </summary>
  158. private void DoDelete()
  159. {
  160. try
  161. {
  162. Infragistics.Win.UltraWinGrid.SelectedRowsCollection rows = this.ultraGrid1.Selected.Rows;
  163. if (rows.Count < 1)
  164. {
  165. MessageBox.Show("请选择要删除的堆垛原则。");
  166. return;
  167. }
  168. string yardKind = rows[0].Cells["yard_kind"].Text;
  169. string areaKind = rows[0].Cells["area_kind"].Text;
  170. string yardAddr = rows[0].Cells["yard_addr"].Text;
  171. string delParam = yardKind + "," + areaKind + "," + yardAddr;
  172. if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
  173. {
  174. if (!"".Equals(delParam))
  175. {
  176. CoreClientParam ccp = new CoreClientParam();
  177. ccp.ServerName = "UIM.UIM010030";
  178. ccp.MethodName = "delYardRule";
  179. ccp.ServerParams = new object[] { yardKind, areaKind, yardAddr };
  180. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  181. if (ccp.ReturnCode != 0) return;
  182. }
  183. this.ultraGrid1.DeleteSelectedRows(false);
  184. MessageBox.Show("删除成功!");
  185. }
  186. }
  187. catch (Exception EX)
  188. {
  189. MessageBox.Show(EX.ToString());
  190. }
  191. }
  192. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  193. {
  194. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  195. this.textBox1.Text = uRow.Cells["yard_kind"].Text;
  196. this.textBox2.Text = uRow.Cells["area_kind"].Text;
  197. this.textBox3.Text = uRow.Cells["yard_addr"].Text;
  198. this.textBox4.Text = uRow.Cells["from_stl_grd"].Text;
  199. this.textBox5.Text = uRow.Cells["to_stl_grd"].Text;
  200. this.textBox6.Text = uRow.Cells["stl_grd1"].Text;
  201. this.textBox7.Text = uRow.Cells["stl_grd2"].Text;
  202. this.textBox8.Text = uRow.Cells["stl_grd3"].Text;
  203. this.textBox9.Text = uRow.Cells["stl_grd4"].Text;
  204. this.textBox10.Text = uRow.Cells["stl_grd5"].Text;
  205. this.textBox11.Text = uRow.Cells["stl_grd6"].Text;
  206. this.textBox12.Text = uRow.Cells["stl_grd7"].Text;
  207. }
  208. }
  209. }