using DeviceRepair.Models.Attr; using DeviceRepair.Models.Enum; using Newtonsoft.Json; using System.Linq; using TsSFCDevice.Client.Biz.Base.Utils; namespace TsSFCDevice.Client.Biz.His { public class FieldDataHistory { [HistoryFilterField(Code = "EnumType", CtlType = HistoryFilterCtlType.ComboBox, DefaultValue = "", Description = "主数据字段", ShowSequence = 0, QueryItems = "0:现象区分;1:维修方式;2:故障发生地;3:配件维护")] [JsonProperty("vFieldCode", NullValueHandling = NullValueHandling.Ignore)] public string vFieldCode { get; set; } [JsonProperty("oFieldCode", NullValueHandling = NullValueHandling.Ignore)] public string oFieldCode { get; set; } [JsonProperty("nFieldCode", NullValueHandling = NullValueHandling.Ignore)] public string nFieldCode { get; set; } [JsonProperty("oFieldType", NullValueHandling = NullValueHandling.Ignore)] public string oFieldType { get; set; } [JsonProperty("nFieldType", NullValueHandling = NullValueHandling.Ignore)] public string nFieldType { get; set; } /// /// 名称 /// [HistoryFilterField(Code = "FieldText", CtlType = HistoryFilterCtlType.TextBox, DefaultValue = "0", Description = "更改前名称", ShowSequence = 1)] [HistoryGridField(Description = "更改前名称", ShowSequence = 1)] [JsonProperty("oFieldText", NullValueHandling = NullValueHandling.Ignore)] public string oFieldText { get; set; } [HistoryGridField(Description = "更改后名称", ShowSequence = 2)] [JsonProperty("nFieldText", NullValueHandling = NullValueHandling.Ignore)] public string nFieldText { get; set; } /// /// 旧类型 /// [HistoryGridField(Description = "更改前值类型", ShowSequence = 3)] [JsonProperty("oFieldTypeDisplay", NullValueHandling = NullValueHandling.Ignore)] public string oFieldTypeDisplay { get { string vtype = ""; switch ((oFieldType?.ToUpper() ?? "")) { case "DECIMAL": vtype = "货币"; break; case "DOUBLE": vtype = "数值"; break; case "NVARCHAR": vtype = "文本值"; break; default: vtype = "N/A"; break; } return vtype; } } /// /// 新类型 /// [HistoryGridField(Description = "更改后值类型", ShowSequence = 4)] [JsonProperty("nFieldTypeDisplay", NullValueHandling = NullValueHandling.Ignore)] public string nFieldTypeDisplay { get { string vtype = ""; switch ((nFieldType?.ToUpper() ?? "")) { case "DECIMAL": vtype = "货币"; break; case "DOUBLE": vtype = "数值"; break; case "NVARCHAR": vtype = "文本值"; break; default: vtype = "N/A"; break; } return vtype; } } /// /// 旧值 /// [HistoryGridField(Description = "更改前值", ShowSequence = 5)] [JsonProperty("oFieldValue", NullValueHandling = NullValueHandling.Ignore)] public string oFieldValue { get; set; } /// /// 新值 /// [HistoryGridField(Description = "更改后值", ShowSequence = 6)] [JsonProperty("nFieldValue", NullValueHandling = NullValueHandling.Ignore)] public string nFieldValue { get; set; } [JsonProperty("Operator", NullValueHandling = NullValueHandling.Ignore)] public int Operator { get; set; } [HistoryGridField(Description = "操作人", ShowSequence = 7)] [JsonProperty("OperatorName", NullValueHandling = NullValueHandling.Ignore)] public string OperatorName { get { var us = Utility.SystemRuntimeInfo.CurrentUsersCaches.FirstOrDefault(x => x.Id == Operator); return (us?.UserCode) ?? "N/A"; } } [HistoryGridField(Description = "操作时间", ShowSequence = 8)] [JsonProperty("OperationDate", NullValueHandling = NullValueHandling.Ignore)] public string OperationDate { get; set; } [HistoryGridField(Description = "操作客户端", ShowSequence = 9)] [JsonProperty("OperationComputer", NullValueHandling = NullValueHandling.Ignore)] public string OperationComputer { get; set; } } }