F_PM_0101.cs 16 KB

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