F_RPT_010101_1.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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.txtBarcode.Clear();
  157. this.chkGroutingFlag.AllItemCheck();
  158. this.chkScrapFlag.AllItemCheck();
  159. this.chkBarcodeFlag.AllItemCheck();
  160. this.chkTestMouldFlag.AllItemCheck();
  161. this.chkDeliverTime.Checked = false;
  162. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  163. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  164. this.chkScrapTime.Checked = false;
  165. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  166. this.dtpScrapTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  167. this.chkDeliverFlag.ClearItemCheck();
  168. this.chkGCTime.Checked = false;
  169. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  170. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  171. }
  172. private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
  173. {
  174. this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
  175. this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
  176. if (!this.chkDeliverTime.Checked)
  177. {
  178. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  179. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
  180. }
  181. }
  182. private void chkGroutingDateStart_CheckedChanged(object sender, EventArgs e)
  183. {
  184. this.dtpGroutingDateStart.Enabled = this.chkGroutingDateStart.Checked;
  185. this.dtpGroutingDateEnd.Enabled = this.chkGroutingDateStart.Checked;
  186. if (!this.chkGroutingDateStart.Checked)
  187. {
  188. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  189. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  190. }
  191. }
  192. private void chkScrapTime_CheckedChanged(object sender, EventArgs e)
  193. {
  194. this.dtpScrapTimeBegin.Enabled = this.chkScrapTime.Checked;
  195. this.dtpScrapTimeEnd.Enabled = this.chkScrapTime.Checked;
  196. if (!this.chkScrapTime.Checked)
  197. {
  198. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  199. this.dtpScrapTimeEnd.Value = DateTime.Now.Date;
  200. }
  201. }
  202. #endregion
  203. #region 私有方法
  204. /// <summary>
  205. /// 根据界面查询条件获取数据集
  206. /// </summary>
  207. private DataTable GetSearchData()
  208. {
  209. try
  210. {
  211. RPT010101_SE se = new RPT010101_SE();
  212. se.GoodsIDS = this.scbGoods.CheckedPKMember;
  213. se.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  214. se.GroutingMouldCode = this.txtGroutingMouldCode.Text.Trim();
  215. //se.GroutingLineIDS = this.dkGroutingLineSearchBox.GroutingLineIDS;
  216. se.GroutingLineIDS = this.scbGroutingLine.SearchedPKMember == 0 ? null : this.scbGroutingLine.SearchedPKMember.ToString();
  217. se.GMouldTypeIDS = this.scbGMouldType.CheckedPKMember;
  218. if (this.chkGroutingDateStart.Checked)
  219. {
  220. se.GroutingDateStart = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  221. se.GroutingDateEnd = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  222. }
  223. se.GroutingUserIDS = this.dkGroutingUserCode.UserIDS;
  224. se.NoGroutingRreason = this.dropNotGroutingRreason.Text.Trim();
  225. se.CreateUserIDS = this.dkOperUserCode.UserIDS;
  226. if (this.txtGroutingBatchNo.DataValue.HasValue)
  227. {
  228. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  229. }
  230. object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
  231. if (groutingFlags.Length == 1)
  232. {
  233. se.GroutingFlag = groutingFlags[0].ToString();
  234. }
  235. object[] scrapFlags = this.chkScrapFlag.SelectedValues;
  236. if (scrapFlags.Length == 1)
  237. {
  238. se.ScrapFlag = scrapFlags[0].ToString();
  239. }
  240. object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
  241. if (barcodeFlags.Length == 1)
  242. {
  243. se.BarCodeFlag = barcodeFlags[0].ToString();
  244. }
  245. object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
  246. if (deliverFlag.Length == 1)
  247. {
  248. se.DeliverFlag = deliverFlag[0].ToString();
  249. }
  250. if (this.chkDeliverTime.Checked)
  251. {
  252. se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value.Date;
  253. se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  254. }
  255. if (this.chkScrapTime.Checked)
  256. {
  257. se.ScrapTimeBegin = this.dtpScrapTimeBegin.Value.Date;
  258. se.ScrapTimeEnd = this.dtpScrapTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  259. }
  260. if (this.chkGCTime.Checked)
  261. {
  262. se.GCTimeBegin = this.dtpGCTimeBegin.Value;
  263. se.GCTimeEnd = this.dtpGCTimeEnd.Value;
  264. }
  265. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  266. if (testMouldFlags.Length == 1)
  267. {
  268. se.TestMouldFlag = testMouldFlags[0].ToString();
  269. }
  270. se.Remarks = this.txtRemarks.Text;
  271. se.Barcode = this.txtBarcode.Text;
  272. // 调用服务器端获取数据集
  273. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  274. {
  275. return ReportModuleProxy.Service.GetRPT010101SData(se);
  276. }
  277. );
  278. if (sre.Status == Constant.ServiceResultStatus.Success)
  279. {
  280. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  281. {
  282. // 提示未查找到数据
  283. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  284. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  285. //清空数据
  286. return null;
  287. }
  288. return sre.Data.Tables[0];
  289. }
  290. return null;
  291. }
  292. catch (Exception ex)
  293. {
  294. throw ex;
  295. }
  296. }
  297. private void BindNotGroutingRreason()
  298. {
  299. DataTable dtNotGroutingRreason = new DataTable();
  300. // 获取成型线类型数据并绑定到控件上
  301. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  302. {
  303. return PMModuleProxyNew.Service.GetFPM0102IData(0);
  304. }
  305. );
  306. if (sre.Status == Constant.ServiceResultStatus.Other)
  307. {
  308. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
  309. this.DialogResult = DialogResult.Cancel;
  310. this.Close();
  311. return;
  312. }
  313. if (sre.Status != Constant.ServiceResultStatus.Success)
  314. {
  315. return;
  316. }
  317. if (sre.Data != null && sre.Data.Tables.Count > 0)
  318. {
  319. dtNotGroutingRreason = sre.Data.Tables[0];
  320. // 设置空选项
  321. DataRow dataRow = dtNotGroutingRreason.NewRow();
  322. dataRow["DictionaryID"] = DBNull.Value;
  323. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  324. dataRow["DisplayNo"] = 0;
  325. dtNotGroutingRreason.Rows.InsertAt(dataRow, 0);
  326. }
  327. this.dropNotGroutingRreason.ValueMember = "DictionaryID";
  328. this.dropNotGroutingRreason.DisplayMember = "DictionaryValue";
  329. this.dropNotGroutingRreason.DataSource = dtNotGroutingRreason;
  330. }
  331. #endregion
  332. private void chkGCTime_CheckedChanged(object sender, EventArgs e)
  333. {
  334. this.dtpGCTimeBegin.Enabled = this.chkGCTime.Checked;
  335. this.dtpGCTimeEnd.Enabled = this.chkGCTime.Checked;
  336. if (!this.chkGCTime.Checked)
  337. {
  338. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  339. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  340. }
  341. }
  342. private void c_Label6_Click(object sender, EventArgs e)
  343. {
  344. }
  345. }
  346. }