diff --git a/Reportapi/MyCode.Project.Infrastructure/Common/JsonHelper.cs b/Reportapi/MyCode.Project.Infrastructure/Common/JsonHelper.cs index 6647ebc..0d10a7c 100644 --- a/Reportapi/MyCode.Project.Infrastructure/Common/JsonHelper.cs +++ b/Reportapi/MyCode.Project.Infrastructure/Common/JsonHelper.cs @@ -110,7 +110,8 @@ namespace MyCode.Project.Infrastructure.Common /// 目标对象 /// 是否将双引号转成单引号 /// 是否首字母小写 - public static string ToJson(object target, bool isConvertToSingleQuotes = false,bool isFirstLetterSmall = false) + /// 是否Null字段忽略不写入jason + public static string ToJson(object target, bool isConvertToSingleQuotes = false,bool isFirstLetterSmall = false,bool nullValueHandling=false) { if (target == null) return "{}"; @@ -125,7 +126,8 @@ namespace MyCode.Project.Infrastructure.Common { var settings = new JsonSerializerSettings(); settings.ContractResolver = new CamelCasePropertyNamesContractResolver();//首字母小写驼峰式命名 - + if(nullValueHandling) + settings.NullValueHandling = NullValueHandling.Ignore; result = JsonConvert.SerializeObject(target,settings); } diff --git a/Reportapi/MyCode.Project.OutSideService/Implementation/KingDeeService.cs b/Reportapi/MyCode.Project.OutSideService/Implementation/KingDeeService.cs index 1dbe892..d556f46 100644 --- a/Reportapi/MyCode.Project.OutSideService/Implementation/KingDeeService.cs +++ b/Reportapi/MyCode.Project.OutSideService/Implementation/KingDeeService.cs @@ -2,6 +2,7 @@ using MyCode.Project.Domain.Message.Request.KingDee; using MyCode.Project.Domain.Message.Response.KingDee; using MyCode.Project.Infrastructure.Common; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; @@ -92,8 +93,8 @@ namespace MyCode.Project.OutSideService.Implementation public string Save(string formId, BillSave billSave) { staClient = GetK3CloudClient(); - var datastr = JsonHelper.ToJson(billSave); - //LogHelper.Info(datastr); + var datastr = JsonHelper.ToJson(billSave,false, false, true); + LogHelper.Info(datastr); var resultString = staClient.Save(formId, datastr); if (resultString.Contains("ErrorCode")) { diff --git a/Reportapi/MyCode.Project.Services/Implementation/JackYunStockinService.cs b/Reportapi/MyCode.Project.Services/Implementation/JackYunStockinService.cs index 7177d46..91e0a52 100644 --- a/Reportapi/MyCode.Project.Services/Implementation/JackYunStockinService.cs +++ b/Reportapi/MyCode.Project.Services/Implementation/JackYunStockinService.cs @@ -111,6 +111,7 @@ namespace MyCode.Project.Services.Implementation var OutStockHead = list.Where(t => t.type != "+").Select(p => p.relDataId).Distinct().ToList(); OutStockHead.ForEach(relDataId => { + CreateAndStockoutGetRequestBizData requestBizData = new CreateAndStockoutGetRequestBizData(); List stockOutDetailViews = new List(); @@ -140,7 +141,7 @@ namespace MyCode.Project.Services.Implementation JackyunResponse response = Call(EnumAttribute.GetAttribute(ApiEnum.CREATEANDSTOCKOUT).Value, "1.0", requestBizData); //判断返回结果是否成功 if (response.code == "200") - { + { _wMStoJackyunInventoryMovementView1Repository.UpdateStatus(2, relDataId); } else diff --git a/Reportapi/MyCode.Project.Services/Implementation/OrderPushService.cs b/Reportapi/MyCode.Project.Services/Implementation/OrderPushService.cs index 2903fb8..4f5174f 100644 --- a/Reportapi/MyCode.Project.Services/Implementation/OrderPushService.cs +++ b/Reportapi/MyCode.Project.Services/Implementation/OrderPushService.cs @@ -18,7 +18,7 @@ using System.Threading.Tasks; namespace MyCode.Project.Services.Implementation { - public class OrderPushService : IOrderPushService //, IOrderPushService + public class OrderPushService : IOrderPushService { private IJackYunService _jackYunService; private IJackOrdersRepository _jackOrdersRepository;