diff --git a/NX.ERP.BLL/Model/Inbound.cs b/NX.ERP.BLL/Model/Inbound.cs index 39198a8..6cf2edd 100644 --- a/NX.ERP.BLL/Model/Inbound.cs +++ b/NX.ERP.BLL/Model/Inbound.cs @@ -5,9 +5,10 @@ using System.Text; namespace NX.ERP.BLL.Model { - public class Inbound:NX.ERP.Model.BaseModel + public class Inbound : NX.ERP.Model.BaseModel { public string InboundNo { get; set; } + //[Newtonsoft.Json.JsonConverter(typeof(NX.ERP.Model.TimestampConverter))] public DateTime InboundDate { get; set; } public InboundType InboundType { get; set; } diff --git a/NX.ERP.BLL/NX.ERP.BLL.csproj b/NX.ERP.BLL/NX.ERP.BLL.csproj index f3c79a9..b40e051 100644 --- a/NX.ERP.BLL/NX.ERP.BLL.csproj +++ b/NX.ERP.BLL/NX.ERP.BLL.csproj @@ -31,6 +31,9 @@ 4 + + ..\packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll + @@ -61,5 +64,8 @@ NX.ERP.U8 + + + \ No newline at end of file diff --git a/NX.ERP.BLL/packages.config b/NX.ERP.BLL/packages.config new file mode 100644 index 0000000..d766d04 --- /dev/null +++ b/NX.ERP.BLL/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index 6e23d62..0d6ee2f 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -61,6 +61,7 @@ + diff --git a/NX.ERP.Model/TimestampConverter.cs b/NX.ERP.Model/TimestampConverter.cs new file mode 100644 index 0000000..7e4de80 --- /dev/null +++ b/NX.ERP.Model/TimestampConverter.cs @@ -0,0 +1,36 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model +{ + public class TimestampConverter : JsonConverter + { + public override bool CanConvert(Type objectType) + { + return objectType == typeof(DateTime); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + return ConvertIntDateTime(int.Parse(reader.Value.ToString())); + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(ConvertDateTimeInt((DateTime)value)); + } + + public static DateTime ConvertIntDateTime(int aSeconds) + { + return new DateTime(1970, 1, 1).AddSeconds(aSeconds); + } + + public static int ConvertDateTimeInt(DateTime aDT) + { + return (int)(aDT - new DateTime(1970, 1, 1)).TotalSeconds; + } + } +} diff --git a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs index 10e01f5..c307138 100644 --- a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs +++ b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs @@ -55,6 +55,8 @@ namespace NX.ERP.WebAPi { //忽略循环引用,如果设置为Error,则遇到循环引用的时候报错 ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + DateTimeZoneHandling=DateTimeZoneHandling.Local, + //NullValueHandling = NullValueHandling.Ignore, //Formatting = Newtonsoft.Json.Formatting.Indented, //小驼峰命名法 @@ -64,7 +66,7 @@ namespace NX.ERP.WebAPi NamingStrategy = new SnakeCaseNamingStrategy() } //格式化日期时间 - + //空值处理 //NullValueHandling = NullValueHandling.Ignore diff --git a/README.md b/README.md index ef70509..e7eab10 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ## U8API -##HTTP 错误 500.21 - Internal Server Error +### HTTP 错误 500.21 - Internal Server Error 处理程序“ExtensionlessUrlHandler-Integrated-4.0”在其模块列表中有一个错误模块“ManagedPipelineHandler” | C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i +### 时间不一致问题 +注册表 搜索sShortDate 全改为 yyyy-MM-dd + +