F_PP_0203.cs 4.8 KB

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