DealCloseModel.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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/11/3 18:02:43
  12. //Author
  13. //Description Create
  14. //----------------------------------------------------------------
  15. using System.Windows.Documents;
  16. using Muchinfo.MTPClient.Data.Enums;
  17. using Muchinfo.MTPClient.Data.Helper;
  18. namespace Muchinfo.MTPClient.Data.Model.Account
  19. {
  20. /// <summary>
  21. /// 协议平仓
  22. /// </summary>
  23. public class DealCloseModel
  24. {
  25. // d.AUTOID , // 协议单号
  26. //d.TRADEMODE, // 交易模式
  27. //d.BUYACCOUNTID, //买方账号
  28. //d.SELLACCOUNTID , //卖方账号
  29. //sellconfirmtime 卖方确认时间
  30. //BuyConfirmTime 买方确认时间
  31. // BuyAccountCode买方账号
  32. // BuyAccountname 买方名称
  33. // SellAccountCode卖方账号
  34. //ORDERQTY 委托数量
  35. // ORDERPRICE 委托价格
  36. //ORDERQTY 委托数量
  37. // STATUS 状态
  38. // 商品名称
  39. //d.ORDERQTY ,
  40. //d.ORDERPRICE,
  41. //d.CREATETIME,
  42. //d.STATUS,
  43. //d.CREATORID,
  44. //d.CHECKTIME ,
  45. //d.CHECKID,
  46. //d.DEALCLOSETIME
  47. // d.DEALCLOSEMODE ,
  48. //d.ACCOUNTSURE ,
  49. /// <summary>
  50. /// 协议单号
  51. /// </summary>
  52. [PropertyDisc("AUTOID")]
  53. public uint DealNum { get; set; }
  54. /// <summary>
  55. /// 交易模式
  56. /// </summary>
  57. [PropertyDisc("TRADEMODE")]
  58. public eTradeMode TRADEMODE { get; set; }
  59. /// <summary>
  60. /// 买方账号
  61. /// </summary>
  62. [PropertyDisc("BUYACCOUNTID")]
  63. public long BuyAccountId { get; set; }
  64. /// <summary>
  65. /// 卖方账号
  66. /// </summary>
  67. [PropertyDisc("SELLACCOUNTID")]
  68. public ulong SellAccountId { get; set; }
  69. /// <summary>
  70. /// 商品ID
  71. /// </summary>
  72. [PropertyDisc("GOODSID")]
  73. public long GoodsId { get; set; }
  74. /// <summary>
  75. /// 商品名称
  76. /// </summary>
  77. [PropertyDisc("GoodsName")]
  78. public string GoodsName { get; set; }
  79. /// <summary>
  80. /// 商品代码
  81. /// </summary>
  82. [PropertyDisc("GoodsCode")]
  83. public string GoodsCode { get; set; }
  84. /// <summary>
  85. /// BuyAccountname 买方名称
  86. /// </summary>
  87. [PropertyDisc("BuyAccountname")]
  88. public string BuyAccountName { get; set; }
  89. /// <summary>
  90. /// BuyAccountCode买方账号
  91. /// </summary>
  92. [PropertyDisc("BuyAccountCode")]
  93. public string BuyAccountCode { get; set; }
  94. /// <summary>
  95. /// SellAccountName卖方名称
  96. /// </summary>
  97. [PropertyDisc("SellAccountName")]
  98. public string SellAccountName { get; set; }
  99. /// <summary>
  100. /// SellAccountCode卖方账号
  101. /// </summary>
  102. [PropertyDisc("SellAccountCode")]
  103. public string SellAccountCode { get; set; }
  104. /// <summary>
  105. ///ORDERQTY 委托数量
  106. /// </summary>
  107. [PropertyDisc("ORDERQTY")]
  108. public long OrderQty { get; set; }
  109. /// <summary>
  110. /// ORDERPRICE 委托价格
  111. /// </summary>
  112. [PropertyDisc("ORDERPRICE")]
  113. public decimal OrderPrice { get; set; }
  114. /// <summary>
  115. /// STATUS 状态
  116. /// </summary>
  117. [PropertyDisc("STATUS")]
  118. public DealCloseStatus Status { get; set; }
  119. /// <summary>
  120. ///
  121. /// </summary>
  122. [PropertyDisc("ACCOUNTSURE")]
  123. public NeedComfrim AccountSure { get; set; }
  124. /// <summary>
  125. ///DEALCLOSETIME 平仓时间
  126. /// </summary>
  127. [PropertyDisc("DEALCLOSETIME")]
  128. public DateTime DealCloseTime
  129. {
  130. get; set;
  131. }
  132. /// <summary>
  133. ///BuyConfirmTime 买方确认时间
  134. /// </summary>
  135. [PropertyDisc("BuyConfirmTime")]
  136. public DateTime BuyConfirmTime { get; set; }
  137. /// <summary>
  138. ///sellconfirmtime 卖方确认时间
  139. /// </summary>
  140. [PropertyDisc("sellconfirmtime")]
  141. public DateTime SellConfirmTime { get; set; }
  142. /// <summary>
  143. /// 审核状态
  144. /// </summary>
  145. [PropertyDisc("AuditStatus")]
  146. public eAuditStatus AuditStatus { get; set; }
  147. /// <summary>
  148. /// 己方ID
  149. /// </summary>
  150. public ulong SelfAccountId { get; set; }
  151. /// <summary>
  152. /// 状态
  153. /// </summary>
  154. public string StatusDisplay
  155. {
  156. get
  157. {
  158. return Status.Discription();
  159. //if (IsShowComfrim)
  160. //{
  161. // return Status.Discription();
  162. //}
  163. //return "--";
  164. }
  165. }
  166. /// <summary>
  167. /// 对方Code
  168. /// </summary>
  169. public string PartnerCode
  170. {
  171. get
  172. {
  173. if (SelfAccountId == SellAccountId)
  174. {
  175. return BuyAccountCode;
  176. }
  177. else
  178. {
  179. return SellAccountCode;
  180. }
  181. }
  182. }
  183. /// <summary>
  184. /// 对方名称
  185. /// </summary>
  186. public string PartnerName
  187. {
  188. get
  189. {
  190. if (SelfAccountId == SellAccountId)
  191. {
  192. return BuyAccountName;
  193. }
  194. else
  195. {
  196. return SellAccountName;
  197. }
  198. }
  199. }
  200. public Direction Direction
  201. {
  202. get
  203. {
  204. if (SelfAccountId == SellAccountId)
  205. {
  206. return Direction.Ask;
  207. }
  208. else
  209. {
  210. return Direction.Bid;
  211. }
  212. }
  213. }
  214. /// <summary>
  215. /// 显示方向
  216. /// </summary>
  217. public string DirectionDisplay
  218. {
  219. get
  220. {
  221. return Direction.Discription();
  222. }
  223. }
  224. /// <summary>
  225. /// 是否可平仓
  226. /// </summary>
  227. public bool CanComfrim
  228. {
  229. get
  230. {
  231. if (AuditStatus != eAuditStatus.AUDITSTATUS_SUCCESS)
  232. {
  233. return false;
  234. }
  235. switch (Status)
  236. {
  237. case DealCloseStatus.AllComfirmed:
  238. case DealCloseStatus.AllTraded:
  239. case DealCloseStatus.Dealing:
  240. case DealCloseStatus.CloseFail:
  241. case DealCloseStatus.SysCancel:
  242. case DealCloseStatus.SelfCanel: ////不可确认的状态
  243. return false;
  244. }
  245. if (Direction == Direction.Ask) ////其他状态看对应方向的确认时间是否有值判断是否可确认
  246. {
  247. return SellConfirmTime == DateTime.MinValue;
  248. }
  249. else
  250. {
  251. return BuyConfirmTime == DateTime.MinValue;
  252. }
  253. }
  254. }
  255. /// <summary>
  256. /// /是否显示确认
  257. /// </summary>
  258. public bool IsShowComfrim
  259. {
  260. get
  261. {
  262. return AccountSure == NeedComfrim.Yes;
  263. }
  264. }
  265. }
  266. }