F_RPT_080117.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. /*******************************************************************************
  2. * 类的信息:
  3. * 1.程序名称:F_RPT_080117.cs
  4. * 2.功能描述:QC检验计划分析明细表
  5. * 编辑履历:
  6. * 作者 日期 版本 修改内容
  7. * 李士越 2024/6/17 1.00 新建
  8. *******************************************************************************/
  9. using System;
  10. using System.Data;
  11. using System.Text;
  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.Client.Controls;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. using System.Collections.Generic;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. /// <summary>
  24. /// QC检验计划分析明细表
  25. /// </summary>
  26. public partial class F_RPT_080117 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 窗体的单例模式
  30. private static F_RPT_080117 _instance;
  31. #endregion
  32. #region 构造函数
  33. public F_RPT_080117()
  34. {
  35. InitializeComponent();
  36. // 窗体显示的Title
  37. this.Text = "QC检验计划分析明细表";
  38. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  39. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  40. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  41. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  42. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_RPT_080117 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null || _instance.IsDisposed)
  54. {
  55. _instance = new F_RPT_080117();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件处理
  62. /// <summary>
  63. /// 窗体加载事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void F_RPT_080117_Load(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. // 加载权限
  72. FormPermissionManager.FormPermissionControl(this.Name, this,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  74. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  75. // 设置表格不自动创建列
  76. this.dgvScrapTotalModule.AutoGenerateColumns = false;
  77. this.dgvScrapTotalModuleDetail.AutoGenerateColumns = false;
  78. // 注浆时间
  79. this.dtpGDateStart.Value = DateTime.Now.Date;
  80. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  81. this.dtpGDateStart.Enabled = true;
  82. this.dtpGDateEnd.Enabled = true;
  83. //单选框原始数据
  84. listBox1.DataSource = new List<string>() { "A班次", "B班次", "全部" };
  85. }
  86. catch (Exception ex)
  87. {
  88. // 对异常进行共通处理
  89. ExceptionManager.HandleEventException(this.ToString(),
  90. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  91. }
  92. }
  93. /// <summary>
  94. /// 窗体关闭事件
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void F_RPT_080117_FormClosed(object sender, FormClosedEventArgs e)
  99. {
  100. _instance = null;
  101. }
  102. /// <summary>
  103. /// 关闭按钮
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void tsbtnClose_Click(object sender, EventArgs e)
  108. {
  109. this.Close();
  110. }
  111. /// <summary>
  112. /// 自动适应列宽
  113. /// </summary>
  114. /// <param name="sender"></param>
  115. /// <param name="e"></param>
  116. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  117. {
  118. if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_ZERO)
  119. {
  120. this.dgvScrapTotalModule.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  121. }
  122. else
  123. {
  124. this.dgvScrapTotalModuleDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  125. }
  126. }
  127. /// <summary>
  128. /// 查询按钮事件
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void btnSearch_Click(object sender, EventArgs e)
  133. {
  134. //班次
  135. string classes = listBox1.Text == "全部" ? "" : listBox1.Text == "A班次" ? "A" : "B";
  136. //开始时间
  137. string startdata = dtpGDateStart.Text;
  138. //结束时间
  139. string enddata = dtpGDateEnd.Text;
  140. //是否汇总
  141. bool summary = chkSpecialRepairFlag.Checked;
  142. try
  143. {
  144. if (this.tblScrapTotalModule.SelectedIndex == Constant.INT_IS_ZERO)
  145. {
  146. //QC检验计划分析明细汇总表
  147. //创建查询连接
  148. ServiceResultEntity sreByid = DoAsync<ServiceResultEntity>(() =>
  149. {
  150. ClientRequestEntity cre = new ClientRequestEntity();
  151. cre.NameSpace = "F_RPT_080117";
  152. cre.Name = "huizhong";
  153. cre.Properties["classes"] = classes;
  154. cre.Properties["startdata"] = startdata;
  155. cre.Properties["enddata"] = enddata;
  156. cre.Properties["summary"] = summary;
  157. return SystemModuleProxy.Service.DoRequest(cre);
  158. });
  159. //没有数据
  160. if (sreByid.Data.Tables[0].Rows.Count == 0)
  161. {
  162. //调用弹窗提示
  163. meaasge();
  164. }
  165. //清空页面数据
  166. this.dgvScrapTotalModule.DataSource = null;
  167. this.dgvScrapTotalModule.DataSource = sreByid.Data.Tables[0];
  168. }
  169. else //QC检验计划分析明细表
  170. {
  171. //清空页面数据
  172. this.dgvScrapTotalModuleDetail.DataSource = null;
  173. //调用查询
  174. this.dgvScrapTotalModuleDetail.DataSource = GetSearchDetailData(new readdata()
  175. {
  176. classes = listBox1.Text == "全部" ? "" : listBox1.Text == "A班次" ? "A" : "B",
  177. startdata = dtpGDateStart.Text,
  178. enddata = dtpGDateEnd.Text,
  179. });
  180. }
  181. }
  182. catch (Exception ex)
  183. {
  184. this.btnSearch.Enabled = true;
  185. // 对异常进行共通处理
  186. ExceptionManager.HandleEventException(this.ToString(),
  187. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  188. }
  189. }
  190. /// <summary>
  191. /// 弹窗提示
  192. /// </summary>
  193. private void meaasge()
  194. { // 提示未查找到数据
  195. MessageBox.Show("根据查询条件,没有相应的数据", this.Text,
  196. MessageBoxButtons.OK, MessageBoxIcon.Information);
  197. }
  198. /// <summary>
  199. /// 清空条件按钮事件
  200. /// </summary>
  201. /// <param name="sender"></param>
  202. /// <param name="e"></param>
  203. private void btnClearCondition_Click(object sender, EventArgs e)
  204. {
  205. this.chkSpecialRepairFlag.Checked = true;
  206. // 注浆时间
  207. this.dtpGDateStart.Value = DateTime.Now.Date;
  208. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  209. this.dtpGDateStart.Enabled = true;
  210. this.dtpGDateEnd.Enabled = true;
  211. }
  212. /// <summary>
  213. /// 双击单元格事件
  214. /// </summary>
  215. /// <param name="sender"></param>
  216. /// <param name="e"></param>
  217. private void dgvScrapTotalModule_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  218. {
  219. try
  220. {
  221. //判断是否为空
  222. if (this.dgvScrapTotalModule.CurrentRow == null)
  223. {
  224. return;
  225. }
  226. //获取数据信息
  227. DataGridViewRow dgvr = dgvScrapTotalModule.CurrentRow;
  228. //清空页面数据
  229. this.dgvScrapTotalModuleDetail.DataSource = null;
  230. //切换tab表
  231. this.tblScrapTotalModule.SelectTab(1);
  232. //获取条件
  233. bool a = !string.IsNullOrEmpty(dgvr.Cells["GOODSID"].Value.ToString());
  234. //调取查询
  235. this.dgvScrapTotalModuleDetail.DataSource = GetSearchDetailData(new readdata()
  236. {
  237. GoodsID = a ==true?dgvr.Cells["GOODSID"].Value.ToString():null,
  238. configtype = a == true?dgvr.Cells["configtype"].Value.ToString().Contains("总计") ? "" : dgvr.Cells["configtype"].Value.ToString().Contains("大件") ? "大件" : dgvr.Cells["configtype"].Value.ToString().Contains("小件") ? "小件" : "":null,
  239. classes = listBox1.Text == "全部" ? "" : listBox1.Text == "A班次" ? "A" : "B",
  240. startdata = dtpGDateStart.Text,
  241. enddata = dtpGDateEnd.Text,
  242. });
  243. }
  244. catch (Exception ex)
  245. {
  246. this.btnSearch.Enabled = true;
  247. this.btnClearCondition.Enabled = true;
  248. // 对异常进行共通处理
  249. ExceptionManager.HandleEventException(this.ToString(),
  250. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  251. }
  252. }
  253. #endregion
  254. #region 私有方法
  255. /// <summary>
  256. /// 查询对象
  257. /// </summary>
  258. public class readdata
  259. {
  260. /// <summary>
  261. /// 主键
  262. /// </summary>
  263. public string GoodsID { get; set; }
  264. /// <summary>
  265. /// 开始时间
  266. /// </summary>
  267. public string startdata { get; set; }
  268. /// <summary>
  269. /// 结束时间
  270. /// </summary>
  271. public string enddata { get; set; }
  272. /// <summary>
  273. /// 班次
  274. /// </summary>
  275. public string classes { get; set; }
  276. /// <summary>
  277. /// 大小件 总计
  278. /// </summary>
  279. public string configtype { get; set; }
  280. }
  281. /// <summary>
  282. /// 查询QC检验计划分析明细表
  283. /// </summary>
  284. private DataTable GetSearchDetailData(readdata ietm)
  285. {
  286. try
  287. {
  288. //创建查询连接
  289. ServiceResultEntity sreByid = DoAsync<ServiceResultEntity>(() =>
  290. {
  291. ClientRequestEntity cre = new ClientRequestEntity();
  292. cre.NameSpace = "F_RPT_080117";
  293. cre.Name = "mingxi";
  294. cre.Properties["GOODSID"] = ietm.GoodsID;
  295. cre.Properties["CLASSESTYPE"] = ietm.classes;
  296. cre.Properties["configtype"] = ietm.configtype;
  297. cre.Properties["startdata"] = ietm.startdata;
  298. cre.Properties["enddata"] = ietm.enddata;
  299. return SystemModuleProxy.Service.DoRequest(cre);
  300. });
  301. //没有数据时调用弹窗提示
  302. if (sreByid.Data.Tables[0].Rows.Count == 0) { meaasge(); }
  303. return sreByid.Data.Tables[0];
  304. }
  305. catch (Exception ex)
  306. {
  307. throw ex;
  308. }
  309. }
  310. #endregion
  311. }
  312. }