This commit is contained in:
杰 朱
2021-02-02 15:23:54 +08:00
7 changed files with 57 additions and 3 deletions

View File

@@ -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; }

View File

@@ -31,6 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -61,5 +64,8 @@
<Name>NX.ERP.U8</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net35" />
</packages>

View File

@@ -61,6 +61,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BaseModel.cs" />
<Compile Include="TimestampConverter.cs" />
<Compile Include="Request\Arrival.cs" />
<Compile Include="Request\Bin.cs" />
<Compile Include="Request\Customer.cs" />

View File

@@ -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;
}
}
}

View File

@@ -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

View File

@@ -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