Browse Source

更新KITTING,测试数据不要删

dev_DY_CC
赵新宇 1 year ago
parent
commit
0f62bcbd4a
  1. 625
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
  2. 235
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
  3. 3
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskOptions.cs
  4. 6
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json
  5. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDetailDTO.cs
  6. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingDetailInput.cs
  7. 34
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs
  8. 37
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs
  9. 34
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Caches/CacheAppService.cs
  10. 28
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs
  11. 6
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAutoMapperProfile.cs
  12. 71
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs
  13. 64
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  14. 9
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingDetail.cs
  15. 4
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs
  16. 10
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs
  17. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs
  18. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/InjectionIssueRequests/DTOs/InjectionIssueRequestDetailDTO.cs
  19. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/InjectionIssueRequests/IInjectionIssueRequestAppService.cs
  20. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
  21. 30
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/InjectionIssueRequests/InjectionIssueRequestAppService.cs

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

@ -1,72 +1,587 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using StackExchange.Redis;
using Volo.Abp.Application.Services;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent;
using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Client;
public class WebServiceAppService : IReader
#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."
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
#pragma warning disable 612 // Disable "CS0612 '...' is obsolete"
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
{
private readonly IHttpClientFactory _httpClientFactory;
private readonly IOptions<InjectionMoldingTaskOptions> _options;
using System = global::System;
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class Client
{
#pragma warning disable 8618
private string _baseUrl;
#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);
#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)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
BaseUrl = baseUrl;
_httpClient = httpClient;
}
private static System.Text.Json.JsonSerializerOptions CreateSerializerSettings()
{
var settings = new System.Text.Json.JsonSerializerOptions();
UpdateJsonSerializerSettings(settings);
return settings;
}
public string BaseUrl
{
get { return _baseUrl; }
set
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
_baseUrl += '/';
}
}
protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _settings.Value; } }
static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions 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);
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
/// <summary>
/// 生命周期操作
/// </summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<int> GetMacStaticAsync()
{
return GetMacStaticAsync(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>
/// <summary>
/// 生命周期操作
/// </summary>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<int> GetMacStaticAsync(System.Threading.CancellationToken cancellationToken)
{
var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain");
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "CargoState/GetMacStatic"
urlBuilder_.Append("CargoState/GetMacStatic");
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
PrepareRequest(client_, request_, url_);
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
var disposeResponse_ = true;
try
{
var headers_ = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.IEnumerable<string>>();
foreach (var item_ in response_.Headers)
headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
headers_[item_.Key] = item_.Value;
}
ProcessResponse(client_, response_);
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<int>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
return objectResponse_.Object;
}
else
if (status_ == 403)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 401)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 400)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 404)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 501)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 500)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
}
}
finally
{
if (disposeResponse_)
response_.Dispose();
}
}
}
finally
{
if (disposeClient_)
client_.Dispose();
}
}
/// <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)
{
return GetCargoStaticAsync(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)
{
var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "text/plain");
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));
var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "CargoState/GetCargoStatic"
urlBuilder_.Append("CargoState/GetCargoStatic");
urlBuilder_.Append('?');
if (areaID != null)
{
urlBuilder_.Append(System.Uri.EscapeDataString("AreaID")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(areaID, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
}
urlBuilder_.Length--;
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
PrepareRequest(client_, request_, url_);
var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
var disposeResponse_ = true;
try
{
var headers_ = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.IEnumerable<string>>();
foreach (var item_ in response_.Headers)
headers_[item_.Key] = item_.Value;
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
headers_[item_.Key] = item_.Value;
}
ProcessResponse(client_, response_);
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<System.Collections.Generic.ICollection<ResponCargoItem>>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
return objectResponse_.Object;
}
else
if (status_ == 403)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 401)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 400)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 404)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 501)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 500)
{
var objectResponse_ = await ReadObjectResponseAsync<RemoteServiceErrorResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
throw new ApiException<RemoteServiceErrorResponse>("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
}
}
finally
{
if (disposeResponse_)
response_.Dispose();
}
}
}
finally
{
if (disposeClient_)
client_.Dispose();
}
}
protected struct ObjectResponseResult<T>
{
public ObjectResponseResult(T responseObject, string responseText)
{
this.Object = responseObject;
this.Text = responseText;
}
public T Object { get; }
public string Text { get; }
}
public WebServiceAppService(IHttpClientFactory httpClientFactory, IOptions<InjectionMoldingTaskOptions> options)
public bool ReadResponseAsString { get; set; }
protected virtual async System.Threading.Tasks.Task<ObjectResponseResult<T>> ReadObjectResponseAsync<T>(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.Threading.CancellationToken cancellationToken)
{
if (response == null || response.Content == null)
{
return new ObjectResponseResult<T>(default(T), string.Empty);
}
if (ReadResponseAsString)
{
var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
var typedBody = System.Text.Json.JsonSerializer.Deserialize<T>(responseText, JsonSerializerSettings);
return new ObjectResponseResult<T>(typedBody, responseText);
}
catch (System.Text.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);
}
}
else
{
try
{
using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
var typedBody = await System.Text.Json.JsonSerializer.DeserializeAsync<T>(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false);
return new ObjectResponseResult<T>(typedBody, string.Empty);
}
}
catch (System.Text.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);
}
}
}
private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo)
{
if (value == null)
{
return "";
}
if (value is System.Enum)
{
var name = System.Enum.GetName(value.GetType(), value);
if (name != null)
{
var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name);
if (field != null)
{
var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute))
as System.Runtime.Serialization.EnumMemberAttribute;
if (attribute != null)
{
return attribute.Value != null ? attribute.Value : name;
}
}
var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo));
return converted == null ? string.Empty : converted;
}
}
else if (value is bool)
{
return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant();
}
else if (value is byte[])
{
return System.Convert.ToBase64String((byte[])value);
}
else if (value is string[])
{
return string.Join(",", (string[])value);
}
else if (value.GetType().IsArray)
{
var valueArray = (System.Array)value;
var valueTextArray = new string[valueArray.Length];
for (var i = 0; i < valueArray.Length; i++)
{
valueTextArray[i] = ConvertToString(valueArray.GetValue(i), cultureInfo);
}
return string.Join(",", valueTextArray);
}
var result = System.Convert.ToString(value, cultureInfo);
return result == null ? "" : result;
}
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class RemoteServiceErrorInfo
{
_httpClientFactory = httpClientFactory;
_options = options;
[System.Text.Json.Serialization.JsonPropertyName("code")]
public string Code { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("message")]
public string Message { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("details")]
public string Details { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("data")]
public System.Collections.Generic.IDictionary<string, object> Data { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("validationErrors")]
public System.Collections.Generic.ICollection<RemoteServiceValidationErrorInfo> ValidationErrors { get; set; }
}
public Task<List<IncomingFromExternal>> ReadAsync()
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class RemoteServiceErrorResponse
{
throw new NotImplementedException();
[System.Text.Json.Serialization.JsonPropertyName("error")]
public RemoteServiceErrorInfo Error { get; set; }
}
[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")]
public string Message { get; set; }
[System.Text.Json.Serialization.JsonPropertyName("members")]
public System.Collections.Generic.ICollection<string> Members { get; set; }
}
/// <summary>
///
/// </summary>
/// <param name="p_type"></param>
/// <returns></returns>
public async Task<string> WebApi(int p_type)
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class ResponCargoItem
{
/// <summary>
/// 区域ID
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("areaID")]
public int AreaID { get; set; }
/// <summary>
/// 货位号
/// </summary>
//var client = _httpClientFactory.CreateClient();
//// 设置用户名和密码
//var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
//client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
//// 发送HTTP请求
//var response = await client.GetAsync("https://example.com/api/data");
//if (response.IsSuccessStatusCode)
//{
// return await response.Content.ReadAsStringAsync();
//}
// SoapClient
var address = _options.Value.AutoRemote.IpAddress;
var username = _options.Value.AutoRemote.UserName;
var password=_options.Value.AutoRemote.Password;
var token= _options.Value.AutoRemote.Token;
var client = _httpClientFactory.CreateClient();
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
var response = await client.GetAsync("https://example.com/api/data").ConfigureAwait(false);
if (response.IsSuccessStatusCode)
[System.Text.Json.Serialization.JsonPropertyName("cargoID")]
public string CargoID { get; set; }
/// <summary>
/// 零件号
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("partCode")]
public string PartCode { get; set; }
/// <summary>
/// 货位状态
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("flag")]
public int Flag { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class ApiException : System.Exception
{
public int StatusCode { get; private set; }
public string Response { get; private set; }
public System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> Headers { get; private set; }
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, System.Exception innerException)
: base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException)
{
StatusCode = statusCode;
Response = response;
Headers = headers;
}
public override string ToString()
{
return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString());
}
}
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class ApiException<TResult> : ApiException
{
public TResult Result { get; private set; }
public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> headers, TResult result, System.Exception innerException)
: base(message, statusCode, response, headers, innerException)
{
return await response.Content.ReadAsStringAsync();
Result = result;
}
return "Error occurred";
}
}
#pragma warning restore 108
#pragma warning restore 114
#pragma warning restore 472
#pragma warning restore 612
#pragma warning restore 1573
#pragma warning restore 1591
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8625

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

@ -19,6 +19,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts;
using System.Text.Json.Serialization;
using System.IdentityModel.Tokens.Jwt;
using Volo.Abp;
using System.Net.NetworkInformation;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming;
public class InjectionMoldingRequestReader : IReader
{
@ -60,69 +61,112 @@ public class InjectionMoldingRequestReader : IReader
try
{
// 获取注塑叫料任务数量
var count = await _injectionRequest.GetCountAsync().ConfigureAwait(false);
List<InjectionIssueRequestEditInput> joblist = new List<InjectionIssueRequestEditInput>();
if (count == 0)
{
//var count = await _injectionRequest.GetCountAsync().ConfigureAwait(false);
//List<InjectionIssueRequestEditInput> joblist = new List<InjectionIssueRequestEditInput>();
//if (count == 0)
//{
// 调用 ReaderCameraApi 方法获取摄像头信息
string camera = await ReaderCameraApi().ConfigureAwait(false);
List<InjectionRequest> cameraList = new List<InjectionRequest>();
if (camera == "Error occured")
Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
var flag= await client.GetMacStaticAsync().ConfigureAwait(false);
if (flag!=1)
{
// 记录错误日志并返回空列表
_logger.LogInformation($"没有读取到摄像头信息{DateTime.Now},请检查网络");
_logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头");
return new List<IncomingFromExternal>();
}
if (string.IsNullOrEmpty(_options.Value.AutoRemote.AreaIDs))
{
_logger.LogInformation($"没有设置指定区域AutoRemote->AreaIDs");
return new List<IncomingFromExternal>();
}
//将摄像头信息转换为注塑叫料明细任务数据
cameraList = System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(camera);
//测试数据
//var cameraList = new List<InjectionRequest>()
//{
// new InjectionRequest() { ItemCode = "THILDD0A542AG", ToLocCode = "ZSXB2", Qty = 100 },
// };
InjectionIssueRequestEditInput input = new InjectionIssueRequestEditInput();
input.Worker = "Vision";
input.Type = "Vision";
input.AutoSubmit = true;
input.ActiveDate = DateTime.Now;
input.UseOnTheWayLocation = false;
input.Remark = "视觉叫料";
List<InjectionIssueRequestDetailInput> injectionRequestDetails = new List<InjectionIssueRequestDetailInput>();
foreach (var job in cameraList)
var ids=_options.Value.AutoRemote.AreaIDs.Split(",");
List<ResponCargoItem> camralist = new List<ResponCargoItem>();
foreach (var itm in ids)//遍历区域查找所有货物
{
var detailInput = new InjectionIssueRequestDetailInput()
{
ItemCode = job.ItemCode,
ToLocationCode = job.ToLocCode,
Qty = job.Qty,
RecommendType = EnumRecommendType.W,
IssuedQty = 0,
ReceivedQty = 0,
Status = EnumStatus.Open,
RequestStatus = EnumRequestStatus.New,
};
// 添加注塑叫料明细任务数据
injectionRequestDetails.Add(detailInput);
var idsList= await client.GetCargoStaticAsync(int.Parse(itm)).ConfigureAwait(false);
camralist.AddRange(idsList);
}
input.Details.AddRange(injectionRequestDetails);
// 通过 BindAsync 方法对零件仓库进行赋值
var errors = await BindAsync(input.Details).ConfigureAwait(false);
if (errors.Count > 0)
camralist = camralist.Where(p=>p.Flag==0).ToList();
List<UnCompletedRequestDto> inputdetail=new List<UnCompletedRequestDto>();
foreach (var item in camralist)
{
UnCompletedRequestDto jobrequestinput = new UnCompletedRequestDto();
jobrequestinput.ItemCode = item.PartCode;
jobrequestinput.LocCode = item.AreaID.ToString();
jobrequestinput.PositionCode = item.CargoID.ToString();
inputdetail.Add(jobrequestinput);
}
var uncompletelist= await _injectionRequest.GetUnCompletedRequestAsync(inputdetail).ConfigureAwait(false);//将所有库位零件信息查找未完成记录
var query = from itm in camralist
join itm1 in uncompletelist on new { locCode = itm.AreaID.ToString(), itmCode = itm.PartCode, PositionCode = itm.CargoID.ToString() }
equals new { locCode = itm1.LocCode, itmCode = itm1.ItemCode, PositionCode = itm1.PositionCode} into temp
from tm in temp.DefaultIfEmpty()
where tm == null
select itm;
var injectionList=query.ToList();//已经完成的记录
foreach (var inject in injectionList)
{
// 记录错误日志并返回空列表
foreach (var error in errors)
List<InjectionRequest> cameraList = new List<InjectionRequest>();
InjectionIssueRequestEditInput input = new InjectionIssueRequestEditInput();
input.Worker = "Vision";
input.Type = "Vision";
input.AutoSubmit = true;
input.ActiveDate = DateTime.Now;
input.UseOnTheWayLocation = false;
input.Remark = "视觉叫料";
List<InjectionIssueRequestDetailInput> injectionRequestDetails = new List<InjectionIssueRequestDetailInput>();
//foreach (var job in cameraList)
//{
var detailInput = new InjectionIssueRequestDetailInput()
{
ItemCode = inject.PartCode,
ToLocationCode = inject.AreaID.ToString(),
PositionCode=inject.CargoID,
Qty = 1,
RecommendType = EnumRecommendType.W,
IssuedQty = 0,
ReceivedQty = 0,
Status = EnumStatus.Open,
RequestStatus = EnumRequestStatus.New,
BoxQty=1
};
// 添加注塑叫料明细任务数据
injectionRequestDetails.Add(detailInput);
//}
input.Details.AddRange(injectionRequestDetails);
// 通过 BindAsync 方法对零件仓库进行赋值
var errors = await BindAsync(input.Details).ConfigureAwait(false);
if (errors.Count > 0)
{
_logger.LogInformation(error);
// 记录错误日志并返回空列表
foreach (var error in errors)
{
_logger.LogInformation(error);
}
return new List<IncomingFromExternal>();
}
return new List<IncomingFromExternal>();
// 创建新的注塑请求并将数据写入数据库
await _injectionRequest.CreateAsync(input).ConfigureAwait(false);
}
// 创建新的注塑请求并将数据写入数据库
await _injectionRequest.CreateAsync(input).ConfigureAwait(false);
}
else
{
_logger.LogInformation("注塑叫料任务已存在,无需读取");
}
//}
//else
//{
// _logger.LogInformation("注塑叫料任务已存在,无需读取");
//}
}
// 捕获特定异常并记录日志
@ -151,6 +195,10 @@ public class InjectionMoldingRequestReader : IReader
if (itm == null) { errors.Add($"编号:{request.ItemCode}零件表中没找到!"); }
else
{
// 更新请求中的零件描述和名称
request.ItemDesc1 = itm.Desc1;
request.ItemDesc2 = itm.Desc2;
@ -162,6 +210,7 @@ public class InjectionMoldingRequestReader : IReader
if (loc == null) { errors.Add($"编号:{request.ToLocationCode}库位表中没找到!"); }
else
{
// 更新请求中的库位相关信息
request.ToLocationCode = loc.Code;
request.ToLocationGroup = loc.LocationGroupCode;
@ -174,55 +223,55 @@ public class InjectionMoldingRequestReader : IReader
return errors;
}
/// <summary>
/// 读取摄像头API
/// </summary>
/// <param name="p_type"></param>
/// <returns></returns>
public async Task<string> ReaderCameraApi()
{
// /// <summary>
// /// 读取摄像头API
// /// </summary>
// /// <param name="p_type"></param>
// /// <returns></returns>
// public async Task<string> ReaderCameraApi()
// {
try
{
// try
// {
// 从配置中获取远程摄像头的地址、用户名、密码和令牌
var address = _options.Value.AutoRemote.IpAddress;
var username = _options.Value.AutoRemote.UserName;
var password = _options.Value.AutoRemote.Password;
var token = _options.Value.AutoRemote.Token;
// // 从配置中获取远程摄像头的地址、用户名、密码和令牌
// var address = _options.Value.AutoRemote.IpAddress;
// var username = _options.Value.AutoRemote.UserName;
// var password = _options.Value.AutoRemote.Password;
// var token = _options.Value.AutoRemote.Token;
// 创建一个HttpClient实例
var client = _httpClientFactory.CreateClient();
// // 创建一个HttpClient实例
// var client = _httpClientFactory.CreateClient();
// 将用户名和密码转换为Base64编码的凭据,并设置请求的身份验证信息
var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
// // 将用户名和密码转换为Base64编码的凭据,并设置请求的身份验证信息
// var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{password}"));
// client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
// 发送GET请求到远程摄像头地址并等待响应
var response = await client.GetAsync(address).ConfigureAwait(false);
// // 发送GET请求到远程摄像头地址并等待响应
// var response = await client.PostAsync(address, new StringContent(token, Encoding.UTF8, "application/json")).ConfigureAwait(false);
// 如果请求成功,则返回响应内容,否则返回错误信息
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
}
catch (HttpRequestException ex)
{
_logger.LogInformation("远程摄像头连接失败:" + ex.Message);
}
// // 如果请求成功,则返回响应内容,否则返回错误信息
// if (response.IsSuccessStatusCode)
// {
// return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
// }
// }
// catch (HttpRequestException ex)
// {
// _logger.LogInformation("远程摄像头连接失败:" + ex.Message);
return "Error occurred";
}
// }
private List<InjectionRequest> Parse(string p_str)
{
List<InjectionRequest> requests = new List<InjectionRequest>();
// return "Error occurred";
// }
return System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(p_str);
}
// private List<InjectionRequest> Parse(string p_str)
// {
// List<InjectionRequest> requests = new List<InjectionRequest>();
// return System.Text.Json.JsonSerializer.Deserialize<List<InjectionRequest>>(p_str);
// }
@ -231,7 +280,7 @@ public class InjectionMoldingRequestReader : IReader
public class InjectionRequest
public class InjectionRequest
{
/// <summary>
/// 零件M
@ -256,7 +305,7 @@ public class InjectionRequest
}

3
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/InjectionMoldingTaskOptions.cs

@ -24,6 +24,9 @@ public class InjectionAutoRemote
public string Password { set; get; }
// 令牌
public string Token { set; get; }
public string AreaIDs { set; get; }
}

6
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json

@ -67,11 +67,11 @@
"InjectionMoldingTaskOptions": {
"AutoRemote": {
"IpAddress": "http://10.164.113.31:60085/",
"IpAddress": "http://localhost:59094/",
"UserName": "",
"Password": "",
"Token": ""
"Token": "",
"AreaIDs": "1"
},
"IncomingOptions": {

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDetailDTO.cs

@ -20,17 +20,17 @@ public class KittingDetailDTO: AuditedEntityDto<Guid>, IMultiTenant, IRemark
/// 物料编码
/// </summary>
[Display(Name = "物料编码")]
public string PartCode { set; get; }
public string ItemCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
[Display(Name = "描述1")]
public string Desc1 { set; get; }
public string ItemDesc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
[Display(Name = "描述2")]
public string Desc2 { set; get; }
public string ItemDesc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingDetailInput.cs

@ -20,17 +20,17 @@ public class KittingDetailInput: EntityDto<Guid>, IMultiTenant, IRemark
/// 物料编码
/// </summary>
[Display(Name = "物料编码")]
public string PartCode { set; get; }
public string ItemCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
[Display(Name = "描述1")]
public string Desc1 { set; get; }
public string ItemDesc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
[Display(Name = "描述2")]
public string Desc2 { set; get; }
public string ItemDesc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>

34
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/Inputs/KittingImportInput.cs

@ -8,32 +8,32 @@ public class KittingImportInput : SfsBaseDataImportInputBase
/// <summary>
/// Kitting编码
/// </summary>
[Display(Name = "Kitting编码")]
public string Code { get; set; }
///
[Display(Name = "物料编码")]
public string ItemCode { set; get; }
/// <summary>
/// Kitting名称
/// 描述1
/// </summary>
[Display(Name = "Kitting名称")]
public string Name { get; set; }
[Display(Name = "描述1")]
public string ItemDesc1 { set; get; }
/// <summary>
/// 物料编码
/// 描述2
/// </summary>
[Display(Name = "物料编码")]
public string PartCode { set; get; }
[Display(Name = "描述2")]
public string ItemDesc2 { set; get; }
/// <summary>
/// 描述1
/// </summary>
[Display(Name = "物料描述1")]
public string Desc1 { set; get; }
[Display(Name = "Kitting编码")]
public string Code { get; set; }
/// <summary>
/// 描述2
/// Kitting名称
/// </summary>
[Display(Name = "物料描述2")]
public string Desc2 { set; get; }
[Display(Name = "Kitting名称")]
public string Name { get; set; }
/// <summary>
/// 包装数量

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

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win_in.Sfs.Basedata.tests;
[Serializable]
//测试文件暂时不删除
public class ResponseJson
{
// 错误码:
public int Code { set; get; } = 0;
// 返回值 其具体含义由调用接口确定
public string Value { set; get; } = "";
// 错误消息
public string Msg { set; get; } = "";
}
[Serializable]
public class ResponCargoItem
{
// 区域ID
[Display(Name = "区域ID")]
public int AreaID { set; get; } = 0;
// 货位号
[Display(Name = "货位号")]
public string CargoID { set; get; } = "";
// 零件号
[Display(Name = "零件号")]
public string PartCode { set; get; } = "";
//货位状态 1 – 货位占用 0 – 货位空闲
[Display(Name = "货位状态")]
public int Flag { set; get; } = 0;
}

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

@ -43,13 +43,6 @@ public class TaskItem
public class CycleOptions
{
/// <summary>
@ -76,22 +69,17 @@ public class CacheService:ISingletonDependency
/// </summary>
private async Task BomsCycle()
{
//Task.Run(async () =>
//{
var reassigner = new Reassigner(DateTime.Now, new TimeSpan(0, 0, _options.Value.BomsCycle == 0 ? 60 : _options.Value.BomsCycle));
await reassigner.RunAsync(async () =>
{
using var serviceScope = _serviceProvider.CreateScope();
var repository = serviceScope.ServiceProvider.GetRequiredService<IBomRepository>();
Cache.Boms.Clear();
Cache.Boms = await repository.GetListAsync().ConfigureAwait(false);
}).ConfigureAwait(false);
//});
;
var reassigner = new Reassigner(DateTime.Now, new TimeSpan(0, 0, _options.Value.BomsCycle == 0 ? 60 : _options.Value.BomsCycle));
await reassigner.RunAsync(async () =>
{
using (var serviceScope = _serviceProvider.CreateScope())
{
var repository = serviceScope.ServiceProvider.GetRequiredService<IBomRepository>();
Cache.Boms.Clear();
Cache.Boms = await repository.GetListAsync().ConfigureAwait(false);
};
}).ConfigureAwait(false);
}
/// <summary>
/// 异步开始生命周期操作不能堵塞
/// </summary>
@ -100,8 +88,6 @@ public class CacheService:ISingletonDependency
BomsCycle();//异步处理不能堵塞主任务
}
}

28
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs

@ -55,10 +55,9 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, Kitt
var detailquery=await _repository.WithDetailsAsync().ConfigureAwait(false);
var first = detailquery.FirstOrDefault(p => p.Code == input.Code);
var codes = input.Details.Select(p => p.PartCode);
var codes = input.Details.Select(p => p.ItemCode);
if (first != null)
{
throw new UserFriendlyException($"已存在编码:{input.Code}的Kitting箱");
//var query = from itm in input.Details
// join itm1 in first.Details on itm.PartCode equals itm1.PartCode
@ -86,7 +85,6 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, Kitt
});
entity = await _repository.InsertAsync(entity).ConfigureAwait(false);
return ObjectMapper.Map<Kitting, KittingDTO>(entity);
}
//first.Details.Where(p => codes.Contains(p.PartCode));
@ -151,13 +149,11 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, Kitt
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
var inputFileBytes = ms.GetAllBytes();
var importList= _excelService.Import<KittingImportInput>(inputFileBytes).ToList();
var checklist=importList.GroupBy(p => new { p.Code, p.PartCode }).Where(g => g.Count() > 1).Select(p => new { Code = p.Key.Code, PartCode = p.Key.PartCode });//导入重复报错 //检测是否导入重复
var checklist=importList.GroupBy(p => new { p.Code, p.ItemCode }).Where(g => g.Count() > 1).Select(p => new { Code = p.Key.Code, PartCode = p.Key.ItemCode });//导入重复报错 //检测是否导入重复
List<KittingErrorDto> errors = new List<KittingErrorDto>();
if (checklist.Any())
{
foreach (var error in checklist) {
errors.Add(new KittingErrorDto() { Code=error.Code,PartCode=error.PartCode, Content="记录有重复!" });
}
}
@ -183,7 +179,6 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, Kitt
var first = newDetail.FirstOrDefault();
var kitting = new KittingEditInput();
kitting.InjectFrom(first);
// kitting.Code = $"Q{kitting.Code}";
foreach (var detail in newDetail)
{
var inputdetail = new KittingDetailInput();
@ -197,47 +192,40 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase<Kitting, Kitt
{
var id = Guid.NewGuid();
itm.SetId(id);
//newMainList.Add(itm);
foreach (var detail in itm.Details)
{
detail.SetId(Guid.NewGuid());
detail.MasterId = id;
//newdetailList.Add(detail);
}
}
await _repository.InsertManyAsync(kittingList).ConfigureAwait(false);
//await _repository.GetDbContext().BulkInsertAsync(newMainList).ConfigureAwait(false);
//await _repository.GetDbContext().BulkInsertAsync<KittingDetail>(newdetailList).ConfigureAwait(false);
#endregion
}
if (existCodeList.Any())
{
var existKittingList = importList.Where(p => existCodeList.Contains(p.Code)).ToList();//新Kitting
List<KittingEditInput> existKittingInputList = new List<KittingEditInput>();
//List<KittingDetail> existKittingDetailList = new List<KittingDetail>();
//List<KittingDetail> newKittingDetailList = new List<KittingDetail>();
foreach (var include in includeList)
{
var newDetail = existKittingList.Where(p => p.Code == include.Code).ToList();
var innerExist = from itm in newDetail
join itm1 in include.Details on itm.PartCode equals itm1.PartCode
join itm1 in include.Details on itm.ItemCode equals itm1.ItemCode
select itm;
if (innerExist.Any())
{
var list = innerExist.ToList();
foreach (var itm in include.Details)
{
var entity = list.FirstOrDefault(p => p.PartCode == itm.PartCode);
itm.Desc1 = entity.Desc1;
itm.Desc2 = entity.Desc2;
var entity = list.FirstOrDefault(p => p.ItemCode == itm.ItemCode);
itm.ItemDesc1 = entity.ItemDesc1;
itm.ItemDesc2 = entity.ItemDesc2;
itm.Qty = entity.Qty;
itm.Conf = entity.Conf;
//existKittingDetailList.Add(itm);
}
}
var leftExist = from itm in newDetail
join itm1 in include.Details on itm.PartCode equals itm1.PartCode
join itm1 in include.Details on itm.ItemCode equals itm1.ItemCode
into temp
from tm in temp.DefaultIfEmpty()
where tm == null

6
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAutoMapperProfile.cs

@ -30,9 +30,9 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
CreateMap<KittingImportInput, KittingDetail>()
.IgnoreAuditedObjectProperties()
//.ForMember(x => x., y => y.MapFrom(t => t.Code))
.ForMember(x => x.PartCode, y => y.MapFrom(t => t.PartCode))
.ForMember(x => x.Desc1, y => y.MapFrom(t => t.Desc1))
.ForMember(x => x.Desc2, y => y.MapFrom(t => t.Desc2))
.ForMember(x => x.ItemCode, y => y.MapFrom(t => t.ItemCode))
.ForMember(x => x.ItemDesc1, y => y.MapFrom(t => t.ItemDesc1))
.ForMember(x => x.ItemDesc2, y => y.MapFrom(t => t.ItemDesc2))
.Ignore(x => x.MasterId)
.Ignore(x => x.TenantId)
.Ignore(x => x.Remark)

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

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office2010.Drawing;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
using Win_in.Sfs.Basedata.Domain.Caches;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Basedata.tests;
namespace Win_in.Sfs.Basedata.Application;
/// <summary>
/// 接口模拟测试
/// </summary>
[AllowAnonymous]
[Route($"CargoState")]
public class TestService:ApplicationService
{
private readonly IServiceProvider _serviceProvider;
private readonly IOptions<CycleOptions> _options;
public TestService(IServiceProvider serviceProvider, IOptions<CycleOptions> options)
{
_serviceProvider = serviceProvider;
_options = options;
}
/// <summary>
/// 生命周期操作
/// </summary>
[HttpPost("GetMacStatic")]
public async Task<int> GetMacStatic()
{
return 1;
}
[HttpPost("GetCargoStatic")]
/// <summary>
/// 异步开始生命周期操作不能堵塞
/// </summary>
public async Task<List<ResponCargoItem>> GetCargoStatic(int 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 });
return result;
}
}

64
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs

@ -249,7 +249,7 @@ public class BomManager : DomainService, IBomManager
return list;
}
@ -261,35 +261,39 @@ public class BomManager : DomainService, IBomManager
/// <param name="p_component"></param>
/// <param name="p_type"></param>
/// <returns></returns>
public async Task<List<BomComponent>> GetSubcomponentsRecursive(BomComponent p_component, EnumBomSelectedType p_type
)
public async Task<List<BomComponent>> GetSubcomponentsRecursive(BomComponent p_component, EnumBomSelectedType p_type
)
{
// 创建用于存储最终结果、维度结果和树状结果的列表
List<BomComponent> lastList = new List<BomComponent>();
List<BomComponent> dimensionList=new List<BomComponent>();
var treeList=await GetSubcomponentsRecursive(p_component, 1, p_component.ComponentQty, p_component.Component,
List<BomComponent> dimensionList = new List<BomComponent>();
// 调用异步方法GetSubcomponentsRecursive以获取树状结果,并使用lambda表达式将结果添加到lastList和dimensionList
var treeList = await GetSubcomponentsRecursive(p_component, 1, p_component.ComponentQty, p_component.Component,
(rs) => lastList.Add(rs)
,
(rs1)=>{
(rs1) => {
dimensionList.Add(rs1);
}).ConfigureAwait(false);
List<BomComponent> returnList=new List<BomComponent>();
// 根据用户指定的类型,返回相应的结果列表
List<BomComponent> returnList = new List<BomComponent>();
switch (p_type)
{
case EnumBomSelectedType.Last:
returnList = lastList;
break;
case EnumBomSelectedType.Tree:
returnList=treeList;
returnList = treeList;
break;
case EnumBomSelectedType.Dimension:
returnList=dimensionList;
returnList = dimensionList;
break;
}
return returnList;
}
/// <summary>
@ -303,55 +307,73 @@ public class BomManager : DomainService, IBomManager
/// <param name="p_actionDimension">树型转成一维表用</param>
/// <param name="bomList"></param>
/// <returns></returns>
private async Task<List<BomComponent>> GetSubcomponentsRecursive(BomComponent p_component, int level, decimal sumQty, string root, Action<BomComponent> p_actionLast,
Action<BomComponent> p_actionDimension
/* ,List<Bom> bomList =null*/
)
Action<BomComponent> p_actionDimension
/* ,List<Bom> bomList =null*/
)
{
// 初始化子零件列表
List<BomComponent> subComponents = new List<BomComponent>();
// 假设 GetComponentsByProduct 方法可获取某个物料号下的所有子零件
List<BomComponent> directSubComponents =await GetComponentsByProduct(p_component.Component).ConfigureAwait(false);
List<BomComponent> directSubComponents = await GetComponentsByProduct(p_component.Component).ConfigureAwait(false);
if (!directSubComponents.Any() && level != 1)//不是根元素
// 如果没有直接子零件且不是根元素,则执行最后操作回调函数
if (!directSubComponents.Any() && level != 1)
{
p_actionLast(p_component);
}
// 遍历直接子零件列表
foreach (var component in directSubComponents)
{
// 设置根元素和数量
component.Root = root;
component.SumQty = sumQty * component.ComponentQty;
component.ParentComponent = p_component.Component;
component.Level = level;
// 设置拆解路径
component.Path = (p_component.Component != root) ? p_component.Path + $"->{component.Component}" : p_component.Component + $"->{component.Component}";
component.SubComponents =await GetSubcomponentsRecursive(component, level + 1, sumQty * component.ComponentQty, component.Root, p_actionLast, p_actionDimension).ConfigureAwait(false);
// 递归获取子零件列表,并执行维度操作回调函数
component.SubComponents = await GetSubcomponentsRecursive(component, level + 1, sumQty * component.ComponentQty, component.Root, p_actionLast, p_actionDimension).ConfigureAwait(false);
p_actionDimension(component);
// 添加子零件到子零件列表
subComponents.Add(component);
}
// 返回子零件列表
return subComponents;
}
/// <summary>
/// 读取子节点
/// </summary>
/// <param name="product"></param>
/// <returns></returns>
private async Task<List<BomComponent>> GetComponentsByProduct(string product)
{
List<Bom> list=new List<Bom>();
List<Bom> list = new List<Bom>();
if (Cache.Boms.Count == 0)
{
InitBomComponent();
}
list=Cache.Boms.Count > 0 ? Cache.Boms.Where(p => p.Product == product).ToList() :
// 如果缓存中有Bom列表,则从缓存中筛选符合条件的数据;否则从仓储中异步获取数据
list = Cache.Boms.Count > 0 ? Cache.Boms.Where(p => p.Product == product).ToList() :
await _repository.GetListAsync(p => p.Product == product).ConfigureAwait(false);
List<BomComponent> components = new List<BomComponent>();
List<BomComponent> components = new List<BomComponent>();
foreach (var component in list)
{
BomComponent bomComponent = new BomComponent();
bomComponent.InjectFrom(component);
components.Add(bomComponent);
components.Add(bomComponent);
}
// 其他物料号的子零件信息类似添加
return components;
}
/// <summary>
/// 获取所有bomtree
/// </summary>

9
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Kittings/KittingDetail.cs

@ -14,15 +14,18 @@ public class KittingDetail : AuditedEntity<Guid>, IMultiTenant, IRemark
/// <summary>
/// 物料编码
/// </summary>
public string PartCode { set; get; }
[Display(Name = "物料编码")]
public string ItemCode { set; get; }
/// <summary>
/// 描述1
/// </summary>
public string Desc1 { set; get; }
[Display(Name = "描述1")]
public string ItemDesc1 { set; get; }
/// <summary>
/// 描述2
/// </summary>
public string Desc2 { set; get; }
[Display(Name = "描述2")]
public string ItemDesc2 { set; get; }
/// <summary>
/// 包装数量
/// </summary>

4
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingDbContextModelCreatingExtensions.cs

@ -37,9 +37,9 @@ public static class KittingDbContextModelCreatingExtensions
//Configure Sfs base properties
b.ConfigureSfsBase();
b.Property(p => p.Desc1).HasMaxLength(SfsPropertyConst.DescLength);
b.Property(p => p.ItemDesc1).HasMaxLength(SfsPropertyConst.DescLength);
//Properties
b.Property(q => q.Desc2).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.ItemDesc2).HasMaxLength(SfsPropertyConst.CodeLength);
//Relations
b.Property(q => q.MasterId).IsRequired();
//Indexes

10
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Kittings/KittingEfCoreRepository.cs

@ -33,14 +33,14 @@ public class KittingEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataD
var left = from itm in newData.Details
join itm1 in detailList on
itm.PartCode equals itm1.PartCode
itm.ItemCode equals itm1.ItemCode
into temp
from tm in temp.DefaultIfEmpty()
where tm == null
select itm;
var inner = from itm in detailList
join itm1 in newData.Details on
itm.PartCode equals itm1.PartCode
itm.ItemCode equals itm1.ItemCode
select itm1;
//await detail.AddRangeAsync(left.ToList()).ConfigureAwait(false);
@ -48,10 +48,10 @@ public class KittingEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataD
List<KittingDetail> update = new List<KittingDetail>();
foreach (var itm in inner.ToList())
{
var first = newData.Details.FirstOrDefault(p => p.PartCode == itm.PartCode);
var first = newData.Details.FirstOrDefault(p => p.ItemCode == itm.ItemCode);
itm.Qty = first.Qty;
itm.Desc1 = first.Desc1;
itm.Desc2 = first.Desc2;
itm.ItemDesc1 = first.ItemDesc1;
itm.ItemDesc2 = first.ItemDesc2;
update.Add(itm);
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs

@ -29,7 +29,7 @@ public class MesNoteEditInput : SfsStoreCreateOrUpdateInputBase
public string MesRequestNumber { get; set; }
/// <summary>
/// Mes类型(40-冻结、41-解冻 )
/// Mes类型(事务类型40-冻结、41-解冻 )
/// </summary>
[Display(Name = "类型")]
public string Type { get; set; }

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/InjectionIssueRequests/DTOs/InjectionIssueRequestDetailDTO.cs

@ -53,3 +53,10 @@ public class InjectionIssueRequestDetailDTO : SfsStoreDetailWithQtyDTOBase
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
}
public class UnCompletedRequestDto
{
public string ItemCode { get; set; }
public string LocCode { get; set; }
public string PositionCode { get; set; }
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/IssueRequest/InjectionIssueRequests/IInjectionIssueRequestAppService.cs

@ -16,4 +16,7 @@ public interface IInjectionIssueRequestAppService
/// </summary>
/// <returns></returns>
Task<long> GetCountAsync();
Task<List<UnCompletedRequestDto>> GetUnCompletedRequestAsync(List<UnCompletedRequestDto> p_list);
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs

@ -66,7 +66,11 @@ public class MesNoteAppService :
var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
if (fromLocation == null)
{
throw new UserFriendlyException($"库位为空");
throw new UserFriendlyException($"来源库位为空");
}
if (fromLocation == null)
{
throw new UserFriendlyException($"目标库位为空");
}
detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number);
detail.FromLocationArea = fromLocation.AreaCode;

30
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/InjectionIssueRequests/InjectionIssueRequestAppService.cs

@ -321,5 +321,35 @@ public class InjectionIssueRequestAppService : SfsStoreRequestAppServiceBase<Inj
return query;
}
/// <summary>
/// 获取已完成的叫料单数量
/// </summary>
/// <returns></returns>
[HttpPost("get-uncompleted-request")]
public async Task<List<UnCompletedRequestDto>> GetUnCompletedRequestAsync(List<UnCompletedRequestDto> p_list)
{
List<UnCompletedRequestDto> returnList = new List<UnCompletedRequestDto>();
//枚举类型查不到改成SQL查询
var list =await _repository.WithDetails().Where(p => p.RequestStatus != EnumRequestStatus.Completed && p.Type == nameof(EnumIssueType.Vision)).ToListAsync().ConfigureAwait(false);
foreach (var itm in list)
{
var query = from detail in itm.Details join citm in p_list on new { detail.ItemCode, locCode= detail.ToLocationCode,areaCode=detail.PositionCode } equals
new { citm.ItemCode, locCode= citm.LocCode,areaCode=citm.PositionCode }
select new UnCompletedRequestDto { ItemCode = detail.ItemCode, LocCode = detail.ToLocationCode, PositionCode = detail.PositionCode } ;
returnList.AddRange(query.ToList());
}
return returnList;
}
#endregion
}

Loading…
Cancel
Save