F_PP_0202.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*******************************************************************************
  2. * Copyright(c) 2019 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PP_0202.cs
  5. * 2.功能描述:月计划新建
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 徐伟 2019/08/27 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.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.PPModule
  22. {
  23. /// <summary>
  24. /// 月计划窗体
  25. /// </summary>
  26. public partial class F_PP_0202 : DKDockPanelBase
  27. {
  28. #region 单例模式 防止窗体被重复创建
  29. private static F_PP_0202 _instance = null;
  30. public static F_PP_0202 Instance
  31. {
  32. get
  33. {
  34. if (_instance == null)
  35. {
  36. _instance = new F_PP_0202();
  37. }
  38. return _instance;
  39. }
  40. }
  41. private void F_PP_0202_FormClosed(object sender, FormClosedEventArgs e)
  42. {
  43. _instance = null;
  44. }
  45. #endregion
  46. #region 构造函数
  47. /// <summary>
  48. /// 月计划窗体
  49. /// </summary>
  50. public F_PP_0202()
  51. {
  52. InitializeComponent();
  53. //this.Text = "月计划";
  54. }
  55. #endregion
  56. //月计划id,0:插入操作,>0更新操作
  57. public int planId = 0;
  58. /// <summary>
  59. /// 画面加载
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. private void F_PP_0202_Load(object sender, System.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. catch (Exception ex)
  73. {
  74. // 对异常进行共通处理
  75. ExceptionManager.HandleEventException(this.ToString(),
  76. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  77. }
  78. }
  79. private void BtnCancel_Click(object sender, EventArgs e)
  80. {
  81. this.Close();
  82. }
  83. private void BtnSave_Click(object sender, EventArgs e)
  84. {
  85. PlanMonthUpdate();
  86. this.Close();
  87. }
  88. //更新操作
  89. private void PlanMonthUpdate()
  90. {
  91. //月计划 插入
  92. ClientRequestEntity cre = new ClientRequestEntity();
  93. //用户填写的数据
  94. cre.Properties["YEARNO"] = Convert.ToInt32(planYearNo.Text);
  95. cre.Properties["MONTHNO"] = planMonthNo.Text.Trim().PadLeft(2, '0');
  96. cre.Properties["PLANNAME"] = planName.Text;
  97. cre.Properties["PLANTYPEID"] = Convert.ToInt32(planType.SelectedValue);
  98. cre.Properties["REMARKS"] = planRemarks.Text;
  99. //自动填写的数据
  100. cre.Properties["STARTDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planMonthNo.Value.ToString()}-01");
  101. cre.Properties["ENDDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planMonthNo.Value.ToString()}-1").AddMonths(1).AddDays(-1);
  102. cre.Properties["UPDATETIME"] = DateTime.Now;
  103. cre.Properties["UPDATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  104. ServiceResultEntity result;
  105. if (planId == 0)
  106. {
  107. //新建专属的列
  108. cre.Properties["PLANVER"] = PPModuleProxy.Service.PlanMonthVer(Convert.ToInt32(planType.SelectedValue));
  109. cre.Properties["ACCOUNTID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.AccountID;
  110. cre.Properties["CREATETIME"] = DateTime.Now;
  111. cre.Properties["CREATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  112. result = PPModuleProxy.Service.PlanMonthInsert(cre);
  113. }
  114. else
  115. {
  116. //更新时主键要指定值
  117. cre.Properties["PLANID"] = planId;
  118. result = PPModuleProxy.Service.PlanMonthUpdate(cre);
  119. }
  120. }
  121. }
  122. }