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 6a3d3d176..4c5397d7f 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 @@ -133,9 +133,19 @@ public class TestService:ApplicationService reusltObject.Message = "OK"; reusltObject.ReqCode = "T6000001970"; return reusltObject; - } + [HttpPost("notifyOutTaskBack4FW")] + public async Task NotifyOutTaskBack4FW(AgvRequestBack1 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; + } @@ -278,6 +288,18 @@ public class AgvRequestUnplanned1 } +public class AgvRequestBack1 +{ + [Display(Name = "物料编号")] + public string MatCode { set; get; } + [Display(Name = "物料数量")] + public string ReturnQty { set; get; } + [Display(Name = "目标工位")] + public string EndPosition { set; get; } +} + + + 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 e0ba24361..32628d42a 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 @@ -116,7 +116,6 @@ public class AgvRequestUnplannedDetailDto } - /// /// 闻荫调海康入参 /// @@ -161,6 +160,29 @@ 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 AgvRequestBack +{ + /// + /// 物料编号 + /// + [Newtonsoft.Json.JsonProperty("matCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string MatCode { get; set; } + + /// + /// 物料数量 + /// + [Newtonsoft.Json.JsonProperty("returnQty", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public decimal ReturnQty { 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 { @@ -235,3 +257,6 @@ public partial class AgvResultObject } + + + 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 7ba9fae02..dad0f92fd 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 @@ -28,6 +28,7 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; #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))")] @@ -47,7 +48,7 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; { BaseUrl = baseUrl; _httpClient = httpClient; - _path = path; + _path = path; Initialize(); } @@ -69,18 +70,19 @@ 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; } } static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); @@ -375,6 +377,148 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; } } + /// Success + /// A server side error occurred. + public virtual System.Threading.Tasks.Task NotifyOutTaskBack4FWAsync(AgvRequestBack body) + { + return NotifyOutTaskBack4FWAsync(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 NotifyOutTaskBack4FWAsync(AgvRequestBack 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: "notifyOutTaskBack4FW" + urlBuilder_.Append("notifyOutTaskBack4FW"); + + 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(); + } + } + protected struct ObjectResponseResult { public ObjectResponseResult(T responseObject, string responseText) @@ -529,7 +673,6 @@ namespace Win_in.Sfs.Wms.Store.Jobs.IssueJobs.proxy; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial class ApiException : System.Exception { @@ -567,10 +710,10 @@ 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 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 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 a5ad60506..dc4030548 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 @@ -792,7 +792,7 @@ public class UnplannedIssueJobAppService dto.HandledQty = detail.MatQty; - + dto.HandledPackingCode = detail.PakingCode; dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; dto.HandledFromLocationCode = fromlocation.Code; dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; @@ -800,6 +800,9 @@ public class UnplannedIssueJobAppService dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; details.Add(dto); + + + //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); } @@ -816,8 +819,17 @@ public class UnplannedIssueJobAppService itm.Worker = "AGV"; itm.Details = details; + + + await CompleteAsync(itm.Id, itm).ConfigureAwait(false);//是否这么调待明确 + + + + + _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); } + } else { @@ -872,7 +884,7 @@ public class UnplannedIssueJobAppService request.MatCode = first.ItemCode; request.MatQty = first.RecommendQty; request.OrderNum = job.Number; - request.OrderType = job.JobType.ToString(); + request.OrderType = job.UnplannedIssueType==EnumUnplannedIssueType.Raw?EnumJobType.UnplannedIssueJobHasPacking.ToString():EnumJobType.UnplannedIssueJobNoPacking.ToString() ; request.PakingCode = first.RecommendPackingCode; request.ErpLocationCode = job.FromErpLocationCode; request.BeginPosition = first.HandledFromLocationCode; 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 470d19ea9..34d05306a 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 @@ -461,11 +461,12 @@ public class UnplannedReceiptJobAppService var dto = new UnplannedReceiptJobDetailDTO(); dto.InjectFrom(entity); dto.HandledQty = detail.MatQty; - dto.HandledToWarehouseCode = fromlocation.WarehouseCode; - dto.HandledToLocationCode = fromlocation.Code; - dto.HandledToLocationGroup = fromlocation.LocationGroupCode; - dto.HandledToLocationArea = fromlocation.AreaCode; - dto.HandledToLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledPackingCode = detail.PakingCode; + dto.HandledToWarehouseCode = tolocation.WarehouseCode; + dto.HandledToLocationCode = tolocation.Code; + dto.HandledToLocationGroup = tolocation.LocationGroupCode; + dto.HandledToLocationArea = tolocation.AreaCode; + dto.HandledToLocationErpCode = tolocation.ErpLocationCode; details.Add(dto); //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); @@ -484,6 +485,11 @@ public class UnplannedReceiptJobAppService itm.Worker = "AGV"; itm.Details = details; + + await CompleteAsync(itm.Id, itm).ConfigureAwait(false);//是否这么调待明确 + + + _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); } } @@ -545,7 +551,7 @@ public class UnplannedReceiptJobAppService request.PakingCode = first.HandledPackingCode; request.EndPosition = first.HandledToLocationCode; - request.OrderType =job.JobType.ToString(); + request.OrderType = request.OrderType = job.UnplannedReceiptType == EnumUnplannedReceiptType.Raw ? EnumJobType.UnplannedReceiptJobHasPacking.ToString() : EnumJobType.UnplannedReceiptJobNoPacking.ToString(); ; var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) @@ -579,6 +585,7 @@ public class UnplannedReceiptJobAppService var client = new AgvJobClient(_agvOptions.Value.Address, httpclient, _agvOptions.Value.Path); ret = await client.PushOutTaskUnplannedAsync(request).ConfigureAwait(false); + } catch (Exception e) {