F_PM_0101.cs 15 KB

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