frmWorkReportView.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using LYFZ.BLL;
  2. using LYFZ.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace LYFZ.Software.MainBusiness.OAShopManagement
  9. {
  10. public class frmWorkReportView : LYFZ.Software.UI.OAShopManagement.frmWorkReportView
  11. {
  12. public frmWorkReportView()
  13. {
  14. this.btnClose.Click += btnClose_Click;
  15. this.btnSave.Click += btnSave_Click;
  16. this.Load += frmTeskView_Load;
  17. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.WorkReport, CustomAttributes.OperatingAuthority.Audit))
  18. { this.btnSave.Enabled = true; }
  19. else
  20. { this.btnSave.Enabled = false; }
  21. this.btnSet.Click += btnSet_Click;
  22. }
  23. void btnSet_Click(object sender, EventArgs e)
  24. {
  25. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet();
  26. frm.TypeName = BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper();
  27. frm.Version = "Version";
  28. if (frm.ShowDialog() == DialogResult.OK)
  29. {
  30. FinancialManagement.frmEditStatisticsProgram.LoadAllSystemCategory();
  31. FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper(), this.cmbCategory.TreeView);
  32. }
  33. }
  34. BLL_ErpShopEvententry Bll = new BLL_ErpShopEvententry();
  35. string _id = "";
  36. /// <summary>
  37. /// ID
  38. /// </summary>
  39. public string ID { get { return this._id; } set { this._id = value; } }
  40. Model_ErpShopEvententry model = new Model_ErpShopEvententry();
  41. void frmTeskView_Load(object sender, EventArgs e)
  42. {
  43. FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper(), this.cmbCategory.TreeView);
  44. if (!string.IsNullOrEmpty(this.ID))
  45. {
  46. model = Bll.GetModel(Convert.ToInt32(ID));
  47. //申请人
  48. this.labPriority.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName);
  49. FinancialManagement.frmEditStatisticsProgram.SetSelectItme(this.cmbCategory, model.Matter_Category);
  50. //申请时间
  51. this.labReleaseDatetime.Text = model.Matter_CreateDatetime.ToString("yyyy-MM-dd HH:mm");
  52. //申请内容
  53. this.txtApplyInfo.Text = model.Matter_content;
  54. //审批人
  55. this.labPostedby.Text = Bll.Name(model.Matter_UpdateName);
  56. //审批意见
  57. this.txtApplyReply.Text = model.Matter_opinion;
  58. this.txtLeadershipInstruction.Text = model.Matter_LeadershipInstruction;
  59. this.txtTitle.Text = model.Matter_Title;
  60. }
  61. switch (_ApplyType)
  62. {
  63. case MattersApplyType.批示领导:
  64. this.txtApplyReply.Enabled = false;
  65. this.txtLeadershipInstruction.Enabled = true;
  66. this.btnSave.Enabled = true;
  67. break;
  68. case MattersApplyType.申请人:
  69. this.txtApplyReply.Enabled = false;
  70. this.txtLeadershipInstruction.Enabled = false;
  71. this.btnSave.Enabled = false;
  72. break;
  73. case MattersApplyType.审核人:
  74. this.txtApplyReply.Enabled = true;
  75. this.txtLeadershipInstruction.Enabled = false;
  76. this.btnSave.Enabled = true;
  77. break;
  78. }
  79. }
  80. /// <summary>
  81. /// 审核按钮
  82. /// </summary>
  83. /// <param name="sender"></param>
  84. /// <param name="e"></param>
  85. void btnSave_Click(object sender, EventArgs e)
  86. {
  87. if (model.ID > 0)
  88. {
  89. if (this.cmbCategory.TreeView.SelectedNode == null)
  90. {
  91. MessageBoxCustom.Show("请选工作审批评价");
  92. return;
  93. }
  94. if (_ApplyType == MattersApplyType.审核人)
  95. {
  96. if (string.IsNullOrEmpty(txtApplyReply.Text))
  97. {
  98. MessageBoxCustom.Show("请输入审批意见"); return;
  99. }
  100. if (txtApplyReply.Text.Trim().Length > 200)
  101. {
  102. MessageBoxCustom.Show("审批意见不能超过200个字"); return;
  103. }
  104. model.Matter_opinion = this.txtApplyReply.Text.Trim();
  105. model.Matter_UpdateDatetime = SDateTime.Now;
  106. model.Matter_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  107. }
  108. else if (_ApplyType == MattersApplyType.批示领导)
  109. {
  110. if (string.IsNullOrEmpty(txtLeadershipInstruction.Text))
  111. {
  112. MessageBoxCustom.Show("请输入领导批示意见"); return;
  113. }
  114. if (txtLeadershipInstruction.Text.Trim().Length > 200)
  115. {
  116. MessageBoxCustom.Show("领导批示意见不能超过200个字"); return;
  117. }
  118. model.Matter_LeadershipInstruction = this.txtLeadershipInstruction.Text.Trim();
  119. model.Matter_InstructedPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  120. model.Matter_InstructedTime = SDateTime.Now;
  121. }
  122. model.Matter_Category = this.cmbCategory.TreeView.SelectedNode.Name;
  123. model.Matter_state = state.申请通过.ToString();
  124. if (model.Matter_state == state.申请中.ToString())
  125. {
  126. MessageBoxCustom.Show("请选择审核状态"); return;
  127. }
  128. if (Bll.Update(model))
  129. {
  130. MessageBoxCustom.Show("审核成功");
  131. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  132. }
  133. else
  134. {
  135. MessageBoxCustom.Show("审核失败");
  136. }
  137. }
  138. }
  139. void btnClose_Click(object sender, EventArgs e)
  140. { this.Close(); }
  141. MattersApplyType _ApplyType = MattersApplyType.申请人;
  142. /// <summary>
  143. /// 操作人类型 申请,审核
  144. /// </summary>
  145. internal MattersApplyType ApplyType
  146. {
  147. get { return _ApplyType; }
  148. set { _ApplyType = value; }
  149. }
  150. }
  151. }