电子药箱通讯服务端
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ItemLotBLL.ext.cs 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using RDH.Data.Models;
  6. namespace RDH.Data.BLL
  7. {
  8. public partial class ItemLotBLL : IItemLotBLL
  9. {
  10. public IEnumerable<ItemLot> ListItemLot()
  11. {
  12. var sql = BuildBaseSql();
  13. var ListItemLot = SqlMapper.Query<ItemLot>(ConnectionFactory.Current.GetSessionConnection(), sql, null);
  14. return ListItemLot;
  15. }
  16. public IEnumerable<ItemLot> SearchItemLot(Guid itemKey, String lotCode, DateTime? expDate)
  17. {
  18. String sqlSelect = String.Format("SELECT * FROM "
  19. + "({0} WHERE item_key=:ItemKey ORDER BY exp_date DESC) t WHERE ROWNUM<10 ",
  20. BuildBaseSql());
  21. if (!String.IsNullOrEmpty(lotCode))
  22. {
  23. sqlSelect += " AND \"LotNo\" = :LotNo";
  24. }
  25. if (expDate.HasValue)
  26. {
  27. sqlSelect += " AND \"ExpDate\"=:ExpDate";
  28. }
  29. ItemLot paramLot = new ItemLot();
  30. paramLot.ItemKey = itemKey;
  31. paramLot.LotNo = lotCode;
  32. paramLot.ExpDate = expDate.GetValueOrDefault();
  33. var rlt = SqlMapper.Query<ItemLot>(ConnectionFactory.Current.GetSessionConnection(),
  34. sqlSelect, paramLot);
  35. return rlt;
  36. }
  37. public ItemLot GetByItemIdAndLotNo(string itemId, string lotNo)
  38. {
  39. var sql = BuildBaseSql();
  40. return SqlMapper.Query<ItemLot>(ConnectionFactory.Current.GetSessionConnection(), sql + " WHERE ITEM_ID = :ItemId And LOT_NO = :LotNo", new { ItemId = itemId, LotNo = lotNo }).FirstOrDefault();
  41. }
  42. }
  43. }