| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2016/4/6 18:17:54
- //Author
- //Description Create
- //----------------------------------------------------------------
- using Muchinfo.MTPClient.Adapter.Abstract;
- using Muchinfo.MTPClient.Adapter.Utilities;
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Data.Model.Account;
- using tas;
- namespace Muchinfo.MTPClient.Adapter.ProtoBuf
- {
- public class SaleProtoBufAdapter:SaleAdapter
- {
- //private OrderHead ToOrderHead(NewEntrustOrder entrustorder)
- //{
- // return new OrderHead()
- // {
- // //OrderID = entrustorder.RelationTicket, ////委托单号
- // AccountType = (uint)entrustorder.AccountType,
- // ValidType = (int)entrustorder.ValidType,
- // ClientSerialNo = Guid.NewGuid().ToString(),
- // AccountID = (uint)entrustorder.AccountId,
- // OperatorID = (uint)entrustorder.AccountId,
- // ClientOrderTime = entrustorder.EntrurstTime.ToString("yyyy-MM-dd HH:mm:ss"),
- // OperateType = 0,
- // ClientFlag = 2 + string.Empty,
- // GoodsID = entrustorder.GoodsId,
- // ///ClientOrderTime
- // // ClientFlag= ////默认PC交易端
- // // AccountID=entrustorder.TradeCode, ///
- // //AccountStatus
- // //GoodsID
- // //ValidTime
- // //OperateType
- // //OperatorID
- // //OrderSrc
- // //AttachParam
- // };
- //}
-
- public override byte[] ToSaleEntrustOrder(Data.Model.NewEntrustOrder entrustOrder)
- {
- return null;
- //var marketOrder = new IMOrderReq()
- //{
- // OrderPrice = Convert.ToDouble(entrustOrder.EntrustPrice),
- // OrderQty = Convert.ToDouble(entrustOrder.EntrustQuantity),
- // BuyOrSell = (uint)entrustOrder.BuyOrSell,
- // BuildType = (uint)entrustOrder.BuildType,
- // //RelateOrderID=entrustOrder.RelationTicket,
- //};
- //marketOrder.Header = new MessageHead() { AccountID = entrustOrder.AccountId, GoodsID = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToString() };
- //marketOrder.OrderHead = ToOrderHead(entrustOrder);
- //return ProtoBufHelper.EntitySerialize(marketOrder, false);
- }
- public override Data.ResponeEntity<Data.Model.Account.OrderDetail> ToSaleOrder(object responeData)
- {
- return null;
- //var buffer = responeData as byte[];
- //if (buffer == null)
- //{
- // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
- //}
- //var imOrderRsp = ProtoBufHelper.EntityDeSerialize<IMOrderRsp>(buffer);
- //return new ResponeEntity<OrderDetail>()
- //{
- // RetCode = imOrderRsp.RetCode,
- // RetMessage = imOrderRsp.RetDesc,
- // Entity = new OrderDetail()
- // {
- // //OrderID = imOrderRsp.OrderID,
- // EntrustOrderType = (eBuildType)imOrderRsp.OrderType,
- // ////todo:生成委托
- // }
- //};
- }
-
- public override byte[] ToDepositReqBytes(DepositOrder depositOrder)
- {
- return null;
- //var depositReq = new DepositReq()
- //{
- // //accountId = depositOrder.Accountid,
- // depositId=depositOrder.DepositId,
- // depositNum=Convert.ToDouble( depositOrder.DepositNum),
- // depositType=(int)depositOrder.BuildType,
- // warehouseId=depositOrder.WarehouseId,
- // storeinId=depositOrder.StoreinId,
- //};
- ////marketOrder.Header = new MessageHead() { AccountId = entrustOrder.AccountId, GoodsId = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToByteArray() };
- ////marketOrder.OrderHead = ToOrderHead(entrustOrder);
- //return ProtoBufHelper.EntitySerialize(depositReq, true);
- }
- public override ResponeEntity<DepositOrder> ToLocalDepositEntity(object responeData)
- {
- return null;
- //var buffer = responeData as byte[];
- //if (buffer == null)
- //{
- // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!");
- //}
- //var imOrderRsp = ProtoBufHelper.EntityDeSerialize<DepositRsp>(buffer);
- //return new ResponeEntity<DepositOrder>()
- //{
- // RetCode = imOrderRsp.RetCode,
- // RetMessage = imOrderRsp.RetDesc,
-
- // Entity = new DepositOrder()
- // {
- // //Accountid = imOrderRsp.accountId,
- // BuildType = (eBuildType)imOrderRsp.depositType,
- // ////todo:生成委托
- // }
- //};
-
- }
- }
- }
|