SalesService.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using LeaRun.Application.Entity.WarehouseManage;
  2. using LeaRun.Data;
  3. using LeaRun.Util;
  4. using LeaRun.Util.WebControl;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace LeaRun.Application.Service.WarehouseManage
  12. {
  13. public class SalesService
  14. {
  15. public SqlHelper sqlHelper = new SqlHelper("InstallDB");
  16. /// <summary>
  17. /// 获取销售订单
  18. /// </summary>
  19. /// <param name="pagination">分页参数</param>
  20. /// <returns></returns>
  21. public IEnumerable<SalesEntity> GetSalesOrderList() {
  22. try
  23. {
  24. string sql = "select * from WM_Sales order by CreateDt desc";
  25. // int total = pagination.records;
  26. DataTable dt = sqlHelper.ExecuteDataTable(sql,CommandType.Text,null);
  27. // pagination.records = total;
  28. return DataHelper.DataTableToT<SalesEntity>(dt);
  29. }
  30. catch (Exception ex)
  31. {
  32. return null;
  33. }
  34. }
  35. /// <summary>
  36. /// 获取业务员列表
  37. /// </summary>
  38. /// <returns></returns>
  39. public IEnumerable<SalesmanEntity> GetSalesManList() {
  40. try
  41. {
  42. string sql = "select SalesmanId,SalemanName from WM_Salesman";
  43. DataTable dt = sqlHelper.ExecuteDataTable(sql,CommandType.Text,null);
  44. var list = DataHelper.DataTableToT<SalesmanEntity>(dt);
  45. return list;
  46. }
  47. catch (Exception ex)
  48. {
  49. return null;
  50. }
  51. }
  52. /// <summary>
  53. /// 获取销售订单详情
  54. /// </summary>
  55. /// <param name="saleId"></param>
  56. /// <returns></returns>
  57. public SalesEntity GetSalesOrder(string saleId) {
  58. try
  59. {
  60. string sql = "select SaleId,Code,CustomerName,OrderType, SaleSerialNumer,SalemanId,OrderPayment,CreateDt,remark from WM_Sales where saleId="+saleId;
  61. DataTable dtResult = sqlHelper.ExecuteDataTable(sql,CommandType.Text,null);
  62. List<SalesEntity> list = DataHelper.DataTableToT<SalesEntity>(dtResult);
  63. return list[0];
  64. }
  65. catch (Exception ex)
  66. {
  67. return null;
  68. }
  69. }
  70. /// <summary>
  71. /// 获取编码与单据号
  72. /// </summary>
  73. /// <returns></returns>
  74. public DataTable getCodeNum() {
  75. string sql = "select top 1 Code,SaleSerialNumer from WM_Sales order by Code desc";
  76. DataTable dt = sqlHelper.ExecuteDataTable(sql,CommandType.Text,null);
  77. return dt;
  78. }
  79. }
  80. }