Browse Source

更新配置信息

dev_DY_CC
赵新宇 1 year ago
parent
commit
248d92f48c
  1. 70
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
  2. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
  3. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs
  4. 10
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Caches/CacheAppService.cs
  5. 11
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs

70
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs

@ -1,4 +1,8 @@
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
@ -25,7 +29,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
#pragma warning restore 8618
private System.Net.Http.HttpClient _httpClient;
private static System.Lazy<System.Text.Json.JsonSerializerOptions> _settings = new System.Lazy<System.Text.Json.JsonSerializerOptions>(CreateSerializerSettings, true);
private static System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings, true);
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public Client(string baseUrl, System.Net.Http.HttpClient httpClient)
@ -35,9 +39,9 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
_httpClient = httpClient;
}
private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings()
private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
var settings = new System.Text.Json.JsonSerializerOptions();
var settings = new Newtonsoft.Json.JsonSerializerSettings();
UpdateJsonSerializerSettings(settings);
return settings;
}
@ -53,9 +57,9 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
}
}
protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } }
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } }
static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings);
static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
@ -208,15 +212,15 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(int? areaID)
public virtual System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string p_AreaID)
{
return GetCargoStaticAsync(areaID, System.Threading.CancellationToken.None);
return GetCargoStaticAsync(p_AreaID, System.Threading.CancellationToken.None);
}
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(int? areaID, System.Threading.CancellationToken cancellationToken)
public virtual async System.Threading.Tasks.Task<System.Collections.Generic.ICollection<ResponCargoItem>> GetCargoStaticAsync(string p_AreaID, System.Threading.CancellationToken cancellationToken)
{
var client_ = _httpClient;
var disposeClient_ = false;
@ -233,9 +237,9 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
// Operation Path: "CargoState/GetCargoStatic"
urlBuilder_.Append("CargoState/GetCargoStatic");
urlBuilder_.Append('?');
if (areaID != null)
if (p_AreaID != null)
{
urlBuilder_.Append(System.Uri.EscapeDataString("AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(areaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
urlBuilder_.Append(System.Uri.EscapeDataString("p_AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(p_AreaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
}
urlBuilder_.Length--;
@ -378,10 +382,10 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
var typedBody = System.Text.Json.JsonSerializer.Deserialize<T>(responseText, JsonSerializerSettings);
var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject<T>(responseText, JsonSerializerSettings);
return new ObjectResponseResult<T>(typedBody, responseText);
}
catch (System.Text.Json.JsonException exception)
catch (Newtonsoft.Json.JsonException exception)
{
var message = "Could not deserialize the response body string as " + typeof(T).FullName + ".";
throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception);
@ -392,12 +396,15 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
try
{
using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
using (var streamReader = new System.IO.StreamReader(responseStream))
using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader))
{
var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync<T>(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false);
var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings);
var typedBody = serializer.Deserialize<T>(jsonTextReader);
return new ObjectResponseResult<T>(typedBody, string.Empty);
}
}
catch (System.Text.Json.JsonException exception)
catch (Newtonsoft.Json.JsonException exception)
{
var message = "Could not deserialize the response body stream as " + typeof(T).FullName + ".";
throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception);
@ -463,20 +470,19 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class RemoteServiceErrorInfo
{
[System.Text.Json.Serialization.JsonPropertyName("code")]
[Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Code { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("message")]
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Message { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("details")]
[Newtonsoft.Json.JsonProperty("details", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Details { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("data")]
[Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary<string, object> Data { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("validationErrors")]
[Newtonsoft.Json.JsonProperty("validationErrors", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<RemoteServiceValidationErrorInfo> ValidationErrors { get; set; }
}
@ -484,8 +490,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class RemoteServiceErrorResponse
{
[System.Text.Json.Serialization.JsonPropertyName("error")]
[Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public RemoteServiceErrorInfo Error { get; set; }
}
@ -493,11 +498,10 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class RemoteServiceValidationErrorInfo
{
[System.Text.Json.Serialization.JsonPropertyName("message")]
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Message { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("members")]
[Newtonsoft.Json.JsonProperty("members", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> Members { get; set; }
}
@ -508,29 +512,25 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
/// <summary>
/// 区域ID
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("areaID")]
public int AreaID { get; set; }
[Newtonsoft.Json.JsonProperty("areaID", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string AreaID { get; set; }
/// <summary>
/// 货位号
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("cargoID")]
[Newtonsoft.Json.JsonProperty("cargoID", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CargoID { get; set; }
/// <summary>
/// 零件号
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("partCode")]
[Newtonsoft.Json.JsonProperty("partCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PartCode { get; set; }
/// <summary>
/// 货位状态
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("flag")]
[Newtonsoft.Json.JsonProperty("flag", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int Flag { get; set; }
}

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

@ -88,7 +88,7 @@ public class InjectionMoldingRequestReader : IReader
List<ResponCargoItem> camralist = new List<ResponCargoItem>();
foreach (var itm in ids)//遍历区域查找所有货物
{
var idsList= await client.GetCargoStaticAsync(int.Parse(itm)).ConfigureAwait(false);
var idsList= await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
camralist.AddRange(idsList);
}
camralist = camralist.Where(p=>p.Flag==0).ToList();
@ -195,10 +195,6 @@ public class InjectionMoldingRequestReader : IReader
if (itm == null) { errors.Add($"编号:{request.ItemCode}零件表中没找到!"); }
else
{
// 更新请求中的零件描述和名称
request.ItemDesc1 = itm.Desc1;
request.ItemDesc2 = itm.Desc2;

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs

@ -24,7 +24,7 @@ public class ResponCargoItem
{
// 区域ID
[Display(Name = "区域ID")]
public int AreaID { set; get; } = 0;
public string AreaID { set; get; }
// 货位号
[Display(Name = "货位号")]
public string CargoID { set; get; } = "";

10
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Caches/CacheAppService.cs

@ -80,11 +80,21 @@ public class CacheService:ISingletonDependency
};
}).ConfigureAwait(false);
}
/// <summary>
/// 异步开始生命周期操作不能堵塞
/// </summary>
public async Task StartAsync()
{
BomsCycle();//异步处理不能堵塞主任务
}

11
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.Drawing;
using Microsoft.AspNetCore.Authorization;
@ -50,16 +51,16 @@ public class TestService:ApplicationService
/// <summary>
/// 异步开始生命周期操作不能堵塞
/// </summary>
public async Task<List<ResponCargoItem>> GetCargoStatic(int AreaID)
public async Task<List<ResponCargoItem>> GetCargoStatic(string p_AreaID)
{
List<ResponCargoItem> result = new List<ResponCargoItem>();
result.Add(new ResponCargoItem() { AreaID = 1, CargoID = "PTXB1", PartCode = "TMDLYA0A071AB", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = 1, CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = 2, CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB1", PartCode = "TMDLYA0A071AB", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = "1", CargoID = "PTXB2", PartCode = "TMDLYA0A061AB", Flag = 0 });
result.Add(new ResponCargoItem() { AreaID = "2", CargoID = "ZSXB2", PartCode = "TMDLYD0ABM5A", Flag = 0 });
result = result.Where(p => p.AreaID == p_AreaID).ToList();
return result;

Loading…
Cancel
Save