using System; using System.ComponentModel; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using Newtonsoft.Json; namespace Core.StlMes.Client.Mcp.Control.Entity { [Serializable] /// /// 数据库表HTT_CONTROL_LOG_DETAIL所对应的实体类(生成工具:代码生成工具4.0 访问地址:http://172.16.2.128/tool/) /// 作者:tgcx-test 时间:2018-07-23 /// public class HttControlLogDetailEntity { /// /// GUID主键 /// private string controlId = ""; /// /// 日志开始时间(‘YYYYMMDDhhmm’) /// private string logsBeg = ""; /// /// 日志结束时间(‘YYYYMMDDhhmm’) /// private string logsEnd = ""; /// /// 停机分类 /// private string stopType = ""; /// /// 停机原因 /// private string stopReason = ""; /// /// 停机小类 /// private string stopSmall = ""; /// /// 序号 /// private decimal? controlSeq = null; /// /// GUID主键 /// [Description("GUID主键")] [JsonProperty("controlId")] public string ControlId { get { return controlId; } set { controlId = value; } } /// /// 日志开始时间(‘YYYYMMDDhhmm’) /// [Description("开始时间")] [JsonProperty("logsBeg")] public string LogsBeg { get { return logsBeg; } set { logsBeg = value; } } /// /// 日志结束时间(‘YYYYMMDDhhmm’) /// [Description("结束时间")] [JsonProperty("logsEnd")] public string LogsEnd { get { return logsEnd; } set { logsEnd = value; } } /// /// 停机分类 /// [Description("停机分类")] [JsonProperty("stopType")] public string StopType { get { return stopType; } set { stopType = value; } } /// /// 停机原因 /// [Description("停机原因")] [JsonProperty("stopReason")] public string StopReason { get { return stopReason; } set { stopReason = value; } } /// /// 停机小类 /// [Description("停机小类")] [JsonProperty("stopSmall")] public string StopSmall { get { return stopSmall; } set { stopSmall = value; } } /// /// 序号 /// [Description("序号")] [JsonProperty("controlSeq")] public decimal? ControlSeq { get { return controlSeq; } set { controlSeq = value; } } /// /// 选择 /// [Description("选择")] [JsonProperty("Chk")] public bool Chk { get; set; } /// /// 工序点代码 /// private string stationCode = ""; /// /// 工序点代码 /// [Description("工序点 ")] [JsonProperty("stationCode")] public string StationCode { get { return stationCode; } set { stationCode = value; } } /// /// 工序点代码 /// private string memo = ""; /// /// 工序点代码 /// [Description("备注 ")] [JsonProperty("MEMO")] public string Memo { get { return memo; } set { memo = value; } } /// /// 生产用时 /// [Description("总时间(m)")] [JsonProperty("ProductTime")] public string ProductTime { get { DateTime dt1, dt2; if (DateTime.TryParse(logsBeg, out dt1) && DateTime.TryParse(logsEnd, out dt2)) { TimeSpan ts1 = new TimeSpan(dt1.Ticks); TimeSpan ts2 = new TimeSpan(dt2.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); return ts.TotalMinutes.ToString2(); } return ""; } } public HttControlLogDetailEntity Clone() { using (var memStream = new MemoryStream()) { var binaryFormatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone)); binaryFormatter.Serialize(memStream, this); memStream.Seek(0, SeekOrigin.Begin); return binaryFormatter.Deserialize(memStream) as HttControlLogDetailEntity; } } } }