FlowService.Utils.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using GxPress.Entity;
  2. using GxPress.Entity.WorkFlow;
  3. using GxPress.Entity.WorkProcess;
  4. using GxPress.EnumConst;
  5. namespace GxPress.Service.Implement
  6. {
  7. public partial class FlowService
  8. {
  9. public string GetFlowName(User user, Process process)
  10. {
  11. if (user != null && process != null)
  12. {
  13. return $"{user.Name}提交的{process.Name}申请";
  14. }
  15. return "未知申请";
  16. }
  17. public string GetFieldValue(FlowFieldValue value)
  18. {
  19. if (value == null) return string.Empty;
  20. if (value.FieldType == nameof(FieldTypeConst.Number) || value.FieldType == nameof(FieldTypeConst.Currency))
  21. {
  22. return value.IntValue.ToString();
  23. }
  24. if (value.FieldType == nameof(FieldTypeConst.Radio))
  25. {
  26. return value.StringValues;
  27. }
  28. return value.StringValue;
  29. }
  30. public string GetTodoAction(FlowTodo todo)
  31. {
  32. if (todo.Type == nameof(TodoTypeConst.ApproverCheck))
  33. {
  34. if (!todo.IsDone && !todo.IsChecked && todo.IsOperate)
  35. {
  36. return NodeStateConstUtils.GetText(NodeStateConst.Checking);
  37. }
  38. else if (!todo.IsDone && !todo.IsChecked && !todo.IsOperate)
  39. {
  40. return "";
  41. }
  42. else if (todo.IsDone && !todo.IsChecked)
  43. {
  44. if (todo.DoneType == 1)
  45. return "上会";
  46. else if (todo.DoneType == 2)
  47. return "待定";
  48. return NodeStateConstUtils.GetText(NodeStateConst.Denied);
  49. }
  50. else if (todo.IsDone && todo.IsChecked && todo.IsReferral)
  51. {
  52. return NodeStateConstUtils.GetText(NodeStateConst.Referral);
  53. }
  54. else if (todo.IsDone && todo.IsChecked)
  55. {
  56. return NodeStateConstUtils.GetText(NodeStateConst.Checked);
  57. }
  58. return todo.IsChecked ? NodeStateConstUtils.GetText(NodeStateConst.Checked) : NodeStateConstUtils.GetText(NodeStateConst.Denied);
  59. }
  60. //if (todo.Type == nameof(TodoTypeConst.ApproverCheck))
  61. //{
  62. // return todo.IsDone ? NodeStateConstUtils.GetText(NodeStateConst.Checked) : NodeStateConstUtils.GetText(NodeStateConst.Denied);
  63. //}
  64. return string.Empty;
  65. }
  66. }
  67. }