F_PM_3101.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3101.cs
  5. * 2.功能描述:品保抽查
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2019/05/10 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Basics.DockPanel;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PMModule
  19. {
  20. /// <summary>
  21. /// 品保抽查
  22. /// </summary>
  23. public partial class F_PM_3101 : DockPanelBase
  24. {
  25. #region 成员变量
  26. private static F_PM_3101 _instance; //单例模式
  27. #endregion
  28. #region 构造函数
  29. /// <summary>
  30. /// 废弃一览构造
  31. /// </summary>
  32. private F_PM_3101()
  33. {
  34. InitializeComponent();
  35. this.Text = "品保抽查";
  36. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  37. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  38. this.tsbtnSuspend.Text = "抽查(&S)";
  39. this.cbSelectTime.Checked = true;
  40. this.txtDateStart.Value = DateTime.Now.Date;
  41. this.txtDateEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
  42. }
  43. #endregion
  44. #region 单例模式
  45. /// <summary>
  46. /// 单例模式,防止重复创建窗体
  47. /// </summary>
  48. public static F_PM_3101 Instance
  49. {
  50. get
  51. {
  52. if (_instance == null)
  53. {
  54. _instance = new F_PM_3101();
  55. }
  56. return _instance;
  57. }
  58. }
  59. #endregion
  60. #region 事件
  61. /// <summary>
  62. /// 窗体加载
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_PM_3101_Load(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. this.dgvScrapProduct.AutoGenerateColumns = false;
  71. // 加载权限
  72. //FormPermissionManager.FormPermissionControl(this.Name, this,
  73. // Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  74. // Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  75. }
  76. catch (Exception ex)
  77. {
  78. // 对异常进行共通处理
  79. ExceptionManager.HandleEventException(this.ToString(),
  80. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  81. }
  82. }
  83. /// <summary>
  84. /// 查询事件
  85. /// </summary>
  86. /// <param name="sender"></param>
  87. /// <param name="e"></param>
  88. private void btnSearch_Click(object sender, EventArgs e)
  89. {
  90. try
  91. {
  92. DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
  93. {
  94. return this.GetScrapProduct();
  95. }));
  96. if (dsScrapProduct != null)
  97. {
  98. if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  99. {
  100. this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
  101. this.dgvScrapProduct.ReadOnly = true;
  102. }
  103. else
  104. {
  105. this.dgvScrapProduct.DataSource = null;
  106. // 提示未查找到数据
  107. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  108. MessageBoxButtons.OK, MessageBoxIcon.Information);
  109. }
  110. }
  111. else
  112. {
  113. this.dgvScrapProduct.DataSource = null;
  114. // 提示未查找到数据
  115. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  116. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  117. }
  118. }
  119. catch (Exception ex)
  120. {
  121. // 对异常进行共通处理
  122. ExceptionManager.HandleEventException(this.ToString(),
  123. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  124. }
  125. }
  126. /// <summary>
  127. /// 抽查按钮点击事件
  128. /// </summary>
  129. /// <param name="sender"></param>
  130. /// <param name="e"></param>
  131. private void tsbtnSuspend_Click(object sender, EventArgs e)
  132. {
  133. // 抽查
  134. F_PM_3102 frm3102 = new F_PM_3102();
  135. DialogResult dialogResult = frm3102.ShowDialog();
  136. }
  137. /// <summary>
  138. /// 时间有效性切换
  139. /// </summary>
  140. /// <param name="sender"></param>
  141. /// <param name="e"></param>
  142. private void cbSelectTime_CheckedChanged(object sender, EventArgs e)
  143. {
  144. this.txtDateStart.Enabled = this.cbSelectTime.Checked;
  145. this.txtDateEnd.Enabled = this.cbSelectTime.Checked;
  146. }
  147. /// <summary>
  148. /// 清空条件
  149. /// </summary>
  150. /// <param name="sender"></param>
  151. /// <param name="e"></param>
  152. private void btnClearCondition_Click(object sender, EventArgs e)
  153. {
  154. this.txtBarCode.Text = "";
  155. this.cbSelectTime.Checked = true;
  156. this.txtDateStart.Value = DateTime.Now.Date;
  157. this.txtDateEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1);
  158. this.txtRemarks.Text = "";
  159. this.txtCheckUser.Text = "";
  160. this.txtGoodscode.Text = "";
  161. }
  162. /// <summary>
  163. /// 关闭一览窗体
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void tsbtnClose_Click(object sender, EventArgs e)
  168. {
  169. this.Close();
  170. }
  171. /// <summary>
  172. /// 窗体关闭事件
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void F_PM_3101_FormClosed(object sender, FormClosedEventArgs e)
  177. {
  178. _instance = null;
  179. }
  180. /// <summary>
  181. /// 自动列宽
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  186. {
  187. this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  188. }
  189. #endregion
  190. #region 私有方法
  191. /// <summary>
  192. /// 根据界面查询条件获取数据集
  193. /// </summary>
  194. private DataSet GetScrapProduct()
  195. {
  196. try
  197. {
  198. ClientRequestEntity cre = new ClientRequestEntity();
  199. cre.NameSpace = "QASpotCheck";
  200. cre.Name = "GetAllQASpotCheck";
  201. cre.Properties["barcode"] = this.txtBarCode.Text.Trim();
  202. cre.Properties["goodscode"] = this.txtGoodscode.Text.Trim();
  203. cre.Properties["usercode"] = this.txtCheckUser.Text.Trim();
  204. cre.Properties["remarks"] = this.txtRemarks.Text.Trim();
  205. if (this.cbSelectTime.Checked)
  206. {
  207. cre.Properties["checktimebegin"] = this.txtDateStart.Value;
  208. cre.Properties["checktimeend"] = this.txtDateEnd.Value.AddMinutes(1);
  209. }
  210. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  211. return result.Data;
  212. }
  213. catch (Exception ex)
  214. {
  215. throw ex;
  216. }
  217. }
  218. #endregion
  219. }
  220. }