From 514c40c02df88323b376424c1925da27436a4276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Tue, 10 Dec 2024 10:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/TestAppService.cs | 72 ++++- .../Enums/Inventory/EnumTransSubType.cs | 16 +- .../Jobs/IssueJobs/AgvJobs/DTOS/AgvDto.cs | 134 ++++++++- .../KittingIssueJobAppService.cs | 4 +- .../Jobs/IssueJobs/proxy/AgvJobClient.cs | 233 +++++++++++++-- .../UnplannedIssueJobAppService.cs | 11 +- .../UnplannedReceiptJobAppService.cs | 13 +- .../TransferNotes/TransferNoteAppService.cs | 281 ++++++++++++++++++ 8 files changed, 694 insertions(+), 70 deletions(-) diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs index 658d43ca0..6a3d3d176 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs @@ -123,7 +123,18 @@ public class TestService:ApplicationService return reusltObject; } + [HttpPost("pushOutTaskUnplanned")] + public async Task pushOutTaskUnplanned(AgvRequestUnplanned1 request) + { + var json = System.Text.Json.JsonSerializer.Serialize(request); + _logger.LogInformation(json); + AgvResultObject1 reusltObject = new AgvResultObject1(); + reusltObject.Code = "0"; + reusltObject.Message = "OK"; + reusltObject.ReqCode = "T6000001970"; + return reusltObject; + } @@ -168,28 +179,16 @@ public class AgvResultObject1 public string ReqCode { set; get; } } #region AGV -public class AgvRequestHK1 -{ - [Display(Name ="请求编号")] - public string ReqCode { set; get; } - [Display(Name ="明细")] - public List Data { set; get; } -} -public class AgvRequestInputHK1 +public class AgvRequestUnplannedDto1 { - //[Display(Name = "请求编号")] - //public string ReqCode { set; get; } + [Display(Name = "明细")] - public List Data { set; get; } + public List Data { set; get; } } - - - - -public class AgvRequestHKDetail1 +public class AgvRequestUnplannedDetailDto1 { [Display(Name = "任务类型")] public string OrderType { set; get; } @@ -203,6 +202,10 @@ public class AgvRequestHKDetail1 public string BeginPosition { set; get; } [Display(Name = "终点")] public string EndPosition { set; get; } + + [Display(Name = "箱码")] + public string PakingCode { set; get; } + [Display(Name = "批次属性07")] public string BatchAttr07 { set; get; } [Display(Name = "批次属性08")] @@ -225,6 +228,12 @@ public class AgvRequestHKDetail1 } + + + + + + /// /// 闻荫调海康入参 /// @@ -238,10 +247,41 @@ public class AgvRequest1 public string MatCode { set; get; } [Display(Name = "物料数量")] public string MatQty { set; get; } + [Display(Name = "来源工位")] + public string BeginPosition { set; get; } [Display(Name = "目标工位")] public string EndPosition { set; get; } } + +public class AgvRequestUnplanned1 +{ + [Display(Name = "批次")] + public string Batch { set; get; } + [Display(Name = "箱码")] + public string PakingCode { set; get; } + [Display(Name = "ERP储位")] + public string ErpLocationCode { set; get; } + [Display(Name = "任务类型")] + public string OrderType { set; get; } + [Display(Name = "任务编号")] + public string OrderNum { set; get; } + [Display(Name = "物料编号")] + public string MatCode { set; get; } + [Display(Name = "物料数量")] + public string MatQty { set; get; } + [Display(Name = "来源工位")] + public string BeginPosition { set; get; } + [Display(Name = "目标工位")] + public string EndPosition { set; get; } + +} + + + + + + #endregion diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs index 47624c403..1d6b1d6bc 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs @@ -239,5 +239,19 @@ public enum EnumTransSubType ///AGV出库线边仓调拨 /// [Display(Name = "AGV出库线边仓调拨")] - Agv_Transfer_WIP = 1512 + Agv_Transfer_WIP = 1512, + + + /// + ///AGV冻结 + /// + [Display(Name = "AGV冻结")] + Agv_Freezed = 1513, + + /// + ///AGV冻结 + /// + [Display(Name = "AGV解冻")] + Agv_UnFreezed = 1514 + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AgvJobs/DTOS/AgvDto.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AgvJobs/DTOS/AgvDto.cs index 12ee9b325..e0ba24361 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AgvJobs/DTOS/AgvDto.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/AgvJobs/DTOS/AgvDto.cs @@ -68,6 +68,55 @@ public class AgvRequestDetailDto public string BatchAttr15 { set; get; } } + +public class AgvRequestUnplannedDto +{ + + [Display(Name = "明细")] + public List Data { set; get; } + +} +public class AgvRequestUnplannedDetailDto +{ + [Display(Name = "任务类型")] + public string OrderType { set; get; } + [Display(Name = "任务编号")] + public string OrderNum { set; get; } + [Display(Name = "物料编号")] + public string MatCode { set; get; } + [Display(Name = "物料数量")] + public decimal MatQty { set; get; } + [Display(Name = "起始点")] + public string BeginPosition { set; get; } + [Display(Name = "终点")] + public string EndPosition { set; get; } + + [Display(Name = "箱码")] + public string PakingCode { set; get; } + + [Display(Name = "批次属性07")] + public string BatchAttr07 { set; get; } + [Display(Name = "批次属性08")] + public string BatchAttr08 { set; get; } + [Display(Name = "批次属性09")] + public string BatchAttr09 { set; get; } + [Display(Name = "批次属性10")] + public string BatchAttr10 { set; get; } + [Display(Name = "批次属性11")] + public string BatchAttr11 { set; get; } + [Display(Name = "批次属性12")] + public string BatchAttr12 { set; get; } + [Display(Name = "批次属性13")] + public string BatchAttr13 { set; get; } + [Display(Name = "批次属性14")] + public string BatchAttr14 { set; get; } + [Display(Name = "批次属性15")] + public string BatchAttr15 { set; get; } + +} + + + /// /// 闻荫调海康入参 /// @@ -77,36 +126,96 @@ public partial class AgvRequest /// /// 任务类型 /// - - [System.Text.Json.Serialization.JsonPropertyName("orderType")] + [Newtonsoft.Json.JsonProperty("orderType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OrderType { get; set; } /// /// 任务编号 /// - - [System.Text.Json.Serialization.JsonPropertyName("orderNum")] + [Newtonsoft.Json.JsonProperty("orderNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OrderNum { get; set; } /// /// 物料编号 /// - - [System.Text.Json.Serialization.JsonPropertyName("matCode")] + [Newtonsoft.Json.JsonProperty("matCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string MatCode { get; set; } /// /// 物料数量 /// - - [System.Text.Json.Serialization.JsonPropertyName("matQty")] + [Newtonsoft.Json.JsonProperty("matQty", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public decimal MatQty { get; set; } + /// + /// 来源工位 + /// + [Newtonsoft.Json.JsonProperty("beginPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string BeginPosition { get; set; } + /// /// 目标工位 /// + [Newtonsoft.Json.JsonProperty("endPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string EndPosition { get; set; } + +} + +[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] +public partial class AgvRequestUnplanned +{ + /// + /// 批次 + /// + [Newtonsoft.Json.JsonProperty("batch", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Batch { get; set; } + + /// + /// 箱码 + /// + [Newtonsoft.Json.JsonProperty("pakingCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PakingCode { get; set; } + + /// + /// ERP储位 + /// + [Newtonsoft.Json.JsonProperty("erpLocationCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ErpLocationCode { get; set; } + + /// + /// 任务类型 + /// + [Newtonsoft.Json.JsonProperty("orderType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OrderType { get; set; } + + /// + /// 任务编号 + /// + [Newtonsoft.Json.JsonProperty("orderNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string OrderNum { get; set; } - [System.Text.Json.Serialization.JsonPropertyName("endPosition")] + /// + /// 物料编号 + /// + [Newtonsoft.Json.JsonProperty("matCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MatCode { get; set; } + + /// + /// 物料数量 + /// + [Newtonsoft.Json.JsonProperty("matQty", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public decimal MatQty { get; set; } + + /// + /// 来源工位 + /// + [Newtonsoft.Json.JsonProperty("beginPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string BeginPosition { get; set; } + + /// + /// 目标工位 + /// + [Newtonsoft.Json.JsonProperty("endPosition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string EndPosition { get; set; } } @@ -114,14 +223,13 @@ public partial class AgvRequest [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class AgvResultObject { - - [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("reqCode")] + [Newtonsoft.Json.JsonProperty("reqCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ReqCode { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs index 96a5e45b4..1a2e8f130 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs @@ -36,7 +36,7 @@ namespace Win_in.Sfs.Wms.Store.Application; public class KittingIssueJobAppService : SfsJobAppServiceBase, - IKittingIssueJobAppService, ITransferLibCallback,IAgvJobAccountService + IKittingIssueJobAppService, ITransferLibCallback { private readonly IKittingIssueJobManager _kittingIssueJobManager; private readonly ILocationAppService _locationAppService; @@ -932,6 +932,8 @@ public class KittingIssueJobAppService request.MatQty = first.HandledToQty; request.OrderNum = job.Number; request.OrderType = EnumJobType.KittingIssueJob.ToString(); + request.BeginPosition = first.HandledFromLocationCode; + request.EndPosition = first.HandledToLocationCode; var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/AgvJobClient.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/AgvJobClient.cs index 7c23313c4..7ba9fae02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/AgvJobClient.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/proxy/AgvJobClient.cs @@ -8,16 +8,38 @@ using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; +//---------------------- +// +// Generated using the NSwag toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// +//---------------------- + +#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 649 // Disable "CS0649 Field is never assigned to, and will always have its default value null" +#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 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)." + + using System = global::System; + [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class AgvJobClient - { +{ #pragma warning disable 8618 private string _baseUrl; #pragma warning restore 8618 private System.Net.Http.HttpClient _httpClient; - private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); - private System.Text.Json.JsonSerializerOptions _instanceSettings; + private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); + private Newtonsoft.Json.JsonSerializerSettings _instanceSettings; #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. public AgvJobClient(string baseUrl, System.Net.Http.HttpClient httpClient,string path) @@ -26,14 +48,12 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; BaseUrl = baseUrl; _httpClient = httpClient; _path = path; - - Initialize(); } - 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; } @@ -49,21 +69,21 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; } } + + private string _path; public string Path { get { return _path; } set { - _path = value; - + _path = value; } } + protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - protected System.Text.Json.JsonSerializerOptions JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } } - - static partial void UpdateJsonSerializerSettings(System.Text.Json.JsonSerializerOptions settings); + static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); partial void Initialize(); @@ -89,8 +109,8 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; { using (var request_ = new System.Net.Http.HttpRequestMessage()) { - var json_ = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(body, JsonSerializerSettings); - var content_ = new System.Net.Http.ByteArrayContent(json_); + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); @@ -99,7 +119,149 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; var urlBuilder_ = new System.Text.StringBuilder(); if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl); // Operation Path: "pushOutTask4FW" - urlBuilder_.Append(_path); + urlBuilder_.Append("pushOutTask4FW"); + + 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>(); + 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(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(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("Forbidden", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 401) + { + var objectResponse_ = await ReadObjectResponseAsync(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("Unauthorized", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 400) + { + var objectResponse_ = await ReadObjectResponseAsync(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("Bad Request", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 404) + { + var objectResponse_ = await ReadObjectResponseAsync(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("Not Found", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 501) + { + var objectResponse_ = await ReadObjectResponseAsync(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("Server Error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); + } + else + if (status_ == 500) + { + var objectResponse_ = await ReadObjectResponseAsync(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("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(); + } + } + + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task PushOutTaskUnplannedAsync(AgvRequestUnplanned body) + { + return PushOutTaskUnplannedAsync(body, System.Threading.CancellationToken.None); + } + + /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. + /// Success + /// A server side error occurred. + public virtual async System.Threading.Tasks.Task PushOutTaskUnplannedAsync(AgvRequestUnplanned body, System.Threading.CancellationToken cancellationToken) + { + var client_ = _httpClient; + var disposeClient_ = false; + try + { + using (var request_ = new System.Net.Http.HttpRequestMessage()) + { + var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, JsonSerializerSettings); + var content_ = new System.Net.Http.StringContent(json_); + content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + request_.Content = content_; + 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: "pushOutTaskUnplanned" + urlBuilder_.Append("pushOutTaskUnplanned"); PrepareRequest(client_, request_, urlBuilder_); @@ -240,10 +402,10 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); try { - var typedBody = System.Text.Json.JsonSerializer.Deserialize(responseText, JsonSerializerSettings); + var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); return new ObjectResponseResult(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); @@ -254,12 +416,15 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; 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(responseStream, JsonSerializerSettings, cancellationToken).ConfigureAwait(false); + var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); + var typedBody = serializer.Deserialize(jsonTextReader); return new ObjectResponseResult(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); @@ -325,20 +490,19 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.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 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 ValidationErrors { get; set; } } @@ -346,8 +510,7 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.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; } } @@ -355,11 +518,10 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.2.0.0 (NJsonSchema v11.1.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 Members { get; set; } } @@ -405,3 +567,14 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; +#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 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs index e6ff2a2df..00bb7656c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedIssueJobs/UnplannedIssueJobAppService.cs @@ -692,7 +692,7 @@ public class UnplannedIssueJobAppService /// /// [HttpPost("call-back-agv")] - public async Task CallBackAgvAsync(AgvRequestDto request) + public async Task CallBackAgvAsync(AgvRequestUnplannedDto request) { var json = JsonSerializer.Serialize(request); var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); @@ -867,12 +867,13 @@ public class UnplannedIssueJobAppService using var unitOfWork = _unitOfWorkManager.Begin(); try { - var first = job.Details.FirstOrDefault(); - var request = new AgvRequest(); + var first = job.FacDetails.FirstOrDefault(); + var request = new AgvRequestUnplanned(); request.MatCode = first.ItemCode; request.MatQty = first.RecommendQty; request.OrderNum = job.Number; - request.OrderType = EnumJobType.UnplannedIssueJob.ToString(); + request.OrderType = job.JobType.ToString(); + request.PakingCode = first.RecommendPackingCode; var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) @@ -904,7 +905,7 @@ public class UnplannedIssueJobAppService } var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path); - ret = await client.PushOutTask4FWAsync(request).ConfigureAwait(false); + ret = await client.PushOutTaskUnplannedAsync(request).ConfigureAwait(false); } catch (Exception e) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs index 90888d752..1ef13ffeb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/UnplannedReceiptJobs/UnplannedReceiptJobAppService.cs @@ -363,7 +363,7 @@ public class UnplannedReceiptJobAppService /// /// [HttpPost("call-back-agv")] - public async Task CallBackAgvAsync(AgvRequestDto request) + public async Task CallBackAgvAsync(AgvRequestUnplannedDto request) { var json = JsonSerializer.Serialize(request); var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); @@ -536,11 +536,16 @@ public class UnplannedReceiptJobAppService try { var first = job.Details.FirstOrDefault(); - var request = new AgvRequest(); + var request = new AgvRequestUnplanned(); request.MatCode = first.ItemCode; request.MatQty = first.RecommendQty; request.OrderNum = job.Number; - request.OrderType = EnumJobType.UnplannedReceiptJob.ToString(); + request.Batch = first.HandledPackingCode; + request.ErpLocationCode = job.FromErpLocationCode; + request.PakingCode = first.HandledPackingCode; + + + request.OrderType =job.JobType.ToString(); var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) @@ -572,7 +577,7 @@ public class UnplannedReceiptJobAppService } var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path); - ret = await client.PushOutTask4FWAsync(request).ConfigureAwait(false); + ret = await client.PushOutTaskUnplannedAsync(request).ConfigureAwait(false); } catch (Exception e) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index 380f69695..3dd36c252 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -670,6 +670,287 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase } + [HttpPost("call-back-unfreezed-agv")] + public async Task CallUnFreezedAgvAsync(AgvRequestDto request) + { + var json = JsonSerializer.Serialize(request); + var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); + _logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); +#if DEBUG +#endif + var errors = new List(); + var ret = new AgvResultObject + { + Code = "0", + Message = "OK", + ReqCode = "", + }; + using var unitOfWork = _unitOfWorkManager.Begin(); + try + { + if (request.Data.Count > 0) + { + var notes = request.Data; + + foreach (var detail in notes) + { + TransferNoteEditInput transfer = new TransferNoteEditInput(); + transfer.CallJobNumber = detail.OrderNum; + transfer.Type = EnumTransSubType.Agv_Transfer_WIP.ToString(); + transfer.Worker = "Agv"; + transfer.UseOnTheWayLocation = false; + List transferNoteDetailInputs = new List(); + TransferNoteDetailInput detailInput = new TransferNoteDetailInput(); + var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); + if (fromloc == null) + { + errors.Add($"来源起始点{detail.BeginPosition}没查到"); + } + LocationDTO fromlocation = null; + if (fromloc != null) + { + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); + } + if (fromlocation == null) + { + errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); + } + var toloc = await _postionLocationAppService.GetByCodeAsync(detail.EndPosition) + .ConfigureAwait(false); + if (toloc == null) + { + errors.Add($"结束点{detail.EndPosition}没查到"); + } + LocationDTO tolocation = null; + if (toloc != null) + { + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); + } + if (tolocation == null) + { + errors.Add($"结束点{detail.EndPosition}库位没查到"); + } + var item = await _itemBasicAppService.GetByCodeAsync(detail.MatCode).ConfigureAwait(false); + if (item == null) + { + errors.Add($"零件号{detail.MatCode}的零件不存在!"); + } + else + { + detailInput.ItemCode = item.Code; + detailInput.Uom = item.BasicUom; + detailInput.ItemName = item.Name; + detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : string.Empty; + } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + detailInput.ToLocationCode = tolocation.Code; + detailInput.ToLocationGroup = tolocation.LocationGroupCode; + detailInput.ToLocationArea = tolocation.AreaCode; + detailInput.ToLocationErpCode = tolocation.ErpLocationCode; + detailInput.ToWarehouseCode = tolocation.WarehouseCode; + detailInput.ToStatus = tolocation.DefaultInventoryStatus; + + + + detailInput.Qty = detail.MatQty; + //detailInput.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + detailInput.ToPackingCode = string.Empty; + detailInput.FromWarehouseCode = fromlocation.WarehouseCode; + detailInput.FromLocationCode = fromlocation.Code; + detailInput.FromLocationGroup = fromlocation.LocationGroupCode; + detailInput.FromLocationArea = fromlocation.AreaCode; + detailInput.FromLocationErpCode = fromlocation.ErpLocationCode; + detailInput.FromStatus = EnumInventoryStatus.FROZEN; + detailInput.Qty = detail.MatQty; + //detailInput.FromLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + detailInput.FromPackingCode = string.Empty; + + transfer.Details.Add(detailInput); + + + await CreateAsync(transfer).ConfigureAwait(false); + } + } + else + { + errors.Add("Agv确认单据里无数据! \n"); + } + } + catch (Exception ex) + { + ret = new AgvResultObject + { + Code = "-1", + ReqCode = "", + Message = ex.Message + }; + await unitOfWork.RollbackAsync().ConfigureAwait(false); + + } + + if (errors.Count > 0) + { + ret = new AgvResultObject + { + Code = "-1", + Message = string.Join(",", errors.ToArray()), + ReqCode = "" + }; + await unitOfWork.RollbackAsync().ConfigureAwait(false); + } + return ret; + } + + + [HttpPost("call-back-freezed-agv")] + public async Task CallFreezedAgvAsync(AgvRequestDto request) + { + var json = JsonSerializer.Serialize(request); + var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); + _logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); +#if DEBUG +#endif + var errors = new List(); + var ret = new AgvResultObject + { + Code = "0", + Message = "OK", + ReqCode = "", + }; + using var unitOfWork = _unitOfWorkManager.Begin(); + try + { + if (request.Data.Count > 0) + { + var notes = request.Data; + + foreach (var detail in notes) + { + TransferNoteEditInput transfer = new TransferNoteEditInput(); + transfer.CallJobNumber = detail.OrderNum; + transfer.Type = EnumTransSubType.Agv_Freezed.ToString(); + transfer.Worker = "Agv"; + transfer.UseOnTheWayLocation = false; + List transferNoteDetailInputs = new List(); + TransferNoteDetailInput detailInput = new TransferNoteDetailInput(); + var fromloc = await _postionLocationAppService.GetByCodeAsync(detail.BeginPosition).ConfigureAwait(false); + if (fromloc == null) + { + errors.Add($"来源起始点{detail.BeginPosition}没查到"); + } + LocationDTO fromlocation = null; + if (fromloc != null) + { + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); + } + if (fromlocation == null) + { + errors.Add($"来源起始点{detail.BeginPosition}库位没查到"); + } + var toloc = await _postionLocationAppService.GetByCodeAsync(detail.EndPosition) + .ConfigureAwait(false); + if (toloc == null) + { + errors.Add($"结束点{detail.EndPosition}没查到"); + } + LocationDTO tolocation = null; + if (toloc != null) + { + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); + } + if (tolocation == null) + { + errors.Add($"结束点{detail.EndPosition}库位没查到"); + } + var item = await _itemBasicAppService.GetByCodeAsync(detail.MatCode).ConfigureAwait(false); + if (item == null) + { + errors.Add($"零件号{detail.MatCode}的零件不存在!"); + } + else + { + detailInput.ItemCode = item.Code; + detailInput.Uom = item.BasicUom; + detailInput.ItemName = item.Name; + detailInput.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : string.Empty; + } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + + detailInput.ToLocationCode = tolocation.Code; + detailInput.ToLocationGroup = tolocation.LocationGroupCode; + detailInput.ToLocationArea = tolocation.AreaCode; + detailInput.ToLocationErpCode = tolocation.ErpLocationCode; + detailInput.ToWarehouseCode = tolocation.WarehouseCode; + detailInput.ToStatus = EnumInventoryStatus.FROZEN; + + detailInput.Qty = detail.MatQty; + //detailInput.ToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + detailInput.ToPackingCode = string.Empty; + detailInput.FromWarehouseCode = fromlocation.WarehouseCode; + detailInput.FromLocationCode = fromlocation.Code; + detailInput.FromLocationGroup = fromlocation.LocationGroupCode; + detailInput.FromLocationArea = fromlocation.AreaCode; + detailInput.FromLocationErpCode = fromlocation.ErpLocationCode; + detailInput.FromStatus = EnumInventoryStatus.OK; + detailInput.Qty = detail.MatQty; + //detailInput.FromLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + detailInput.FromPackingCode = string.Empty; + transfer.Details.Add(detailInput); + await CreateAsync(transfer).ConfigureAwait(false); + } + } + else + { + errors.Add("Agv确认单据里无数据! \n"); + } + } + catch (Exception ex) + { + ret = new AgvResultObject + { + Code = "-1", + ReqCode = "", + Message = ex.Message + }; + await unitOfWork.RollbackAsync().ConfigureAwait(false); + + } + + if (errors.Count > 0) + { + ret = new AgvResultObject + { + Code = "-1", + Message = string.Join(",", errors.ToArray()), + ReqCode = "" + }; + await unitOfWork.RollbackAsync().ConfigureAwait(false); + } + return ret; + } + + + + + + [HttpPost("call-back-agv")] public async Task CallBackAgvAsync(AgvRequestDto request) {