HttControlLogDetailEntity.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. using System;
  2. using System.ComponentModel;
  3. using System.IO;
  4. using System.Runtime.Serialization;
  5. using System.Runtime.Serialization.Formatters.Binary;
  6. using Newtonsoft.Json;
  7. namespace Core.StlMes.Client.Mcp.Control.Entity
  8. {
  9. [Serializable]
  10. /// <summary>
  11. /// 数据库表HTT_CONTROL_LOG_DETAIL所对应的实体类(生成工具:代码生成工具4.0 访问地址:http://172.16.2.128/tool/)
  12. /// 作者:tgcx-test 时间:2018-07-23
  13. /// </summary>
  14. public class HttControlLogDetailEntity
  15. {
  16. /// <summary>
  17. /// GUID主键
  18. /// </summary>
  19. private string controlId = "";
  20. /// <summary>
  21. /// 日志开始时间(‘YYYYMMDDhhmm’)
  22. /// </summary>
  23. private string logsBeg = "";
  24. /// <summary>
  25. /// 日志结束时间(‘YYYYMMDDhhmm’)
  26. /// </summary>
  27. private string logsEnd = "";
  28. /// <summary>
  29. /// 停机分类
  30. /// </summary>
  31. private string stopType = "";
  32. /// <summary>
  33. /// 停机原因
  34. /// </summary>
  35. private string stopReason = "";
  36. /// <summary>
  37. /// 停机小类
  38. /// </summary>
  39. private string stopSmall = "";
  40. /// <summary>
  41. /// 序号
  42. /// </summary>
  43. private decimal? controlSeq = null;
  44. /// <summary>
  45. /// GUID主键
  46. /// </summary>
  47. [Description("GUID主键")]
  48. [JsonProperty("controlId")]
  49. public string ControlId
  50. {
  51. get { return controlId; }
  52. set { controlId = value; }
  53. }
  54. /// <summary>
  55. /// 日志开始时间(‘YYYYMMDDhhmm’)
  56. /// </summary>
  57. [Description("开始时间")]
  58. [JsonProperty("logsBeg")]
  59. public string LogsBeg
  60. {
  61. get { return logsBeg; }
  62. set { logsBeg = value; }
  63. }
  64. /// <summary>
  65. /// 日志结束时间(‘YYYYMMDDhhmm’)
  66. /// </summary>
  67. [Description("结束时间")]
  68. [JsonProperty("logsEnd")]
  69. public string LogsEnd
  70. {
  71. get { return logsEnd; }
  72. set { logsEnd = value; }
  73. }
  74. /// <summary>
  75. /// 停机分类
  76. /// </summary>
  77. [Description("停机分类")]
  78. [JsonProperty("stopType")]
  79. public string StopType
  80. {
  81. get { return stopType; }
  82. set { stopType = value; }
  83. }
  84. /// <summary>
  85. /// 停机原因
  86. /// </summary>
  87. [Description("停机原因")]
  88. [JsonProperty("stopReason")]
  89. public string StopReason
  90. {
  91. get { return stopReason; }
  92. set { stopReason = value; }
  93. }
  94. /// <summary>
  95. /// 停机小类
  96. /// </summary>
  97. [Description("停机小类")]
  98. [JsonProperty("stopSmall")]
  99. public string StopSmall
  100. {
  101. get { return stopSmall; }
  102. set { stopSmall = value; }
  103. }
  104. /// <summary>
  105. /// 序号
  106. /// </summary>
  107. [Description("序号")]
  108. [JsonProperty("controlSeq")]
  109. public decimal? ControlSeq
  110. {
  111. get { return controlSeq; }
  112. set { controlSeq = value; }
  113. }
  114. /// <summary>
  115. /// 选择
  116. /// </summary>
  117. [Description("选择")]
  118. [JsonProperty("Chk")]
  119. public bool Chk { get; set; }
  120. /// <summary>
  121. /// 工序点代码
  122. /// </summary>
  123. private string stationCode = "";
  124. /// <summary>
  125. /// 工序点代码
  126. /// </summary>
  127. [Description("工序点 ")]
  128. [JsonProperty("stationCode")]
  129. public string StationCode
  130. {
  131. get { return stationCode; }
  132. set { stationCode = value; }
  133. }
  134. /// <summary>
  135. /// 工序点代码
  136. /// </summary>
  137. private string memo = "";
  138. /// <summary>
  139. /// 工序点代码
  140. /// </summary>
  141. [Description("备注 ")]
  142. [JsonProperty("MEMO")]
  143. public string Memo
  144. {
  145. get { return memo; }
  146. set { memo = value; }
  147. }
  148. /// <summary>
  149. /// 生产用时
  150. /// </summary>
  151. [Description("总时间(m)")]
  152. [JsonProperty("ProductTime")]
  153. public string ProductTime
  154. {
  155. get
  156. {
  157. DateTime dt1, dt2;
  158. if (DateTime.TryParse(logsBeg, out dt1) && DateTime.TryParse(logsEnd, out dt2))
  159. {
  160. TimeSpan ts1 = new TimeSpan(dt1.Ticks);
  161. TimeSpan ts2 = new
  162. TimeSpan(dt2.Ticks);
  163. TimeSpan ts = ts1.Subtract(ts2).Duration();
  164. return ts.TotalMinutes.ToString2();
  165. }
  166. return "";
  167. }
  168. }
  169. public HttControlLogDetailEntity Clone()
  170. {
  171. using (var memStream = new MemoryStream())
  172. {
  173. var binaryFormatter = new BinaryFormatter(null,
  174. new StreamingContext(StreamingContextStates.Clone));
  175. binaryFormatter.Serialize(memStream, this);
  176. memStream.Seek(0, SeekOrigin.Begin);
  177. return binaryFormatter.Deserialize(memStream) as HttControlLogDetailEntity;
  178. }
  179. }
  180. }
  181. }