SlmBaseCustStorage.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.SaleBase.model;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.SaleBase
  17. {
  18. public partial class SlmBaseCustStorage : FrmBase
  19. {
  20. SlmBaseCustStorageEntity entity;
  21. public SlmBaseCustStorageEntity Entity
  22. {
  23. get { return entity; }
  24. set { entity = value; }
  25. }
  26. public SlmBaseCustStorage()
  27. {
  28. InitializeComponent();
  29. EntityHelper.ShowGridCaption<SlmBaseCustStorageEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  30. }
  31. public override void ToolBar_Click(object sender, string ToolbarKey)
  32. {
  33. base.ToolBar_Click(sender, ToolbarKey);
  34. switch (ToolbarKey)
  35. {
  36. case "doQuery":
  37. Query();
  38. break;
  39. case "doAdd":
  40. Add();
  41. break;
  42. case "doUpdate":
  43. Update();
  44. break;
  45. case "doDelete":
  46. Delete();
  47. break;
  48. case "doRecovery":
  49. Recovery();
  50. break;
  51. case "doClose":
  52. this.Close();
  53. break;
  54. }
  55. }
  56. private void Recovery()
  57. {
  58. this.ultraGrid1.UpdateData();
  59. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  60. ArrayList parms = new ArrayList();
  61. foreach (UltraGridRow row in checkRows)
  62. {
  63. SlmBaseCustStorageEntity parm = row.ListObject as SlmBaseCustStorageEntity;
  64. parm.UpdateName = this.UserInfo.GetUserName();
  65. parms.Add(JSONFormat.Format(parm));
  66. }
  67. if (MessageUtil.ShowYesNoAndQuestion("是否确认恢复记录?") == DialogResult.No)
  68. {
  69. return;
  70. }
  71. List<string> jsons = new List<string>();
  72. CoreClientParam ccp = new CoreClientParam();
  73. ccp.ServerName = "com.steering.pss.sale.base.SlmBaseCustStorage";
  74. ccp.MethodName = "UpdateValidflag";
  75. ccp.ServerParams = new object[] { parms, "1" };
  76. ccp.IfShowErrMsg = false;
  77. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  78. if (ccp != null)
  79. {
  80. if (ccp.ReturnCode == -1)
  81. {
  82. MessageUtil.ShowWarning(ccp.ReturnInfo);
  83. return;
  84. }
  85. MessageUtil.ShowTips("恢复成功!");
  86. Query();
  87. }
  88. }
  89. private void Delete()
  90. {
  91. this.ultraGrid1.UpdateData();
  92. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  93. ArrayList parms = new ArrayList();
  94. foreach (UltraGridRow row in checkRows)
  95. {
  96. SlmBaseCustStorageEntity parm = row.ListObject as SlmBaseCustStorageEntity;
  97. parm.DeleteName = this.UserInfo.GetUserName();
  98. parms.Add(JSONFormat.Format(parm));
  99. }
  100. if (MessageUtil.ShowYesNoAndQuestion("是否确认作废记录?") == DialogResult.No)
  101. {
  102. return;
  103. }
  104. List<string> jsons = new List<string>();
  105. CoreClientParam ccp = new CoreClientParam();
  106. ccp.ServerName = "com.steering.pss.sale.base.SlmBaseCustStorage";
  107. ccp.MethodName = "UpdateValidflag";
  108. ccp.ServerParams = new object[] { parms, "0" };
  109. ccp.IfShowErrMsg = false;
  110. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  111. if (ccp != null)
  112. {
  113. if (ccp.ReturnCode == -1)
  114. {
  115. MessageUtil.ShowWarning(ccp.ReturnInfo);
  116. return;
  117. }
  118. MessageUtil.ShowTips("作废成功!");
  119. Query();
  120. }
  121. }
  122. private void Update()
  123. {
  124. this.ultraGrid1.UpdateData();
  125. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  126. ArrayList parms = new ArrayList();
  127. foreach (UltraGridRow row in checkRows)
  128. {
  129. SlmBaseCustStorageEntity parm = row.ListObject as SlmBaseCustStorageEntity;
  130. parm.CustomerNo = row.Cells["CustomerNM"].Value.ToString2();
  131. parm.CustomerNm = row.Cells["CustomerNM"].Text.ToString2();
  132. parm.StorageNo = row.Cells["StorageName"].Value.ToString2();
  133. parm.StorageName = row.Cells["StorageName"].Text.ToString2();
  134. parm.UpdateName = this.UserInfo.GetUserName();
  135. parms.Add(JSONFormat.Format(parm));
  136. }
  137. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改记录?") == DialogResult.No)
  138. {
  139. return;
  140. }
  141. List<string> jsons = new List<string>();
  142. CoreClientParam ccp = new CoreClientParam();
  143. ccp.ServerName = "com.steering.pss.sale.base.SlmBaseCustStorage";
  144. ccp.MethodName = "Update";
  145. ccp.ServerParams = new object[] { parms };
  146. ccp.IfShowErrMsg = false;
  147. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  148. if (ccp != null)
  149. {
  150. if (ccp.ReturnCode == -1)
  151. {
  152. MessageUtil.ShowWarning(ccp.ReturnInfo);
  153. return;
  154. }
  155. MessageUtil.ShowTips("修改成功!");
  156. Query();
  157. }
  158. }
  159. private void Add()
  160. {
  161. this.ultraGrid1.UpdateData();
  162. IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  163. ArrayList parms = new ArrayList();
  164. foreach (UltraGridRow row in checkRows)
  165. {
  166. SlmBaseCustStorageEntity parm = row.ListObject as SlmBaseCustStorageEntity;
  167. parm.CustomerNo = row.Cells["CustomerNM"].Value.ToString2();
  168. parm.CustomerNm = row.Cells["CustomerNM"].Text.ToString2();
  169. parm.StorageNo = row.Cells["StorageName"].Value.ToString2();
  170. parm.StorageName = row.Cells["StorageName"].Text.ToString2();
  171. parm.CreateName = this.UserInfo.GetUserName();
  172. parms.Add(JSONFormat.Format(parm));
  173. }
  174. if (MessageUtil.ShowYesNoAndQuestion("是否确认新增记录?") == DialogResult.No)
  175. {
  176. return;
  177. }
  178. List<string> jsons = new List<string>();
  179. CoreClientParam ccp = new CoreClientParam();
  180. ccp.ServerName = "com.steering.pss.sale.base.SlmBaseCustStorage";
  181. ccp.MethodName = "Insert";
  182. ccp.ServerParams = new object[] { parms };
  183. //ccp.IfShowErrMsg = false;
  184. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  185. if (ccp != null)
  186. {
  187. if (ccp.ReturnCode == -1)
  188. {
  189. MessageUtil.ShowWarning(ccp.ReturnInfo);
  190. return;
  191. }
  192. MessageUtil.ShowTips("新增成功!");
  193. Query();
  194. }
  195. }
  196. private void Query()
  197. {
  198. string storageName = labelTextBox1.CheckBox.Checked ? labelTextBox1.Text.Trim() : "";
  199. string customerNm = labelTextBox2.CheckBox.Checked ? labelTextBox2.Text.Trim() : "";
  200. string flag = ultraCheckEditor1.Checked ? "0" : "1";
  201. List<SlmBaseCustStorageEntity> listSource = EntityHelper.GetData<SlmBaseCustStorageEntity>(
  202. "com.steering.pss.sale.base.SlmBaseCustStorage.Query", new object[] { storageName, customerNm, flag }, this.ob);
  203. slmBaseCustStorageEntityBindingSource.DataSource = listSource;
  204. }
  205. private void SlmBaseCustStorage_Load(object sender, EventArgs e)
  206. {
  207. // 查询仓库
  208. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.base.SlmBaseCustStorage.QueryStorage", null, this.ob);
  209. Storage_S.DataSource = dt;
  210. Storage_S.DisplayMember = "STORAGE_NAME";
  211. Storage_S.ValueMember = "STORAGE_NO";
  212. Storage_S.DataBind();
  213. // 查询客户
  214. DataTable dt1 = ServerHelper.GetData("com.steering.pss.sale.base.SlmBaseCustStorage.QueryCustomer", null, this.ob);
  215. Customer_S.DataSource = dt1;
  216. Customer_S.DisplayMember = "CUSTOMER_NM";
  217. Customer_S.ValueMember = "CUSTOMER_NO";
  218. Customer_S.DataBind();
  219. Query();
  220. }
  221. }
  222. }