FrmGPLocationDlog.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 Core.Mes.Client.Comm.Tool;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.StlMes.Client.YdmStuffManage.Entity;
  13. using System.Collections;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Core.Mes.Client.Comm.Format;
  16. using Infragistics.Win;
  17. using Core.Mes.Client.Comm.Control;
  18. using System.Threading;
  19. namespace Core.StlMes.Client.YdmStuffManage
  20. {
  21. public partial class FrmGPLocationDlog : FrmBase
  22. {
  23. public FrmGPLocationDlog(List<FrmGPRuleEntity> list)
  24. {
  25. entitys = list;
  26. InitializeComponent();
  27. }
  28. List<FrmGPRuleEntity> entitys = null;
  29. ArrayList arr = new ArrayList();
  30. private void Frm_Load(object sender, EventArgs e)
  31. {
  32. GridHelper.SetAllColumnsActive(ultraGrid1);
  33. //EntityHelper.ShowGridCaption<FrmGPRuleEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  34. foreach (FrmGPRuleEntity item in entitys) {
  35. arr.Add(item.StorageNo);
  36. }
  37. doQuery();
  38. }
  39. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  40. {
  41. switch (e.Tool.Key)
  42. {
  43. case "Query":
  44. doQuery();
  45. break;
  46. case "doConfirm":
  47. doConfirm();
  48. break;
  49. case "Close":
  50. this.Close();
  51. break;
  52. }
  53. }
  54. private void doQuery()
  55. {
  56. this.dataTable1.Clear();
  57. String parm = "";
  58. if (chkLocationName.Checked) {
  59. parm = txtLocationName.Text;
  60. }
  61. DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmGPRule.queryLocation", new Object[] { arr,parm }, this.ob);
  62. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  63. }
  64. private void doConfirm()
  65. {
  66. try
  67. {
  68. this.ultraGrid1.UpdateData();
  69. if (ultraGrid1.ActiveRow == null)
  70. {
  71. MessageUtil.ShowTips("请选择返库的料位号!");
  72. return;
  73. }
  74. ArrayList strEntity = new ArrayList();
  75. foreach (FrmGPRuleEntity item in entitys)
  76. {
  77. strEntity.Add(JSONFormat.Format(item));
  78. }
  79. CoreClientParam ccp = new CoreClientParam();
  80. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGPRule";
  81. ccp.MethodName = "insertYdmGpOutList";
  82. ccp.ServerParams = new object[] { strEntity,ultraGrid1.ActiveRow.Cells["LOCATION_NO"].Value.ToString(),ultraGrid1.ActiveRow.Cells["LOCATION_NAME"].Value.ToString() };
  83. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  84. if (ccp != null)
  85. {
  86. if (ccp.ReturnCode == -1)
  87. {
  88. MessageUtil.ShowWarning(ccp.ReturnInfo);
  89. return;
  90. }
  91. MessageUtil.ShowTips("返库成功!");
  92. this.CloseEvent = "update";
  93. this.Close();
  94. }
  95. }
  96. catch (System.Exception ex)
  97. {
  98. MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  99. }
  100. }
  101. private void chkStoveNo_CheckedChanged(object sender, EventArgs e)
  102. {
  103. if (chkLocationName.Checked)
  104. {
  105. this.txtLocationName.Enabled = true;
  106. }
  107. else {
  108. this.txtLocationName.Enabled = false;
  109. }
  110. }
  111. /// <summary>
  112. /// 窗体关闭属性 默认关闭
  113. /// </summary>
  114. private string closeEvent = "formClose";
  115. /// <summary>
  116. /// 窗体关闭属性
  117. /// </summary>
  118. public string CloseEvent
  119. {
  120. get { return closeEvent; }
  121. set { closeEvent = value; }
  122. }
  123. }
  124. }