电子药箱通讯服务端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PortableStorageItemLotBLL.cs 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using RDH.Data.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml.Linq;
  8. namespace RDH.Data.BLL
  9. {
  10. public partial class PortableStorageItemLotBLL : BaseOrclBLL<PortableStorageItemLot>
  11. {
  12. public PortableStorageItemLotBLL() : base()
  13. {
  14. AliasTableName = "psil";
  15. }
  16. internal override String TABLE_NAME { get { return "PORTABLE_STORAGE_ITEM_LOT"; } }//TB_NAME
  17. internal override string ENTITY_NAME { get { return "PortableStorageItemLot"; } }
  18. internal override String KEY_COLUMN { get { return "KEY"; } }//KEY_COLUMN4
  19. internal override void InitMaps()
  20. {
  21. ColumnPropMaps.Add("KEY", "Key");
  22. ColumnPropMaps.Add("QUANTITY", "Quantity");
  23. ColumnPropMaps.Add("ITEM_KEY", "ItemKey");
  24. ColumnPropMaps.Add("LOT_KEY", "LotKey");
  25. ColumnPropMaps.Add("PORTABLE_ITEM_KEY", "PortableStorageItemkey");
  26. ColumnPropMaps.Add("CREATE_BY", "CreateBy");
  27. ColumnPropMaps.Add("CREATE_TIME", "CreateTime");
  28. ColumnPropMaps.Add("FLAG", "Flag");
  29. ColumnPropMaps.Add("CLIENT_TIME", "ClientTime");
  30. ColumnPropMaps.Add("SERVER_TIME", "ServerTime");
  31. ColumnPropMaps.Add("EXT01", "Ext01");
  32. ColumnPropMaps.Add("EXT02", "Ext02");
  33. ColumnPropMaps.Add("EXT03", "Ext03");
  34. ColumnPropMaps.Add("EXT04", "Ext04");
  35. ColumnPropMaps.Add("EXT05", "Ext05");
  36. ColumnPropMaps.Add("EXT06", "Ext06");
  37. ColumnPropMaps.Add("EXT07", "Ext07");
  38. ColumnPropMaps.Add("EXT08", "Ext08");
  39. ColumnPropMaps.Add("EXT09", "Ext09");
  40. ColumnPropMaps.Add("EXT10", "Ext10");
  41. }
  42. internal override object GetParam(PortableStorageItemLot item)
  43. {
  44. return new
  45. {
  46. Key = item.Key,
  47. Quantity = item.Quantity,
  48. ItemKey = item.ItemKey,
  49. LotKey = item.LotKey,
  50. PortableStorageItemkey = item.PortableStorageItemkey,
  51. CreateBy = item.CreateBy,
  52. CreateTime = item.CreateTime,
  53. Flag = item.Flag,
  54. ClientTime = item.ClientTime,
  55. ServerTime = item.ServerTime,
  56. Ext01 = item.Ext01,
  57. Ext02 = item.Ext02,
  58. Ext03 = item.Ext03,
  59. Ext04 = item.Ext04,
  60. Ext05 = item.Ext05,
  61. Ext06 = item.Ext06,
  62. Ext07 = item.Ext07,
  63. Ext08 = item.Ext08,
  64. Ext09 = item.Ext09,
  65. Ext10 = item.Ext10,
  66. };
  67. }
  68. /// <summary>
  69. /// 根据药品计数条码获取药品库存信息
  70. /// </summary>
  71. public PortableStorageItemLot GetByItemBarcode(String barcode)
  72. {
  73. SqlBuilder sqlBuilder = new SqlBuilder(this);
  74. PortableStorageItemBLL portableStorageItemBLL = new PortableStorageItemBLL();
  75. TableJoinInfo psiTable = new TableJoinInfo
  76. {
  77. LeftDal = this,
  78. LeftColumnName = "PORTABLE_ITEM_KEY",
  79. RightDal = portableStorageItemBLL,
  80. RightColumnName = "KEY",
  81. JoinType = TableJoinTypes.Inner,
  82. };
  83. sqlBuilder.AppendSelectionTable(psiTable);
  84. ItemBLL itemBLL = new ItemBLL();
  85. TableJoinInfo itemTable = new TableJoinInfo
  86. {
  87. LeftDal = portableStorageItemBLL,
  88. LeftColumnName = "ITEM_KEY",
  89. RightDal = itemBLL,
  90. RightColumnName = "KEY",
  91. JoinType = TableJoinTypes.Inner,
  92. };
  93. sqlBuilder.AppendSelectionTable(itemTable);
  94. ItemLotBLL itemLotBLL = new ItemLotBLL();
  95. TableJoinInfo itemlotTable = new TableJoinInfo
  96. {
  97. LeftDal = this,
  98. LeftColumnName = "LOT_KEY",
  99. RightDal = itemLotBLL,
  100. RightColumnName = "KEY",
  101. JoinType = TableJoinTypes.Inner,
  102. };
  103. sqlBuilder.AppendSelectionTable(itemlotTable);
  104. sqlBuilder.AppendWherePhrases($"{this.AliasTableName}.EXT01=:itemBarcode");
  105. return SqlMapper.Query<PortableStorageItemLot, PortableStorageItem, Item ,ItemLot, PortableStorageItemLot>(ConnectionFactory.Current.GetSessionConnection(),
  106. sqlBuilder.ToString(),
  107. (psil, psi, i, il) =>
  108. {
  109. psil.PortableStorageItem = psi;
  110. psi.Item = i;
  111. psil.ItemLot = il;
  112. return psil;
  113. },
  114. new { itemBarcode = barcode },
  115. splitOn: sqlBuilder.GetSpiltors()).FirstOrDefault();
  116. }
  117. }
  118. }