F_PP_0103.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*******************************************************************************
  2. * Copyright(c) 2019 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PP_0103.cs
  5. * 2.功能描述:年计划产品产量新建
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 徐伟 2019/09/05 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_0103 : DKDockPanelBase
  24. {
  25. #region 单例模式 防止窗体被重复创建
  26. private static F_PP_0103 _instance = null;
  27. public static F_PP_0103 Instance
  28. {
  29. get
  30. {
  31. if (_instance == null)
  32. {
  33. _instance = new F_PP_0103();
  34. }
  35. return _instance;
  36. }
  37. }
  38. private void F_PP_0103_FormClosed(object sender, FormClosedEventArgs e)
  39. {
  40. _instance = null;
  41. }
  42. #endregion
  43. #region 构造函数
  44. /// <summary>
  45. /// 年计划窗体
  46. /// </summary>
  47. public F_PP_0103()
  48. {
  49. InitializeComponent();
  50. //this.Text = "年计划";
  51. }
  52. #endregion
  53. //年计划传入的Key和冗余数据
  54. public int planId = 0;
  55. public int planYearNo = DateTime.Now.Year;
  56. public DateTime planStartDate = DateTime.Now;
  57. public DateTime planEndDate = DateTime.Now;
  58. //产品产量id,0:插入操作,>0更新操作
  59. public int planGoodsId = 0;
  60. /// <summary>
  61. /// 画面加载
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void F_PP_0103_Load(object sender, System.EventArgs e)
  66. {
  67. try
  68. {
  69. // 加载权限
  70. FormPermissionManager.FormPermissionControl(this.Name, this,
  71. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  72. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  73. }
  74. catch (Exception ex)
  75. {
  76. // 对异常进行共通处理
  77. ExceptionManager.HandleEventException(this.ToString(),
  78. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  79. }
  80. }
  81. private void BtnCancel_Click(object sender, EventArgs e)
  82. {
  83. this.Close();
  84. }
  85. private void BtnSave_Click(object sender, EventArgs e)
  86. {
  87. PlanYearUpdate();
  88. this.Close();
  89. }
  90. //更新操作
  91. private void PlanYearUpdate()
  92. {
  93. //年计划 插入
  94. ClientRequestEntity cre = new ClientRequestEntity();
  95. //用户填写的数据
  96. cre.Properties["GOODSID"] = Convert.ToInt32(goodsCode.SelectedValue);
  97. cre.Properties["PLANQUANTITY"] = Convert.ToInt32(planQuantity.Value);
  98. cre.Properties["REMARKS"] = planRemarks.Text;
  99. //自动填写的数据
  100. cre.Properties["UPDATETIME"] = DateTime.Now;
  101. cre.Properties["UPDATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  102. ServiceResultEntity result;
  103. if (planGoodsId == 0)
  104. {
  105. //新建专属的列
  106. cre.Properties["PLANID"] = planId;
  107. cre.Properties["YEARNO"] = planYearNo;
  108. cre.Properties["STARTDATE"] = planStartDate;
  109. cre.Properties["ENDDATE"] = planEndDate;
  110. cre.Properties["ACCOUNTID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.AccountID;
  111. cre.Properties["CREATETIME"] = DateTime.Now;
  112. cre.Properties["CREATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  113. result = PPModuleProxy.Service.PlanYearGoodsInsert(cre);
  114. }
  115. else
  116. {
  117. //更新时主键要指定值
  118. cre.Properties["PLANGOODSID"] = planGoodsId;
  119. result = PPModuleProxy.Service.PlanYearGoodsUpdate(cre);
  120. //更新时生成新版本
  121. }
  122. }
  123. }
  124. }