From 9817388c5e3f9294fa64198800bfc0ad14ff43de Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 25 Jul 2024 16:20:42 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.TaskApi/Controllers/TaskManageController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs index 0c8b2e31..791524a4 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -28,7 +28,7 @@ public class TaskManageController : ApiController /// 返回回执 [HttpPost("CreateTaskJob")] [ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous] - public async Task> CreateTaskJob(TaskManageOrderMessageInfo info) + public async Task CreateTaskJob(TaskManageOrderMessageInfo info) { var result = await taskManageService.InitTaskJob(info); return result; @@ -43,7 +43,7 @@ public class TaskManageController : ApiController /// 返回回执 [HttpPost("CreateBCTaskJob")] [ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous] - public async Task> CreateBCTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData) + public async Task CreateBCTaskJob(IFormFile file, IFormFile modifyFile, [FromForm] string jsonData) { TaskManageOrderMessageInfo? info = JsonConvert.DeserializeObject(jsonData); if (info == null) From c54a74acd523c2d8bd8a7f9ab0b99d7972a2997c Mon Sep 17 00:00:00 2001 From: dengyu Date: Thu, 25 Jul 2024 17:04:26 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=AE=B1=E7=AE=A1=2020240725?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ApiController.cs | 18 ++ .../Controllers/CM_CurrentStateController.cs | 95 +++++++ .../DS.WMS.ContainerManagementApi.csproj | 24 ++ .../DS.WMS.ContainerManagementApi.http | 6 + .../Logs/internal-nlog.txt | 42 +++ .../DS.WMS.ContainerManagementApi/Program.cs | 86 ++++++ .../Properties/launchSettings.json | 41 +++ .../appsettings.Development.json | 8 + .../appsettings.json | 89 ++++++ .../DS.WMS.ContainerManagementApi/nlog.config | 36 +++ .../Dtos/CM_CurrentStateReq.cs | 136 +++++++++ .../Dtos/CM_CurrentStateRes.cs | 117 ++++++++ .../Entity/CM_CurrentState.cs | 136 +++++++++ .../Interface/ICM_CurrentStateService.cs | 33 +++ .../Method/ClientAccountDateService.cs | 115 ++++++++ ds-wms-service/DS.WMS.Gateway/ocelot.json | 18 ++ .../DS.WMS.Test/ContainerManagementTest.cs | 258 ++++++++++++++++++ ds-wms-service/ds-wms-service.sln | 7 + 18 files changed, 1265 insertions(+) create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/ApiController.cs create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_CurrentStateController.cs create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.csproj create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.http create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/Properties/launchSettings.json create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.Development.json create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.json create mode 100644 ds-wms-service/DS.WMS.ContainerManagementApi/nlog.config create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_CurrentStateService.cs create mode 100644 ds-wms-service/DS.WMS.Core/ContainerManagement/Method/ClientAccountDateService.cs create mode 100644 ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/ApiController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/ApiController.cs new file mode 100644 index 00000000..e50631a2 --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/ApiController.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.ContainerManagementApi.Controllers; + +/// +/// WebApi控制器基类 +/// +[Authorize] +[ApiController] +[Route("containerManagementApi/[controller]")] +public abstract class ApiController : Controller +{ + // /// + // /// 获取用户信息 + // /// + // public UserInfo UserDetails => Request.GetUserInfo(); +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_CurrentStateController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_CurrentStateController.cs new file mode 100644 index 00000000..bf5678ea --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_CurrentStateController.cs @@ -0,0 +1,95 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.ContainerManagement.Info.Dtos; +using DS.WMS.ContainerManagement.Info.Entity; +using DS.WMS.ContainerManagement.Info.Interface; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Op.Dtos; +using DS.WMS.Core.Op.Interface; +using DS.WMS.Core.Op.View; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.ContainerManagementApi.Controllers; + +/// +/// 集装箱管理 +/// +public class CM_CurrentStateController : ApiController +{ + private readonly ICM_CurrentStateService _invokeService; + + /// + /// 构造函数 + /// + /// + public CM_CurrentStateController(ICM_CurrentStateService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetCM_CurrentStateList")] + public async Task>> GetCM_CurrentStateList([FromBody] PageRequest request) + { + var res = await _invokeService.GetListByPage(request); + return res; + } + + /// + /// 直接编辑状态 + /// + /// + [HttpPost] + [Route("EditCM_CurrentState")] + public DataResult EditCM_CurrentState([FromBody] CM_CurrentStateReq model) + { + var res = _invokeService.EditCM_CurrentState(model); + return res; + } + + + /// + /// 查看状态详情 + /// + /// + /// + [HttpGet] + [Route("GetCM_CurrentStateInfo")] + public DataResult GetCM_CurrentStateInfo([FromQuery] string id) + { + var res = _invokeService.GetCM_CurrentStateInfo(id); + return res; + } + + ///// + ///// 费用锁定 + ///// + ///// 主表Ids + ///// + //[HttpPost] + //[Route("FeeLocking")] + //public DataResult FeeLocking([FromBody] IdModel req) + //{ + // var res = _invokeService.FeeLocking(req); + // return res; + //} + + + ///// + ///// 费用解除锁定 + ///// + ///// 主表Ids + ///// + //[HttpPost] + //[Route("FeeUnLocking")] + //public DataResult FeeUnLocking([FromBody] IdModel req) + //{ + // var res = _invokeService.FeeUnLocking(req); + // return res; + //} +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.csproj b/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.csproj new file mode 100644 index 00000000..9f6d401c --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + true + True + bin\Debug\net8.0\Api.xml + + + + + + + + + + + + + + + diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.http b/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.http new file mode 100644 index 00000000..d2a062b9 --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/DS.WMS.ContainerManagementApi.http @@ -0,0 +1,6 @@ +@DS.WMS.ContainerManagementApi_HostAddress = http://localhost:5011 + +GET {{DS.WMS.ContainerManagementApi_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt new file mode 100644 index 00000000..30eb1c52 --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Logs/internal-nlog.txt @@ -0,0 +1,42 @@ +2024-07-25 15:40:36.9950 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 15:40:37.0123 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 15:40:37.0161 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 15:40:37.0333 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 15:40:37.0333 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 15:40:37.0333 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 15:40:37.0498 Info Configuration initialized. +2024-07-25 15:41:29.0953 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 15:41:29.1107 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 15:41:29.1107 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 15:41:29.1294 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 15:41:29.1294 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 15:41:29.1444 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 15:41:29.1444 Info Configuration initialized. +2024-07-25 16:17:59.0630 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 16:17:59.0872 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 16:17:59.0946 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 16:17:59.1151 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 16:17:59.1151 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 16:17:59.1292 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 16:17:59.1292 Info Configuration initialized. +2024-07-25 16:19:07.1595 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 16:19:07.1728 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 16:19:07.1728 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 16:19:07.1911 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 16:19:07.1911 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 16:19:07.1911 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 16:19:07.2052 Info Configuration initialized. +2024-07-25 16:24:33.7032 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 16:24:33.7032 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 16:24:33.7248 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 16:24:33.7460 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 16:24:33.7541 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 16:24:33.7541 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 16:24:33.7696 Info Configuration initialized. +2024-07-25 16:34:52.0017 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 16:34:52.0017 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 16:34:52.0175 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 16:34:52.0332 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 16:34:52.0332 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\ds8-solution-pro\ds-wms-service\DS.WMS.ContainerManagementApi\bin\Debug\net8.0\nlog.config +2024-07-25 16:34:52.0332 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 16:34:52.0509 Info Configuration initialized. diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs new file mode 100644 index 00000000..6bc37b0c --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Program.cs @@ -0,0 +1,86 @@ +using Autofac; +using Autofac.Extensions.DependencyInjection; +using DS.Module.AutofacModule; +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.Module.Core.ServiceExtensions; +using DS.Module.Jwt; +using DS.Module.MultiLanguage; +using DS.Module.SqlSugar; +using DS.Module.Swagger; +using DS.Module.UserModule; +using NLog.Web; +using Swashbuckle.AspNetCore.SwaggerUI; + +var builder = WebApplication.CreateBuilder(args); +var environment = builder.Environment.EnvironmentName; +Console.WriteLine("ǰ:" + environment); +//ע +builder.Configuration + // .SetBasePath(builder.Environment.ContentRootPath) + .AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true) + // .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true) + .Build(); +builder.Configuration.AddEnvironmentVariables(); +builder.Logging.AddNLog("nlog.config"); +// Add services to the container. +//Autofacע +builder.Host + .UseServiceProviderFactory(new AutofacServiceProviderFactory()) + .ConfigureContainer(builder => { builder.RegisterModule(new AutofacModuleRegister()); }); + +builder.Services.AddAppWebInstal(); +builder.Services.AddCorsInstall(); +builder.Services.AddUserModuleInstall(); //û +builder.Services.AddSqlSugarInstall(); +builder.Services.AddSwaggerInstall(); +builder.Services.AddJwtInstall(); +builder.Services.AddSaasDbInstall();//ֿ +builder.Services.AddMultiLanguageInstall();//Է +// builder.Services.AddEndpointsApiExplorer(); +// builder.Services.AddSwaggerGen(); + +//builder.Services.AddCrawlerModuleInstall();//ٷ + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +// if (app.Environment.IsDevelopment()) +// { +// app.UseSwagger(); +// app.UseSwaggerUI(); +// } +//swagger +// app.UseSwagger(); +var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }); +app + .UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; }) + .UseSwaggerUI(c => + { + c.SwaggerEndpoint("/" + documentName + "/swagger.json", + AppSetting.app(new string[] { "SwaggerDoc", "ContactName" })); + c.DocExpansion(DocExpansion.None);//DocExpansionΪNone۵з + c.DefaultModelExpandDepth(-1);//-1 ɲʾModels + }); +// +var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" }); +if (!policyName.IsNullOrEmpty()) +{ + app.UseCors(policyName); //ӿм +} + +app.UseRouting(); + +app.UseStaticFiles(); +//м +app.UseMiddleware(); +// //־м +// app.UseMiddleware(); + +// ȿ֤ +app.UseAuthentication(); +// ȻȨм +app.UseAuthorization(); +app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); + +app.Run(); \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Properties/launchSettings.json b/ds-wms-service/DS.WMS.ContainerManagementApi/Properties/launchSettings.json new file mode 100644 index 00000000..153510ec --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:52580", + "sslPort": 44370 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5011", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7026;http://localhost:5011", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.Development.json b/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.json b/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.json new file mode 100644 index 00000000..a97587c4 --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/appsettings.json @@ -0,0 +1,89 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "JwtSettings": { + "Issuer": "vol.core.owner", + "Audience": "vol.core", + "User": "C5ABA9E202D94C43A3CA66002BF77FAF", + "SecretKey": "sdfsdfsrty45634kkhllghtdgdfss345t678fs" + }, + "Cors": { + "PolicyName": "WMSCore.API", + "Url": "http://localhost:8000,http://localhost:5999,http://localhost:8088,http://localhost:5173,http://0.0.0.0:5999,http://0.0.0.0:9995,http://localhost:9995,http://60.209.125.238:9995,http://localhost:3000,https://localhost:3100,http://47.104.255.182:3100,http://47.104.255.182:3110,https://localhost:3110,http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084" + }, + "DBInfo": { + "DefaultDbConnId": "1288018625843826688", + "DefaultDbType": 0, + "DefaultDbString": "server=60.209.125.238;port=32006;uid=root;pwd=Djy@Mysql.test;database=shippingweb8_dev", + "DBS": [ + { + "ConnId": "1288018625843826680", + "DBType": 0, + "Enabled": false, + "HitRate": 40, + "Connection": "server=60.209.125.238;port=32006;uid=root;pwd=Djy@Mysql.test;database=shippingweb8_log" + } + ] + }, + "SwaggerDoc": { + "ContactName": "WmsContainerManagementAPI", + "ContactEmail": "Wms API.Core@xxx.com", + "ContactUrl": "https://www.xxx.com", + "Version": "1.0", + "Title": "Wms ContainerManagement API", + "Description": "Wms ContainerManagement API" + }, + "Middleware": { + "RecordAccessLogs": { + "Enabled": true, + "IgnoreApis": "/api/permission/getnavigationbar,/api/monitor/getids4users,/api/monitor/getaccesslogs,/api/monitor/server,/api/monitor/getactiveusers,/api/monitor/server," + } + }, + "FileSettings": { + "BasePath": "", //基础路径,不配置则使用当前系统目录 + "RelativePath": "LinkAttach", + "FileType": [ ".xls", ".xlsx", ".pdf", ".jpg", ".png", ".txt", ".pms" ] + }, + //打印模板 + "PrintTemplate": { + "BasePath": "", //基础路径,不配置则使用当前系统目录 + "RelativePath": "Upload/PrintTemplate", + "FileType": [ ".frx", ".xls" ] + }, + "TempFile": { + "Path": "TempFiles", + "RemainHours": 2 + }, + "PrintService": { + "IP": "60.209.125.238", + "Port": "3009", + "AccessKey": "1777229107311022080", + "AccessSecret": "d816e6fe938f24e2f205db129d31286a", + "GetModuleListUrl": "/printApi/OpenPrint/GetPrintModuleList", + "GetTemplateListUrl": "/printApi/OpenPrint/GetPrintTemplateList", + "GetJsonPrintInfoUrl": "/printApi/OpenPrint/GetOpenJsonPrintInfo" + }, + "DjyService": { + "IP": "60.209.125.238", + "Port": "35100", + "AccessKey": "6b050e757c1e405489e19602dd81ebbe", + "AccessSecret": "51d564741c761e0760f62d904f13c193009e74d0af9f72e2dc67f9320b8ae42580e2339745aee1bf", + "SaveServiceProjectUrl": "/EmbedProjectGoodsStatus/SaveServiceProject", + "CancelServiceProjectUrl": "/EmbedProjectGoodsStatus/CancelServiceProject", + "GetServiceProjectListUrl": "/EmbedProjectGoodsStatus/GetServiceProjectList", + "GetServiceStatusListUrl": "/EmbedProjectGoodsStatus/GetServiceStatusList", + "SaveServiceStatusUrl": "/EmbedProjectGoodsStatus/SaveServiceStatus", + "CancelServiceStatusUrl": "/EmbedProjectGoodsStatus/CancelServiceStatus" + }, + "ExcuteRuleService": { + "IP": "47.104.73.97", + "Port": "7115", + "SenderKey": "SEFBZkh5V3R1TGxtdlBIcTF4QmNMWURCS08vb2EvTzVxS0F0eDFKdlgyS3lKVUx6K3JRRE94Q2kvcWZMRytZeWxyVkhLdk9hRGpzVStPamhIUXd5NU9FMjhFTktwUlZ2eThJZGlQd3p5dUk9", + "SendUrl": "/api/RulesEngineManage/ExcuteWorkFlow" + } +} diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/nlog.config b/ds-wms-service/DS.WMS.ContainerManagementApi/nlog.config new file mode 100644 index 00000000..46e6f7cb --- /dev/null +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/nlog.config @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs new file mode 100644 index 00000000..72d3027c --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateReq.cs @@ -0,0 +1,136 @@ +using DS.Module.Core; +using FluentValidation; +using SqlSugar; + +namespace DS.WMS.ContainerManagement.Info.Dtos; + +/// +/// 集装箱当前状态 请求实体 +/// +public class CM_CurrentStateReq +{ + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 集装箱号 + /// + public string Cntrno { get; set; } + + // + /// Desc:箱型 + /// + public string Ctnall { get; set; } + + /// + /// Desc:是否上线(是否管理中) + /// + public bool IsOnline { get; set; } = false; + + /// + /// Desc:新旧箱 空白/used/new + /// + public string UsedState { get; set; } + + /// + /// Desc:箱主 + /// + public string CtnOwner { get; set; } + + + /// + /// Desc:业务所属分部 + /// + public string Corpid { get; set; } + + /// + /// Desc:箱来源: 自有箱/短租租入/长租租入/买箱 + /// + public string CtnSource { get; set; } + + /// + /// Desc:箱业务状态: 短租租出 长租租出 单程 卖箱 + /// + public string CtnBizState { get; set; } = "0"; + + /// + /// Desc:箱业务编号:当前 + /// + public string Billno { get; set; } + + /// + /// Desc:关联放箱单号 + /// + public string CtnReleaseNo { get; set; } + + /// + /// Desc:箱状态 + /// + public string CtnState { get; set; } + + /// + /// Desc:箱损坏/维修状态 + /// + public string CtnBreakState { get; set; } + + /// + /// Desc:当前港口 + /// + public string Portid { get; set; } + + /// + /// Desc:码头或场站 + /// + public string Depot { get; set; } + + /// + /// Desc:运输工具 + /// + public string VehicleName { get; set; } + + /// + /// Desc:当前业务编号 + /// + public string Mblno { get; set; } + + + /// + /// Desc:业务委托单位 + /// + public string CustomerName { get; set; } + + + /// + /// Desc:ETD + /// + public DateTime? ETD { get; set; } + + /// + /// Desc:ETD + /// + public DateTime? ETA { get; set; } + + + /// + /// Desc:状态时间 + /// + public DateTime? StateTime { get; set; } +} + +/// +/// 验证 +/// +public class CM_CurrentStateReqValidator : AbstractValidator +{ + /// + /// 构造函数 + /// + public CM_CurrentStateReqValidator() + { + this.RuleFor(o => o.Cntrno) + .NotEmpty().WithName("集装箱号"); + this.RuleFor(o => o.Ctnall) + .NotEmpty().WithName("箱型"); + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs new file mode 100644 index 00000000..dc1f13e3 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_CurrentStateRes.cs @@ -0,0 +1,117 @@ +using DS.Module.Core; +using SqlSugar; + +namespace DS.WMS.ContainerManagement.Info.Dtos; + +/// +/// 集装箱当前状态 返回实体 +/// +public class CM_CurrentStateRes +{ + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 集装箱号 + /// + public string Cntrno { get; set; } + + // + /// Desc:箱型 + /// + public string Ctnall { get; set; } + + /// + /// Desc:是否上线(是否管理中) + /// + public bool IsOnline { get; set; } = false; + + /// + /// Desc:新旧箱 空白/used/new + /// + public string UsedState { get; set; } + + /// + /// Desc:箱主 + /// + public string CtnOwner { get; set; } + + /// + /// Desc:业务所属分部 + /// + public string Corpid { get; set; } + + /// + /// Desc:箱来源: 自有箱/短租租入/长租租入/买箱 + /// + public string CtnSource { get; set; } + + /// + /// Desc:箱业务状态: 短租租出 长租租出 单程 卖箱 + /// + public string CtnBizState { get; set; } = "0"; + + /// + /// Desc:箱业务编号:当前 + /// + public string Billno { get; set; } + + /// + /// Desc:关联放箱单号 + /// + public string CtnReleaseNo { get; set; } + + /// + /// Desc:箱状态 + /// + public string CtnState { get; set; } + + /// + /// Desc:箱损坏/维修状态 + /// + public string CtnBreakState { get; set; } + + /// + /// Desc:当前港口 + /// + public string Portid { get; set; } + + /// + /// Desc:码头或场站 + /// + public string Depot { get; set; } + + /// + /// Desc:运输工具 + /// + public string VehicleName { get; set; } + + /// + /// Desc:当前业务编号 + /// + public string Mblno { get; set; } + + + /// + /// Desc:业务委托单位 + /// + public string CustomerName { get; set; } + + + /// + /// Desc:ETD + /// + public DateTime? ETD { get; set; } + + /// + /// Desc:ETD + /// + public DateTime? ETA { get; set; } + + + /// + /// Desc:状态时间 + /// + public DateTime? StateTime { get; set; } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs new file mode 100644 index 00000000..8dacc9cc --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_CurrentState.cs @@ -0,0 +1,136 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using SqlSugar; + +namespace DS.WMS.ContainerManagement.Info.Entity; + +/// +/// 集装箱当前状态 +/// +[SqlSugar.SugarTable("CM_CurrentState", "箱管_当前状态")] +public class CM_CurrentState : BaseOrgModel +{ + /// + /// Desc:集装箱号 + /// + [SugarColumn(ColumnDescription = "集装箱号", IsNullable = false, Length = 20)] + public string Cntrno { get; set; } + + /// + /// Desc:箱型 + /// + [SugarColumn(ColumnDescription = "箱型", IsNullable = false, Length = 20)] + public string Ctnall { get; set; } + + /// + /// Desc:是否上线(是否管理中) + /// + [SugarColumn(ColumnDescription = "是否上线", IsNullable = false,DefaultValue ="0")] + public bool IsOnline { get; set; } = false; + + /// + /// Desc:新旧箱 空白/used/new + /// + [SugarColumn(ColumnDescription = "新旧箱", IsNullable = true, Length = 20)] + public string UsedState { get; set; } + + /// + /// Desc:箱主 + /// + [SugarColumn(ColumnDescription = "箱主", IsNullable = true, Length = 50)] + public string CtnOwner { get; set; } + + /// + /// Desc:业务所属分部 + /// + [SugarColumn(ColumnDescription = "业务所属分部", IsNullable = true, Length = 50)] + public string Corpid { get; set; } + + /// + /// Desc:箱来源: 自有箱/短租租入/长租租入/买箱 + /// + [SugarColumn(ColumnDescription = "箱来源", IsNullable = true, Length = 20)] + public string CtnSource { get; set; } + + /// + /// Desc:箱业务状态: 短租租出 长租租出 单程 卖箱 + /// + [SugarColumn(ColumnDescription = "箱业务状态", DefaultValue = "")] + public string CtnBizState { get; set; } = "0"; + + /// + /// Desc:箱业务编号:当前 + /// + [SugarColumn(ColumnDescription = "箱业务编号", IsNullable = true, Length = 50)] + public string Billno { get; set; } + + /// + /// Desc:关联放箱单号 + /// + [SugarColumn(ColumnDescription = "关联放箱单号", Length = 50)] + public string CtnReleaseNo { get; set; } + + /// + /// Desc:箱状态 + /// + [SugarColumn(ColumnDescription = "箱状态", IsNullable = true, Length = 20)] + public string CtnState { get; set; } + + /// + /// Desc:箱损坏/维修状态 + /// + [SugarColumn(ColumnDescription = "箱损坏/维修状态", IsNullable = true, Length = 20)] + public string CtnBreakState { get; set; } + + /// + /// Desc:当前港口 + /// + [SugarColumn(ColumnDescription = "当前港口", IsNullable = true, Length = 50)] + public string Portid { get; set; } + + /// + /// Desc:码头或场站 + /// + [SugarColumn(ColumnDescription = "码头或场站", IsNullable = true, Length = 50)] + public string Depot { get; set; } + + /// + /// Desc:运输工具 + /// + [SugarColumn(ColumnDescription = "运输工具", IsNullable = true, Length = 50)] + public string VehicleName { get; set; } + + /// + /// Desc:当前业务编号 + /// + [SugarColumn(ColumnDescription = "当前业务编号", IsNullable = true, Length = 50)] + public string Mblno { get; set; } + + + /// + /// Desc:业务委托单位 + /// + [SugarColumn(ColumnDescription = "业务委托单位", IsNullable = true, Length = 50)] + public string CustomerName { get; set; } + + + /// + /// Desc:ETD + /// + [SugarColumn(ColumnDescription = "ETD", IsNullable = true)] + public DateTime? ETD { get; set; } + + /// + /// Desc:ETD + /// + [SugarColumn(ColumnDescription = "ETA", IsNullable = true)] + public DateTime? ETA { get; set; } + + + /// + /// Desc:状态时间 + /// + [SugarColumn(ColumnDescription = "状态时间", IsNullable = true)] + public DateTime? StateTime { get; set; } + +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_CurrentStateService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_CurrentStateService.cs new file mode 100644 index 00000000..73562116 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_CurrentStateService.cs @@ -0,0 +1,33 @@ +using DS.Module.Core; +using DS.WMS.ContainerManagement.Info.Dtos; +using DS.WMS.Core.Info.Dtos; +using DS.WMS.Core.Op.View; +using DS.WMS.Core.Sys.Dtos; + +namespace DS.WMS.ContainerManagement.Info.Interface; + +public interface ICM_CurrentStateService +{ + /// + /// 列表 + /// + /// + /// + //DataResult> GetListByPage(PageRequest request); + public Task>> GetListByPage(PageRequest request); + + + /// + /// 编辑 + /// + /// + /// + DataResult EditCM_CurrentState(CM_CurrentStateReq model); + + /// + /// 获取详情 + /// + /// + /// + DataResult GetCM_CurrentStateInfo(string id); +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/ClientAccountDateService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/ClientAccountDateService.cs new file mode 100644 index 00000000..3bc46a14 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/ClientAccountDateService.cs @@ -0,0 +1,115 @@ +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.ContainerManagement.Info.Dtos; +using DS.WMS.ContainerManagement.Info.Entity; +using DS.WMS.ContainerManagement.Info.Interface; +using DS.WMS.Core.Info.Dtos; +using DS.WMS.Core.Info.Entity; +using DS.WMS.Core.Info.Interface; +using DS.WMS.Core.Op.View; +using DS.WMS.Core.Sys.Entity; +using Mapster; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; + +namespace DS.WMS.ContainerManagement.Info.Method; + +public class CM_CurrentStateService : ICM_CurrentStateService +{ + private readonly IServiceProvider _serviceProvider; + private readonly ISqlSugarClient db; + private readonly IUser user; + private readonly ISaasDbService saasService; + + /// + /// + /// + /// + public CM_CurrentStateService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = _serviceProvider.GetRequiredService(); + user = _serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + + /// + /// 列表 + /// + /// + /// + public async Task>> GetListByPage(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = tenantDb.Queryable() + .Where(whereList) + .Select().ToQueryPage(request.PageCondition); + return data; + } + //public async Task>> GetListByPage(PageRequest request) + //{ + // var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + // //序列化查询条件 + // var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + // var data = await tenantDb.Queryable() + // .Where(whereList) + // .ToQueryPageAsync(request.PageCondition); + // return data; + //} + + + /// + /// 编辑 + /// + /// + /// + public DataResult EditCM_CurrentState(CM_CurrentStateReq req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + if (req.Id == 0) + { + //if (tenantDb.Queryable().Where(x => x.AccountType == req.AccountType && + // x.AccountType == req.AccountType && + // x.SaleId == req.SaleId && + // x.BeginDate == req.BeginDate && + // x.EndDate == req.EndDate).Any()) + //{ + // return DataResult.Failed("客户账期信息已存在!", MultiLanguageConst.ClientAccountDateExist); + //} + + var data = req.Adapt(); + + var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); + + return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess); + } + else + { + var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + + info = req.Adapt(info); + + tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); + } + } + + /// + /// 详情 + /// + /// + /// + public DataResult GetCM_CurrentStateInfo(string id) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var data = tenantDb.Queryable() + .Where(a => a.Id == long.Parse(id)) + .Select() + .First(); + return DataResult.Success(data, MultiLanguageConst.DataQuerySuccess); + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Gateway/ocelot.json b/ds-wms-service/DS.WMS.Gateway/ocelot.json index 49d632c6..5eb6ac5c 100644 --- a/ds-wms-service/DS.WMS.Gateway/ocelot.json +++ b/ds-wms-service/DS.WMS.Gateway/ocelot.json @@ -199,6 +199,24 @@ "Type": "RoundRobin" } }, + { + "DownstreamPathTemplate": "/containerManagementApi/{url}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 3005 + } + ], + "UpstreamPathTemplate": "/containerManagementApi/{url}", + "UpstreamHttpMethod": [ + "Get", + "Post" + ], + "LoadBalancerOptions": { + "Type": "RoundRobin" + } + }, { "DownstreamPathTemplate": "/LinkAttach/{url}", "DownstreamScheme": "http", diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs new file mode 100644 index 00000000..8a5fe6db --- /dev/null +++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs @@ -0,0 +1,258 @@ +using System.Reflection; +using DS.Module.Core; +using DS.Module.Core.Extensions; +using DS.Module.SqlSugar; +using DS.WMS.ContainerManagement.Info.Entity; +using DS.WMS.Core.Check.Entity; +using DS.WMS.Core.Code.Entity; +using DS.WMS.Core.Info.Entity; +using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Op.Entity.BookingSlot; +using DS.WMS.Core.Sys.Entity; +using DS.WMS.Core.TaskPlat.Entity; +using Mapster; +using Masuit.Tools.Strings; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Owin.BuilderProperties; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using Org.BouncyCastle.Ocsp; +using SqlSugar; +using SqlSugar.IOC; +using Xunit; + +namespace Ds.WMS.Test; + +public class ContainerManagementTest +{ + private readonly IServiceProvider _serviceProvider; + private readonly SqlSugarScope db; + private readonly ISaasDbService saasService; + public ContainerManagementTest(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + db = (SqlSugarScope)_serviceProvider.GetRequiredService(); + saasService = _serviceProvider.GetRequiredService(); + } + + [Fact] + public void ContainerManagementTest1() + { + Type[] types = Assembly + .LoadFrom("DS.WMS.Core.dll")//如果 .dll报错,可以换成 xxx.exe 有些生成的是exe + .GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Op.Entity.")) + //.GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Code.Entity.") || it.FullName.Contains("DS.WMS.Core.Info.Entity.") || it.FullName.Contains("DS.WMS.Core.Flow.Entity.") + //|| it.FullName.Contains("DS.WMS.Core.Check.Entity.") || it.FullName.Contains("DS.WMS.Core.Map.Entity."))//命名空间过滤,当然你也可以写其他条件过滤 + .ToArray(); + //Type[] types = Assembly + // .LoadFrom("DS.WMS.Core.dll")//如果 .dll报错,可以换成 xxx.exe 有些生成的是exe + // .GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Code.Entity."))//命名空间过滤,当然你也可以写其他条件过滤 + // .ToArray(); + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + // var temp = tenantDb.CodeFirst.GetDifferenceTables(types); || it.FullName.Contains("DS.WMS.Core.Op.Entity.") + // var diffString= tenantDb.CodeFirst.GetDifferenceTables(types).ToDiffString(); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + //types = types.Where(it => it.Name != "BusinessFeeStatus").ToArray(); + //types = types.Where(it => it.Name != "BusinessOrderContact").ToArray(); + + tenantDb.CodeFirst.InitTables(types); + // //初始化数库 + // tenantDb.DbMaintenance.CreateDatabase(); + // + // tenantDb.CodeFirst.InitTables(typeof(CodeCountry)); + Assert.True(true); + } + + + /// + /// 主库初始化单表 + /// + //[Fact] + //public void MasterInitTableTest() + //{ + // StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + // db.CodeFirst.InitTables(typeof(SysPrintTemplate)); + // //tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail)); + // //db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn)); + // Assert.True(true); + //} + /// + /// 初始化单表 + /// + [Fact] + public void InitTableTest() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + + + tenantDb.CodeFirst.InitTables(typeof(CM_CurrentState)); + //tenantDb.CodeFirst.InitTables(typeof(BookingStatusLog)); + //tenantDb.CodeFirst.InitTables(typeof(BookingStatus)); + //tenantDb.CodeFirst.InitTables(typeof(BookingStatusLogDetail)); + //tenantDb.CodeFirst.InitTables(typeof(BusinessOrderContact)); + //tenantDb.CodeFirst.InitTables(typeof(BusinessTruck)); + //tenantDb.CodeFirst.InitTables(typeof(BusinessTruckCtn)); + //tenantDb.CodeFirst.InitTables(typeof(BusinessYard)); + ////tenantDb.CodeFirst.InitTables(typeof(OpCtn)); + //tenantDb.CodeFirst.InitTables(typeof(OpCtnDetail)); + //tenantDb.CodeFirst.InitTables(typeof(OpFile)); + ////tenantDb.CodeFirst.InitTables(typeof(SeaExport)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportBillManage)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportBillManageCtn)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportEdi)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportRemark)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportShippingBill)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportShippingBillCtn)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportShippingBillPartCtn)); + //tenantDb.CodeFirst.InitTables(typeof(SeaExportShippingBillTemplate)); + //db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn)); + Assert.True(true); + } + + ///// + ///// 初始化海运出口视图 + ///// + //[Fact] + //public void InitSeaExportViewTest() + //{ + // var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + // StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + // tenantDb.CodeFirst.InitTables(typeof(SeaExport)); + // Assert.True(true); + //} + [Fact] + public void SaasCheckTest() + { + Type[] types = Assembly + .LoadFrom("DS.WMS.Core.dll")//如果 .dll报错,可以换成 xxx.exe 有些生成的是exe + .GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Code.Entity"))//命名空间过滤,当然你也可以写其他条件过滤 + .ToArray(); + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + tenantDb.CodeFirst.InitTables(types); + Assert.True(true); + } + [Fact] + public void SaasFeeTest() + { + Type[] types = Assembly + .LoadFrom("DS.WMS.Core.dll")//如果 .dll报错,可以换成 xxx.exe 有些生成的是exe + .GetTypes().Where(it => it.FullName.Contains("DS.WMS.Core.Fee.Entity"))//命名空间过滤,当然你也可以写其他条件过滤 + .ToArray(); + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + tenantDb.CodeFirst.InitTables(types); + Assert.True(true); + } + [Fact] + + public void ClientBatchEdit() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + + var info = tenantDb.Queryable().Filter(null, true).Where(x => x.Id == 1772138307266940928).First(); + + var temp = new ClientTemp + { + Address = "4", + Name = "4", + }; + var dic = temp.GetPropertiesArray(); + + info = temp.Adapt(info); + tenantDb.Updateable(info).UpdateColumns(dic).ExecuteCommand(); + + + Assert.True(true); + } + [Fact] + + public void CopyColumnTest() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + + var columns = "noBill,enName,copyNoBill"; + + + var list = columns.Split(","); + var list1 = new List(); + foreach (var item in list) + { + list1.Add(item.ToUpperCamelCase()); + } + Console.WriteLine(list1[0]); + Assert.True(true); + } + + + public class ClientTemp + { + /// + /// Desc:客户中文名称或描述信息 + /// + public string Description { get; set; } + + /// + /// Desc:客户英文简称 + /// + public string Name { get; set; } + + /// + /// Desc:客户英文全称 + /// + public string EnFullName { get; set; } + + /// + /// Desc:通讯地址 + /// + public string Address { get; set; } + } + + /// + /// 初始化单表 + /// + [Fact] + public void InitTableTestJHQ() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + //tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrder)); + //tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderCtn)); + //tenantDb.CodeFirst.InitTables(typeof(SpaceBookingOrderShipSchedule)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotBase)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotCtn)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotStock)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotAllocation)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotAllocationCtn)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotDemand)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotDemandCtn)); + //tenantDb.CodeFirst.InitTables(typeof(BookingSlotCompare)); + //tenantDb.CodeFirst.InitTables(typeof(BookingContractNoManage)); + //tenantDb.CodeFirst.InitTables(typeof(BookingLabel)); + //tenantDb.CodeFirst.InitTables(typeof(BookingLabelAllocation)); + + tenantDb.CodeFirst.InitTables(typeof(InfoClient)); + //tenantDb.CodeFirst.InitTables(typeof(CodeThirdParty)); + //tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail)); + //db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn)); + Assert.True(true); + } + /// + /// 初始化单表 + /// + [Fact] + public void InitTableTestZXF() + { + var tenantDb = saasService.GetBizDbScopeById("1750335377144680448"); + StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持 + + var ass = Assembly.Load("DS.WMS.Core"); + var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray(); + tenantDb.CodeFirst.InitTables(types); + + //tenantDb.CodeFirst.InitTables(typeof(TaskFlowLog)); + //tenantDb.CodeFirst.InitTables(typeof(TaskFlowLogDetail)); + Assert.True(true); + } +} \ No newline at end of file diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 7994ebf3..22e9738c 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -67,6 +67,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.PrintApi", "DS.WMS.P EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.OcrModule", "DS.Module.OcrModule\DS.Module.OcrModule.csproj", "{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.ContainerManagementApi", "DS.WMS.ContainerManagementApi\DS.WMS.ContainerManagementApi.csproj", "{7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -189,6 +191,10 @@ Global {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Debug|Any CPU.Build.0 = Debug|Any CPU {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.ActiveCfg = Release|Any CPU {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.Build.0 = Release|Any CPU + {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -223,6 +229,7 @@ Global {4B51DCC1-62A5-49C5-978B-798E6B48F3C0} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {274B1D18-A15A-4917-A567-6FDCD090D5B0} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} + {7C3E248A-DF40-46AC-A8DF-224DD7C4EEF7} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788} From 81b824bce69401f7978d4084d631d691990e943d Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Thu, 25 Jul 2024 17:13:14 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=B0=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/TaskPlat/TaskSourceEnum.cs | 2 +- .../Enums/TaskPlat/TaskStatLevelEnum.cs | 26 + .../DS.Module.Core/Utils/EnumUtil.cs | 41 +- .../TaskPlat/Dtos/TaskUserStatItem.cs | 62 ++ .../TaskPlat/Entity/TaskBaseInfo.cs | 10 +- .../TaskPlat/Interface/ITaskManageService.cs | 7 + .../TaskPlat/Method/TaskManageService.cs | 718 +++++++++++++++--- .../Controllers/TaskManageController.cs | 59 ++ .../PublishProfiles/本地部署.pubxml | 22 + 9 files changed, 846 insertions(+), 101 deletions(-) create mode 100644 ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs create mode 100644 ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs create mode 100644 ds-wms-service/DS.WMS.TaskApi/Properties/PublishProfiles/本地部署.pubxml diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs index 05ea112c..0acca91b 100644 --- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs +++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskSourceEnum.cs @@ -64,7 +64,7 @@ namespace DS.Module.Core /// /// 工作流 /// - [Description("系统")] + [Description("工作流")] WORK_FLOW, } } diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs new file mode 100644 index 00000000..25c36ca3 --- /dev/null +++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskStatLevelEnum.cs @@ -0,0 +1,26 @@ +using System.ComponentModel; + +namespace DS.Module.Core +{ + /// + /// 任务统计分类枚举 + /// + public enum TaskStatLevelEnum + { + /// + /// 异常 + /// + [Description("异常")] + EXCPTION, + /// + /// 个人 + /// + [Description("个人")] + PERSON, + /// + /// 公共 + /// + [Description("公共")] + PUBLIC + } +} diff --git a/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs b/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs index 150be6e0..e53ccab8 100644 --- a/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs +++ b/ds-wms-service/DS.Module.Core/Utils/EnumUtil.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System.Collections.Concurrent; +using System.ComponentModel; using System.Reflection; namespace DS.Module.Core; @@ -8,6 +9,9 @@ namespace DS.Module.Core; /// public static class EnumUtil { + // 枚举显示字典缓存 + private static readonly ConcurrentDictionary> EnumShowNameDict = new ConcurrentDictionary>(); + /// /// 字符串转Enum /// @@ -58,4 +62,39 @@ public static class EnumUtil return 0; } } + + + /// + /// 获取枚举对象Key与名称的字典(缓存) + /// + /// + /// + public static Dictionary GetEnumDictionaryWithKey(this Type enumType) + { + if (!enumType.IsEnum) + throw new ArgumentException("Type '" + enumType.Name + "' is not an enum."); + + // 查询缓存 + var enumDic = EnumShowNameDict.ContainsKey(enumType) ? EnumShowNameDict[enumType] : new Dictionary(); + if (enumDic.Count != 0) + return enumDic; + + string[] fieldstrs = Enum.GetNames(enumType); + // 取枚举类型的Key/Value字典集合 + enumDic = fieldstrs.Select(item => + { + object[] arr = enumType.GetField(item).GetCustomAttributes(typeof(DescriptionAttribute), true); + + return new + { + Key = item, + Val = ((DescriptionAttribute)arr[0]).Description + }; + }).ToDictionary(a => a.Key, b => b.Val); + + // 缓存 + EnumShowNameDict[enumType] = enumDic; + + return enumDic; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs new file mode 100644 index 00000000..ed178fc8 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Dtos/TaskUserStatItem.cs @@ -0,0 +1,62 @@ +namespace DS.WMS.Core.TaskPlat.Dtos +{ + public class TaskUserStatResultInfo + { + /// + /// 第一层(异常/个人/公共) + /// + public List LevelTop { get; set; } + + /// + /// 第二层(待处理/已完成/已取消/已挂起) + /// + public List LevelNext { get; set; } + + /// + /// 任务类型树(按照任务类型展示) + /// + public List LevelTree { get; set; } + } + /// + /// 用户任务统计展示 + /// + public class TaskUserStatItem + { + /// + /// 排序值 + /// + public int SortNo { get; set; } + + /// + /// 展示代码 + /// + public string Key { get; set; } + + /// + /// 展示名称 + /// + public string Name { get; set; } + + /// + /// 记录条数 + /// + public int Total { get; set; } + + /// + /// 执行KEY + /// + public string ActionKey { get; set; } + + } + + + public class TaskUserStatItemNext: TaskUserStatItem + { + public string TopKey { get; set; } + } + + public class TaskUserStatItemTree : TaskUserStatItemNext + { + public string NextKey { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs index e87ff106..df95e1eb 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Entity/TaskBaseInfo.cs @@ -251,11 +251,11 @@ namespace DS.WMS.Core.TaskPlat.Entity [SugarColumn(ColumnDescription = "批次统计", IsNullable = true, Length = 50)] public string? BATCH_STATIC { get; set; } - /// - /// 大简云userid - /// - [SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)] - public string? DJYUserId { get; set; } + ///// + ///// 大简云userid + ///// + //[SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)] + //public string? DJYUserId { get; set; } } diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs index 7eb57732..2b72c5d7 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -6,6 +6,13 @@ namespace DS.WMS.Core.TaskPlat.Interface { public interface ITaskManageService { + /// + /// 获取登陆人相关的任务统计信息 + /// + /// 是否强制计算 + /// 返回回执 + Task> GetCurrentTotalStat(bool isReCalc); + /// /// 任务台台账列表查询 /// diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs index 567c2288..51cbef5b 100644 --- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -7,7 +7,6 @@ using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Interface; using Mapster; -using Masuit.Tools.Systems; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; @@ -160,7 +159,7 @@ namespace DS.WMS.Core.TaskPlat.Method CUSTOMER_ID = info.Main.CustomerId, CUSTOMER_NAME = info.Main.CustomerName, BATCH_STATIC = info.Main.BatchStatic, - DJYUserId = info.Head.DJYUserId, + //DJYUserId = info.Head.DJYUserId, OUT_BS_NO = info.Head.BSNO, CreateTime = DateTime.Now, }; @@ -469,12 +468,12 @@ namespace DS.WMS.Core.TaskPlat.Method if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) { fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString(); - fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.GetDescription(); + fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.EnumDescription(); } else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE) { fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC_MODIFY.ToString(); - fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.GetDescription(); + fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC_MODIFY.EnumDescription(); } } else @@ -484,7 +483,7 @@ namespace DS.WMS.Core.TaskPlat.Method System.Enum.TryParse(file.FileCategory, out fileCategoryEnum); fileInfo.FILE_CATEGORY = fileCategoryEnum.ToString(); - fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.GetDescription(); + fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.EnumDescription(); } if (string.IsNullOrWhiteSpace(fileInfo.FILE_NAME)) @@ -686,108 +685,639 @@ namespace DS.WMS.Core.TaskPlat.Method { taskType = (TaskBaseTypeEnum)temp; }; + + var userId = long.Parse(user.UserId); + DataResult> result; switch (taskType) { case TaskBaseTypeEnum.BC: { - var result = await tenantDb.Queryable() - .LeftJoin((t, bc) => t.Id == bc.TASK_ID) - .Where(whereList) - .Select((t, bc) => new - { - Id = t.Id.SelectAll(), - bc.BUSI_TYPE, - bc.SHIPPER, - bc.CONSIGNEE, - bc.NOTIFYPARTY, - bc.BC_MODIFY_TIMES, - bc.BC_MODIFY_DATE, - //bc.MBL_NO, - bc.VESSEL, - bc.VOYNO, - bc.CARRIER, - bc.PLACERECEIPT, - bc.PORTLOAD, - bc.CLOSING_DATE, - bc.VGM_CUTOFF_TIME, - bc.ETA, - //bc.ETD, - bc.POD_ETA, - bc.CUT_SINGLE_TIME, - bc.PORTDISCHARGE, - bc.PLACEDELIVERY, - bc.SHIPPING_METHOD, - bc.SERVICE, - bc.PRETRANS_MODE, - bc.DESCRIPTION, - bc.ISSUEPLACE, - bc.COLLECTION_TERMINAL, - bc.CONTRACTNO, - bc.PREPARDAT, - bc.SHIP_AGENT, - bc.YARD, - bc.YARD_CONTACT_USR, - bc.YARD_CONTACT_TEL, - bc.FST_CUSTOMER_SER_USRNAME, - bc.FST_CUSTOMER_SER_TEL, - bc.FST_CUSTOMER_SER_EMAIL, - bc.REMARK1, - bc.CY_CUTOFF_TIME, - bc.CARRIERID, - bc.LANECODE, - bc.LANENAME, - bc.CARRIAGE_TYPE, - bc.CARRIAGE_TYPE_NAME, - bc.BOOKING_SLOT_TYPE, - bc.BOOKING_SLOT_TYPE_NAME, - bc.CTN_STAT, - bc.WEEK_AT, - bc.DETENSION_FREE_DAYS, - bc.SI_CUT_DATE, - bc.MANIFEST_CUT_DATE, - bc.MDGF_CUT_DATE, - bc.TRANSFER_PORT_1, - bc.TRANSFER_PORT_2, - bc.SECOND_VESSEL, - bc.SECOND_VOYNO, - bc.SECOND_ETD, - bc.SECOND_ETA, - //bc.STATUS, - bc.FILE_MD5, - bc.LAST_TOBOOKING_DATE, - bc.FROM_EMAIL, - bc.RECV_EMAIL, - bc.BOOKING_ORDER_ID, - bc.BOOKING_SLOT_ID, - bc.BOOKING_COMFIRM_DATE, - bc.BATCH_NO, - bc.CUSTOM_SI_CUT_DATE, - bc.IS_SET_AUTO_EMAIL, - bc.IS_SEND_EMAIL, - bc.DIFF_NUM, - bc.AUTO_SEND_USER, - bc.PROCESS_STATUS, - bc.PROCESS_RESULT, - bc.PROCESS_DATE, - bc.PRICE_CALCULATION_DATE - }) - .ToQueryPageAsync(querySearch.PageCondition); + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + Id = t.Id.SelectAll(), + bc.BUSI_TYPE, + bc.SHIPPER, + bc.CONSIGNEE, + bc.NOTIFYPARTY, + bc.BC_MODIFY_TIMES, + bc.BC_MODIFY_DATE, + //bc.MBL_NO, + bc.VESSEL, + bc.VOYNO, + bc.CARRIER, + bc.PLACERECEIPT, + bc.PORTLOAD, + bc.CLOSING_DATE, + bc.VGM_CUTOFF_TIME, + bc.ETA, + //bc.ETD, + bc.POD_ETA, + bc.CUT_SINGLE_TIME, + bc.PORTDISCHARGE, + bc.PLACEDELIVERY, + bc.SHIPPING_METHOD, + bc.SERVICE, + bc.PRETRANS_MODE, + bc.DESCRIPTION, + bc.ISSUEPLACE, + bc.COLLECTION_TERMINAL, + bc.CONTRACTNO, + bc.PREPARDAT, + bc.SHIP_AGENT, + bc.YARD, + bc.YARD_CONTACT_USR, + bc.YARD_CONTACT_TEL, + bc.FST_CUSTOMER_SER_USRNAME, + bc.FST_CUSTOMER_SER_TEL, + bc.FST_CUSTOMER_SER_EMAIL, + bc.REMARK1, + bc.CY_CUTOFF_TIME, + bc.CARRIERID, + bc.LANECODE, + bc.LANENAME, + bc.CARRIAGE_TYPE, + bc.CARRIAGE_TYPE_NAME, + bc.BOOKING_SLOT_TYPE, + bc.BOOKING_SLOT_TYPE_NAME, + bc.CTN_STAT, + bc.WEEK_AT, + bc.DETENSION_FREE_DAYS, + bc.SI_CUT_DATE, + bc.MANIFEST_CUT_DATE, + bc.MDGF_CUT_DATE, + bc.TRANSFER_PORT_1, + bc.TRANSFER_PORT_2, + bc.SECOND_VESSEL, + bc.SECOND_VOYNO, + bc.SECOND_ETD, + bc.SECOND_ETA, + //bc.STATUS, + bc.FILE_MD5, + bc.LAST_TOBOOKING_DATE, + bc.FROM_EMAIL, + bc.RECV_EMAIL, + bc.BOOKING_ORDER_ID, + bc.BOOKING_SLOT_ID, + bc.BOOKING_COMFIRM_DATE, + bc.BATCH_NO, + bc.CUSTOM_SI_CUT_DATE, + bc.IS_SET_AUTO_EMAIL, + bc.IS_SEND_EMAIL, + bc.DIFF_NUM, + bc.AUTO_SEND_USER, + bc.PROCESS_STATUS, + bc.PROCESS_RESULT, + bc.PROCESS_DATE, + bc.PRICE_CALCULATION_DATE + }) + .ToQueryPageAsync(querySearch.PageCondition); return result; } - default: + case TaskBaseTypeEnum.SI_FEEDBACK: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.CARRIER, + //bc.MBL_NO, + bc.TAKE_ISSUETYPE_NAME, + bc.ISSUETYPE, + bc.NOTICE_DATE, + bc.BOOKING_ID, + bc.SUBMITTED_DATE, + bc.BILLOF_NUM, + bc.RELEASE_INSTRUCTION, + bc.SI_SUBTYPE, + bc.SHIPPER, + bc.CONSIGNEE, + bc.NOTIFYPARTY, + bc.NOTIFYPARTY2, + bc.TRANSPORT_RECEIVER, + bc.MARKS, + bc.HSCODE, + bc.DESCRIPTION, + bc.PKGS, + bc.KINDPKGS, + bc.KGS, + bc.CBM, + bc.VESSEL, + bc.VOYNO, + bc.COMMODITY, + bc.PLACERECEIPTID, + bc.PLACERECEIPT, + bc.PORTLOADID, + bc.PORTLOAD, + bc.PORTDISCHARGEID, + bc.PORTDISCHARGE, + bc.PLACEDELIVERYID, + bc.PLACEDELIVERY, + bc.PROCESS_STATUS, + bc.IS_SET_AUTO_UPD_BOOKING, + bc.PROCESS_RESULT, + bc.PROCESS_DATE, + bc.DIFF_NUM, + bc.IS_UPDATE_BOOKING, + bc.UPDATE_BOOKING_DATE + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.INVOICE_BILL_MAIL: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_PKID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_PKID, + //bc.MBL_NO, + bc.INVOICE_NO, + bc.CANCEL_NO, + bc.TOTAL_AMOUNT, + bc.IS_DONGSH_RECV, + bc.IS_DONGSH_RESULT, + bc.DONGSH_RECV_TIME, + bc.DONGSH_RESULT_TIME, + bc.DONGSH_RECV_REASON + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.TRUCK_DISPATCH: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.BookingTruckId, + bc.BookingId, + bc.TruckId, + bc.TruckCode, + bc.TruckName, + bc.ToName, + bc.Attn, + bc.AttnTel, + bc.AttnMail, + bc.AttnFax, + bc.FromName, + bc.FromTel, + bc.FromMail, + bc.FromMobile, + bc.FromFax, + bc.KGS, + bc.Fee, + bc.PayMethod, + bc.PayMethodName, + bc.TruckTime, + bc.YARDID, + bc.YARD, + bc.YARDCONTRACT, + bc.YARDCONTRACTTEL, + bc.FactoryId, + bc.FactoryCode, + bc.FactoryName, + bc.FactoryContact, + bc.FactoryTel, + bc.ReturnTime, + bc.InYardID, + bc.InYard, + bc.InYardContact, + bc.InYardContractTel, + //bc.NeedArriveTime, + bc.ClosingTime, + bc.PickUpTime, + bc.IsGuaJi, + //bc.Status, + bc.Attention, + bc.Remark, + bc.DispatcherId, + bc.DispatcherName, + bc.TruckFlowNo, + bc.TaskNo, + bc.Vessel, + bc.VoyNo, + bc.MBLNo, + bc.CntrTotal, + bc.FactoryAddr + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.CUT_MODIFY: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.CARRIER, + bc.VESSEL, + bc.VOYNO, + bc.NOTICE_DATE + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.ROLLING_NOMINATION: + case TaskBaseTypeEnum.TRANSFER_NOMINATION: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.PLAN_TYPE, + bc.BATCH_NO, + bc.CARRIERID, + bc.CARRIER, + bc.CONFIRM_DEAD_LINE, + bc.READ_CREATE_TIME, + bc.ROLL_DOUBLE_REMARK, + bc.PLAN_TXT, + //bc.REMARK, + bc.TASK_BATCH_TOTAL, + bc.TASK_BATCH_PER_TOTAL + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.DRAFT: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.CARRIER, + //bc.MBL_NO, + bc.BOOKING_ID, + bc.IS_CHANGE, + bc.IS_EMAIL_SEND, + bc.SEND_EMAIL_DATE, + bc.NOTICE_DATE, + }) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.POD_DISCHARGE_FULL: + case TaskBaseTypeEnum.POD_GATEOUT_FULL: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.CARRIER, + bc.NOTICE_TYPE, + bc.NOTICE_TYPE_NAME, + //bc.MBL_NO, + bc.NOTICE_DATE + }).ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.CAUTION_NOTICE: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.SOURCE_SYSTEM, + bc.SOURCE_BUSI_TYPE, + bc.SOURCE_BUSI_TYPENAME, + bc.NOTIFY_CONTENT, + //bc.MBL_NO, + bc.CARRIER, + bc.CAUTION_NOTICE_TYPE, + bc.IS_WEEK_DIFF, + bc.IS_PRICE_DATE_DIFF, + bc.IS_TRANSFER, + bc.IS_VESSEL_CHANGE, + bc.IS_CUT_DATE_ADVANCED, + bc.BOOKING_ID, + bc.BOOKING_SLOT_ID, + bc.SOURCE_TASK_ID, + bc.OLD_VAL, + bc.NEW_VAL, + }).ToQueryPageAsync(querySearch.PageCondition); + return result; + } + case TaskBaseTypeEnum.ROUTE_CUT_CHANGE: { - var result = await tenantDb.Queryable() + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .LeftJoin((t, a, bc) => t.Id == bc.TASK_ID) .Where(whereList) - .Select(t => new - { - Id = t.Id.SelectAll() - }) - .ToQueryPageAsync(querySearch.PageCondition); + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select((t, a, bc) => new + { + PK_ID = t.Id.SelectAll(), + bc.TASK_ID, + bc.VESSEL, + bc.VOYNO, + bc.CARRIER, + bc.READ_PORTLOAD, + bc.ORIG_ETD, + bc.MDGF_CUT_DATE, + bc.ETA, + //bc.ETD, + bc.SI_CUT_DATE, + bc.TM_SHIFT_CUT_DATE, + bc.VGM_CUTOFF_TIME, + bc.CY_CUT_DATE, + bc.ROUTE_CODE, + bc.EMAIL_SUBJECT, + bc.WEEK, + bc.PORTLOADID, + bc.PORTLOAD + + }).ToQueryPageAsync(querySearch.PageCondition); return result; } + default: + { + result = await tenantDb.Queryable().LeftJoin((t, a) => t.Id == a.TaskId) + .Where(whereList) + .Where((t, a) => a.UserId == userId || t.CreateBy == userId) + .Select(t => t) + .ToQueryPageAsync(querySearch.PageCondition); + return result; + } + } + } + /// + /// 获取登陆人相关的任务统计信息 + /// + /// 是否强制计算 + /// 返回回执 + public async Task> GetCurrentTotalStat(bool isReCalc) + { + TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo + { + LevelTop = new List(), + LevelNext = new List(), + LevelTree = new List() + }; + + /* + 1、首先判断当前登陆人是否有统计记录,如果没有触发统计生成统计记录。 + 2、如果isReCalc=true,表示强制重新统计数据,并重新更新统计数据。 + 3、按照统计类型(个人/公共)、任务状态、是否异常分组汇总,并写入统计表。 + */ + + //var userTendInfo = await _sysUserRepository.AsQueryable() + // .LeftJoin((usr, ten) => usr.TenantId == ten.Id) + // .Where(usr => usr.Id == UserManager.UserId) + // .Select((usr, ten) => new { User = usr, Tend = ten }).FirstAsync(); + + //if (userTendInfo == null) + // throw Oops.Oh($"当前用户关联租户信息获取失败"); + + ////var statList = _taskStatManageInfoRepository.AsQueryable().Where(t => (t.USER_ID == userTendInfo.User.Id + ////&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList(); + + ////菜单375504048771141=我的任务台账 + //List userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage); + + //bool isAdmin = userlist == null; + + var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + var userId = long.Parse(user.UserId); + //任务列表分组统计 + var groupList = await tenantDb.Queryable() + .LeftJoin((t, a) => t.Id == a.TaskId) + .Where((t, a) => t.IS_PUBLIC == 1 + || t.CreateBy == userId + || (t.IS_PUBLIC == 0 && a.UserId == userId)) + .GroupBy(t => new { t.TASK_TYPE, t.STATUS, t.IS_EXCEPT, t.IS_PUBLIC }) + .Select(t => new + { + Total = SqlFunc.AggregateCount(t.Id), + TaskType = t.TASK_TYPE, + Status = t.STATUS, + IsExcept = t.IS_EXCEPT, + IsPublic = t.IS_PUBLIC + }).ToListAsync(); + + var exceptList = groupList + .Where(t => t.IsExcept == 1).ToList(); + + var personList = groupList + .Where(t => t.IsExcept == 0 && t.IsPublic == 0).ToList(); + + var publicList = groupList + .Where(t => t.IsExcept == 0 && t.IsPublic == 1).ToList(); + + #region 异常 + if (exceptList.Count > 0) + { + resultInfo.LevelTop.Add(new TaskUserStatItem + { + Key = TaskStatLevelEnum.EXCPTION.ToString(), + Name = TaskStatLevelEnum.EXCPTION.EnumDescription(), + Total = exceptList.Sum(t => t.Total), + SortNo = (int)TaskStatLevelEnum.EXCPTION, + ActionKey = TaskStatLevelEnum.EXCPTION.ToString() + }); + + var nextList = new List(); + + exceptList.GroupBy(t => t.Status) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key); + + nextList.Add(new TaskUserStatItemNext + { + TopKey = TaskStatLevelEnum.EXCPTION.ToString(), + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{currEnum.ToString()}" + }); + + }); + + if (nextList.Count > 0) + resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList()); + + exceptList.GroupBy(t => new { t.Status, t.TaskType }) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType); + TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType); + + resultInfo.LevelTree.Add(new TaskUserStatItemTree + { + TopKey = TaskStatLevelEnum.EXCPTION.ToString(), + NextKey = t.Key.Status, + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.EXCPTION.ToString()}#{t.Key.Status}#{currEnum.ToString()}" + }); + + }); + } + #endregion + + #region 个人 + if (personList.Count > 0) + { + resultInfo.LevelTop.Add(new TaskUserStatItem + { + Key = TaskStatLevelEnum.PERSON.ToString(), + Name = TaskStatLevelEnum.PERSON.EnumDescription(), + Total = personList.Sum(t => t.Total), + SortNo = (int)TaskStatLevelEnum.PERSON, + ActionKey = TaskStatLevelEnum.PERSON.ToString() + }); + + var nextList = new List(); + personList.GroupBy(t => t.Status) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key); + + nextList.Add(new TaskUserStatItemNext + { + TopKey = TaskStatLevelEnum.PERSON.ToString(), + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{currEnum.ToString()}" + }); + + }); + + if (nextList.Count > 0) + resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList()); + + personList.GroupBy(t => new { t.Status, t.TaskType }) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType); + TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType); + + resultInfo.LevelTree.Add(new TaskUserStatItemTree + { + TopKey = TaskStatLevelEnum.PERSON.ToString(), + NextKey = t.Key.Status, + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.PERSON.ToString()}#{t.Key.Status}#{currEnum.ToString()}" + }); + + }); } + #endregion + + #region 公共 + if (publicList.Count > 0) + { + resultInfo.LevelTop.Add(new TaskUserStatItem + { + Key = TaskStatLevelEnum.PUBLIC.ToString(), + Name = TaskStatLevelEnum.PUBLIC.EnumDescription(), + Total = publicList.Sum(t => t.Total), + SortNo = (int)TaskStatLevelEnum.PUBLIC, + ActionKey = TaskStatLevelEnum.PUBLIC.ToString() + }); + + var nextList = new List(); + + publicList.GroupBy(t => t.Status) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + TaskStatusEnum currEnum = (TaskStatusEnum)System.Enum.Parse(typeof(TaskStatusEnum), t.Key); + + nextList.Add(new TaskUserStatItemNext + { + TopKey = TaskStatLevelEnum.PUBLIC.ToString(), + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{currEnum.ToString()}" + }); + + }); + + if (nextList.Count > 0) + resultInfo.LevelNext.AddRange(nextList.OrderBy(t => t.SortNo).ToList()); + + publicList.GroupBy(t => new { t.Status, t.TaskType }) + .Select(t => new { Key = t.Key, Total = t.ToList().Sum(p => p.Total) }) + .ToList().ForEach(t => + { + //TaskBusiTypeEnum currEnum = (TaskBusiTypeEnum)System.Enum.Parse(typeof(TaskBusiTypeEnum), t.Key.TaskType); + TaskBaseTypeEnum currEnum = (TaskBaseTypeEnum)System.Enum.Parse(typeof(TaskBaseTypeEnum), t.Key.TaskType); + + resultInfo.LevelTree.Add(new TaskUserStatItemTree + { + TopKey = TaskStatLevelEnum.PUBLIC.ToString(), + NextKey = t.Key.Status, + Key = currEnum.ToString(), + Name = currEnum.EnumDescription(), + Total = t.Total, + SortNo = (int)currEnum, + ActionKey = $"{TaskStatLevelEnum.PUBLIC.ToString()}#{t.Key.Status}#{currEnum.ToString()}" + }); + + }); + } + #endregion + + if (resultInfo.LevelTree != null && resultInfo.LevelTree.Count > 0) + { + resultInfo.LevelTree = resultInfo.LevelTree.OrderBy(x => x.SortNo).ToList(); + } + + return DataResult.Success(resultInfo); } + + + #region 私有方法 /// diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs index 791524a4..0c6a6e2f 100644 --- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -77,6 +77,65 @@ public class TaskManageController : ApiController return result; } + + /// + /// 获取登陆人相关的任务统计信息 + /// + /// 是否强制计算 + [HttpPost("GetCurrentTotalStat")] + public async Task> GetCurrentTotalStat([FromQuery] bool isReCalc = false) + { + var result = await taskManageService.GetCurrentTotalStat(isReCalc); + return result; + } + + /// + /// 取消任务(可批量) + /// + /// 任务主键数组 + /// 返回结果 + [HttpPost("CancelTask")] + public async Task> CancelTask([FromBody] string[] Ids) + { + return default; + //var result = await taskManageService.GetCurrentTotalStat(isReCalc); + //return result; + } + + + /// + /// 获取任务台相关的枚举类型的值 + /// + [HttpPost("GetTaskPlatEnumDict")] + public DataResult GetTaskPlatEnumDict() + { + Dictionary> dict = new(); + + dict.Add("STATUS", EnumUtil.GetEnumDictionaryWithKey(typeof(TaskStatusEnum)) + .Select(x => (x.Key.ToString(), x.Value)) + .ToList()); + dict.Add("TASK_TYPE", EnumUtil.GetEnumDictionaryWithKey(typeof(TaskBaseTypeEnum)) + .Select(x => (x.Key.ToString(), x.Value)) + .ToList()); + dict.Add("SOURCE", EnumUtil.GetEnumDictionaryWithKey(typeof(TaskSourceEnum)) + .Select(x => (x.Key.ToString(), x.Value)) + .ToList()); + dict.Add("CATEGORY", EnumUtil.GetEnumDictionaryWithKey(typeof(TaskStatLevelEnum)) + .Select(x => (x.Key.ToString(), x.Value)) + .ToList()); + + var result = dict.Select(x => new + { + Type = x.Key, + Data = x.Value.Select(y => new + { + Code = y.key, + Name = y.value + }) + }); + return DataResult.Success(result); + } + // /TaskManage/CreateBCTaskJob // /TaskManage/CreateDRAFTTaskJob // /TaskManage/CreateAdvisoryTaskJob diff --git a/ds-wms-service/DS.WMS.TaskApi/Properties/PublishProfiles/本地部署.pubxml b/ds-wms-service/DS.WMS.TaskApi/Properties/PublishProfiles/本地部署.pubxml new file mode 100644 index 00000000..faaae3d6 --- /dev/null +++ b/ds-wms-service/DS.WMS.TaskApi/Properties/PublishProfiles/本地部署.pubxml @@ -0,0 +1,22 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + D:\WebPublish\ds_taskapi + FileSystem + <_TargetId>Folder + + net8.0 + win-x64 + 8dae16a3-e249-4c86-beec-da8429fd837c + false + + \ No newline at end of file From cb023c6e9b7298ea6eec505f7cd775df27103671 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 25 Jul 2024 17:23:23 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=88=B1=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 15 ++++- .../BookingSlot/IBookingSlotService.cs | 2 +- .../Method/BookingSlot/BookingSlotService.cs | 56 ++++++++++++++----- .../BookingSlotServiceController.cs | 6 +- .../DS.WMS.OpApi/Logs/internal-nlog.txt | 14 +++++ 5 files changed, 75 insertions(+), 18 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index f65f7b1e..7506a799 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1400,7 +1400,20 @@ public static class MultiLanguageConst /// [Description("作废成功")] public const string BookingSlotDeleteSucc = "BookingSlot_DeleteSucc"; - + + /// + /// 舱位变更比对结果不存在 + /// + [Description("舱位变更比对结果不存在")] + public const string BookingSlotCompareNull = "BookingSlot_CompareNull"; + + /// + /// 获取舱位变更比对结果错误,比对内容不存在 + /// + [Description("获取舱位变更比对结果错误,比对内容不存在")] + public const string BookingSlotCompareJsonNull = "BookingSlot_CompareJsonNull"; + + #endregion diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs index 4259edc9..a312d7df 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/BookingSlot/IBookingSlotService.cs @@ -121,7 +121,7 @@ namespace DS.WMS.Core.Op.Interface /// 舱位主键 /// 批次号 /// 返回舱位变更比对结果 - Task> GetSlotCompareResult(long id, string batchNo); + Task>> GetSlotCompareResult(long id, string batchNo); /// /// 导入舱位 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index 0d8b104a..9ef44c5f 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -978,7 +978,7 @@ namespace DS.WMS.Core.Op.Method dto.DataObj.CtnList.ForEach(t => { - if (!string.IsNullOrWhiteSpace(t.CtnAll) && string.IsNullOrWhiteSpace(t.CtnCode)) + if ((!string.IsNullOrWhiteSpace(t.CtnAll) && string.IsNullOrWhiteSpace(t.CtnCode)) || (!string.IsNullOrWhiteSpace(t.CtnAll) && t.CtnAll == t.CtnCode)) { var ctnCode = ctnCodeList.FirstOrDefault(a => !string.IsNullOrWhiteSpace(a.CtnName) && a.CtnName.Equals(t.CtnAll, StringComparison.OrdinalIgnoreCase)); @@ -1799,7 +1799,8 @@ namespace DS.WMS.Core.Op.Method } } - var list = await GetAvailableSlots(null, model.MergeList, null); + var getRlt = await GetAvailableSlots(null, model.MergeList, null); + var list = getRlt.Data; //舱位合票失败,校验库存为不可用,请确认正确的库存 if (list.Count == 0) @@ -1853,14 +1854,14 @@ namespace DS.WMS.Core.Op.Method /// 可选:分页信息 public async Task>> GetAvailableSlots(BookingSlotBaseDto input,PageWithTotal pageInfo) { - var result = await GetAvailableSlots(input, null, pageInfo); + var rlt = await GetAvailableSlots(input, null, pageInfo); SqlSugarPagedList pageResult = new() { PageIndex = pageInfo.PageNo, PageSize = pageInfo.PageSize, TotalCount = pageInfo.Total, - Items = result, + Items = rlt.Data, }; return DataResult>.Success(pageResult); } @@ -1874,7 +1875,7 @@ namespace DS.WMS.Core.Op.Method /// 筛选条件2:舱位主键列表 /// 筛选条件3:分页 /// 可用的舱位列表(含可用的箱子列表) - public async Task> GetAvailableSlots(BookingSlotBaseDto slotInput = null, + public async Task>> GetAvailableSlots(BookingSlotBaseDto slotInput = null, List slotIdListInput = null, PageWithTotal pageInfo = null) { @@ -1985,7 +1986,7 @@ namespace DS.WMS.Core.Op.Method } } - return result; + return DataResult>.Success(result); } #endregion @@ -2022,8 +2023,9 @@ namespace DS.WMS.Core.Op.Method } var slotIdList = slots.Select(s => s.Id).ToList(); + var lsRlt = await GetAvailableSlots(null, slotIdList); // 查询可用舱位及箱子列表 - var latestSlotList = await GetAvailableSlots(null, slotIdList); + var latestSlotList = lsRlt.Data; // 判断余量是否满足需求 foreach (var inSlotItem in slots) @@ -3469,10 +3471,6 @@ namespace DS.WMS.Core.Op.Method } #endregion - Task>> IBookingSlotService.GetAvailableSlots(BookingSlotBaseDto slotInput, List slotIdListInput, PageWithTotal pageInfo) - { - throw new NotImplementedException(); - } /// /// 舱位台账查询 @@ -3662,10 +3660,42 @@ namespace DS.WMS.Core.Op.Method throw new NotImplementedException(); } - Task> IBookingSlotService.GetSlotCompareResult(long id, string batchNo) + #region 获取舱位变更比对结果 + /// + /// 获取舱位变更比对结果 + /// + /// 舱位主键 + /// 批次号 + /// 返回舱位变更比对结果 + public async Task>> GetSlotCompareResult(long id, string batchNo) { - throw new NotImplementedException(); + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + var compareInfo = await tenantDb.Queryable() + .FirstAsync(t => t.SlotId == id && t.CompareBatchNo == batchNo); + + if (compareInfo == null) + { + //舱位变更比对结果不存在 + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotCompareNull))); + } + + if (string.IsNullOrWhiteSpace(compareInfo.CompareRlt)) + { + //获取舱位变更比对结果错误,比对内容不存在 + throw new Exception(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BookingSlotCompareJsonNull))); + } + + if (!string.IsNullOrWhiteSpace(compareInfo.CompareRlt)) + { + var data = JsonConvert.DeserializeObject>(compareInfo.CompareRlt); + + return DataResult>.Success(data); + } + + return DataResult>.FailedData(new List()); } + #endregion #region 获取舱位详情列表 /// diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs index 9e08504e..82b307fd 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/BookingSlotServiceController.cs @@ -182,7 +182,7 @@ namespace DS.WMS.OpApi.Controllers [Route("GetSlotCompareResult")] public async Task>> GetSlotCompareResult([FromQuery] long id, [FromQuery] string batchNo) { - return null;//await _bookingSlotService.GetSlotCompareResult(id, batchNo); + return await _bookingSlotService.GetSlotCompareResult(id, batchNo); } #endregion @@ -208,9 +208,9 @@ namespace DS.WMS.OpApi.Controllers /// 返回回执 [HttpPost] [Route("CreateBookingOrder")] - public async Task CreateBookingOrder([FromBody] BookingGenerateDto model) + public async Task> CreateBookingOrder([FromBody] BookingGenerateDto model) { - return null;// await _bookingSlotService.CreateBookingOrder(model); + return await _bookingSlotService.CreateBookingOrder(model); } #endregion diff --git a/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt index e67d359d..d5e3e0e4 100644 --- a/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt @@ -810,3 +810,17 @@ 2024-07-25 16:11:06.6047 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config 2024-07-25 16:11:06.6047 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-25 16:11:06.6305 Info Configuration initialized. +2024-07-25 16:35:26.1612 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 16:35:26.1790 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 16:35:26.1790 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 16:35:26.1968 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 16:35:26.2067 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-25 16:35:26.2067 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 16:35:26.2203 Info Configuration initialized. +2024-07-25 17:01:27.4675 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-25 17:01:27.4868 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-25 17:01:27.4868 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-25 17:01:27.5029 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-25 17:01:27.5029 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-07-25 17:01:27.5133 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-25 17:01:27.5133 Info Configuration initialized. From 9a157d0e469494dc84110d0b3f5bb90cf1cb8e51 Mon Sep 17 00:00:00 2001 From: jianghaiqing Date: Thu, 25 Jul 2024 17:33:49 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=88=B1=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Entity/BookingSlot/BookingSlotBase.cs | 2 +- .../Op/Method/BookingSlot/BookingSlotService.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotBase.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotBase.cs index 96674243..74aa8e61 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotBase.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/BookingSlot/BookingSlotBase.cs @@ -240,7 +240,7 @@ namespace DS.WMS.Core.Op.Entity /// /// 截港时间 /// - [SqlSugar.SugarColumn(ColumnDescription = "样单截止日期", IsNullable = true)] + [SqlSugar.SugarColumn(ColumnDescription = "截港时间", IsNullable = true)] public Nullable CYCutDate { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs index 9ef44c5f..0b22b8a6 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/BookingSlot/BookingSlotService.cs @@ -2212,20 +2212,20 @@ namespace DS.WMS.Core.Op.Method SaleId = generateModel.SaleId.HasValue ? generateModel.SaleId.Value : 0, Sale = generateModel.SaleName, OperatorId = generateModel.OpId.HasValue ? generateModel.OpId.Value : 0, - //op = generateModel.OpName, + OperatorName = generateModel.OpName, Doc = generateModel.DocId.HasValue ? generateModel.DocId.Value : 0, - //DOC = generateModel.DocName, + DocName = generateModel.DocName, //ROUTEID = generateModel.RouteID?.ToString(), //ROUTE = generateModel.Route, //CZRemark = generateModel.CZRemark, //ShenQingXiangShi = generateModel.ShenQingXiangShi, //LineManageID = generateModel.LineManageID?.ToString(), //LineName = generateModel.LineManage, - //CLOSEVGMDATE = bookingSlotBase.VGMSubmissionCutDate, + VGMCloseDate = bookingSlotBase.VGMSubmissionCutDate, ClosingDate = bookingSlotBase.CYCutDate, CloseDocDate = bookingSlotBase.SICutDate, CustomerService = generateModel.CustServiceId.HasValue ? generateModel.CustServiceId.Value : 0, - //CUSTSERVICE = generateModel.CustServiceName, + CustomerServiceName = generateModel.CustServiceName, LoadPort = bookingSlotBase.PortLoad, LoadPortId = bookingSlotBase.PortLoadId.HasValue ? bookingSlotBase.PortLoadId.Value : 0, @@ -2431,7 +2431,7 @@ namespace DS.WMS.Core.Op.Method Note = djyCustomerContactMan.Note, CreateTime = DateTime.Now, CreateBy = long.Parse(user.UserId), - //CreatedUserName = UserManager.Name + CreateUserName = user.UserName }; tenantDb.Insertable(bookingContact).ExecuteCommand(); @@ -2444,7 +2444,7 @@ namespace DS.WMS.Core.Op.Method bookingContact.Note = djyCustomerContactMan.Note; bookingContact.UpdateTime = DateTime.Now; bookingContact.UpdateBy = long.Parse(user.UserId); - //bookingContact.UpdatedUserName = UserManager.Name; + bookingContact.UpdateUserName = user.UserName; tenantDb.Updateable(bookingContact).UpdateColumns(it => new { @@ -2453,7 +2453,7 @@ namespace DS.WMS.Core.Op.Method it.Note, it.UpdateTime, it.UpdateBy, - //it.UpdatedUserName + it.UpdateUserName }).ExecuteCommand(); }