F_PM_0101.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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.Data.SqlTypes;
  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. this.dgvGroutingDaily.DataSource = this.GetSearchData();
  147. //this.btnSearch_Click(sender, e);
  148. }
  149. }
  150. catch (Exception ex)
  151. {
  152. // 对异常进行共通处理
  153. ExceptionManager.HandleEventException(this.ToString(),
  154. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  155. }
  156. }
  157. /// <summary>
  158. /// 编辑注浆日报
  159. /// </summary>
  160. private void tsbtnEdit_Click(object sender, EventArgs e)
  161. {
  162. try
  163. {
  164. DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
  165. if (currentRow != null)
  166. {
  167. int dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
  168. F_PM_0102 frmFPM0102 = new F_PM_0102(dailyId);
  169. DialogResult dialogresult = frmFPM0102.ShowDialog();
  170. if (dialogresult == DialogResult.OK)
  171. {
  172. //this.btnSearch_Click(sender, e);
  173. string groutingDailyIDs = dailyId.ToString();// frmFPM0102.GroutingDailyIDs;
  174. this.dgvGroutingDaily.DataSource = null;
  175. this.dgvGroutingDaily.DataSource = this.GetSearchData();
  176. }
  177. }
  178. else
  179. {
  180. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001);
  181. }
  182. }
  183. catch (Exception ex)
  184. {
  185. // 对异常进行共通处理
  186. ExceptionManager.HandleEventException(this.ToString(),
  187. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  188. }
  189. }
  190. /// <summary>
  191. /// 编辑注浆日报
  192. /// </summary>
  193. private void dgvGroutingDaily_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  194. {
  195. if (e.RowIndex < 0 || e.ColumnIndex < 0)
  196. {
  197. return;
  198. }
  199. this.tsbtnEdit_Click(sender, null);
  200. }
  201. /// <summary>
  202. /// 绑定条码
  203. /// </summary>
  204. /// <param name="sender"></param>
  205. /// <param name="e"></param>
  206. private void tsbtnBindBarCode_Click(object sender, EventArgs e)
  207. {
  208. try
  209. {
  210. //F_PM_0103 frmPM0103 = new F_PM_0103();
  211. //DialogResult dialogResult = frmPM0103.ShowDialog();
  212. //if (dialogResult == DialogResult.OK)
  213. //{
  214. // this.btnSearch_Click(sender, e);
  215. //}
  216. int dailyId = 0;
  217. DataGridViewRow currentRow = this.dgvGroutingDaily.CurrentRow;
  218. if (currentRow != null)
  219. {
  220. dailyId = Convert.ToInt32(currentRow.Cells["GroutingDailyID"].Value);
  221. }
  222. F_PM_0103 frmPM0103 = new F_PM_0103(dailyId);
  223. DialogResult dialogResult = frmPM0103.ShowDialog();
  224. //if (dialogResult == DialogResult.OK)
  225. //{
  226. // this.btnSearch_Click(sender, e);
  227. //}
  228. if (frmPM0103.GroutingDailyIDs != null && frmPM0103.GroutingDailyIDs.Count > 0)
  229. {
  230. string ids = string.Join(",", frmPM0103.GroutingDailyIDs);
  231. this.dgvGroutingDaily.DataSource = null;
  232. // 调用服务器端获取数据集
  233. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  234. {
  235. return PMModuleProxyNew.Service.GetFPM0101SData(ids);
  236. }
  237. );
  238. if (sre.Status == Constant.ServiceResultStatus.Success)
  239. {
  240. this.dgvGroutingDaily.DataSource = sre.Data.Tables[0];
  241. }
  242. }
  243. }
  244. catch (Exception ex)
  245. {
  246. // 对异常进行共通处理
  247. ExceptionManager.HandleEventException(this.ToString(),
  248. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  249. }
  250. }
  251. /// <summary>
  252. /// 重启3#高压注浆线按钮点击事件
  253. /// </summary>
  254. /// <param name="sender"></param>
  255. /// <param name="e"></param>
  256. private void tsbtnReStartGroutingLine_Click(object sender, EventArgs e)
  257. {
  258. try
  259. {
  260. F_PM_0107 frm = new F_PM_0107();
  261. frm.ShowDialog();
  262. }
  263. catch (Exception ex)
  264. {
  265. // 对异常进行共通处理
  266. ExceptionManager.HandleEventException(this.ToString(),
  267. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  268. }
  269. }
  270. /// <summary>
  271. /// 关闭按钮事件
  272. /// </summary>
  273. /// <param name="sender"></param>
  274. /// <param name="e"></param>
  275. private void tsbtnClose_Click(object sender, EventArgs e)
  276. {
  277. this.Close();
  278. }
  279. /// <summary>
  280. /// 自动列宽事件
  281. /// </summary>
  282. /// <param name="sender"></param>
  283. /// <param name="e"></param>
  284. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  285. {
  286. this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  287. }
  288. /// <summary>
  289. /// 窗体关闭
  290. /// </summary>
  291. /// <param name="sender"></param>
  292. /// <param name="e"></param>
  293. private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e)
  294. {
  295. _instance = null;
  296. }
  297. #endregion
  298. #region 私有方法
  299. /// <summary>
  300. /// 初始化控件
  301. /// </summary>
  302. private void InitializeControls()
  303. {
  304. this.Text = FormTitles.F_PM_0101;
  305. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  306. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  307. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  308. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  309. this.tsbtnReStartGroutingLine.Text = ButtonText.TSBTN_RESTARTGROUTINGLINE;
  310. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  311. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  312. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  313. this.chkGroutingFlag.AllItemCheck();
  314. this.chkScrapFlag.AllItemCheck();
  315. this.chkBarcodeFlag.AllItemCheck();
  316. this.dgvGroutingDaily.AutoGenerateColumns = false;
  317. this.dgvGroutingDaily.ReadOnly = true;
  318. }
  319. /// <summary>
  320. /// 根据界面查询条件获取数据集
  321. /// </summary>
  322. private DataTable GetSearchData()
  323. {
  324. try
  325. {
  326. FPM0101_SE se = new FPM0101_SE();
  327. se.GroutingLineCode = this.txtGroutingLineCode.Text;
  328. se.GroutingLineName = this.txtGroutingLineName.Text;
  329. se.GroutingMouldCode = this.txtGroutingMouldCode.Text;
  330. se.GoodsCode = this.txtGoodsCode.Text;
  331. se.GoodsName = this.txtGoodsName.Text;
  332. se.Remarks = this.txtRemarks.Text;
  333. se.GroutingDateBegin = this.txtGroutingDateBegin.Value.Date;
  334. se.GroutingDateEnd = this.txtGroutingDateEnd.Value.Date;
  335. if (this.txtGroutingBatchNo.DataValue.HasValue)
  336. {
  337. se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue);
  338. }
  339. if (this.cboGroutingLineType.SelectedValue != null)
  340. {
  341. se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue);
  342. }
  343. object[] groutingFlags = this.chkGroutingFlag.SelectedValues;
  344. if (groutingFlags.Length == 1)
  345. {
  346. se.GroutingFlag = groutingFlags[0].ToString();
  347. }
  348. object[] scrapFlags = this.chkScrapFlag.SelectedValues;
  349. if (scrapFlags.Length == 1)
  350. {
  351. se.ScrapFlag = scrapFlags[0].ToString();
  352. }
  353. object[] barcodeFlags = this.chkBarcodeFlag.SelectedValues;
  354. if (barcodeFlags.Length == 1)
  355. {
  356. se.BarCodeFlag = barcodeFlags[0].ToString();
  357. }
  358. se.GroutingUserCode = this.txtGroutingUser.Text;
  359. object[] deliverFlag = this.chkDeliverFlag.SelectedValues;
  360. if (deliverFlag.Length == 1)
  361. {
  362. se.DeliverFlag = deliverFlag[0].ToString();
  363. }
  364. if (this.chkDeliverTime.Checked)
  365. {
  366. se.DeliverTimeBegin = this.dtpDeliverTimeBegin.Value;
  367. se.DeliverTimeEnd = this.dtpDeliverTimeEnd.Value;
  368. }
  369. else {
  370. se.DeliverTimeBegin = SqlDateTime.MinValue.Value;
  371. se.DeliverTimeEnd = SqlDateTime.MaxValue.Value.AddDays(-1);
  372. }
  373. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  374. if (testMouldFlags.Length == 1)
  375. {
  376. se.TestMouldFlag = testMouldFlags[0].ToString();
  377. }
  378. // 调用服务器端获取数据集
  379. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  380. {
  381. return PMModuleProxyNew.Service.GetFPM0101SData(se);
  382. }
  383. );
  384. if (sre.Status == Constant.ServiceResultStatus.Success)
  385. {
  386. return sre.Data.Tables[0];
  387. }
  388. return null;
  389. }
  390. catch (Exception ex)
  391. {
  392. throw ex;
  393. }
  394. }
  395. #endregion
  396. private void chkDeliverTime_CheckedChanged(object sender, EventArgs e)
  397. {
  398. this.dtpDeliverTimeBegin.Enabled = this.chkDeliverTime.Checked;
  399. this.dtpDeliverTimeEnd.Enabled = this.chkDeliverTime.Checked;
  400. if (!this.chkDeliverTime.Checked)
  401. {
  402. this.dtpDeliverTimeBegin.Value = DateTime.Now.Date;
  403. this.dtpDeliverTimeEnd.Value = DateTime.Now.Date;
  404. }
  405. }
  406. private void tsbtnUnLast_Click(object sender, EventArgs e)
  407. {
  408. try
  409. {
  410. F_PM_0106 f_PM_0106 = new F_PM_0106();
  411. f_PM_0106.ShowDialog();
  412. }
  413. catch (Exception ex)
  414. {
  415. // 对异常进行共通处理
  416. ExceptionManager.HandleEventException(this.ToString(),
  417. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  418. }
  419. }
  420. private void gbxCondition_Enter(object sender, EventArgs e)
  421. {
  422. }
  423. }
  424. }