sync.sample.cs 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using SQLData;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. namespace SiteCore.Handler
  5. {
  6. public partial class sync
  7. {
  8. //拿样导入接口
  9. public void get_erp_sample()
  10. {
  11. DataStruct dStruct = GetPostStruct();
  12. List<string> lw = new List<string>();
  13. string tid = GetPostString("tid");
  14. if (tid.Length > 0) lw.Add(string.Format("tid like '%{0}%'", tid));
  15. string shopName = GetPostString("shopName");
  16. if (shopName.Length > 0) lw.Add(string.Format("shopName like '%{0}%'", shopName));
  17. string SampleUser = GetPostString("SampleUser");
  18. if (SampleUser.Length > 0) lw.Add(string.Format("SampleUser like '%{0}%'", SampleUser));
  19. string date1 = GetPostString("date1");
  20. string date2 = GetPostString("date2");
  21. string dw = GetDateMinuteWhere("SampleDate", date1, date2);
  22. if (dw.Length > 0) lw.Add(dw);
  23. string PayDate1 = GetPostString("PayDate1");
  24. string PayDate2 = GetPostString("PayDate2");
  25. string dw2 = GetDateMinuteWhere("pay_time", PayDate1, PayDate2);
  26. if (dw2.Length > 0) lw.Add(dw2);
  27. string Payment1 = GetPostString("Payment1");
  28. if (Payment1.Length > 0) lw.Add(string.Format("payment >= {0}", Payment1));
  29. string Payment2 = GetPostString("Payment2");
  30. if (Payment2.Length > 0) lw.Add(string.Format("payment <= {0}", Payment2));
  31. string ServiceFee1 = GetPostString("ServiceFee1");
  32. if (ServiceFee1.Length > 0) lw.Add(string.Format("ServiceFee >= {0}", ServiceFee1));
  33. string ServiceFee2 = GetPostString("ServiceFee2");
  34. if (ServiceFee2.Length > 0) lw.Add(string.Format("ServiceFee <= {0}", ServiceFee2));
  35. string LogisticsFee1 = GetPostString("LogisticsFee1");
  36. if (LogisticsFee1.Length > 0) lw.Add(string.Format("LogisticsFee >= {0}", LogisticsFee1));
  37. string LogisticsFee2 = GetPostString("LogisticsFee2");
  38. if (LogisticsFee2.Length > 0) lw.Add(string.Format("LogisticsFee <= {0}", LogisticsFee2));
  39. string Commission1 = GetPostString("Commission1");
  40. if (Commission1.Length > 0) lw.Add(string.Format("Commission >= {0}", Commission1));
  41. string Commission2 = GetPostString("Commission2");
  42. if (Commission2.Length > 0) lw.Add(string.Format("Commission <= {0}", Commission2));
  43. dStruct.Order = "ctid desc";
  44. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  45. DataTable dt = WebCache.GetData("view_ErpTradeSample", dStruct);
  46. writeGridDataTableJson(dStruct.TotalCount, dt);
  47. }
  48. //拿样导入那边 上面的统计
  49. public void get_erp_sample_gather()
  50. {
  51. //发货前的统计
  52. List<string> lw = new List<string>();
  53. string tid = GetPostString("tid");
  54. if (tid.Length > 0) lw.Add(string.Format("tid like '%{0}%'", tid));
  55. string shop = GetPostString("shop");
  56. if (shop.Length > 0) lw.Add(string.Format("shopName='{0}'", shop));
  57. string date1 = GetPostString("date1");
  58. string date2 = GetPostString("date2");
  59. string dw = GetDateMinuteWhere("SampleDate", date1, date2);
  60. if (dw.Length > 0) lw.Add(dw);
  61. string PayDate1 = GetPostString("PayDate1");
  62. string PayDate2 = GetPostString("PayDate2");
  63. string dw2 = GetDateMinuteWhere("pay_time", PayDate1, PayDate2);
  64. if (dw2.Length > 0) lw.Add(dw2);
  65. string orderWhere = string.Join(" and ", lw.ToArray());
  66. string sql = "";
  67. //根据时间 做发货前的统计
  68. if (orderWhere.Length <= 0)
  69. {
  70. sql = string.Format("select count(tid) as countNum,sum(payment) as sumPrice, sum(ServiceFee) as sumService, sum(Commission) as sumCom, sum(LogisticsFee) as sumLogist from view_ErpTradeSample ");
  71. }
  72. else
  73. sql = string.Format("select count(tid) as countNum,sum(payment) as sumPrice, sum(ServiceFee) as sumService, sum(Commission) as sumCom, sum(LogisticsFee) as sumLogist from view_ErpTradeSample where " + orderWhere);
  74. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  75. //writeGridDataTableJson(dt.Rows.Count, dt);
  76. returnSuccess(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
  77. }
  78. }
  79. }