人民医院API

AddLogBll.cs 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Transactions;
  7. namespace RMYY_CallCenter_Api.Bll
  8. {
  9. public class AddLogBll
  10. {
  11. T_Dis_WorkOrderItem itembll = new T_Dis_WorkOrderItem();
  12. /// <summary>
  13. /// 添加工单记录
  14. /// </summary>
  15. public long AddLog(int woid, int wostate, int type, string content, int itemtype, int opttype, string nextuser, int nextdept, string usercode, int F_IsUsed = 0)
  16. {
  17. Model.T_Dis_WorkOrderItem itemModel = new Model.T_Dis_WorkOrderItem();
  18. #region
  19. long res = 0;
  20. //处理当前工单的记录之前的记录过期
  21. var itemlast = itembll.GetModelList(" isnull(F_IsUsed,'0')='0' and F_ItemType=" + itemtype + " and F_WoID=" + woid + " and (F_CreateUser=" + usercode + " or F_NextUser like '%" + usercode + "%')");
  22. using (TransactionScope trans = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(0, 10, 0)))
  23. {
  24. if (F_IsUsed == 0)
  25. {
  26. if (itemlast.Count > 0)
  27. {
  28. foreach (var it in itemlast)
  29. {
  30. it.F_IsUsed = 1;
  31. itembll.Update(it);
  32. }
  33. }
  34. }
  35. #endregion
  36. itemModel.F_WoID = woid;
  37. itemModel.F_WoState = wostate;
  38. itemModel.F_WoType = type;
  39. itemModel.F_ItemType = itemtype;
  40. itemModel.F_OptType = opttype;
  41. itemModel.F_OptContent = content;
  42. itemModel.F_NextUser = nextuser;
  43. itemModel.F_NextDept = nextdept;
  44. itemModel.F_IsUsed = F_IsUsed;
  45. itemModel.F_CreateTime = DateTime.Now;
  46. itemModel.F_CreateUser = usercode;
  47. res = itembll.Add(itemModel);
  48. trans.Complete();
  49. }
  50. return res;
  51. }
  52. public long AddLogAboutKey(int woid, int wostate, int type, string content, int itemtype, int opttype, string nextuser, int nextdept, string usercode,int key,string value,string reason ,int F_IsUsed = 0)
  53. {
  54. Model.T_Dis_WorkOrderItem itemModel = new Model.T_Dis_WorkOrderItem();
  55. #region
  56. long res = 0;
  57. //处理当前工单的记录之前的记录过期
  58. var itemlast = itembll.GetModelList(" isnull(F_IsUsed,'0')='0' and F_ItemType=" + itemtype + " and F_WoID=" + woid + " and (F_CreateUser=" + usercode + " or F_NextUser like '%" + usercode + "%')");
  59. using (TransactionScope trans = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(0, 10, 0)))
  60. {
  61. if (F_IsUsed == 0)
  62. {
  63. if (itemlast.Count > 0)
  64. {
  65. foreach (var it in itemlast)
  66. {
  67. it.F_IsUsed = 1;
  68. itembll.Update(it);
  69. }
  70. }
  71. }
  72. #endregion
  73. itemModel.F_WoID = woid;
  74. itemModel.F_WoState = wostate;
  75. itemModel.F_WoType = type;
  76. itemModel.F_ItemType = itemtype;
  77. itemModel.F_OptType = opttype;
  78. itemModel.F_OptContent = content;
  79. itemModel.F_NextUser = nextuser;
  80. itemModel.F_NextDept = nextdept;
  81. itemModel.F_IsUsed = F_IsUsed;
  82. itemModel.F_CreateTime = DateTime.Now;
  83. itemModel.F_CreateUser = usercode;
  84. itemModel.F_AboutKey = key;
  85. itemModel.F_AboutReason = value;
  86. itemModel.F_EnterReason = reason;
  87. res = itembll.Add(itemModel);
  88. trans.Complete();
  89. }
  90. return res;
  91. }
  92. }
  93. }