F_PC_0801.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. using Dongke.IBOSS.PRD.Basics.BaseResources;
  2. using Dongke.IBOSS.PRD.Client.CommonModule;
  3. using Dongke.IBOSS.PRD.Client.Controls;
  4. using Dongke.IBOSS.PRD.WCF.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.Proxys;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Reflection;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Dongke.IBOSS.PRD.Client.PCModule
  16. {
  17. public partial class F_PC_0801 : DKDockPanelBase
  18. {
  19. #region 成员变量
  20. // 单例模式
  21. private static F_PC_0801 _instance;
  22. // 正在查询
  23. private bool _isSearching = false;
  24. #endregion
  25. #region 构造函数
  26. public F_PC_0801()
  27. {
  28. InitializeComponent();
  29. this.Text = "线边仓组件配置";
  30. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  31. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  32. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  33. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  34. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  35. }
  36. #endregion
  37. #region 单例模式
  38. /// <summary>
  39. /// 单例模式,防止重复创建窗体
  40. /// </summary>
  41. public static F_PC_0801 Instance
  42. {
  43. get
  44. {
  45. if (_instance == null)
  46. {
  47. _instance = new F_PC_0801();
  48. }
  49. return _instance;
  50. }
  51. }
  52. #endregion
  53. #region 事件
  54. /// <summary>
  55. /// 加载
  56. /// </summary>
  57. /// <param name="sender"></param>
  58. /// <param name="e"></param>
  59. private void F_PC_0801_Load(object sender, EventArgs e)
  60. {
  61. dgvLGORT.AutoGenerateColumns = false;
  62. dgvIDNRKTYPE.AutoGenerateColumns = false;
  63. }
  64. /// <summary>
  65. /// 查询
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void btnSearch_Click(object sender, EventArgs e)
  70. {
  71. try
  72. {
  73. this._isSearching = true;
  74. this.dgvLGORT.DataSource = null;
  75. this.dgvIDNRKTYPE.DataSource = null;
  76. ClientRequestEntity cre = new ClientRequestEntity();
  77. cre.NameSpace = "F_PC_0801";
  78. cre.Name = "GetLGORT";
  79. cre.Properties["dictionaryvalue"] = this.txtLGORT.Text;
  80. cre.Properties["DICTIONARYTYPE"] = "TPC011"; //线边仓数据字典类别
  81. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  82. {
  83. return PCModuleProxyNew.Service.HandleRequest(cre);
  84. });
  85. if (sre.Status == Constant.ServiceResultStatus.Success)
  86. {
  87. this.Tag = false;
  88. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  89. {
  90. this.dgvLGORT.DataSource = sre.Data.Tables[0];
  91. this.Tag = true;
  92. dgvLGORT_SelectionChanged(null, null);
  93. }
  94. else
  95. {
  96. // 清空明细中的数据
  97. this.dgvLGORT.DataSource = null;
  98. // 提示未查找到数据
  99. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  100. MessageBoxButtons.OK, MessageBoxIcon.Information);
  101. }
  102. }
  103. }
  104. catch (Exception ex)
  105. {
  106. this.btnSearch.Enabled = true;
  107. this.btnClearCondition.Enabled = true;
  108. // 对异常进行共通处理
  109. ExceptionManager.HandleEventException(this.ToString(),
  110. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  111. }
  112. }
  113. /// <summary>
  114. /// 自适应列宽
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  119. {
  120. this.dgvLGORT.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  121. this.dgvIDNRKTYPE.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  122. }
  123. /// <summary>
  124. /// 关闭
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void tsbtnClose_Click(object sender, EventArgs e)
  129. {
  130. this.Close();
  131. }
  132. /// <summary>
  133. /// 编辑
  134. /// </summary>
  135. /// <param name="sender"></param>
  136. /// <param name="e"></param>
  137. private void tsbtnEdit_Click(object sender, EventArgs e)
  138. {
  139. try
  140. {
  141. if (this.dgvLGORT.SelectedRows.Count != 0)
  142. {
  143. string dictionaryvalue = this.dgvLGORT.SelectedRows[0].Cells["dictionaryvalue"].Value + "";
  144. F_PC_0802 frmFPC0802 = new F_PC_0802(dictionaryvalue);
  145. DialogResult dialogresult = frmFPC0802.ShowDialog();
  146. if (dialogresult.Equals(DialogResult.OK))
  147. {
  148. DataGridViewRow currentRow = this.dgvLGORT.CurrentRow;
  149. if (currentRow != null)
  150. {
  151. string LGORT = currentRow.Cells["dictionaryvalue"].Value.ToString();
  152. // 调用服务器端获取数据集
  153. ClientRequestEntity cre = new ClientRequestEntity();
  154. cre.NameSpace = "F_PC_0801";
  155. cre.Name = "GetIDNRKTYPE";
  156. cre.Properties["LGORT"] = LGORT;
  157. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  158. {
  159. return PCModuleProxyNew.Service.HandleRequest(cre);
  160. });
  161. if (sre.Status == Constant.ServiceResultStatus.Success)
  162. {
  163. this.dgvIDNRKTYPE.DataSource = sre.Data.Tables[0];
  164. }
  165. }
  166. }
  167. }
  168. }
  169. catch (Exception ex)
  170. {
  171. // 对异常进行共通处理
  172. ExceptionManager.HandleEventException(this.ToString(),
  173. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  174. }
  175. }
  176. /// <summary>
  177. /// 清空条件
  178. /// </summary>
  179. /// <param name="sender"></param>
  180. /// <param name="e"></param>
  181. private void btnClearCondition_Click(object sender, EventArgs e)
  182. {
  183. this.txtLGORT.Clear();
  184. }
  185. /// <summary>
  186. /// 组件库选中事件
  187. /// </summary>
  188. /// <param name="sender"></param>
  189. /// <param name="e"></param>
  190. private void dgvLGORT_SelectionChanged(object sender, EventArgs e)
  191. {
  192. try
  193. {
  194. // 在绑定总表时 不查询明细
  195. if (!Convert.ToBoolean(this.Tag)
  196. || this.dgvLGORT.CurrentCell == null)
  197. {
  198. return;
  199. }
  200. else
  201. {
  202. DataGridViewRow currentRow = this.dgvLGORT.CurrentRow;
  203. if (currentRow != null)
  204. {
  205. string LGORT = currentRow.Cells["dictionaryvalue"].Value.ToString();
  206. // 调用服务器端获取数据集
  207. ClientRequestEntity cre = new ClientRequestEntity();
  208. cre.NameSpace = "F_PC_0801";
  209. cre.Name = "GetIDNRKTYPE";
  210. cre.Properties["LGORT"] = LGORT;
  211. if (!this.txtLGORT.ReadOnly)
  212. {
  213. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  214. {
  215. return PCModuleProxyNew.Service.HandleRequest(cre);
  216. });
  217. if (sre.Status == Constant.ServiceResultStatus.Success)
  218. {
  219. // 绑定明细数据
  220. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  221. {
  222. this.dgvIDNRKTYPE.DataSource = sre.Data.Tables[0];
  223. this.dgvIDNRKTYPE.Focus();
  224. this.dgvIDNRKTYPE.CurrentCell = null;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. catch (Exception ex)
  232. {
  233. // 对异常进行共通处理
  234. ExceptionManager.HandleEventException(this.ToString(),
  235. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  236. }
  237. }
  238. /// <summary>
  239. /// 释放窗体
  240. /// </summary>
  241. /// <param name="sender"></param>
  242. /// <param name="e"></param>
  243. private void F_PC_0801_FormClosed(object sender, FormClosedEventArgs e)
  244. {
  245. _instance = null;
  246. }
  247. #endregion
  248. }
  249. }