FxBaseItemCore.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using WMS.Info;
  7. using WMS.Util;
  8. namespace WMS.Core.ServiceCore.FeiXu
  9. {
  10. public class FxBaseItemCore
  11. {
  12. /// <summary>
  13. /// 获取列表数据
  14. /// <summary>
  15. /// <returns></returns>
  16. public IEnumerable<BASE_ITEM> GetList(string keyword)
  17. {
  18. try
  19. {
  20. return SysDbCore.GetDbCtx().Queryable<BASE_ITEM>().Where(it => it.F_isStop).WhereIF(!keyword.IsEmpty(), it => it.F_matNo.Contains(keyword) || it.F_matName.Contains(keyword) || it.F_matName.Contains(keyword)).ToList();
  21. }
  22. catch (Exception ex)
  23. {
  24. throw ex;
  25. }
  26. }
  27. /// <summary>
  28. /// 获取分页数据
  29. /// <summary>
  30. /// <returns></returns>
  31. public IEnumerable<BASE_ITEM> GetPageList(string keyword,Pagination pagination)
  32. {
  33. try
  34. {
  35. int count = 0;
  36. var db = SysDbCore.GetDbCtx().Queryable<BASE_ITEM>().WhereIF(!keyword.IsEmpty(), it => it.F_matNo.Contains(keyword) || it.F_matName.Contains(keyword) || it.F_matName1.Contains(keyword));
  37. List<BASE_ITEM> list = null;
  38. if (pagination.sord.ToUpper() == "ASC")
  39. {
  40. list = db.OrderBy(pagination.sidx).ToPageList(pagination.page, pagination.rows, ref count);
  41. }
  42. else
  43. {
  44. string orderstr = pagination.sidx + " desc";
  45. list = db.OrderBy(orderstr).ToPageList(pagination.page, pagination.rows, ref count);
  46. }
  47. pagination.records = count;
  48. return list;
  49. }
  50. catch (Exception ex)
  51. {
  52. throw ex;
  53. }
  54. }
  55. /// <summary>
  56. /// 停用启用
  57. /// <summary>
  58. /// <returns></returns>
  59. public void IsEnable(int f_no,bool isStop)
  60. {
  61. try
  62. {
  63. SysDbCore.GetDbCtx().Updateable<BASE_ITEM>().SetColumns(it=>new BASE_ITEM { F_isStop= isStop }).Where(c => c.F_no == f_no).ExecuteCommand();
  64. }
  65. catch (Exception ex)
  66. {
  67. throw ex;
  68. }
  69. }
  70. }
  71. }