F_PP_0202.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.Reflection;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Client.CommonModule;
  14. using Dongke.IBOSS.PRD.Client.Controls;
  15. using Dongke.IBOSS.PRD.Client.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PPModule
  19. {
  20. /// <summary>
  21. /// 月计划窗体
  22. /// </summary>
  23. public partial class F_PP_0202 : DKDockPanelBase
  24. {
  25. #region 单例模式 防止窗体被重复创建
  26. private static F_PP_0202 _instance = null;
  27. public static F_PP_0202 Instance
  28. {
  29. get
  30. {
  31. if (_instance == null)
  32. {
  33. _instance = new F_PP_0202();
  34. }
  35. return _instance;
  36. }
  37. }
  38. private void F_PP_0202_FormClosed(object sender, FormClosedEventArgs e)
  39. {
  40. _instance = null;
  41. }
  42. #endregion
  43. #region 构造函数
  44. /// <summary>
  45. /// 月计划窗体
  46. /// </summary>
  47. public F_PP_0202()
  48. {
  49. InitializeComponent();
  50. //this.Text = "月计划";
  51. }
  52. #endregion
  53. //月计划id,0:插入操作,>0更新操作
  54. public int planId = 0;
  55. /// <summary>
  56. /// 画面加载
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void F_PP_0202_Load(object sender, System.EventArgs e)
  61. {
  62. try
  63. {
  64. // 加载权限
  65. FormPermissionManager.FormPermissionControl(this.Name, this,
  66. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  67. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  68. }
  69. catch (Exception ex)
  70. {
  71. // 对异常进行共通处理
  72. ExceptionManager.HandleEventException(this.ToString(),
  73. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  74. }
  75. }
  76. private void BtnCancel_Click(object sender, EventArgs e)
  77. {
  78. this.Close();
  79. }
  80. private void BtnSave_Click(object sender, EventArgs e)
  81. {
  82. PlanMonthUpdate();
  83. this.Close();
  84. }
  85. //更新操作
  86. private void PlanMonthUpdate()
  87. {
  88. //月计划 插入
  89. ClientRequestEntity cre = new ClientRequestEntity();
  90. //用户填写的数据
  91. cre.Properties["YEARNO"] = Convert.ToInt32(planYearNo.Text);
  92. cre.Properties["MONTHNO"] = planMonthNo.Text.Trim().PadLeft(2, '0');
  93. cre.Properties["PLANNAME"] = planName.Text;
  94. cre.Properties["PLANTYPEID"] = Convert.ToInt32(planType.SelectedValue);
  95. cre.Properties["REMARKS"] = planRemarks.Text;
  96. //自动填写的数据
  97. cre.Properties["STARTDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planMonthNo.Value.ToString()}-01");
  98. cre.Properties["ENDDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planMonthNo.Value.ToString()}-1").AddMonths(1).AddDays(-1);
  99. cre.Properties["UPDATETIME"] = DateTime.Now;
  100. cre.Properties["UPDATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  101. ServiceResultEntity result;
  102. if (planId == 0)
  103. {
  104. //新建专属的列
  105. cre.Properties["PLANVER"] = PPModuleProxy.Service.PlanMonthVer(Convert.ToInt32(planType.SelectedValue));
  106. cre.Properties["ACCOUNTID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.AccountID;
  107. cre.Properties["CREATETIME"] = DateTime.Now;
  108. cre.Properties["CREATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  109. result = PPModuleProxy.Service.PlanMonthInsert(cre);
  110. }
  111. else
  112. {
  113. //更新时主键要指定值
  114. cre.Properties["PLANID"] = planId;
  115. result = PPModuleProxy.Service.PlanMonthUpdate(cre);
  116. }
  117. }
  118. }
  119. }