F_RPT_010101_1.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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. #region 设置下拉列表框的数据源-车间
  81. DataTable dtWorkShop = new DataTable();
  82. dtWorkShop.Columns.Add("WorkShopId");
  83. dtWorkShop.Columns.Add("WorkShopValue");
  84. DataRow drNull = dtWorkShop.NewRow();
  85. drNull["WorkShopId"] = 0;
  86. drNull["WorkShopValue"] = "";
  87. dtWorkShop.Rows.Add(drNull);
  88. drNull = dtWorkShop.NewRow();
  89. drNull["WorkShopId"] = 1;
  90. drNull["WorkShopValue"] = "A";
  91. dtWorkShop.Rows.Add(drNull);
  92. drNull = dtWorkShop.NewRow();
  93. drNull["WorkShopId"] = 2;
  94. drNull["WorkShopValue"] = "B";
  95. dtWorkShop.Rows.Add(drNull);
  96. drNull = dtWorkShop.NewRow();
  97. drNull["WorkShopId"] = 3;
  98. drNull["WorkShopValue"] = "C";
  99. dtWorkShop.Rows.Add(drNull);
  100. drNull = dtWorkShop.NewRow();
  101. drNull["WorkShopId"] = 4;
  102. drNull["WorkShopValue"] = "高压";
  103. dtWorkShop.Rows.Add(drNull);
  104. drNull = dtWorkShop.NewRow();
  105. drNull["WorkShopId"] = 5;
  106. drNull["WorkShopValue"] = "干补";
  107. dtWorkShop.Rows.Add(drNull);
  108. drNull = dtWorkShop.NewRow();
  109. drNull["WorkShopId"] = 6;
  110. drNull["WorkShopValue"] = "补码";
  111. dtWorkShop.Rows.Add(drNull);
  112. this.cbWorkShop.DataSource = dtWorkShop;
  113. this.cbWorkShop.ValueMember = "WorkShopId";
  114. this.cbWorkShop.DisplayMember = "WorkShopValue";
  115. #endregion
  116. }
  117. catch (Exception ex)
  118. {
  119. // 对异常进行共通处理
  120. ExceptionManager.HandleEventException(this.ToString(),
  121. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  122. }
  123. }
  124. /// <summary>
  125. /// 窗体关闭事件
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void F_RPT_010101_1_FormClosed(object sender, FormClosedEventArgs e)
  130. {
  131. _instance = null;
  132. }
  133. /// <summary>
  134. /// 关闭按钮
  135. /// </summary>
  136. /// <param name="sender"></param>
  137. /// <param name="e"></param>
  138. private void tsbtnClose_Click(object sender, EventArgs e)
  139. {
  140. this.Close();
  141. }
  142. /// <summary>
  143. /// 自动适应列宽
  144. /// </summary>
  145. /// <param name="sender"></param>
  146. /// <param name="e"></param>
  147. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  148. {
  149. this.dgvRptGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  150. }
  151. /// <summary>
  152. /// 查询按钮事件
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void btnSearch_Click(object sender, EventArgs e)
  157. {
  158. try
  159. {
  160. this.dgvRptGroutingDaily.DataSource = null;
  161. this.dgvRptGroutingDaily.DataSource = this.GetSearchData();
  162. }
  163. catch (Exception ex)
  164. {
  165. this.btnSearch.Enabled = true;
  166. // 对异常进行共通处理
  167. ExceptionManager.HandleEventException(this.ToString(),
  168. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  169. }
  170. }
  171. /// <summary>
  172. /// 清空条件按钮事件
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void btnClearCondition_Click(object sender, EventArgs e)
  177. {
  178. this.txtGroutingBatchNo.Clear();
  179. this.GoodsCodes.Text = string.Empty;
  180. this.scbGoodsType.ClearValue();
  181. this.txtGroutingLineCode.Clear();
  182. this.scbGMouldType.ClearValue();
  183. this.groutinguser.Text = string.Empty;
  184. this.dkOperUserCode.ClearControl();
  185. this.txtGroutingMouldCode.Text = string.Empty;
  186. this.chkGroutingDateStart.Checked = true;
  187. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  188. this.dtpGroutingDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  189. this.dropNotGroutingRreason.Text = string.Empty;
  190. this.txtRemarks.Clear();
  191. this.chkGroutingFlag.AllItemCheck();
  192. this.chkScrapFlag.AllItemCheck();
  193. this.chkBarcodeFlag.AllItemCheck();
  194. this.chkTestMouldFlag.AllItemCheck();
  195. this.chkDeliverTime.Checked = false;
  196. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  197. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  198. this.chkScrapTime.Checked = false;
  199. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  200. this.dtpScrapTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  201. this.chkDeliverFlag.ClearItemCheck();
  202. this.chkGCTime.Checked = false;
  203. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  204. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  205. this.cbWorkShop.SelectedValue = null;
  206. }
  207. private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
  208. {
  209. this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
  210. this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
  211. if (!this.chkDeliverTime.Checked)
  212. {
  213. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  214. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
  215. }
  216. }
  217. private void chkGroutingDateStart_CheckedChanged(object sender, EventArgs e)
  218. {
  219. this.dtpGroutingDateStart.Enabled = this.chkGroutingDateStart.Checked;
  220. this.dtpGroutingDateEnd.Enabled = this.chkGroutingDateStart.Checked;
  221. if (!this.chkGroutingDateStart.Checked)
  222. {
  223. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  224. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  225. }
  226. }
  227. private void chkScrapTime_CheckedChanged(object sender, EventArgs e)
  228. {
  229. this.dtpScrapTimeBegin.Enabled = this.chkScrapTime.Checked;
  230. this.dtpScrapTimeEnd.Enabled = this.chkScrapTime.Checked;
  231. if (!this.chkScrapTime.Checked)
  232. {
  233. this.dtpScrapTimeBegin.Value = DateTime.Now.Date;
  234. this.dtpScrapTimeEnd.Value = DateTime.Now.Date;
  235. }
  236. }
  237. #endregion
  238. #region 私有方法
  239. /// <summary>
  240. /// 根据界面查询条件获取数据集
  241. /// </summary>
  242. private DataTable GetSearchData()
  243. {
  244. try
  245. {
  246. RPT010101_SE se = new RPT010101_SE();
  247. se.GoodsCode = this.GoodsCodes.Text.Trim();
  248. se.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  249. se.GroutingMouldCode = this.txtGroutingMouldCode.Text.Trim();
  250. //se.GroutingLineIDS = this.dkGroutingLineSearchBox.GroutingLineIDS;
  251. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  252. se.GMouldTypeIDS = this.scbGMouldType.CheckedPKMember;
  253. if (this.chkGroutingDateStart.Checked)
  254. {
  255. se.GroutingDateStart = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  256. se.GroutingDateEnd = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  257. }
  258. se.GroutingUserCode = this.groutinguser.Text.Trim();
  259. se.NoGroutingRreason = this.dropNotGroutingRreason.Text.Trim();
  260. se.CreateUserIDS = this.dkOperUserCode.UserIDS;
  261. if (this.txtGroutingBatchNo.DataValue.HasValue)
  262. {
  263. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  264. }
  265. // 工段250306
  266. object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
  267. if (groutingFlags.Length == 1)
  268. {
  269. se.GroutingFlag = groutingFlags[0].ToString();
  270. }
  271. object[] scrapFlags = this.chkScrapFlag.SelectedValues;
  272. if (scrapFlags.Length == 1)
  273. {
  274. se.ScrapFlag = scrapFlags[0].ToString();
  275. }
  276. object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
  277. if (barcodeFlags.Length == 1)
  278. {
  279. se.BarCodeFlag = barcodeFlags[0].ToString();
  280. }
  281. object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
  282. if (deliverFlag.Length == 1)
  283. {
  284. se.DeliverFlag = deliverFlag[0].ToString();
  285. }
  286. if (this.chkDeliverTime.Checked)
  287. {
  288. se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value.Date;
  289. se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  290. }
  291. if (this.chkScrapTime.Checked)
  292. {
  293. se.ScrapTimeBegin = this.dtpScrapTimeBegin.Value.Date;
  294. se.ScrapTimeEnd = this.dtpScrapTimeEnd.Value.Date.AddDays(1).AddSeconds(-1);
  295. }
  296. if (this.chkGCTime.Checked)
  297. {
  298. se.GCTimeBegin = this.dtpGCTimeBegin.Value;
  299. se.GCTimeEnd = this.dtpGCTimeEnd.Value;
  300. }
  301. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  302. if (testMouldFlags.Length == 1)
  303. {
  304. se.TestMouldFlag = testMouldFlags[0].ToString();
  305. }
  306. se.Remarks = this.txtRemarks.Text;
  307. // 工段250306
  308. se.GroutingLineNo = this.txtGroutingLineNo.Text;
  309. // 车间250306
  310. if (this.cbWorkShop.Text != string.Empty)
  311. {
  312. se.WorkShop = this.cbWorkShop.Text.ToString();
  313. }
  314. // 调用服务器端获取数据集
  315. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  316. {
  317. return ReportModuleProxy.Service.GetRPT010101SData(se);
  318. }
  319. );
  320. if (sre.Status == Constant.ServiceResultStatus.Success)
  321. {
  322. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  323. {
  324. // 提示未查找到数据
  325. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  326. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  327. //清空数据
  328. return null;
  329. }
  330. return sre.Data.Tables[0];
  331. }
  332. return null;
  333. }
  334. catch (Exception ex)
  335. {
  336. throw ex;
  337. }
  338. }
  339. private void BindNotGroutingRreason()
  340. {
  341. DataTable dtNotGroutingRreason = new DataTable();
  342. // 获取成型线类型数据并绑定到控件上
  343. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  344. {
  345. return PMModuleProxyNew.Service.GetFPM0102IData(0);
  346. }
  347. );
  348. if (sre.Status == Constant.ServiceResultStatus.Other)
  349. {
  350. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
  351. this.DialogResult = DialogResult.Cancel;
  352. this.Close();
  353. return;
  354. }
  355. if (sre.Status != Constant.ServiceResultStatus.Success)
  356. {
  357. return;
  358. }
  359. if (sre.Data != null && sre.Data.Tables.Count > 0)
  360. {
  361. dtNotGroutingRreason = sre.Data.Tables[0];
  362. // 设置空选项
  363. DataRow dataRow = dtNotGroutingRreason.NewRow();
  364. dataRow["DictionaryID"] = DBNull.Value;
  365. dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
  366. dataRow["DisplayNo"] = 0;
  367. dtNotGroutingRreason.Rows.InsertAt(dataRow, 0);
  368. }
  369. this.dropNotGroutingRreason.ValueMember = "DictionaryID";
  370. this.dropNotGroutingRreason.DisplayMember = "DictionaryValue";
  371. this.dropNotGroutingRreason.DataSource = dtNotGroutingRreason;
  372. }
  373. #endregion
  374. private void chkGCTime_CheckedChanged(object sender, EventArgs e)
  375. {
  376. this.dtpGCTimeBegin.Enabled = this.chkGCTime.Checked;
  377. this.dtpGCTimeEnd.Enabled = this.chkGCTime.Checked;
  378. if (!this.chkGCTime.Checked)
  379. {
  380. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  381. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  382. }
  383. }
  384. }
  385. }