F_PP_0303.cs 4.9 KB

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