From aa424e69289f93448d59564d0f743ba0237f072e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 2 Dec 2024 09:00:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4AGV=20appsetting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.Development -NEV.json | 205 ++++++++++++++++++ .../settings/appsettings.Development.json | 36 +-- 2 files changed, 223 insertions(+), 18 deletions(-) create mode 100644 build/src/docker/publish/conf/settings/appsettings.Development -NEV.json diff --git a/build/src/docker/publish/conf/settings/appsettings.Development -NEV.json b/build/src/docker/publish/conf/settings/appsettings.Development -NEV.json new file mode 100644 index 000000000..315505025 --- /dev/null +++ b/build/src/docker/publish/conf/settings/appsettings.Development -NEV.json @@ -0,0 +1,205 @@ +{ + "AlwaysAllowAuthorization": "true", + "RestoOptions": { + + "Address": "http://7e42682n64.goho.co:21171/", + // 用户名 + "UserName": "", + // 密码 + "Password": "", + // 令牌 + "Token": "", + "Path": "zozocnApi/custom/receiveProductionPlan" + + }, + + "AgvOptions": { + + "Address": "http://dev.ccwin-in.com:60084/", + // 用户名 + "UserName": "", + // 密码 + "Password": "", + // 令牌 + "Token": "", + "Path": "Cargostate/pushOutTask4FW" + + }, + + + + + + "App": { + "CorsOrigins": [ + "http://localhost:59080", + "http://localhost:59081", + "http://localhost:59090", + "http://localhost:59091", + "http://localhost:59093", + "http://localhost:59094", + "http://localhost:59095", + "http://localhost:59096", + "http://localhost:59097", + "http://localhost:59098", + "http://localhost:59099", + "http://localhost:59090", + "http://localhost:59091", + "http://localhost:59093", + "http://localhost:59094", + "http://localhost:59095", + "http://localhost:59096", + "http://localhost:59097", + "http://localhost:59098", + "http://localhost:59099", + "https://localhost:59090", + "https://localhost:59091", + "https://localhost:59093", + "https://localhost:59094", + "https://localhost:59095", + "https://localhost:59096", + "https://localhost:59097", + "https://localhost:59098", + "https://localhost:59099", + "https://localhost:59090", + "https://localhost:59091", + "https://localhost:59093", + "https://localhost:59094", + "https://localhost:59095", + "https://localhost:59096", + "https://localhost:59097", + "https://localhost:59098", + "https://localhost:59099", + "http://localhost:9527" + ] + }, + "AuthServer": { + "Audience": "Auth", + "Authority": "http://dev.ccwin-in.com:60083/", + //"Authority": "http://localhost:59093/", + "ClientId": "Auth_App", + "ClientSecret": "1q2w3E*", + "RequireHttpsMetadata": "false", + "SwaggerClientId": "Auth_App", + "SwaggerClientSecret": "1q2w3e*", + "UseAuth": "true" + }, + // "ConnectionStrings": { + // "AbpAuditLogging": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpBackgroundJobs": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpBlobStoring": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpFeatureManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpIdentity": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpIdentityServer": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpPermissionManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpSettingManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "AbpTenantManagement": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Auth": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Basedata": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "DataExchange": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "FileStorage": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Inventory": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Job": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Label": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Message": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;", + // "Store": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;" + // }, + "ConnectionStrings": { + "AbpAuditLogging": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpBackgroundJobs": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpBlobStoring": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpFeatureManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpIdentity": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpIdentityServer": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpPermissionManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpSettingManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpTenantManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Auth": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Basedata": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "FileStorage": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Inventory": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Job": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Label": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Message": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Store": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;" + }, + "IdentityClients": { + "Default": { + "Authority": "http://dev.ccwin-in.com:60083", + //"Authority": "http://localhost:59093", + "ClientId": "Auth_App", + "ClientSecret": "1q2w3E*", + "GrantType": "client_credentials", + "RequireHttps": "false", + "Scope": "Auth" + } + }, + "IsMultiTenancy": "True", + "Redis": { + "Configuration": "localhost:21194", + "KeyPrefix": "Wms:" + //"IsEnabled": "false" + }, + "RemoteServices": { + "Auth": { + "BaseUrl": "http://dev.ccwin-in.com:60083/" + //"BaseUrl": "http://localhost:59093/" + }, + "BaseData": { + //"BaseUrl": "http://dev.ccwin-in.com:60084/" + "BaseUrl": "http://localhost:59094/" + }, + "Default": { + "BaseUrl": "http://dev.ccwin-in.com:60083/" + //"BaseUrl": "http://localhost:59093/" + }, + "FileStorage": { + "BaseUrl": "http://dev.ccwin-in.com:60082/" + //"BaseUrl": "http://localhost:59092/" + }, + "Inventory": { + "BaseUrl": "http://localhost:59095/" + }, + "Job": { + "BaseUrl": "http://localhost:59095/" + }, + "Label": { + "BaseUrl": "http://dev.ccwin-in.com:60082/" + //"BaseUrl": "http://localhost:59092/" + }, + "Message": { + "BaseUrl": "http://dev.ccwin-in.com:60082/" + //"BaseUrl": "http://localhost:59092/" + }, + "Store": { + "BaseUrl": "http://localhost:59095/" + } + }, + "Serilog": { + "WriteTo": [ + { + "Args": { + "configure": [ + { + "Args": { + "path": "logs/log.txt", + "retainedFileCountLimit": "30", + "rollingInterval": "Day" + }, + "Name": "File" + } + ] + }, + "Name": "Async" + }, + { + "Name": "Http", + "Args": { + "requestUri": "http://localhost:21093", + "queueLimitBytes": null + } + } + ] + } +} \ No newline at end of file diff --git a/build/src/docker/publish/conf/settings/appsettings.Development.json b/build/src/docker/publish/conf/settings/appsettings.Development.json index 315505025..f8c6d252a 100644 --- a/build/src/docker/publish/conf/settings/appsettings.Development.json +++ b/build/src/docker/publish/conf/settings/appsettings.Development.json @@ -105,24 +105,24 @@ // "Store": "Server=localhost,21195;Database=Wms;Uid=sa;Pwd=aA123456!;timeout=6000;" // }, "ConnectionStrings": { - "AbpAuditLogging": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpBackgroundJobs": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpBlobStoring": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpFeatureManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpIdentity": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpIdentityServer": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpPermissionManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpSettingManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "AbpTenantManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Auth": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Basedata": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "FileStorage": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Inventory": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Job": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Label": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Message": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", - "Store": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;" + "AbpAuditLogging": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpBackgroundJobs": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpBlobStoring": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpFeatureManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpIdentity": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpIdentityServer": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpPermissionManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpSettingManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "AbpTenantManagement": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Auth": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Basedata": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "FileStorage": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Inventory": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Job": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Label": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Message": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;", + "Store": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_AGV;uid=ccwin-in;pwd=Microsoft@2022;timeout=6000;" }, "IdentityClients": { "Default": { From 0e497dd799606eaac7668fdf8b8770fc1e46d056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 2 Dec 2024 13:23:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9agv=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Jobs/AgvJobs/AgvJobAccountService.cs | 44 ++- .../AssembleIssueJobAppService.cs | 357 ++++++++++-------- .../CoatingIssueJobAppService.cs | 14 +- .../InjectionIssueJobAppService.cs | 14 +- .../KittingIssueJobAppService.cs | 15 +- .../SparePartIssueJobAppService.cs | 15 +- .../UnplannedIssueJobAppService.cs | 31 +- .../UnplannedReceiptJobAppService.cs | 32 +- 8 files changed, 319 insertions(+), 203 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs index 999f39ec0..58027b767 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/AgvJobs/AgvJobAccountService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; @@ -37,22 +38,43 @@ public class AgvJobAccountService : ApplicationService _Accessor = Accessor; } - + [HttpPost("accountOutOrder")] public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK request) { var res = new AgvResultObject(); - res.Code = "0"; - - var first=request.Data.FirstOrDefault(); - var agvJobAccountService = _Accessor(first.OrderType); - var result = await agvJobAccountService.AccountOutOrderAsync(request).ConfigureAwait(false); - if (result.Code!= "0") + ; + + + List errors= new List(); + var jobList = request.Data.Select(p => p.OrderNum).Distinct(); + foreach (var job in jobList) + { + var jobdetails = request.Data.Where(p => p.OrderNum == job); + if (jobdetails!=null && jobdetails.Any()) { - res.Code = "1"; - res.Message = result.Message; - + var first= jobdetails.FirstOrDefault(); + var agvJobAccountService = _Accessor(first.OrderType); + var jobreq = new AgvRequestOnlyJobHK(); + jobreq.Data =jobdetails.ToList(); + var result = await agvJobAccountService.AccountOutOrderAsync(jobreq).ConfigureAwait(false); + if (result.Code != "0") + { + errors.Add($"任务{job}类型{first.OrderType}错误{result.Message}"); + } } - + } + if (errors.Count > 0) + { + res.Code = "1"; + res.Message =string.Join(",",errors); + res.ReqCode = "0"; + return res; + } + + res.Code = "0"; + res.ReqCode = "0"; + res.Message = "OK"; + return res; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs index c86024a0b..4d87e7993 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/AssembleIssueJobs/AssembleIssueJobAppService.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.Json; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using DocumentFormat.OpenXml.Office2016.Excel; using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -845,15 +846,200 @@ public class AssembleIssueJobAppService /// /// [HttpPost("call-agv")] - public async Task CallAgvAsync(List input) + public async Task CallAgvAsync(List inputs) { - return null; + + var res = new ReusltObject(); + List errors = new List(); + List successList= new List(); + foreach (var itm in inputs) + { + var jobres= await PushOutTaskAsync(itm).ConfigureAwait(false); + if (jobres.Code != "0") + { + _logger.LogInformation(jobres.Message); + errors.Add(jobres.Message); + } + else + { + successList.Add(jobres.Message); + } + } + if (errors.Count > 0) + { + res.Code = -1; + res.Message = string.Join(",", errors); + res.Data=""; + return res; + } + return res; + + } [HttpPost("call-back-agv")] - public virtual async Task CallBackAgvAsync(IssueRequestFromRestoDTO input) + public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK request) { - return null; + var json = JsonSerializer.Serialize(request); + var flag = DateTime.Now.ToString("yyyyMMddHHmmss"); + _logger.LogInformation($"{flag}接收到AGV确认单据内容:" + json); +#if DEBUG +#endif + var errors = new List(); + var first = request.Data.FirstOrDefault(); + var job = await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false); + var ret = new AgvResultObject + { + Code = "0", + Message = "OK", + ReqCode = job.AssembleRequestNumber, + }; + using var unitOfWork = _unitOfWorkManager.Begin(); + try + { + if (request.Data.Count > 0) + { + var jobs = request.Data; + var numbers = jobs.Select(p => p.OrderNum); + var query = _repository.WithDetails() + .Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); + + var entities = query.ToList(); + if (entities.Count == 0) + { + errors.Add($"任务号{string.Join(",", numbers)}不存在!"); + } + + var dtos = ObjectMapper.Map, List>(entities); + + foreach (var itm in dtos) + { + var arys = jobs.Where(p => p.OrderNum == itm.Number); + var itmDetails = itm.Details.ToList(); + var details = new List(); + foreach (var detail in arys) + { + + 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 entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode); + if (entity == null) + { + errors.Add($"物料号{detail.MatCode}不在任务明细内!"); + } + + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + var dto = new AssembleIssueJobDetailDTO(); + dto.InjectFrom(entity); + dto.HandledToLocationCode = toloc.Code; + dto.HandledToLocationGroup = tolocation.LocationGroupCode; + dto.HandledToLocationArea = tolocation.AreaCode; + dto.HandledToLocationErpCode = tolocation.ErpLocationCode; + + dto.HandledToWarehouseCode = tolocation.WarehouseCode; + dto.HandledToQty = detail.MatQty; + dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; + dto.HandledToPackingCode = string.Empty; + + dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; + dto.HandledFromLocationCode = fromlocation.Code; + dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; + dto.HandledFromLocationArea = fromlocation.AreaCode; + dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledFromQty = detail.MatQty; + dto.HandledFromLot = string.Empty; + dto.HandledFromPackingCode = string.Empty; + details.Add(dto); + + + + + + //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + } + + if (errors.Count > 0) + { + ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + itm.Worker = "AGV"; + itm.Details = details; + + _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); + } + } + else + { + errors.Add("Agv确认单据里无数据! \n"); + } + } + catch (Exception ex) + { + ret = new AgvResultObject + { + Code = "-1", + ReqCode = job.AssembleRequestNumber, + Message = ex.Message, + }; + await unitOfWork.RollbackAsync(); + return ret; + } + + if (errors.Count > 0) + { + ret = new AgvResultObject + { + Code = "-1", + Message = string.Join(",", errors.ToArray()), + ReqCode = job.AssembleRequestNumber + }; + } + return ret; } #endregion @@ -985,8 +1171,8 @@ public class AssembleIssueJobAppService - [HttpPost("PushOutTask")] - public async Task PushOutTaskAsync(AssembleIssueJobDTO job) + + private async Task PushOutTaskAsync(AssembleIssueJobDTO job) { var ret = new AgvResultObject { @@ -1002,7 +1188,7 @@ public class AssembleIssueJobAppService request.MatCode = first.ItemCode; request.MatQty = first.HandledToQty; request.OrderNum = job.Number; - request.OrderType = "2"; + request.OrderType = "1001"; var httpclient = _httpClientFactory.CreateClient(); _agvOptions.Value.Address = string.IsNullOrEmpty(_agvOptions.Value.Address) @@ -1049,163 +1235,6 @@ public class AssembleIssueJobAppService return ret; } - [HttpPost("accountOutOrder")] - public async Task AccountOutOrderAsync(AgvRequestOnlyJobHK 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 first = request.Data.FirstOrDefault(); - var job=await _repository.GetAsync(p => p.Number == first.OrderNum).ConfigureAwait(false); - - var ret = new AgvResultObject - { - Code = "0", - Message = "OK", - ReqCode = job.AssembleRequestNumber, - - }; - using var unitOfWork = _unitOfWorkManager.Begin(); - try - { - if (request.Data.Count > 0) - { - var jobs = request.Data; - var numbers = jobs.Select(p => p.OrderNum); - var query = _repository.WithDetails() - .Where(p => numbers.Contains(p.Number) && p.JobStatus != EnumJobStatus.Done); - var entities = query.ToList(); - if (entities.Count == 0) - { - errors.Add($"任务号{string.Join(",", numbers)}不存在!"); - } - - var dtos = ObjectMapper.Map, List>(entities); - foreach (var itm in dtos) - { - var arys = jobs.Where(p => p.OrderNum == itm.Number); - var itmDetails = itm.Details.ToList(); - var details = new List(); - foreach (var detail in arys) - { - - 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.Code).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.Code).ConfigureAwait(false); - } - if (tolocation == null) - { - errors.Add($"结束点{detail.EndPosition}库位没查到"); - } - - - var entity = itmDetails.FirstOrDefault(p => p.ItemCode == detail.MatCode); - if (entity == null) - { - errors.Add($"物料号{detail.MatCode}不在任务明细内!"); - } - - var dto = new AssembleIssueJobDetailDTO(); - dto.InjectFrom(entity); - dto.HandledToLocationCode = toloc.Code; - dto.HandledToLocationGroup = tolocation.LocationGroupCode; - dto.HandledToLocationArea = tolocation.AreaCode; - dto.HandledToLocationErpCode = tolocation.ErpLocationCode; - - dto.HandledToWarehouseCode = tolocation.WarehouseCode; - dto.HandledToQty = detail.MatQty; - dto.HandledToLot =!string.IsNullOrEmpty(detail.BatchAttr07)? detail.BatchAttr07: string.Empty; - dto.HandledToPackingCode = string.Empty; - - dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - dto.HandledFromLocationCode = fromlocation.Code; - dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - dto.HandledFromLocationArea = fromlocation.AreaCode; - dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; - dto.HandledFromQty = detail.MatQty; - dto.HandledFromLot = string.Empty; - dto.HandledFromPackingCode = string.Empty; - details.Add(dto); - - - - - - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); - } - - if (errors.Count > 0) - { - ret = new AgvResultObject() - { - Code = "-1", - ReqCode="", - Message = string.Join(",", errors.ToArray()) - }; - } - itm.Worker = "AGV"; - itm.Details = details; - - _logger.LogInformation($"{flag}接收Agv确认单据内容:" + json + "Agv任务完成"); - } - } - else - { - errors.Add("Agv确认单据里无数据! \n"); - } - } - catch (Exception ex) - { - ret = new AgvResultObject - { - Code = "-1", - ReqCode=job.AssembleRequestNumber, - Message = ex.Message, - }; - await unitOfWork.RollbackAsync(); - return ret; - } - - if (errors.Count > 0) - { - ret = new AgvResultObject - { - Code = "-1", - Message = string.Join(",", errors.ToArray()), - ReqCode=job.AssembleRequestNumber - }; - } - return ret; - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs index 9ab045668..9fe656cbd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs @@ -853,7 +853,7 @@ public class CoatingIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -871,7 +871,7 @@ public class CoatingIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -885,6 +885,16 @@ public class CoatingIssueJobAppService errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + var dto = new CoatingIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs index e72132c66..944ce6e88 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs @@ -802,7 +802,7 @@ public class InjectionIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -820,7 +820,7 @@ public class InjectionIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -833,7 +833,15 @@ public class InjectionIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } - + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } var dto = new InjectionIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; 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 f80d37205..868863728 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 @@ -814,7 +814,7 @@ public class KittingIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -832,7 +832,7 @@ public class KittingIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -846,6 +846,17 @@ public class KittingIssueJobAppService errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new KittingIssueJobDetailDTO(); dto.InjectFrom(entity); dto.HandledToLocationCode = toloc.Code; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs index 8a06554c4..3b9400cb5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs @@ -791,7 +791,7 @@ public class SparePartIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -809,7 +809,7 @@ public class SparePartIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -822,6 +822,17 @@ public class SparePartIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new SparePartIssueJobDetailDTO(); dto.InjectFrom(entity); 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 260a84d37..0519fe0f3 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 @@ -767,7 +767,7 @@ public class UnplannedIssueJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -785,7 +785,7 @@ public class UnplannedIssueJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -798,11 +798,22 @@ public class UnplannedIssueJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new UnplannedIssueJobDetailDTO(); dto.InjectFrom(entity); - //dto.HandledQty = toloc.Code; - //dto.location = tolocation.LocationGroupCode; + dto.HandledQty = detail.MatQty; + //dto.= tolocation.LocationGroupCode; //dto.HandledToLocationArea = tolocation.AreaCode; //dto.HandledToLocationErpCode = tolocation.ErpLocationCode; @@ -811,11 +822,11 @@ public class UnplannedIssueJobAppService //dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; //dto.HandledToPackingCode = string.Empty; - //dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - //dto.HandledFromLocationCode = fromlocation.Code; - //dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - //dto.HandledFromLocationArea = fromlocation.AreaCode; - //dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; + dto.HandledFromLocationCode = fromlocation.Code; + dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; + dto.HandledFromLocationArea = fromlocation.AreaCode; + dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; //dto.HandledFromQty = detail.MatQty; //dto.HandledFromLot = string.Empty; //dto.HandledFromPackingCode = string.Empty; @@ -825,7 +836,7 @@ public class UnplannedIssueJobAppService - //await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); + } if (errors.Count > 0) 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 cf7abaa6a..16fce525f 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 @@ -443,7 +443,7 @@ public class UnplannedReceiptJobAppService if (fromloc != null) { - fromlocation = await _locationAppService.GetByCodeAsync(fromloc.Code).ConfigureAwait(false); + fromlocation = await _locationAppService.GetByCodeAsync(fromloc.LocationCode).ConfigureAwait(false); } if (fromlocation == null) { @@ -461,7 +461,7 @@ public class UnplannedReceiptJobAppService if (toloc != null) { - tolocation = await _locationAppService.GetByCodeAsync(toloc.Code).ConfigureAwait(false); + tolocation = await _locationAppService.GetByCodeAsync(toloc.LocationCode).ConfigureAwait(false); } if (tolocation == null) { @@ -474,11 +474,25 @@ public class UnplannedReceiptJobAppService { errors.Add($"物料号{detail.MatCode}不在任务明细内!"); } + if (errors.Count > 0) + { + return ret = new AgvResultObject() + { + Code = "-1", + ReqCode = "", + Message = string.Join(",", errors.ToArray()) + }; + } + + var dto = new UnplannedReceiptJobDetailDTO(); dto.InjectFrom(entity); - // dto.HandledQty = toloc.Code; - //dto.location = tolocation.LocationGroupCode; + + + + dto.HandledQty = detail.MatQty; + //dto.= tolocation.LocationGroupCode; //dto.HandledToLocationArea = tolocation.AreaCode; //dto.HandledToLocationErpCode = tolocation.ErpLocationCode; @@ -487,11 +501,11 @@ public class UnplannedReceiptJobAppService //dto.HandledToLot = !string.IsNullOrEmpty(detail.BatchAttr07) ? detail.BatchAttr07 : string.Empty; //dto.HandledToPackingCode = string.Empty; - //dto.HandledFromWarehouseCode = fromlocation.WarehouseCode; - //dto.HandledFromLocationCode = fromlocation.Code; - //dto.HandledFromLocationGroup = fromlocation.LocationGroupCode; - //dto.HandledFromLocationArea = fromlocation.AreaCode; - //dto.HandledFromLocationErpCode = fromlocation.ErpLocationCode; + dto.HandledToWarehouseCode = fromlocation.WarehouseCode; + dto.HandledToLocationCode = fromlocation.Code; + dto.HandledToLocationGroup = fromlocation.LocationGroupCode; + dto.HandledToLocationArea = fromlocation.AreaCode; + dto.HandledToLocationErpCode = fromlocation.ErpLocationCode; //dto.HandledFromQty = detail.MatQty; //dto.HandledFromLot = string.Empty; //dto.HandledFromPackingCode = string.Empty;