F_RPT_010101_1.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_010101_1.cs
  5. * 2.功能描述:注浆明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/4/10 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  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. namespace Dongke.IBOSS.PRD.Client.ReportModule
  21. {
  22. /// <summary>
  23. /// 注浆明细表
  24. /// </summary>
  25. public partial class F_RPT_010101_1 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 窗体的单例模式
  29. private static F_RPT_010101_1 _instance;
  30. #endregion
  31. #region 构造函数
  32. public F_RPT_010101_1()
  33. {
  34. InitializeComponent();
  35. // 窗体显示的Title
  36. this.Text = FormTitles.F_RPT_010101;
  37. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  38. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  39. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  40. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  41. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  42. }
  43. #endregion
  44. #region 单例模式
  45. /// <summary>
  46. /// 单例模式,防止重复创建窗体
  47. /// </summary>
  48. public static F_RPT_010101_1 Instance
  49. {
  50. get
  51. {
  52. if (_instance == null || _instance.IsDisposed)
  53. {
  54. _instance = new F_RPT_010101_1();
  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_RPT_010101_1_Load(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. // 加载权限
  71. FormPermissionManager.FormPermissionControl(this.Name, this,
  72. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  74. // 设置表格不自动创建列
  75. this.dgvRptGroutingDaily.AutoGenerateColumns = false;
  76. //绑定未注浆原因
  77. BindNotGroutingRreason();
  78. // 初始化时间控件为当前日期
  79. this.btnClearCondition_Click(null, null);
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  86. }
  87. }
  88. /// <summary>
  89. /// 窗体关闭事件
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. private void F_RPT_010101_1_FormClosed(object sender, FormClosedEventArgs e)
  94. {
  95. _instance = null;
  96. }
  97. /// <summary>
  98. /// 关闭按钮
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void tsbtnClose_Click(object sender, EventArgs e)
  103. {
  104. this.Close();
  105. }
  106. /// <summary>
  107. /// 自动适应列宽
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  112. {
  113. this.dgvRptGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  114. }
  115. /// <summary>
  116. /// 查询按钮事件
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void btnSearch_Click(object sender, EventArgs e)
  121. {
  122. try
  123. {
  124. this.dgvRptGroutingDaily.DataSource = null;
  125. this.dgvRptGroutingDaily.DataSource = this.GetSearchData();
  126. }
  127. catch (Exception ex)
  128. {
  129. this.btnSearch.Enabled = true;
  130. // 对异常进行共通处理
  131. ExceptionManager.HandleEventException(this.ToString(),
  132. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  133. }
  134. }
  135. /// <summary>
  136. /// 清空条件按钮事件
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. private void btnClearCondition_Click(object sender, EventArgs e)
  141. {
  142. this.txtGroutingBatchNo.Clear();
  143. this.scbGoods.ClearValue();
  144. this.scbGoodsType.ClearValue();
  145. this.scbGroutingLine.ClearValue();
  146. scbGroutingLine.SearchedPKMember = 0;
  147. this.scbGMouldType.ClearValue();
  148. this.dkGroutingUserCode.ClearControl();
  149. this.dkOperUserCode.ClearControl();
  150. this.txtGroutingMouldCode.Text = string.Empty;
  151. this.chkGroutingDateStart.Checked = true;
  152. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  153. this.dtpGroutingDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  154. this.dropNotGroutingRreason.Text = string.Empty;
  155. this.txtRemarks.Clear();
  156. this.chkGroutingFlag.AllItemCheck();
  157. this.chkScrapFlag.AllItemCheck();
  158. this.chkBarcodeFlag.AllItemCheck();
  159. this.chkDeliverTime.Checked = false;
  160. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  161. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  162. this.chkScrapTime.Checked = false;
  163. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  164. this.dtpScrapTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  165. this.chkDeliverFlag.ClearItemCheck();
  166. this.chkGCTime.Checked = false;
  167. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  168. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  169. }
  170. private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
  171. {
  172. this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
  173. this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
  174. if (!this.chkDeliverTime.Checked)
  175. {
  176. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  177. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
  178. }
  179. }
  180. private void chkGroutingDateStart_CheckedChanged(object sender, EventArgs e)
  181. {
  182. this.dtpGroutingDateStart.Enabled = this.chkGroutingDateStart.Checked;
  183. this.dtpGroutingDateEnd.Enabled = this.chkGroutingDateStart.Checked;
  184. if (!this.chkGroutingDateStart.Checked)
  185. {
  186. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  187. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  188. }
  189. }
  190. private void chkScrapTime_CheckedChanged(object sender, EventArgs e)
  191. {
  192. this.dtpScrapTimeBegin.Enabled = this.chkScrapTime.Checked;
  193. this.dtpScrapTimeEnd.Enabled = this.chkScrapTime.Checked;
  194. if (!this.chkScrapTime.Checked)
  195. {
  196. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  197. this.dtpScrapTimeEnd.Value = DateTime.Now.Date;
  198. }
  199. }
  200. #endregion
  201. #region 私有方法
  202. /// <summary>
  203. /// 根据界面查询条件获取数据集
  204. /// </summary>
  205. private DataTable GetSearchData()
  206. {
  207. try
  208. {
  209. RPT010101_SE se = new RPT010101_SE();
  210. se.GoodsIDS = this.scbGoods.CheckedPKMember;
  211. se.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  212. se.GroutingMouldCode = this.txtGroutingMouldCode.Text.Trim();
  213. //se.GroutingLineIDS = this.dkGroutingLineSearchBox.GroutingLineIDS;
  214. se.GroutingLineIDS = this.scbGroutingLine.SearchedPKMember == 0 ? null : this.scbGroutingLine.SearchedPKMember.ToString();
  215. se.GMouldTypeIDS = this.scbGMouldType.CheckedPKMember;
  216. if (this.chkGroutingDateStart.Checked)
  217. {
  218. se.GroutingDateStart = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  219. se.GroutingDateEnd = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  220. }
  221. se.GroutingUserIDS = this.dkGroutingUserCode.UserIDS;
  222. se.NoGroutingRreason = this.dropNotGroutingRreason.Text.Trim();
  223. se.CreateUserIDS = this.dkOperUserCode.UserIDS;
  224. if (this.txtGroutingBatchNo.DataValue.HasValue)
  225. {
  226. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  227. }
  228. object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
  229. if (groutingFlags.Length == 1)
  230. {
  231. se.GroutingFlag = groutingFlags[0].ToString();
  232. }
  233. object[] scrapFlags = this.chkScrapFlag.SelectedValues;
  234. if (scrapFlags.Length == 1)
  235. {
  236. se.ScrapFlag = scrapFlags[0].ToString();
  237. }
  238. object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
  239. if (barcodeFlags.Length == 1)
  240. {
  241. se.BarCodeFlag = barcodeFlags[0].ToString();
  242. }
  243. object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
  244. if (deliverFlag.Length == 1)
  245. {
  246. se.DeliverFlag = deliverFlag[0].ToString();
  247. }
  248. if (this.chkDeliverTime.Checked)
  249. {
  250. se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value.Date;
  251. se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  252. }
  253. if (this.chkScrapTime.Checked)
  254. {
  255. se.ScrapTimeBegin = this.dtpScrapTimeBegin.Value.Date;
  256. se.ScrapTimeEnd = this.dtpScrapTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  257. }
  258. if (this.chkGCTime.Checked)
  259. {
  260. se.GCTimeBegin = this.dtpGCTimeBegin.Value;
  261. se.GCTimeEnd = this.dtpGCTimeEnd.Value;
  262. }
  263. se.Remarks = this.txtRemarks.Text;
  264. // 调用服务器端获取数据集
  265. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  266. {
  267. return ReportModuleProxy.Service.GetRPT010101SData(se);
  268. }
  269. );
  270. if (sre.Status == Constant.ServiceResultStatus.Success)
  271. {
  272. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  273. {
  274. // 提示未查找到数据
  275. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  276. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  277. //清空数据
  278. return null;
  279. }
  280. return sre.Data.Tables[0];
  281. }
  282. return null;
  283. }
  284. catch (Exception ex)
  285. {
  286. throw ex;
  287. }
  288. }
  289. private void BindNotGroutingRreason()
  290. {
  291. DataTable dtNotGroutingRreason = new DataTable();
  292. // 获取成型线类型数据并绑定到控件上
  293. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  294. {
  295. return PMModuleProxyNew.Service.GetFPM0102IData(0);
  296. }
  297. );
  298. if (sre.Status == Constant.ServiceResultStatus.Other)
  299. {
  300. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
  301. this.DialogResult = DialogResult.Cancel;
  302. this.Close();
  303. return;
  304. }
  305. if (sre.Status != Constant.ServiceResultStatus.Success)
  306. {
  307. return;
  308. }
  309. if (sre.Data != null && sre.Data.Tables.Count > 0)
  310. {
  311. dtNotGroutingRreason = sre.Data.Tables[0];
  312. // 设置空选项
  313. DataRow dataRow = dtNotGroutingRreason.NewRow();
  314. dataRow["DictionaryID"] = DBNull.Value;
  315. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  316. dataRow["DisplayNo"] = 0;
  317. dtNotGroutingRreason.Rows.InsertAt(dataRow, 0);
  318. }
  319. this.dropNotGroutingRreason.ValueMember = "DictionaryID";
  320. this.dropNotGroutingRreason.DisplayMember = "DictionaryValue";
  321. this.dropNotGroutingRreason.DataSource = dtNotGroutingRreason;
  322. }
  323. #endregion
  324. private void chkGCTime_CheckedChanged(object sender, EventArgs e)
  325. {
  326. this.dtpGCTimeBegin.Enabled = this.chkGCTime.Checked;
  327. this.dtpGCTimeEnd.Enabled = this.chkGCTime.Checked;
  328. if (!this.chkGCTime.Checked)
  329. {
  330. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  331. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  332. }
  333. }
  334. }
  335. }