F_PM_0101.cs 17 KB

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