You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

3 years ago
  1. using EasyBL.WebApi.Message;
  2. using EasyNet;
  3. using Entity;
  4. using Entity.Sugar;
  5. using Entity.ViewModels;
  6. using JumpKick.HttpLib;
  7. using SqlSugar;
  8. using SqlSugar.Base;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Net;
  13. using System.Text.RegularExpressions;
  14. using Aspose.Cells;
  15. using Newtonsoft.Json;
  16. using Newtonsoft.Json.Linq;
  17. using System.Data;
  18. using System.IO;
  19. using EasyBL;
  20. namespace EasyBL.WEBAPP.CRM
  21. {
  22. public class CrmComService : ServiceBase
  23. {
  24. #region 獲取客訴單號
  25. /// <summary>
  26. /// 獲取客訴單號
  27. /// </summary>
  28. /// <param name="i_crm">todo: describe i_crm parameter on ComplaintNumber</param>
  29. /// <returns></returns>
  30. public ResponseMessage GetComplaintNumber(RequestMessage i_crm)
  31. {
  32. ResponseMessage rm = null;
  33. string sMsg = null;
  34. var db = SugarBase.DB;
  35. try
  36. {
  37. do
  38. {
  39. var sGuid = _fetchString(i_crm, @"Guid");
  40. var listComplaint = db.Queryable<OTB_CRM_Complaint>()
  41. .OrderBy(x => x.CreateDate)
  42. .Where(x => x.DataType == "E" || x.DataType == "H-O")
  43. .Select(x => new {
  44. ComplaintNumber = x.ComplaintNumber
  45. })
  46. .ToList();
  47. rm = new SuccessResponseMessage(null, i_crm);
  48. rm.DATA.Add(BLWording.REL, listComplaint);
  49. } while (false);
  50. }
  51. catch (Exception ex)
  52. {
  53. sMsg = Util.GetLastExceptionMsg(ex);
  54. LogAndSendEmail(sMsg + @"Param:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(CrmComService), @"進出口管理模組", @"GetComplaintNumber(獲取客訴單號)", @"", @"", @"");
  55. }
  56. finally
  57. {
  58. if (null != sMsg)
  59. {
  60. rm = new ErrorResponseMessage(sMsg, i_crm);
  61. }
  62. }
  63. return rm;
  64. }
  65. #endregion 獲取客訴單號
  66. }
  67. }