F_RPT_030116.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030116.cs
  5. * 2.功能描述:成型存坯汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2018/04/01 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. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  19. using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
  20. using Dongke.IBOSS.PRD.Client.Controls;
  21. using System.Collections.Generic;
  22. namespace Dongke.IBOSS.PRD.Client.ReportModule
  23. {
  24. /// <summary>
  25. /// 成型存坯汇总表
  26. /// </summary>
  27. public partial class F_RPT_030116 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. //单例模式
  31. private static F_RPT_030116 _instance;
  32. ClientRequestEntity _cre1 = null;
  33. ClientRequestEntity _cre2 = null;
  34. #endregion
  35. #region 构造函数
  36. /// <summary>
  37. /// 废弃一览构造
  38. /// </summary>
  39. public F_RPT_030116()
  40. {
  41. InitializeComponent();
  42. this.Text = "成型存坯汇总表";
  43. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  44. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  45. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  46. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  47. }
  48. #endregion
  49. #region 单例模式
  50. /// <summary>
  51. /// 单例模式,防止重复创建窗体
  52. /// </summary>
  53. public static F_RPT_030116 Instance
  54. {
  55. get
  56. {
  57. if (_instance == null)
  58. {
  59. _instance = new F_RPT_030116();
  60. }
  61. return _instance;
  62. }
  63. }
  64. #endregion
  65. #region 事件
  66. /// <summary>
  67. /// 查询事件
  68. /// </summary>
  69. /// <param name="sender"></param>
  70. /// <param name="e"></param>
  71. private void btnSearch_Click(object sender, EventArgs e)
  72. {
  73. try
  74. {
  75. // 汇总表
  76. if (this.tabControl1.SelectedIndex == 0)
  77. {
  78. this.dgvG1.DataSource = null;
  79. this._cre1 = new ClientRequestEntity();
  80. this._cre1.NameSpace = "R03";
  81. this._cre1.Name = "R030116Goods";
  82. this._cre1.Properties["LineCode"] = this.txtLinCode.Text.Trim();
  83. this._cre1.Properties["UserCode"] = this.txtUserCode.Text.Trim();
  84. this._cre1.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  85. this._cre1.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  86. if (this.chkGDate.Checked)
  87. {
  88. this._cre1.Properties["DateBegin"] = this.txtTimeStart.Value;
  89. this._cre1.Properties["DateEnd"] = this.txtTimeEnd.Value;
  90. }
  91. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  92. {
  93. return ReportModuleProxy.Service.DoRequest(_cre1);
  94. });
  95. if (resultEntity == null || resultEntity.Data == null ||
  96. resultEntity.Data.Tables.Count == 0 ||
  97. resultEntity.Data.Tables[0].Rows.Count == 0)
  98. {
  99. this.dgvG1.AutoResizeColumns();
  100. return;
  101. }
  102. else
  103. {
  104. this.dgvG1.DataSource = resultEntity.Data.Tables[0];
  105. this.dgvG1.ReadOnly = true;
  106. this.dgvG1.Rows[0].Selected = true;
  107. this.dgvG1.AutoResizeColumns();
  108. }
  109. }
  110. else if (this.tabControl1.SelectedIndex == 1)
  111. {
  112. this.dgvG2.DataSource = null;
  113. this._cre2 = new ClientRequestEntity();
  114. this._cre2.NameSpace = "R03";
  115. this._cre2.Name = "R030116User";
  116. this._cre2.Properties["LineCode"] = this.txtLinCode.Text.Trim();
  117. this._cre2.Properties["UserCode"] = this.txtUserCode.Text.Trim();
  118. this._cre2.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  119. this._cre2.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  120. if (this.chkGDate.Checked)
  121. {
  122. this._cre2.Properties["DateBegin"] = this.txtTimeStart.Value;
  123. this._cre2.Properties["DateEnd"] = this.txtTimeEnd.Value;
  124. }
  125. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  126. {
  127. return ReportModuleProxy.Service.DoRequest(_cre2);
  128. });
  129. if (resultEntity == null || resultEntity.Data == null ||
  130. resultEntity.Data.Tables.Count == 0 ||
  131. resultEntity.Data.Tables[0].Rows.Count == 0)
  132. {
  133. this.dgvG2.AutoResizeColumns();
  134. return;
  135. }
  136. else
  137. {
  138. this.dgvG2.DataSource = resultEntity.Data.Tables[0];
  139. this.dgvG2.ReadOnly = true;
  140. this.dgvG2.Rows[0].Selected = true;
  141. this.dgvG2.AutoResizeColumns();
  142. }
  143. }
  144. //阴干前存坯统计表
  145. else if (this.tabControl1.SelectedIndex == 3)
  146. {
  147. this.dgvG4.DataSource = null;
  148. ClientRequestEntity cre = new ClientRequestEntity();
  149. cre.NameSpace = "R03";
  150. cre.Name = "R030116YG";
  151. cre.Properties["LineCode"] = this.txtLinCode.Text.Trim();
  152. cre.Properties["UserCode"] = this.txtUserCode.Text.Trim();
  153. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  154. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  155. if (this.chkGDate.Checked)
  156. {
  157. cre.Properties["DateBegin"] = this.txtTimeStart.Value;
  158. cre.Properties["DateEnd"] = this.txtTimeEnd.Value;
  159. }
  160. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  161. {
  162. return ReportModuleProxy.Service.DoRequest(cre);
  163. });
  164. if (resultEntity == null || resultEntity.Data == null ||
  165. resultEntity.Data.Tables.Count == 0 ||
  166. resultEntity.Data.Tables[0].Rows.Count == 0)
  167. {
  168. this.dgvG4.AutoResizeColumns();
  169. return;
  170. }
  171. else
  172. {
  173. this.dgvG4.DataSource = resultEntity.Data.Tables[0];
  174. this.dgvG4.ReadOnly = true;
  175. this.dgvG4.Rows[0].Selected = true;
  176. this.dgvG4.AutoResizeColumns();
  177. }
  178. }
  179. // 明细表
  180. else
  181. {
  182. this.dgvG3.DataSource = null;
  183. ClientRequestEntity cre = new ClientRequestEntity();
  184. cre.NameSpace = "R03";
  185. cre.Name = "R030116D";
  186. cre.Properties["LineCode"] = this.txtLinCode.Text.Trim();
  187. cre.Properties["UserCode"] = this.txtUserCode.Text.Trim();
  188. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  189. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  190. if (this.chkGDate.Checked)
  191. {
  192. cre.Properties["DateBegin"] = this.txtTimeStart.Value;
  193. cre.Properties["DateEnd"] = this.txtTimeEnd.Value;
  194. }
  195. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  196. {
  197. return ReportModuleProxy.Service.DoRequest(cre);
  198. });
  199. if (resultEntity == null || resultEntity.Data == null ||
  200. resultEntity.Data.Tables.Count == 0 ||
  201. resultEntity.Data.Tables[0].Rows.Count == 0)
  202. {
  203. this.dgvG3.AutoResizeColumns();
  204. return;
  205. }
  206. else
  207. {
  208. this.dgvG3.DataSource = resultEntity.Data.Tables[0];
  209. this.dgvG3.ReadOnly = true;
  210. this.dgvG3.Rows[0].Selected = true;
  211. this.dgvG3.AutoResizeColumns();
  212. }
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. // 对异常进行共通处理
  218. ExceptionManager.HandleEventException(this.ToString(),
  219. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  220. }
  221. }
  222. /// <summary>
  223. /// 清空条件
  224. /// </summary>
  225. /// <param name="sender"></param>
  226. /// <param name="e"></param>
  227. private void btnClearCondition_Click(object sender, EventArgs e)
  228. {
  229. this.txtLinCode.Clear();
  230. this.txtUserCode.Clear();
  231. this.scbGoodsType.ClearValue();
  232. this.txtGoodsCode.Text = string.Empty;
  233. this.chkGDate.Checked = false;
  234. }
  235. /// <summary>
  236. /// 关闭一览窗体
  237. /// </summary>
  238. /// <param name="sender"></param>
  239. /// <param name="e"></param>
  240. private void tsbtnClose_Click(object sender, EventArgs e)
  241. {
  242. this.Close();
  243. }
  244. /// <summary>
  245. /// 窗体关闭事件
  246. /// </summary>
  247. /// <param name="sender"></param>
  248. /// <param name="e"></param>
  249. private void F_RPT_030110_FormClosed(object sender, FormClosedEventArgs e)
  250. {
  251. _instance = null;
  252. }
  253. /// <summary>
  254. /// 自动列宽
  255. /// </summary>
  256. /// <param name="sender"></param>
  257. /// <param name="e"></param>
  258. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  259. {
  260. this.dgvG1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  261. this.dgvG2.AutoResizeColumns();
  262. this.dgvG3.AutoResizeColumns();
  263. }
  264. /// <summary>
  265. /// 窗体加载
  266. /// </summary>
  267. /// <param name="sender"></param>
  268. /// <param name="e"></param>
  269. private void F_RPT_030110_Load(object sender, EventArgs e)
  270. {
  271. try
  272. {
  273. // 加载权限
  274. FormPermissionManager.FormPermissionControl(this.Name, this,
  275. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  276. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  277. this.dgvG1.AutoGenerateColumns = false;
  278. // 设置日期控件默认值
  279. DateTime date = DateTime.Now;
  280. this.txtTimeStart.Value = new DateTime(date.Year, date.Month, 1);
  281. this.txtTimeEnd.Value = this.txtTimeStart.Value.AddMonths(1).AddSeconds(-1);
  282. }
  283. catch (Exception ex)
  284. {
  285. // 对异常进行共通处理
  286. ExceptionManager.HandleEventException(this.ToString(),
  287. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  288. }
  289. }
  290. private void chkGDate_CheckedChanged(object sender, EventArgs e)
  291. {
  292. this.txtTimeStart.Enabled = this.chkGDate.Checked;
  293. this.txtTimeEnd.Enabled = this.chkGDate.Checked;
  294. if (!this.chkGDate.Checked)
  295. {
  296. DateTime date = DateTime.Now;
  297. this.txtTimeStart.Value = new DateTime(date.Year, date.Month, 1);
  298. this.txtTimeEnd.Value = this.txtTimeStart.Value.AddMonths(1).AddSeconds(-1);
  299. }
  300. }
  301. private void dgvG1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  302. {
  303. if (e.ColumnIndex < 0 || e.RowIndex < 0 || this.dgvG1.CurrentRow == null)
  304. {
  305. return;
  306. }
  307. try
  308. {
  309. this.dgvG3.DataSource = null;
  310. this._cre1.NameSpace = "R03";
  311. this._cre1.Name = "R030116D";
  312. this._cre1.Properties["GoodsID"] = this.dgvG1.CurrentRow.Cells["g1GOODSID"].Value;
  313. this.tabControl1.SelectedIndex = 2;
  314. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  315. {
  316. return ReportModuleProxy.Service.DoRequest(this._cre1);
  317. });
  318. if (resultEntity == null || resultEntity.Data == null ||
  319. resultEntity.Data.Tables.Count == 0 ||
  320. resultEntity.Data.Tables[0].Rows.Count == 0)
  321. {
  322. this.dgvG3.AutoResizeColumns();
  323. return;
  324. }
  325. else
  326. {
  327. this.dgvG3.DataSource = resultEntity.Data.Tables[0];
  328. this.dgvG3.ReadOnly = true;
  329. this.dgvG3.Rows[0].Selected = true;
  330. this.dgvG3.AutoResizeColumns();
  331. }
  332. }
  333. catch (Exception ex)
  334. {
  335. // 对异常进行共通处理
  336. ExceptionManager.HandleEventException(this.ToString(),
  337. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  338. }
  339. }
  340. private void dgvG2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  341. {
  342. if (e.ColumnIndex < 0 || e.RowIndex < 0 || this.dgvG2.CurrentRow == null)
  343. {
  344. return;
  345. }
  346. try
  347. {
  348. this.dgvG3.DataSource = null;
  349. this._cre2.NameSpace = "R03";
  350. this._cre2.Name = "R030116D";
  351. this._cre2.Properties["LineID"] = this.dgvG2.CurrentRow.Cells["g2groutinglineid"].Value;
  352. this._cre2.Properties["UserID"] = this.dgvG2.CurrentRow.Cells["g2userid"].Value;
  353. this._cre2.Properties["GoodsID"] = this.dgvG2.CurrentRow.Cells["g2GOODSID"].Value;
  354. this.tabControl1.SelectedIndex = 2;
  355. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  356. {
  357. return ReportModuleProxy.Service.DoRequest(this._cre2);
  358. });
  359. if (resultEntity == null || resultEntity.Data == null ||
  360. resultEntity.Data.Tables.Count == 0 ||
  361. resultEntity.Data.Tables[0].Rows.Count == 0)
  362. {
  363. this.dgvG3.AutoResizeColumns();
  364. return;
  365. }
  366. else
  367. {
  368. this.dgvG3.DataSource = resultEntity.Data.Tables[0];
  369. this.dgvG3.ReadOnly = true;
  370. this.dgvG3.Rows[0].Selected = true;
  371. this.dgvG3.AutoResizeColumns();
  372. }
  373. }
  374. catch (Exception ex)
  375. {
  376. // 对异常进行共通处理
  377. ExceptionManager.HandleEventException(this.ToString(),
  378. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  379. }
  380. }
  381. #endregion
  382. #region 私有方法
  383. /// <summary>
  384. /// 根据界面查询条件获取数据集
  385. /// </summary>
  386. private DataTable GetData(ClientRequestEntity cre)
  387. {
  388. try
  389. {
  390. ServiceResultEntity resultEntity = ReportModuleProxy.Service.DoRequest(cre);
  391. if (resultEntity == null || resultEntity.Data == null || resultEntity.Data.Tables.Count == 0)
  392. {
  393. return null;
  394. }
  395. return resultEntity.Data.Tables[0];
  396. }
  397. catch (Exception ex)
  398. {
  399. throw ex;
  400. }
  401. }
  402. #endregion
  403. }
  404. }