SaleProtoBufAdapter.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. //----------------------------------------------------------------
  6. //Module Name: $safeprojectname$
  7. //Purpose:
  8. //CopyRight: Muchinfo
  9. //History:
  10. //----------------------------------------------------------------
  11. //DateTime 2016/4/6 18:17:54
  12. //Author
  13. //Description Create
  14. //----------------------------------------------------------------
  15. using Muchinfo.MTPClient.Adapter.Abstract;
  16. using Muchinfo.MTPClient.Adapter.Utilities;
  17. using Muchinfo.MTPClient.Data;
  18. using Muchinfo.MTPClient.Data.Enums;
  19. using Muchinfo.MTPClient.Data.Model;
  20. using Muchinfo.MTPClient.Data.Model.Account;
  21. using tas;
  22. namespace Muchinfo.MTPClient.Adapter.ProtoBuf
  23. {
  24. public class SaleProtoBufAdapter:SaleAdapter
  25. {
  26. //private OrderHead ToOrderHead(NewEntrustOrder entrustorder)
  27. //{
  28. // return new OrderHead()
  29. // {
  30. // //OrderID = entrustorder.RelationTicket, ////委托单号
  31. // AccountType = (uint)entrustorder.AccountType,
  32. // ValidType = (int)entrustorder.ValidType,
  33. // ClientSerialNo = Guid.NewGuid().ToString(),
  34. // AccountID = (uint)entrustorder.AccountId,
  35. // OperatorID = (uint)entrustorder.AccountId,
  36. // ClientOrderTime = entrustorder.EntrurstTime.ToString("yyyy-MM-dd HH:mm:ss"),
  37. // OperateType = 0,
  38. // ClientFlag = 2 + string.Empty,
  39. // GoodsID = entrustorder.GoodsId,
  40. // ///ClientOrderTime
  41. // // ClientFlag= ////默认PC交易端
  42. // // AccountID=entrustorder.TradeCode, ///
  43. // //AccountStatus
  44. // //GoodsID
  45. // //ValidTime
  46. // //OperateType
  47. // //OperatorID
  48. // //OrderSrc
  49. // //AttachParam
  50. // };
  51. //}
  52. public override byte[] ToSaleEntrustOrder(Data.Model.NewEntrustOrder entrustOrder)
  53. {
  54. return null;
  55. //var marketOrder = new IMOrderReq()
  56. //{
  57. // OrderPrice = Convert.ToDouble(entrustOrder.EntrustPrice),
  58. // OrderQty = Convert.ToDouble(entrustOrder.EntrustQuantity),
  59. // BuyOrSell = (uint)entrustOrder.BuyOrSell,
  60. // BuildType = (uint)entrustOrder.BuildType,
  61. // //RelateOrderID=entrustOrder.RelationTicket,
  62. //};
  63. //marketOrder.Header = new MessageHead() { AccountID = entrustOrder.AccountId, GoodsID = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToString() };
  64. //marketOrder.OrderHead = ToOrderHead(entrustOrder);
  65. //return ProtoBufHelper.EntitySerialize(marketOrder, false);
  66. }
  67. public override Data.ResponeEntity<Data.Model.Account.OrderDetail> ToSaleOrder(object responeData)
  68. {
  69. return null;
  70. //var buffer = responeData as byte[];
  71. //if (buffer == null)
  72. //{
  73. // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
  74. //}
  75. //var imOrderRsp = ProtoBufHelper.EntityDeSerialize<IMOrderRsp>(buffer);
  76. //return new ResponeEntity<OrderDetail>()
  77. //{
  78. // RetCode = imOrderRsp.RetCode,
  79. // RetMessage = imOrderRsp.RetDesc,
  80. // Entity = new OrderDetail()
  81. // {
  82. // //OrderID = imOrderRsp.OrderID,
  83. // EntrustOrderType = (eBuildType)imOrderRsp.OrderType,
  84. // ////todo:生成委托
  85. // }
  86. //};
  87. }
  88. public override byte[] ToDepositReqBytes(DepositOrder depositOrder)
  89. {
  90. return null;
  91. //var depositReq = new DepositReq()
  92. //{
  93. // //accountId = depositOrder.Accountid,
  94. // depositId=depositOrder.DepositId,
  95. // depositNum=Convert.ToDouble( depositOrder.DepositNum),
  96. // depositType=(int)depositOrder.BuildType,
  97. // warehouseId=depositOrder.WarehouseId,
  98. // storeinId=depositOrder.StoreinId,
  99. //};
  100. ////marketOrder.Header = new MessageHead() { AccountId = entrustOrder.AccountId, GoodsId = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToByteArray() };
  101. ////marketOrder.OrderHead = ToOrderHead(entrustOrder);
  102. //return ProtoBufHelper.EntitySerialize(depositReq, true);
  103. }
  104. public override ResponeEntity<DepositOrder> ToLocalDepositEntity(object responeData)
  105. {
  106. return null;
  107. //var buffer = responeData as byte[];
  108. //if (buffer == null)
  109. //{
  110. // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
  111. //}
  112. //var imOrderRsp = ProtoBufHelper.EntityDeSerialize<DepositRsp>(buffer);
  113. //return new ResponeEntity<DepositOrder>()
  114. //{
  115. // RetCode = imOrderRsp.RetCode,
  116. // RetMessage = imOrderRsp.RetDesc,
  117. // Entity = new DepositOrder()
  118. // {
  119. // //Accountid = imOrderRsp.accountId,
  120. // BuildType = (eBuildType)imOrderRsp.depositType,
  121. // ////todo:生成委托
  122. // }
  123. //};
  124. }
  125. }
  126. }