F_PM_0101.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0101.cs
  5. * 2.功能描述:注浆登记一览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2015/03/25 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Reflection;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.PMModule
  23. {
  24. /// <summary>
  25. /// 注浆登记一览
  26. /// </summary>
  27. public partial class F_PM_0101 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. // 单例模式
  31. private static F_PM_0101 _instance;
  32. #endregion
  33. #region 构造函数
  34. /// <summary>
  35. /// 注浆日报一览窗体构造
  36. /// </summary>
  37. private F_PM_0101()
  38. {
  39. this.InitializeComponent();
  40. this.InitializeControls();
  41. }
  42. #endregion
  43. #region 单例模式
  44. /// <summary>
  45. /// 单例模式,防止重复创建窗体
  46. /// </summary>
  47. public static F_PM_0101 Instance
  48. {
  49. get
  50. {
  51. if (_instance == null)
  52. {
  53. _instance = new F_PM_0101();
  54. }
  55. return _instance;
  56. }
  57. }
  58. #endregion
  59. #region 事件
  60. /// <summary>
  61. /// 窗体加载
  62. /// </summary>
  63. private void F_PM_0101_Load(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. // 按钮权限控制
  68. FormPermissionManager.FormPermissionControl(this.Name, this,
  69. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  70. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  71. // 获取成型线类型数据并绑定到控件上
  72. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  73. {
  74. return PMModuleProxyNew.Service.GetFPM0101IData();
  75. }
  76. );
  77. if (sre.Data != null && sre.Data.Tables.Count > 0)
  78. {
  79. this.cboGroutingLineType.DataSource = sre.Data.Tables[0];
  80. }
  81. this.cboGroutingLineType.SelectedValue = null;
  82. this.chkTestMouldFlag.AllItemCheck();
  83. }
  84. catch (Exception ex)
  85. {
  86. // 对异常进行共通处理
  87. ExceptionManager.HandleEventException(this.ToString(),
  88. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  89. }
  90. }
  91. /// <summary>
  92. /// 清空条件
  93. /// </summary>
  94. private void btnClearCondition_Click(object sender, EventArgs e)
  95. {
  96. this.txtRemarks.Clear();
  97. this.txtGoodsCode.Clear();
  98. this.txtGoodsName.Clear();
  99. this.txtGroutingLineCode.Clear();
  100. this.txtGroutingLineName.Clear();
  101. this.txtGroutingMouldCode.Clear();
  102. this.txtGroutingUser.Clear();
  103. this.chkGroutingFlag.AllItemCheck();
  104. this.chkScrapFlag.AllItemCheck();
  105. this.chkBarcodeFlag.AllItemCheck();
  106. this.txtGroutingDateBegin.Value = DateTime.Now.Date;
  107. this.txtGroutingDateEnd.Value = DateTime.Now.Date;
  108. this.cboGroutingLineType.SelectedValue = null;
  109. this.txtGroutingBatchNo.Clear();
  110. this.chkDeliverTime.Checked = false;
  111. this.chkDeliverFlag.ClearItemCheck();
  112. this.chkTestMouldFlag.AllItemCheck();
  113. }
  114. /// <summary>
  115. /// 查询数据
  116. /// </summary>
  117. private void btnSearch_Click(object sender, System.EventArgs e)
  118. {
  119. try
  120. {
  121. this.dgvGroutingDaily.DataSource = null;
  122. this.dgvGroutingDaily.DataSource = this.GetSearchData();
  123. }
  124. catch (Exception ex)
  125. {
  126. // 对异常进行共通处理
  127. ExceptionManager.HandleEventException(this.ToString(),
  128. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  129. }
  130. }
  131. /// <summary>
  132. /// 添加新注浆日报
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void tsbtnAdd_Click(object sender, EventArgs e)
  137. {
  138. try
  139. {
  140. F_PM_0102 frmFPM0102 = new F_PM_0102();
  141. DialogResult dialogresult = frmFPM0102.ShowDialog();
  142. if (dialogresult == DialogResult.OK)
  143. {
  144. string groutingDailyIDs = frmFPM0102.GroutingDailyIDs;
  145. this.dgvGroutingDaily.DataSource = null;
  146. // 调用服务器端获取数据集
  147. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  148. {
  149. return PMModuleProxyNew.Service.GetFPM0101SData(groutingDailyIDs);
  150. }
  151. );
  152. if (sre.Status == Constant.ServiceResultStatus.Success)
  153. {
  154. this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
  155. }
  156. //this.btnSearch_Click(sender, e);
  157. }
  158. }
  159. catch (Exception ex)
  160. {
  161. // 对异常进行共通处理
  162. ExceptionManager.HandleEventException(this.ToString(),
  163. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  164. }
  165. }
  166. /// <summary>
  167. /// 编辑注浆日报
  168. /// </summary>
  169. private void tsbtnEdit_Click(object sender, EventArgs e)
  170. {
  171. try
  172. {
  173. DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
  174. if (currentRow != null)
  175. {
  176. int dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
  177. F_PM_0102 frmFPM0102 = new F_PM_0102(dailyId);
  178. DialogResult dialogresult = frmFPM0102.ShowDialog();
  179. if (dialogresult == DialogResult.OK)
  180. {
  181. //this.btnSearch_Click(sender, e);
  182. string groutingDailyIDs = dailyId.ToString();// frmFPM0102.GroutingDailyIDs;
  183. this.dgvGroutingDaily.DataSource = null;
  184. // 调用服务器端获取数据集
  185. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  186. {
  187. return PMModuleProxyNew.Service.GetFPM0101SData(groutingDailyIDs);
  188. }
  189. );
  190. if (sre.Status == Constant.ServiceResultStatus.Success)
  191. {
  192. this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
  193. }
  194. }
  195. }
  196. else
  197. {
  198. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
  199. }
  200. }
  201. catch (Exception ex)
  202. {
  203. // 对异常进行共通处理
  204. ExceptionManager.HandleEventException(this.ToString(),
  205. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  206. }
  207. }
  208. /// <summary>
  209. /// 编辑注浆日报
  210. /// </summary>
  211. private void dgvGroutingDaily_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  212. {
  213. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  214. {
  215. return;
  216. }
  217. this.tsbtnEdit_Click(sender, null);
  218. }
  219. /// <summary>
  220. /// 绑定条码
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void tsbtnBindBarCode_Click(object sender, EventArgs e)
  225. {
  226. try
  227. {
  228. //F_PM_0103 frmPM0103 = new F_PM_0103();
  229. //DialogResult dialogResult = frmPM0103.ShowDialog();
  230. //if (dialogResult == DialogResult.OK)
  231. //{
  232. // this.btnSearch_Click(sender, e);
  233. //}
  234. int dailyId = 0;
  235. DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
  236. if (currentRow != null)
  237. {
  238. dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
  239. }
  240. F_PM_0103 frmPM0103 = new F_PM_0103(dailyId);
  241. DialogResult dialogResult = frmPM0103.ShowDialog();
  242. //if (dialogResult == DialogResult.OK)
  243. //{
  244. // this.btnSearch_Click(sender, e);
  245. //}
  246. if (frmPM0103.GroutingDailyIDs != null && frmPM0103.GroutingDailyIDs.Count > 0)
  247. {
  248. string ids = string.Join(",", frmPM0103.GroutingDailyIDs);
  249. this.dgvGroutingDaily.DataSource = null;
  250. // 调用服务器端获取数据集
  251. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  252. {
  253. return PMModuleProxyNew.Service.GetFPM0101SData(ids);
  254. }
  255. );
  256. if (sre.Status == Constant.ServiceResultStatus.Success)
  257. {
  258. this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
  259. }
  260. }
  261. }
  262. catch (Exception ex)
  263. {
  264. // 对异常进行共通处理
  265. ExceptionManager.HandleEventException(this.ToString(),
  266. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  267. }
  268. }
  269. /// <summary>
  270. /// 重启3#高压注浆线按钮点击事件
  271. /// </summary>
  272. /// <param name="sender"></param>
  273. /// <param name="e"></param>
  274. private void tsbtnReStartGroutingLine_Click(object sender, EventArgs e)
  275. {
  276. try
  277. {
  278. F_PM_0107 frm = new F_PM_0107();
  279. frm.ShowDialog();
  280. }
  281. catch (Exception ex)
  282. {
  283. // 对异常进行共通处理
  284. ExceptionManager.HandleEventException(this.ToString(),
  285. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  286. }
  287. }
  288. /// <summary>
  289. /// 关闭按钮事件
  290. /// </summary>
  291. /// <param name="sender"></param>
  292. /// <param name="e"></param>
  293. private void tsbtnClose_Click(object sender, EventArgs e)
  294. {
  295. this.Close();
  296. }
  297. /// <summary>
  298. /// 自动列宽事件
  299. /// </summary>
  300. /// <param name="sender"></param>
  301. /// <param name="e"></param>
  302. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  303. {
  304. this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  305. }
  306. /// <summary>
  307. /// 窗体关闭
  308. /// </summary>
  309. /// <param name="sender"></param>
  310. /// <param name="e"></param>
  311. private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e)
  312. {
  313. _instance = null;
  314. }
  315. #endregion
  316. #region 私有方法
  317. /// <summary>
  318. /// 初始化控件
  319. /// </summary>
  320. private void InitializeControls()
  321. {
  322. this.Text = FormTitles.F_PM_0101;
  323. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  324. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  325. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  326. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  327. this.tsbtnReStartGroutingLine.Text = ButtonText.TSBTN_RESTARTGROUTINGLINE;
  328. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  329. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  330. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  331. this.chkGroutingFlag.AllItemCheck();
  332. this.chkScrapFlag.AllItemCheck();
  333. this.chkBarcodeFlag.AllItemCheck();
  334. this.dgvGroutingDaily.AutoGenerateColumns = false;
  335. //this.dgvGroutingDaily.ReadOnly = true;
  336. }
  337. /// <summary>
  338. /// 根据界面查询条件获取数据集
  339. /// </summary>
  340. private DataTable GetSearchData()
  341. {
  342. try
  343. {
  344. FPM0101_SE se = new FPM0101_SE();
  345. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  346. se.GroutingLineName = this.txtGroutingLineName.Text;
  347. se.GroutingMouldCode = this.txtGroutingMouldCode.Text;
  348. se.GoodsCode = this.txtGoodsCode.Text;
  349. se.GoodsName = this.txtGoodsName.Text;
  350. se.Remarks = this.txtRemarks.Text;
  351. se.GroutingDateBegin = this.txtGroutingDateBegin.Value.Date;
  352. se.GroutingDateEnd = this.txtGroutingDateEnd.Value.Date;
  353. if (this.txtGroutingBatchNo.DataValue.HasValue)
  354. {
  355. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  356. }
  357. if (this.cboGroutingLineType.SelectedValue != null)
  358. {
  359. se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue);
  360. }
  361. object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
  362. if (groutingFlags.Length == 1)
  363. {
  364. se.GroutingFlag = groutingFlags[0].ToString();
  365. }
  366. object[] scrapFlags = this.chkScrapFlag.SelectedValues;
  367. if (scrapFlags.Length == 1)
  368. {
  369. se.ScrapFlag = scrapFlags[0].ToString();
  370. }
  371. object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
  372. if (barcodeFlags.Length == 1)
  373. {
  374. se.BarCodeFlag = barcodeFlags[0].ToString();
  375. }
  376. se.GroutingUserCode = this.txtGroutingUser.Text;
  377. object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
  378. if (deliverFlag.Length == 1)
  379. {
  380. se.DeliverFlag = deliverFlag[0].ToString();
  381. }
  382. if (this.chkDeliverTime.Checked)
  383. {
  384. se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value;
  385. se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value;
  386. }
  387. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  388. if (testMouldFlags.Length == 1)
  389. {
  390. se.TestMouldFlag = testMouldFlags[0].ToString();
  391. }
  392. // 调用服务器端获取数据集
  393. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  394. {
  395. return PMModuleProxyNew.Service.GetFPM0101SData(se);
  396. }
  397. );
  398. if (sre.Status == Constant.ServiceResultStatus.Success)
  399. {
  400. sre.Data.Tables[0].Columns.Add("SEL", typeof(bool));
  401. return sre.Data.Tables[0];
  402. }
  403. return null;
  404. }
  405. catch (Exception ex)
  406. {
  407. throw ex;
  408. }
  409. }
  410. #endregion
  411. private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
  412. {
  413. this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
  414. this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
  415. if (!this.chkDeliverTime.Checked)
  416. {
  417. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  418. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
  419. }
  420. }
  421. private void tsbtnUnLast_Click(object sender, EventArgs e)
  422. {
  423. try
  424. {
  425. F_PM_0106 f_PM_0106 = new F_PM_0106();
  426. f_PM_0106.ShowDialog();
  427. }
  428. catch (Exception ex)
  429. {
  430. // 对异常进行共通处理
  431. ExceptionManager.HandleEventException(this.ToString(),
  432. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  433. }
  434. }
  435. private void tsbtnPrint_Click(object sender, EventArgs e)
  436. {
  437. try
  438. {
  439. DataTable dataTable = this.dgvGroutingDaily.DataSource as DataTable;
  440. if (dataTable == null)
  441. {
  442. return;
  443. }
  444. dataTable.AcceptChanges();
  445. List<DataRow> printData = new List<DataRow>();
  446. foreach (DataRow item in dataTable.Rows)
  447. {
  448. if (item["SEL"] + "" == "True" && !string.IsNullOrEmpty(item["BARCODE"] + ""))
  449. //if (!string.IsNullOrEmpty(item["BARCODE"] + ""))
  450. {
  451. printData.Add(item);
  452. }
  453. }
  454. if (printData.Count == 0)
  455. {
  456. MessageBox.Show("未选择注浆信息或是选择的注浆信息没有绑定条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  457. return;
  458. }
  459. F_SET_014003 f = new F_SET_014003();
  460. f.PrintData = printData;
  461. f.ShowDialog();
  462. }
  463. catch (Exception ex)
  464. {
  465. // 对异常进行共通处理
  466. ExceptionManager.HandleEventException(this.ToString(),
  467. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  468. }
  469. }
  470. }
  471. }