F_PP_0103.cs 4.7 KB

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