F_MST_1801.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using Dongke.IBOSS.PRD.Basics.BaseResources;
  2. using Dongke.IBOSS.PRD.Basics.DockPanel;
  3. using Dongke.IBOSS.PRD.Client.CommonModule;
  4. using Dongke.IBOSS.PRD.Client.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.DataModels;
  6. using Dongke.IBOSS.PRD.WCF.Proxys;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. namespace Dongke.IBOSS.PRD.Client.SystemModule
  16. {
  17. public partial class F_MST_1801 : DockPanelBase
  18. {
  19. #region 成员变量
  20. private static F_MST_1801 _instance;
  21. #endregion
  22. #region 构造函数
  23. public F_MST_1801()
  24. {
  25. InitializeComponent();
  26. this.Text = "产品对应釉料";
  27. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  28. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  29. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  30. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  31. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  32. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  33. }
  34. #endregion
  35. #region 单列模式
  36. public static F_MST_1801 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_MST_1801();
  43. }
  44. return _instance;
  45. }
  46. }
  47. #endregion
  48. #region 事件
  49. /// <summary>
  50. /// 页面加载事件
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="e"></param>
  54. private void F_MST_1801_Load(object sender, EventArgs e)
  55. {
  56. // 按钮权限控制
  57. FormPermissionManager.FormPermissionControl(this.Name, this,
  58. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  59. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  60. ClientRequestEntity cre = new ClientRequestEntity();
  61. cre.NameSpace = "F_MST_1801";
  62. cre.Name = "GetGlaze";
  63. cre.Properties["GLAZE"] = "";
  64. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  65. DataSet set = sre.Data;
  66. DataTable dt = set.Tables[0];
  67. DataRow dr = dt.NewRow();
  68. dr["GLAZETYPEID"] = "0";
  69. dr["GLAZE"] = "";
  70. dt.Rows.Add(dr);
  71. DataSet GlazeInfo = sre.Data;
  72. if (GlazeInfo != null && GlazeInfo.Tables.Count > 0)
  73. {
  74. this.cmbGlaze.DataSource = dt;
  75. this.cmbGlaze.DisplayMember = "GLAZE";
  76. this.cmbGlaze.ValueMember = "GLAZETYPEID";
  77. this.cmbGlaze.SelectedValue = "0";
  78. }
  79. }
  80. /// <summary>
  81. /// 查询事件
  82. /// </summary>
  83. /// <param name="sender"></param>
  84. /// <param name="e"></param>
  85. private void btnSearch_Click(object sender, EventArgs e)
  86. {
  87. this.DataSource = this.GetSearchData();
  88. if (this.DataSource != null)
  89. {
  90. if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0)
  91. {
  92. this.dgvLayout.DataSource = this.DataSource.Tables[0];
  93. }
  94. else
  95. {
  96. // 清空明细中的数据
  97. this.dgvLayout.DataSource = null;
  98. // 提示未查找到数据
  99. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  100. MessageBoxButtons.OK, MessageBoxIcon.Information);
  101. }
  102. }
  103. else
  104. {
  105. // 清空明细中的数据
  106. this.dgvLayout.DataSource = null;
  107. // 提示未查找到数据
  108. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  109. MessageBoxButtons.OK, MessageBoxIcon.Information);
  110. }
  111. }
  112. /// <summary>
  113. /// 自适应列宽
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  118. {
  119. this.dgvLayout.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  120. }
  121. /// <summary>
  122. /// 退出
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void tsbtnClose_Click(object sender, EventArgs e)
  127. {
  128. this.Close();
  129. }
  130. /// <summary>
  131. /// 编辑
  132. /// </summary>
  133. /// <param name="sender"></param>
  134. /// <param name="e"></param>
  135. private void tsbtnEdit_Click(object sender, EventArgs e)
  136. {
  137. try
  138. {
  139. if (this.dgvLayout.SelectedRows.Count != 0)
  140. {
  141. string GlazeTypeID = this.dgvLayout.SelectedRows[0].Cells["GLAZETYPEID"].Value.ToString();
  142. string goodscode= this.dgvLayout.SelectedRows[0].Cells["GOODSCODE"].Value.ToString();
  143. string ValueFlag = this.dgvLayout.SelectedRows[0].Cells["ValueFlag"].Value.ToString();
  144. F_MST_1802 frmFPC1802 = new F_MST_1802(Constant.FormMode.Edit, goodscode, GlazeTypeID, ValueFlag);
  145. DialogResult dialogresult = frmFPC1802.ShowDialog();
  146. btnSearch_Click(sender, null);
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. // 对异常进行共通处理
  152. ExceptionManager.HandleEventException(this.ToString(),
  153. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  154. }
  155. }
  156. /// <summary>
  157. /// 新建
  158. /// </summary>
  159. /// <param name="sender"></param>
  160. /// <param name="e"></param>
  161. private void tsbtnAdd_Click(object sender, EventArgs e)
  162. {
  163. try
  164. {
  165. F_MST_1802 frmMST1802 = new F_MST_1802(Constant.FormMode.Add, "","","");
  166. DialogResult dialogResult = frmMST1802.ShowDialog();
  167. // 重新加载GridView
  168. btnSearch_Click(sender, null);
  169. }
  170. catch (Exception ex)
  171. {
  172. // 对异常进行共通处理
  173. ExceptionManager.HandleEventException(this.ToString(),
  174. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  175. }
  176. }
  177. /// <summary>
  178. /// 清空按钮
  179. /// </summary>
  180. /// <param name="sender"></param>
  181. /// <param name="e"></param>
  182. private void btnClearCondition_Click(object sender, EventArgs e)
  183. {
  184. this.txtGoodsCode.Clear();
  185. this.cmbGlaze.SelectedValue = "0";
  186. this.cbflagtrue.Checked = true;
  187. this.cbflagfalse.Checked = true;
  188. }
  189. /// <summary>
  190. /// 窗体关闭事件
  191. /// </summary>
  192. /// <param name="sender"></param>
  193. /// <param name="e"></param>
  194. private void F_MST_1801_FormClosed(object sender, FormClosedEventArgs e)
  195. {
  196. _instance = null;
  197. }
  198. #endregion
  199. #region 私有方法
  200. /// <summary>
  201. /// 根据界面查询条件获取数据集
  202. /// </summary>
  203. private DataSet GetSearchData()
  204. {
  205. try
  206. {
  207. ClientRequestEntity cre = new ClientRequestEntity();
  208. cre.NameSpace = "F_MST_1801";
  209. cre.Name = "GetGoodsGlaze";
  210. cre.Properties["GLAZETYPEID"] = cmbGlaze.SelectedValue.ToString();
  211. cre.Properties["GLAZE"] = cmbGlaze.Text.ToString();
  212. cre.Properties["GOODSCODE"] = txtGoodsCode.Text;
  213. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  214. {
  215. cre.Properties["VALUEFLAG"] = "";
  216. }
  217. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  218. {
  219. cre.Properties["VALUEFLAG"] = 1;
  220. }
  221. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  222. {
  223. cre.Properties["VALUEFLAG"] = 0;
  224. }
  225. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  226. {
  227. cre.Properties["VALUEFLAG"] = 2;
  228. }
  229. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  230. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  231. {
  232. return sre.Data;
  233. }
  234. return null;
  235. }
  236. catch (Exception ex)
  237. {
  238. throw ex;
  239. }
  240. }
  241. #endregion
  242. private void tsrOperate_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  243. {
  244. }
  245. }
  246. }