OrderDAL.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using CoreEntity.ESEntity;
  2. using Newtonsoft.Json;
  3. using SupplierWeb.Commonss;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. namespace MemberWeb.Commonss.EsDAL
  9. {
  10. #region 订单code实体类
  11. public class Condition
  12. {
  13. /// <summary>
  14. ///
  15. /// </summary>
  16. public string name { get; set; }
  17. /// <summary>
  18. ///
  19. /// </summary>
  20. public string type { get; set; }
  21. }
  22. #endregion
  23. public class Orderscode
  24. {
  25. /// <summary>
  26. ///
  27. /// </summary>
  28. public List<Condition> columns { get; set; }
  29. /// <summary>
  30. ///
  31. /// </summary>
  32. public List<List<string>> rows { get; set; }
  33. }
  34. public class OrderDAL
  35. {
  36. /// <summary>
  37. /// 根据电话号码,获取他所有的订单编号
  38. /// </summary>
  39. /// <param name="data"></param>
  40. /// <returns></returns>
  41. public static string GetPrescriptionOderscode(dynamic data, string filter)
  42. {
  43. string code = "";
  44. data = new { query = "select OrdersCode from mem_order where 1=1 " + filter + "" };
  45. var ordersql = JsonConvert.SerializeObject(data);
  46. string orderstr = Util.ElasticQuery("_sql?format=json", "POST", ordersql);
  47. Orderscode orderscode = EsCommon.FromJSON<Orderscode>(orderstr);
  48. for (int i = orderscode.rows.Count - 1; i >= 0; i--)
  49. {
  50. if (i > 0)
  51. {
  52. code += "'" + orderscode.rows[i][0] + "',";
  53. }
  54. else
  55. {
  56. code += "'" + orderscode.rows[i][0] + "'";
  57. }
  58. }
  59. return code;
  60. }
  61. }
  62. }