F_RPT_080112.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080112.cs
  5. * 2.功能描述:品管数据记录明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 秦祺 2023/06/02 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  18. using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
  19. using Dongke.IBOSS.PRD.Client.CommonModule;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.Client.Controls;
  22. namespace Dongke.IBOSS.PRD.Client.ReportModule
  23. {
  24. /// <summary>
  25. /// 品管数据记录明细表
  26. /// </summary>
  27. public partial class F_RPT_080112 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. //单例模式
  31. private static F_RPT_080112 _instance;
  32. #endregion
  33. #region 构造函数
  34. public F_RPT_080112()
  35. {
  36. InitializeComponent();
  37. }
  38. #endregion
  39. #region 单例模式
  40. /// <summary>
  41. /// 单例模式,防止重复创建窗体
  42. /// </summary>
  43. public static F_RPT_080112 Instance
  44. {
  45. get
  46. {
  47. if (_instance == null)
  48. {
  49. _instance = new F_RPT_080112();
  50. }
  51. return _instance;
  52. }
  53. }
  54. #endregion
  55. #region 事件
  56. /// <summary>
  57. /// 窗体加载
  58. /// </summary>
  59. private void F_RPT_080112_Load(object sender, EventArgs e)
  60. {
  61. // 加载权限
  62. FormPermissionManager.FormPermissionControl(this.Name, this,
  63. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  64. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  65. this.dgvPinGuanDetail.AutoGenerateColumns = false;
  66. this.txtRecordDateStart.Value = DateTime.Now.Date;
  67. this.txtRecordDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  68. this.Text = "品管数据记录明细表";
  69. // 巡检类别
  70. DataTable workStationTable = new DataTable();
  71. workStationTable.Columns.Add("WorkStationID", typeof(int));
  72. workStationTable.Columns.Add("WorkStation", typeof(string));
  73. DataRow drWorkStation = workStationTable.NewRow();
  74. drWorkStation["WorkStationID"] = 1;
  75. drWorkStation["WorkStation"] = "";
  76. workStationTable.Rows.Add(drWorkStation);
  77. drWorkStation = workStationTable.NewRow();
  78. drWorkStation["WorkStationID"] = 2;
  79. drWorkStation["WorkStation"] = "3#功能巡检";
  80. workStationTable.Rows.Add(drWorkStation);
  81. drWorkStation = workStationTable.NewRow();
  82. drWorkStation["WorkStationID"] = 3;
  83. drWorkStation["WorkStation"] = "3#外观巡检";
  84. workStationTable.Rows.Add(drWorkStation);
  85. drWorkStation = workStationTable.NewRow();
  86. drWorkStation["WorkStationID"] = 4;
  87. drWorkStation["WorkStation"] = "3#包装巡检";
  88. workStationTable.Rows.Add(drWorkStation);
  89. this.cbworkStation.DisplayMember = "WorkStation";
  90. this.cbworkStation.ValueMember = "WorkStationID";
  91. this.cbworkStation.DataSource = workStationTable;
  92. this.cbworkStation.SelectedValue = 1;
  93. }
  94. /// <summary>
  95. /// 获取数据
  96. /// </summary>
  97. private void btnSearch_Click(object sender, System.EventArgs e)
  98. {
  99. try
  100. {
  101. this.dgvPinGuanDetail.DataSource = null;
  102. ClientRequestEntity cre = new ClientRequestEntity();
  103. cre.NameSpace = "F_RPT_080112";
  104. cre.Name = "GetPinGuanDetail";
  105. cre.Properties["BarCode"] = this.txtBarcode.Text.Trim();
  106. cre.Properties["CreateTimeBegin"] = this.txtRecordDateStart.Value;
  107. cre.Properties["CreateTimeEnd"] = Convert.ToDateTime(this.txtRecordDateEnd.Value).AddSeconds(1);
  108. cre.Properties["WorkStation"] = this.cbworkStation.Text.Trim();
  109. cre.Properties["User"] = this.txtUser.Text.Trim();
  110. ServiceResultEntity sre = DoAsync(() =>
  111. {
  112. return PCModuleProxyNew.Service.HandleRequest(cre);
  113. });
  114. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  115. {
  116. this.dgvPinGuanDetail.DataSource = sre.Data.Tables[0];
  117. }
  118. else
  119. {
  120. this.dgvPinGuanDetail.DataSource = null;
  121. // 提示未查找到数据
  122. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  123. MessageBoxButtons.OK, MessageBoxIcon.Information);
  124. }
  125. }
  126. catch (Exception ex)
  127. {
  128. // 对异常进行共通处理
  129. ExceptionManager.HandleEventException(this.ToString(),
  130. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  131. }
  132. }
  133. /// <summary>
  134. /// 清空条件
  135. /// </summary>
  136. private void btnClearCondition_Click(object sender, EventArgs e)
  137. {
  138. this.txtBarcode.Text = "";
  139. this.txtRecordDateStart.Value = DateTime.Now;
  140. this.txtRecordDateEnd.Value = DateTime.Now;
  141. }
  142. /// <summary>
  143. /// 窗体关闭
  144. /// </summary>
  145. /// <param name="sender"></param>
  146. /// <param name="e"></param>
  147. private void F_RPT_080112_FormClosed(object sender, FormClosedEventArgs e)
  148. {
  149. _instance = null;
  150. }
  151. /// <summary>
  152. /// 关闭按钮事件
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void tsbtnClose_Click(object sender, EventArgs e)
  157. {
  158. this.Close();
  159. }
  160. /// <summary>
  161. /// 自动列宽事件
  162. /// </summary>
  163. /// <param name="sender"></param>
  164. /// <param name="e"></param>
  165. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  166. {
  167. this.dgvPinGuanDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  168. }
  169. #endregion
  170. #region 私有方法
  171. #endregion
  172. }
  173. }