From 7e0de230a43200d7b793b82850327eff9697da2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZR20090193-=E9=99=88=E6=95=AC=E5=8B=87?= Date: Tue, 21 May 2024 17:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E7=AE=80=E4=BA=91=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=8A=B6=E6=80=81=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.DjyServiceStatus.csproj | 13 + .../DjyHttpUtillib.cs | 262 ++++++++++++++++++ .../DjyServiceStatusDtos.cs | 99 +++++++ .../DjyServiceStatusService.cs | 191 +++++++++++++ .../IDjyServiceStatusService.cs | 53 ++++ .../PrintModuleInstall.cs | 27 ++ .../TaskManageOrderResultDto.cs | 78 ++++++ .../DS.WMS.Core/Op/Entity/SeaExport.cs | 12 +- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 5 +- .../Controllers/PrintController.cs | 62 +++++ .../DS.WMS.MainApi/DS.WMS.MainApi.csproj | 5 +- ds-wms-service/DS.WMS.MainApi/Program.cs | 2 + .../DS.WMS.MainApi/appsettings.json | 12 + .../Controllers/DjyServiceStatusController.cs | 42 +++ .../DS.WMS.OpApi/Logs/internal-nlog.txt | 28 ++ ds-wms-service/ds-wms-service.sln | 9 +- 16 files changed, 887 insertions(+), 13 deletions(-) create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/DS.Module.DjyServiceStatus.csproj create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/DjyHttpUtillib.cs create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusDtos.cs create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusService.cs create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/IDjyServiceStatusService.cs create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/PrintModuleInstall.cs create mode 100644 ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs create mode 100644 ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs create mode 100644 ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/DS.Module.DjyServiceStatus.csproj b/ds-wms-service/DS.Module.DjyServiceStatus/DS.Module.DjyServiceStatus.csproj new file mode 100644 index 00000000..1bb828b2 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/DS.Module.DjyServiceStatus.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/DjyHttpUtillib.cs b/ds-wms-service/DS.Module.DjyServiceStatus/DjyHttpUtillib.cs new file mode 100644 index 00000000..639720b7 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/DjyHttpUtillib.cs @@ -0,0 +1,262 @@ +using DS.Module.Core.Extensions; +using DS.Module.Core.Helpers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using static System.Net.Mime.MediaTypeNames; + +namespace DS.Module.DjyServiceStatus +{ + /// + /// 大简云服务封装请求工具类 + /// + public class DjyHttpUtillib + { + /// 平台ip + /// + private static string _ip; + + /// + /// 平台端口 + /// + private static int _port = 443; + + /// + /// 平台APPKey + /// + private static string _appkey; + + /// + /// 平台APPSecret + /// + private static string _secret; + + /// + /// 是否使用HTTPS协议 + /// + private static bool _isHttps = true; + + /// + /// 设置信息参数 + /// + /// 合作方APPKey + /// 合作方APPSecret + /// 平台IP + /// 平台端口,默认HTTPS的443端口 + /// 是否启用HTTPS协议,默认HTTPS + /// + public static void SetPlatformInfo(string appkey, string secret, string ip, int port = 443, bool isHttps = true) + { + _appkey = appkey; + _secret = secret; + _ip = ip; + _port = port; + _isHttps = isHttps; + + // 设置并发数,如不设置默认为2 + ServicePointManager.DefaultConnectionLimit = 512; + } + /// + /// HTTP GET请求 + /// + /// HTTP接口Url,不带协议和端口,如/artemis/api/resource/v1/cameras/indexCode?cameraIndexCode=a10cafaa777c49a5af92c165c95970e0 + /// 请求超时时间,单位:秒 + /// + public static string HttpGet(string uri, int timeout) + { + Dictionary header = new Dictionary(); + + // 初始化请求:组装请求头,设置远程证书自动验证通过 + initRequest(header, uri, "", false); + + // build web request object + StringBuilder sb = new StringBuilder(); + sb.Append(_isHttps ? "https://" : "http://").Append(_ip).Append(":").Append(_port.ToString()).Append(uri); + + HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(sb.ToString()); + req.KeepAlive = false; + req.ProtocolVersion = HttpVersion.Version11; + req.AllowAutoRedirect = false; // 不允许自动重定向 + req.Method = "GET"; + req.Timeout = timeout * 1000; // 传入是秒,需要转换成毫秒 + req.Accept = header["Accept"]; + req.ContentType = header["Content-Type"]; + + foreach (string headerKey in header.Keys) + { + if (headerKey.Contains("USER_KEY")) + { + req.Headers.Add(headerKey + ":" + header[headerKey]); + } + if (headerKey.Contains("USER_SECRET")) + { + req.Headers.Add(headerKey + ":" + header[headerKey]); + } + //if (headerKey.Contains("sign")) + //{ + // req.Headers.Add(headerKey + ":" + header[headerKey]); + //} + } + + HttpWebResponse rsp = null; + try + { + rsp = (HttpWebResponse)req.GetResponse(); + if (HttpStatusCode.OK == rsp.StatusCode) + { + Stream rspStream = rsp.GetResponseStream(); // 响应内容字节流 + StreamReader sr = new StreamReader(rspStream); + string strStream = sr.ReadToEnd(); + long streamLength = strStream.Length; + byte[] response = System.Text.Encoding.UTF8.GetBytes(strStream); + rsp.Close(); + return System.Text.Encoding.UTF8.GetString(response); + } + else if (HttpStatusCode.Found == rsp.StatusCode || HttpStatusCode.Moved == rsp.StatusCode) // 302/301 redirect + { + string reqUrl = rsp.Headers["Location"].ToString(); // 获取重定向URL + WebRequest wreq = WebRequest.Create(reqUrl); // 重定向请求对象 + WebResponse wrsp = wreq.GetResponse(); // 重定向响应 + long streamLength = wrsp.ContentLength; // 重定向响应内容长度 + Stream rspStream = wrsp.GetResponseStream(); // 响应内容字节流 + byte[] response = new byte[streamLength]; + rspStream.Read(response, 0, (int)streamLength); // 读取响应内容至byte数组 + rspStream.Close(); + rsp.Close(); + return System.Text.Encoding.UTF8.GetString(response); + } + + rsp.Close(); + } + catch (WebException e) + { + if (rsp != null) + { + rsp.Close(); + } + } + + return null; + } + /// + /// HTTP Post请求 + /// + /// HTTP接口Url,不带协议和端口,如/artemis/api/resource/v1/org/advance/orgList + /// 请求参数 + /// 请求超时时间,单位:秒 + /// 请求结果 + public static string HttpPost(string uri, string body, int timeout) + { + Dictionary header = new Dictionary(); + + // 初始化请求:组装请求头,设置远程证书自动验证通过 + initRequest(header, uri, body, true); + + // build web request object + StringBuilder sb = new StringBuilder(); + sb.Append(_isHttps ? "https://" : "http://").Append(_ip).Append(":").Append(_port.ToString()).Append(uri); + + // 创建POST请求 + HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(sb.ToString()); + req.KeepAlive = false; + req.ProtocolVersion = HttpVersion.Version11; + req.AllowAutoRedirect = false; // 不允许自动重定向 + req.Method = "POST"; + req.Timeout = timeout * 1000; // 传入是秒,需要转换成毫秒 + req.Accept = header["Accept"]; + req.ContentType = header["Content-Type"]; + req.UserAgent = "PostmanRuntime/7.26.8"; + + foreach (string headerKey in header.Keys) + { + if (headerKey.Contains("USER_KEY")) + { + req.Headers.Add(headerKey + ":" + header[headerKey]); + } + if (headerKey.Contains("USER_SECRET")) + { + req.Headers.Add(headerKey + ":" + header[headerKey]); + } + //if (headerKey.Contains("sign")) + //{ + // req.Headers.Add(headerKey + ":" + header[headerKey]); + //} + } + byte[] data = Encoding.UTF8.GetBytes(body); + + req.ContentLength = data.Length; + + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + + reqStream.Close(); + } + + HttpWebResponse response = (HttpWebResponse)req.GetResponse(); + Stream stream = response.GetResponseStream(); + Encoding encode = Encoding.UTF8; + StreamReader reader = new StreamReader(stream, encode); + string content = reader.ReadToEnd(); + stream.Close(); + reader.Close(); + return content; + } + + + /// + /// 远程证书验证 + /// + /// + /// + /// + /// + /// 验证是否通过,始终通过 + private static bool remoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, + SslPolicyErrors error) + { + return true; + } + + private static void initRequest(Dictionary header, string url, string body, bool isPost) + { + // Accept + // string accept = "application/json"; // "*/*"; + string accept = "*/*"; // "*/*"; + header.Add("Accept", accept); + + // ContentType + string contentType = "application/json"; + header.Add("Content-Type", contentType); + + + // appId + header.Add("appId", _appkey); + + var timestamp = DateTime.Now.DateToTimeStamp(); + // build string to sign + string signedStr = MD5Helper.Md5EncryptLowerCase(timestamp + _secret); + + // timestamp + header.Add("timestamp", DateTime.Now.DateToTimeStamp()); + // sign + header.Add("sign", signedStr); + + if (_isHttps) + { + // set remote certificate Validation auto pass + ServicePointManager.ServerCertificateValidationCallback = + new System.Net.Security.RemoteCertificateValidationCallback(remoteCertificateValidate); + // FIX:修复不同.Net版对一些SecurityProtocolType枚举支持情况不一致导致编译失败等问题,这里统一使用数值 + // ServicePointManager.SecurityProtocol = (SecurityProtocolType)48 | (SecurityProtocolType)3072 | + // (SecurityProtocolType)768 | (SecurityProtocolType)192 ; + // ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; + } + } + } +} diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusDtos.cs b/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusDtos.cs new file mode 100644 index 00000000..79a66932 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusDtos.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.DjyServiceStatus +{ + public class DjyServiceStatusDtos + { + } + + /// + /// 内嵌服务项目请求 + /// + public class EmbedServiceProjectDto + { + /// + /// 业务主键 + /// + public string BusinessId { get; set; } + + /// + /// 服务项目代码 + /// + public string[] ProjectCodes { get; set; } + + /// + /// 状态操作类型 0-手工 1-自动 + /// + public int OpertType { get; set; } + } + /// + /// 修改服务项目状态 + /// + public class EmbedServiceProjectStatusDto + { + /// + /// 业务主键 + /// + public string businessId { get; set; } + + /// + /// 来源类型 0-人工 1-自动 + /// + public int SourceType { get; set; } = 0; + + /// + /// 服务项目状态明细 + /// + public List StatusCodes { get; set; } + } + + public class EmbedServiceProjectStatusDetailDto + { + /// + /// 状态代码 + /// + public string StatusCode { get; set; } + + /// + /// 人工设定状态完成时间 + /// + public Nullable SetActDate { get; set; } + + /// + /// 人工设定状态值(可传箱使天数) + /// + public string SetActVal { get; set; } + + /// + /// 状态备注 + /// + public string ActRemark { get; set; } + } + + public class EmbedQueryServiceProjectWithStatus + { + /// + /// 业务主键(可为空,不为空时需要查询已触发的记录和未触发的记录,为空时只查询已启用的) + /// + public string BusinessId { get; set; } + + /// + /// 0-查服务项目 1-查服务项目下的状态 + /// + public int QueryType { get; set; } + + /// + /// 服务项目代码组 + /// + public string[] ProjectCodes { get; set; } + + /// + /// 租户ID + /// + public long TenantId { get; set; } + } +} diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusService.cs b/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusService.cs new file mode 100644 index 00000000..bba84046 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/DjyServiceStatusService.cs @@ -0,0 +1,191 @@ +using DS.Module.Core; +using DS.Module.Core.Extensions; +using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; +using NLog; + +namespace DS.Module.DjyServiceStatus +{ + /// + /// + /// + public class DjyServiceStatusService: IDjyServiceStatusService + { + private readonly IServiceProvider _serviceProvider; + private readonly string ip; + private readonly int port; + private readonly string accessKey; + private readonly string accessSecret; + private readonly string saveServiceProjectUrl; + private readonly string cancelServiceProjectUrl; + private readonly string getServiceProjectListUrl; + private readonly string getServiceStatusListUrl; + private readonly string saveServiceStatusUrl; + private readonly string cancelServiceStatusUrl; + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + /// + /// 构造函数 + /// + /// + public DjyServiceStatusService(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + + ip = AppSetting.app(new string[] { "DjyService", "IP" }).ObjToString(); + port = AppSetting.app(new string[] { "DjyService", "Port" }).ToInt(); + accessKey = AppSetting.app(new string[] { "DjyService", "AccessKey" }).ObjToString(); + accessSecret = AppSetting.app(new string[] { "DjyService", "AccessSecret" }).ObjToString(); + saveServiceProjectUrl = AppSetting.app(new string[] { "DjyService", "SaveServiceProjectUrl" }).ObjToString(); + cancelServiceProjectUrl = AppSetting.app(new string[] { "DjyService", "CancelServiceProjectUrl" }).ObjToString(); + getServiceProjectListUrl = AppSetting.app(new string[] { "DjyService", "GetServiceProjectListUrl" }).ObjToString(); + getServiceStatusListUrl = AppSetting.app(new string[] { "DjyService", "GetServiceStatusListUrl" }).ObjToString(); + saveServiceStatusUrl = AppSetting.app(new string[] { "DjyService", "SaveServiceStatusUrl" }).ObjToString(); + cancelServiceStatusUrl = AppSetting.app(new string[] { "DjyService", "CancelServiceStatusUrl" }).ObjToString(); + } + + /// + /// 保存服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task SaveServiceProject(EmbedServiceProjectDto req) + { + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(saveServiceProjectUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + + } + /// + /// 取消服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task CancelServiceProject(EmbedServiceProjectDto req) + { + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(cancelServiceProjectUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + } + /// + /// 获取服务项目列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task GetServiceProjectList(EmbedQueryServiceProjectWithStatus req) + { + + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(getServiceProjectListUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + } + /// + /// 获取服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + public async Task GetServiceStatusList(EmbedQueryServiceProjectWithStatus req) + { + + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(getServiceStatusListUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + } + /// + /// 保存服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task SaveServiceStatus(EmbedServiceProjectStatusDto req) + { + + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(saveServiceStatusUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + } + /// + /// 取消服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + public async Task CancelServiceStatus(EmbedServiceProjectStatusDto req) + { + + // 只要平台信息参数一致,多个请求只需设置一次参数 + DjyHttpUtillib.SetPlatformInfo(accessKey, accessSecret, ip, port, false); + + // 发起POST请求,超时时间15秒,返回响应字节数组 + string result = DjyHttpUtillib.HttpPost(cancelServiceStatusUrl, JsonConvert.SerializeObject(req), 30); + if (null == result) + { + return await Task.FromResult(TaskManageOrderResultDto.Failed("请求失败,请联系管理员")); + } + else + { + var res = JsonConvert.DeserializeObject(result); + // Console.WriteLine(System.Text.Encoding.UTF8.GetString(result)); + return await Task.FromResult(res); + } + } + } +} diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/IDjyServiceStatusService.cs b/ds-wms-service/DS.Module.DjyServiceStatus/IDjyServiceStatusService.cs new file mode 100644 index 00000000..e5d56153 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/IDjyServiceStatusService.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.DjyServiceStatus +{ + public interface IDjyServiceStatusService + { + /// + /// 保存服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + Task SaveServiceProject(EmbedServiceProjectDto req); + /// + /// 取消服务项目 + /// + /// 修改服务项目详情 + /// 返回回执 + Task CancelServiceProject(EmbedServiceProjectDto req); + + /// + /// 获取服务项目列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetServiceProjectList(EmbedQueryServiceProjectWithStatus req); + + + /// + /// 获取服务项目下的状态列表 + /// + /// 查询服务项目和状态详情 + /// 返回回执 + Task GetServiceStatusList(EmbedQueryServiceProjectWithStatus req); + + /// + /// 保存服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + Task SaveServiceStatus(EmbedServiceProjectStatusDto req); + + /// + /// 取消服务状态 + /// + /// 修改服务状态详情 + /// 返回回执 + Task CancelServiceStatus(EmbedServiceProjectStatusDto req); + } +} diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/PrintModuleInstall.cs b/ds-wms-service/DS.Module.DjyServiceStatus/PrintModuleInstall.cs new file mode 100644 index 00000000..f817208e --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/PrintModuleInstall.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.PrintModule +{ + /// + /// 注入打印服务 + /// + public static class PrintModuleInstall + { + /// + /// + /// + /// + /// + public static void AddPrintModuleInstall(this IServiceCollection services) + { + if (services == null) throw new ArgumentNullException(nameof(services)); + + services.AddScoped(); + } + } +} diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs b/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs new file mode 100644 index 00000000..96212328 --- /dev/null +++ b/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.DjyServiceStatus +{ + /// + /// 回执 + /// + public class TaskManageOrderResultDto + { + /// + /// 是否成功 true=成功 false=失败 + /// + public bool succ { get; set; } = false; + + /// + /// 状态 0-成功 + /// + public int status { get; set; } = 0; + + /// + /// 返回消息 + /// + public string msg { get; set; } + + /// + /// 返回校验明细 + /// + public object rows { get; set; } + + /// + /// 返回单个对象 + /// + public object ext { get; set; } + + /// + /// 返回单个对象 + /// + public object ext2 { get; set; } + + /// + /// 是否超时 true-超时 false-未超时 + /// + public bool isTimeout { get; set; } = false; + + /// + /// 执行日期 + /// + public DateTime executeTime { get; set; } = DateTime.Now; + + /// + /// 批量执行统计详情 + /// + public string batchTotal { get; set; } + + /// + /// 业务单号 + /// + public string bno { get; set; } + + /// + /// + /// + /// + /// + public static TaskManageOrderResultDto Failed(string message) + { + return new TaskManageOrderResultDto() + { + succ = false, + msg = message + }; + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs index 07e9c84f..34338b8c 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs @@ -40,7 +40,7 @@ public class SeaExport : BaseOrgModel /// /// 单据费用状态时间 /// - [SqlSugar.SugarColumn(ColumnDescription = "单据费用状态时间", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "单据费用状态时间", IsNullable = true)] public DateTime? BillFeeStatusTime { get; set; } /// @@ -63,7 +63,7 @@ public class SeaExport : BaseOrgModel /// /// 录入日期 /// - [SqlSugar.SugarColumn(ColumnDescription = "录入日期", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "录入日期", IsNullable = true)] public DateTime? BusinessDate { get; set; } = DateTime.Now; /// @@ -875,12 +875,12 @@ public class SeaExport : BaseOrgModel /// /// VGM截止日期 /// - [SqlSugar.SugarColumn(ColumnDescription = "截单日期", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "截单日期", IsNullable = true)] public DateTime? CloseVgmDate { get; set; } /// /// 截单日期 /// - [SqlSugar.SugarColumn(ColumnDescription = "截单日期", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "截单日期", IsNullable = true)] public DateTime? CloseDocDate { get; set; } /// @@ -896,7 +896,7 @@ public class SeaExport : BaseOrgModel /// /// 集港日期 /// - [SqlSugar.SugarColumn(ColumnDescription = "集港日期", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "集港日期", IsNullable = true)] public DateTime? IntoPortDocDate { get; set; } /// @@ -921,7 +921,7 @@ public class SeaExport : BaseOrgModel /// /// Desc:月结算时间 /// - [SqlSugar.SugarColumn(ColumnDescription = "月结算时间", IsNullable = false)] + [SqlSugar.SugarColumn(ColumnDescription = "月结算时间", IsNullable = true)] public DateTime? StlDate { get; set; } /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 73e79f92..fa8da54f 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -379,7 +379,7 @@ public class SeaExportService : ISeaExportService return DataResult.Failed("海运出口信息业务已锁定!", MultiLanguageConst.SeaExportBusinessLock); } - if (req.AccountDate.ToString().IsNotNull()) + if (req.AccountDate.IsNotNull()) { if (tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id) && x.IsFeeLocking == true).Any()) { @@ -392,8 +392,7 @@ public class SeaExportService : ISeaExportService foreach (var item in orderList) { - var info = item; - info = req.Adapt(info); + var info = req.Adapt(item); tenantDb.Updateable(info).UpdateColumns(dic).EnableDiffLogEvent().ExecuteCommand(); } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs new file mode 100644 index 00000000..8f45c700 --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs @@ -0,0 +1,62 @@ +using DS.Module.Core; +using DS.Module.ExcelModule; +using DS.Module.ExcelModule.Model; +using DS.Module.PrintModule; +using DS.WMS.Core.Code.Interface; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.MainApi.Controllers +{ + /// + /// 打印服务 模块 + /// + public class PrintController : ApiController + { + private readonly IPrintService _invokeService; + + /// + /// 构造函数 + /// + /// + public PrintController(IPrintService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 获取打印模块列表 + /// + /// + [HttpGet] + [Route("GetOpenPrintModuleList")] + public DataResult GetOpenPrintModuleList() + { + return _invokeService.GetOpenPrintModuleList(); + } + + /// + /// 获取打印模板列表 + /// + /// + [HttpGet] + [Route("GetOpenPrintTemplateList")] + public DataResult GetOpenPrintTemplateList([FromQuery] string id) + { + return _invokeService.GetOpenPrintTemplateList(id); + } + + + /// + /// 获取Json打印信息 + /// + /// + /// + [HttpPost] + [Route("GetOpenJsonPrintInfo")] + public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req) + { + return _invokeService.GetOpenJsonPrintInfo(req); + } + } +} diff --git a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj index 4d10cf06..886f50c1 100644 --- a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj +++ b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj @@ -16,16 +16,15 @@ bin\Release\net8.0\Api.xml - - - + + diff --git a/ds-wms-service/DS.WMS.MainApi/Program.cs b/ds-wms-service/DS.WMS.MainApi/Program.cs index 30032043..3ea65722 100644 --- a/ds-wms-service/DS.WMS.MainApi/Program.cs +++ b/ds-wms-service/DS.WMS.MainApi/Program.cs @@ -5,6 +5,7 @@ using DS.Module.Core; using DS.Module.Core.Extensions; using DS.Module.Core.ServiceExtensions; using DS.Module.ExcelModule; +using DS.Module.PrintModule; using DS.Module.Jwt; using DS.Module.Middleware; using DS.Module.MultiLanguage; @@ -41,6 +42,7 @@ builder.Services.AddJwtInstall(); builder.Services.AddSaasDbInstall();//分库服务 builder.Services.AddMultiLanguageInstall();//多语言服务 builder.Services.AddExcelModuleInstall();//Excel服务 +builder.Services.AddPrintModuleInstall();//Print服务 // builder.Services.AddEndpointsApiExplorer(); // builder.Services.AddSwaggerGen(); diff --git a/ds-wms-service/DS.WMS.MainApi/appsettings.json b/ds-wms-service/DS.WMS.MainApi/appsettings.json index 4f5c95bf..8ce751e2 100644 --- a/ds-wms-service/DS.WMS.MainApi/appsettings.json +++ b/ds-wms-service/DS.WMS.MainApi/appsettings.json @@ -57,5 +57,17 @@ "GetModuleListUrl": "/printApi/OpenPrint/GetPrintModuleList", "GetTemplateListUrl": "/printApi/OpenPrint/GetPrintTemplateList", "GetJsonPrintInfoUrl": "/printApi/OpenPrint/GetOpenJsonPrintInfo" + }, + "DjyService": { + "IP": "60.209.125.238", + "Port": "35100", + "AccessKey": "0aabffa55f3945b7a011b6beeaf23587", + "AccessSecret": "55b3b74b7291da681201b0342b1dec5af570acf015a3e03b66a7a5d2a43d842958647ddec213ea5f", + "SaveServiceProjectUrl": "/EmbedProjectGoodsStatus/SaveServiceProject", + "CancelServiceProjectUrl": "/EmbedProjectGoodsStatus/CancelServiceProject", + "GetServiceProjectListUrl": "/EmbedProjectGoodsStatus/GetServiceProjectList", + "GetServiceStatusListUrl": "/EmbedProjectGoodsStatus/GetServiceStatusList", + "SaveServiceStatusUrl": "/EmbedProjectGoodsStatus/SaveServiceStatus", + "CancelServiceStatusUrl": "/EmbedProjectGoodsStatus/CancelServiceStatus" } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs new file mode 100644 index 00000000..5128cab4 --- /dev/null +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/DjyServiceStatusController.cs @@ -0,0 +1,42 @@ +using DS.Module.Core; +using DS.Module.ExcelModule; +using DS.Module.ExcelModule.Model; +using DS.Module.PrintModule; +using DS.WMS.Core.Code.Interface; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.OpApi.Controllers +{ + /// + /// 大简云服务项目服务 模块 + /// + public class DjyServiceStatusController : ApiController + { + private readonly IPrintService _invokeService; + + /// + /// 构造函数 + /// + /// + public DjyServiceStatusController(IPrintService invokeService) + { + _invokeService = invokeService; + } + + + + + /// + /// 获取Json打印信息 + /// + /// + /// + [HttpPost] + [Route("GetOpenJsonPrintInfo")] + public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req) + { + return _invokeService.GetOpenJsonPrintInfo(req); + } + } +} 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 71b9c4de..861972a6 100644 --- a/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.OpApi/Logs/internal-nlog.txt @@ -96,3 +96,31 @@ 2024-05-20 16:20:35.1879 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config 2024-05-20 16:20:35.2035 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-05-20 16:20:35.2289 Info Configuration initialized. +2024-05-21 14:43:55.6958 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-21 14:43:55.7321 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-21 14:43:55.7445 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-21 14:43:55.7767 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-05-21 14:43:55.8036 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-05-21 14:43:55.8036 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-21 14:43:55.8362 Info Configuration initialized. +2024-05-21 14:48:42.3616 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-21 14:48:42.4285 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-21 14:48:42.4478 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-21 14:48:42.5838 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-05-21 14:48:42.6506 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-05-21 14:48:42.6862 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-21 14:48:42.7409 Info Configuration initialized. +2024-05-21 14:55:50.3527 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-21 14:55:50.4079 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-21 14:55:50.4942 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-21 14:55:50.6263 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-05-21 14:55:50.6654 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-05-21 14:55:50.7335 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-21 14:55:50.7741 Info Configuration initialized. +2024-05-21 15:04:07.4140 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-05-21 15:04:07.4573 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-05-21 15:04:07.4780 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-05-21 15:04:07.5206 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-05-21 15:04:07.5543 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config +2024-05-21 15:04:07.5713 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-05-21 15:04:07.5944 Info Configuration initialized. diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 84906267..50c83888 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -75,7 +75,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.OpApi", "DS.WMS.OpAp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.FeeApi", "DS.WMS.FeeApi\DS.WMS.FeeApi.csproj", "{4A810D08-AB29-4758-BA37-9BEDBEA97B3A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.CrawlerData", "DS.Module.CrawlerData\DS.Module.CrawlerData.csproj", "{AB3034D8-91F4-42A6-BFE9-497B238D65AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.CrawlerData", "DS.Module.CrawlerData\DS.Module.CrawlerData.csproj", "{AB3034D8-91F4-42A6-BFE9-497B238D65AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.DjyServiceStatus", "DS.Module.DjyServiceStatus\DS.Module.DjyServiceStatus.csproj", "{86AF9895-D98D-4BFD-BEB9-CE291A382426}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -215,6 +217,10 @@ Global {AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {AB3034D8-91F4-42A6-BFE9-497B238D65AD}.Release|Any CPU.Build.0 = Release|Any CPU + {86AF9895-D98D-4BFD-BEB9-CE291A382426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86AF9895-D98D-4BFD-BEB9-CE291A382426}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86AF9895-D98D-4BFD-BEB9-CE291A382426}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86AF9895-D98D-4BFD-BEB9-CE291A382426}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -253,6 +259,7 @@ Global {28C691B0-6891-4407-9A8F-03E6035FB963} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {4A810D08-AB29-4758-BA37-9BEDBEA97B3A} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {AB3034D8-91F4-42A6-BFE9-497B238D65AD} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} + {86AF9895-D98D-4BFD-BEB9-CE291A382426} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}