F_PP_0303.cs 4.8 KB

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