diff --git a/ds-wms-service/DS.Module.Core/Helpers/Extension.Convert.cs b/ds-wms-service/DS.Module.Core/Helpers/Extension.Convert.cs index 17e585d8..264c6fb8 100644 --- a/ds-wms-service/DS.Module.Core/Helpers/Extension.Convert.cs +++ b/ds-wms-service/DS.Module.Core/Helpers/Extension.Convert.cs @@ -1,3 +1,5 @@ +using Microsoft.AspNetCore.Http; + namespace DS.Module.Core.Helpers; /// @@ -95,4 +97,19 @@ public static partial class Extensions return DateTime.MinValue; } } + + // + // 摘要: + // 将 IFormFile 转换成 byte[] + // + // 参数: + // formFile: + public static byte[] ToByteArray(this IFormFile formFile) + { + long length = formFile.Length; + using Stream stream = formFile.OpenReadStream(); + byte[] array = new byte[length]; + stream.Read(array, 0, (int)length); + return array; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs b/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs deleted file mode 100644 index 96212328..00000000 --- a/ds-wms-service/DS.Module.DjyServiceStatus/TaskManageOrderResultDto.cs +++ /dev/null @@ -1,78 +0,0 @@ -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/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs new file mode 100644 index 00000000..e57e4d51 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs @@ -0,0 +1,24 @@ +using DS.Module.Core; +using DS.Module.DjyServiceStatus; +using DS.WMS.Core.TaskPlat.Dtos; +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.TaskPlat.Interface +{ + public interface ITaskManageService + { + /// + /// 创建任务 + /// + /// 任务详情 + /// + /// + /// 返回回执 + Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null); + } +} diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs new file mode 100644 index 00000000..6505d6a5 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs @@ -0,0 +1,589 @@ +using DS.Module.Core; +using DS.Module.Core.Helpers; +using DS.Module.DjyServiceStatus; +using DS.Module.SqlSugar; +using DS.Module.UserModule; +using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.TaskPlat.Dtos; +using DS.WMS.Core.TaskPlat.Entity; +using DS.WMS.Core.TaskPlat.Interface; +using LanguageExt; +using LanguageExt.Common; +using LogicExtensions; +using Masuit.Tools.Systems; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; +using Org.BouncyCastle.Ocsp; +using SharpCompress.Common; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.TaskPlat.Method +{ + public class TaskManageService : ITaskManageService + { + private readonly ILogger _logger; + private readonly IUser user; + private readonly ISaasDbService saasDbService; + private readonly IWebHostEnvironment environment; + + public TaskManageService(ILogger logger, + ISaasDbService saasDbService, + IUser user, + IWebHostEnvironment environment) + { + _logger = logger; + this.saasDbService = saasDbService; + this.user = user; + this.environment = environment; + } + //public Task> CreateTaskJob(TaskManageOrderMessageInfo info) + //{ + // throw new NotImplementedException(); + //} + + public async Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null) + { + string batchNo = Guid.NewGuid().ToString(); + try + { + _logger.LogInformation("批次={no} 接收到创建任务报文 报文={msg}", batchNo, JsonConvert.SerializeObject(info)); + + var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId); + + var taskInfo = await tenantDb.Queryable() + .OrderByDescending(a => a.CreateTime) + .FirstAsync(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}"); + + _logger.LogInformation("批次={no} 接收到创建任务报文 结束查询任务 {msg}", batchNo, taskInfo == null ? "不存在" : "存在"); + + /* + 只要任务最后一次处理任务的状态是已取消、已完成,就可以重入新的任务 + */ + if (taskInfo != null && taskInfo.STATUS != TaskStatusEnum.Cancel.ToString() && taskInfo.STATUS != TaskStatusEnum.Complete.ToString()) + { + _logger.LogInformation("批次={no} 状态已存在,不能重复创建任务 status={status}", batchNo, taskInfo.STATUS); + + throw new Exception($"状态已存在,不能重复创建任务"); + } + + //如果文件路径不为空 判断文件是否真实存在 + if (!string.IsNullOrWhiteSpace(info.Main.FilePath) && !File.Exists(info.Main.FilePath)) + { + throw new Exception(string.Format("{0}文件不存在", info.Main.FilePath)); + } + + //如果文件路径不为空 判断文件是否真实存在 + if (!string.IsNullOrWhiteSpace(info.Main.ModifyFile) && !File.Exists(info.Main.ModifyFile)) + { + throw new Exception(string.Format("{0}文件不存在", info.Main.ModifyFile)); + } + + taskInfo = new TaskBaseInfo + { + Id = SnowFlakeSingle.Instance.NextId(), + STATUS = TaskStatusEnum.Create.ToString(), + IS_EXCEPT = 0, + IS_COMPLETE = 0, + MBL_NO = info.Main.MBlNo, + TASK_BASE_TYPE = info.Main.TaskType.ToString(), + CARRIER_ID = info.Main.CarrierId?.Trim(), + IS_PUBLIC = string.IsNullOrWhiteSpace(info.Main.TaskUserId) ? 1 : 0, + BOOK_ORDER_NO = info.Main.BookingOrderNo, + OUT_BUSI_NO = $"{info.Head.SenderId}_{info.Head.GID}", + TASK_TITLE = info.Main.TaskTitle, + TASK_DESP = info.Main.TaskDesp, + TASK_SOURCE = info.Main.TaskSource.ToString(), + TASK_TYPE = info.Main.TaskType.ToString(), + VESSEL_VOYNO = info.Main.VesselVoyno?.Trim(), + CONTA_INFO = info.Main.ContaInfo, + TASK_REQ_USERNAME = info.Main.TaskUserName, + YARD_NAME = info.Main.YardName, + ETD = info.Main.ETD, + CUSTOMER_ID = info.Main.CustomerId, + CUSTOMER_NAME = info.Main.CustomerName, + BATCH_STATIC = info.Main.BatchStatic, + DJYUserId = info.Head.DJYUserId, + + }; + long taskReqUserId = 0; + + if (!string.IsNullOrWhiteSpace(info.Main.TaskUserId)) + { + if (long.TryParse(info.Main.TaskUserId, out taskReqUserId)) + { + taskInfo.TASK_REQ_USERID = taskReqUserId; + } + } + + // 忽略 + taskInfo.CreateBy = long.Parse(user.UserId); + taskInfo.CreateTime = DateTime.Now; + + //taskInfo.CreatedUserId = userTendInfo.userId; + //taskInfo.CreatedUserName = userTendInfo.userName; + //taskInfo.TenantId = userTendInfo.tendId; + //taskInfo.TenantName = userTendInfo.tenantName; + + if (info.Main.TaskType == TaskBaseTypeEnum.TRUCK_DISPATCH || info.Main.TaskType == TaskBaseTypeEnum.CAUTION_NOTICE) + { + taskInfo.IS_PUBLIC = 0; + } + else + { + taskInfo.IS_PUBLIC = 1; + } + + _logger.LogInformation("批次={no} 获取登录人详情 userid={userid} userinfo={userinfo}", batchNo, + info.Main.RecvUserId, + JsonConvert.SerializeObject(user)); + + if (info.Main != null && info.Main.TruckInfo != null && info.Main.TruckInfo.NeedArriveTime.HasValue) + { + taskInfo.NeedArriveTime = info.Main.TruckInfo.NeedArriveTime; + } + + await tenantDb.Insertable(taskInfo).ExecuteCommandIdentityIntoEntityAsync(); + + if (!string.IsNullOrWhiteSpace(info.Main.FilePath)) + { + string attachFileType = string.Empty; + string fileCategory = string.Empty; + + if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcfiles"; + + fileCategory = TaskFileCategoryEnum.BC.ToString(); + } + else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcmodifyfiles"; + + fileCategory = TaskFileCategoryEnum.BC_MODIFY.ToString(); + } + else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bccancelfiles"; + + fileCategory = TaskFileCategoryEnum.BC_CANCEL.ToString(); + } + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "draftfiles"; + + fileCategory = TaskFileCategoryEnum.DRAFT.ToString(); + } + else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "sisubmittedfiles"; + + fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString(); + } + else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "advisoryfiles"; + + fileCategory = TaskFileCategoryEnum.ADVISORY.ToString(); + } + + if (info.Main.FileList == null) + { + info.Main.FileList = new List(); + } + info.Main.FileList.Add(new TaskManageOrderFileInfo + { + PKId = SnowFlakeSingle.Instance.NextId(), + FileName = Path.GetFileName(info.Main.FilePath), + FileType = Path.GetExtension(info.Main.FilePath).ToLower(), + FilePath = info.Main.FilePath, + FileCategory = fileCategory + }); + + } + else + { + if (file != null) + { + var bytes = file.ToByteArray(); + + string attachFileType = string.Empty; + string fileCategory = string.Empty; + + if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcfiles"; + + fileCategory = TaskFileCategoryEnum.BC.ToString(); + } + else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcmodifyfiles"; + + fileCategory = TaskFileCategoryEnum.BC_MODIFY.ToString(); + } + else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bccancelfiles"; + + fileCategory = TaskFileCategoryEnum.BC_CANCEL.ToString(); + } + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "draftfiles"; + + fileCategory = TaskFileCategoryEnum.DRAFT.ToString(); + } + else if (TaskBaseTypeEnum.SI_FEEDBACK.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "sisubmittedfiles"; + + fileCategory = TaskFileCategoryEnum.SI_SUBMITTED.ToString(); + } + else if (TaskBaseTypeEnum.ROUTE_CUT_CHANGE.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "advisoryfiles"; + + fileCategory = TaskFileCategoryEnum.ADVISORY.ToString(); + } + + var fileFullName = await SaveFile(bytes, + batchNo, + GetFileType(file.FileName), + attachFileType); + + if (!string.IsNullOrWhiteSpace(fileFullName)) + { + if (info.Main.FileList == null) + { + info.Main.FileList = new List(); + } + + info.Main.FileList.Add(new TaskManageOrderFileInfo + { + PKId = SnowFlakeSingle.Instance.NextId(), + FileName = file.FileName, + FileType = Path.GetExtension(file.FileName).ToLower(), + FilePath = fileFullName, + FileCategory = fileCategory + }); + } + } + } + + if (!string.IsNullOrWhiteSpace(info.Main.ModifyFile)) + { + + string fileCategory = string.Empty; + + if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) + fileCategory = TaskFileCategoryEnum.BC_NOTICE.ToString(); + + else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE) + fileCategory = TaskFileCategoryEnum.BC_MODIFY_NOTICE.ToString(); + + else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE) + fileCategory = TaskFileCategoryEnum.BC_CANCEL_NOTICE.ToString(); + + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + fileCategory = TaskFileCategoryEnum.DRAFT_NOTICE.ToString(); + + if (info.Main.FileList == null) + info.Main.FileList = new List(); + + info.Main.FileList.Add(new TaskManageOrderFileInfo + { + PKId = SnowFlakeSingle.Instance.NextId(), + FileName = Path.GetFileName(info.Main.ModifyFile), + FileType = Path.GetExtension(info.Main.ModifyFile).ToLower(), + FilePath = info.Main.FilePath, + FileCategory = fileCategory + }); + } + else + { + if (modifyFile != null) + { + var bytes = modifyFile.ToByteArray(); + + string attachFileType = string.Empty; + string fileCategory = string.Empty; + + if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcnoticefiles"; + + fileCategory = TaskFileCategoryEnum.BC_NOTICE.ToString(); + + } + else if (TaskBaseTypeEnum.BC_MODIFY.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bcmodifynoticefiles"; + + fileCategory = TaskFileCategoryEnum.BC_MODIFY_NOTICE.ToString(); + } + else if (TaskBaseTypeEnum.CANCELLATION.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "bccancelnoticefiles"; + + fileCategory = TaskFileCategoryEnum.BC_CANCEL_NOTICE.ToString(); + } + else if (TaskBaseTypeEnum.DRAFT.ToString() == taskInfo.TASK_BASE_TYPE) + { + attachFileType = "draftnoticefiles"; + + fileCategory = TaskFileCategoryEnum.DRAFT_NOTICE.ToString(); + } + + var noExtensionFileName = Path.GetFileNameWithoutExtension(modifyFile.FileName); + var fileFullName = await SaveFile(bytes, + batchNo, + GetFileType(modifyFile.FileName), + attachFileType); + + if (!string.IsNullOrWhiteSpace(fileFullName)) + { + if (info.Main.FileList == null) + { + info.Main.FileList = new List(); + } + + info.Main.FileList.Add(new TaskManageOrderFileInfo + { + PKId = SnowFlakeSingle.Instance.NextId(), + FileName = modifyFile.FileName, + FileType = Path.GetExtension(modifyFile.FileName).ToLower(), + FilePath = fileFullName, + FileCategory = fileCategory + }); + } + } + } + + #region 附件 + //附件 + if (info.Main.FileList != null && info.Main.FileList.Count > 0) + { + info.Main.FileList.ForEach(async file => + { + var fileInfo = new TaskFileInfo(); + + fileInfo.Id = SnowFlakeSingle.Instance.NextId(); + fileInfo.TASK_PKID = taskInfo.Id; + + fileInfo.CreateBy = taskInfo.CreateBy; + fileInfo.CreateTime = taskInfo.CreateTime; + + //fileInfo.CreatedUserName = taskInfo.CreatedUserName; + //fileInfo.TenantId = taskInfo.TenantId; + //fileInfo.TenantName = taskInfo.TenantName; + + fileInfo.FILE_PATH = file.FilePath; + fileInfo.FILE_NAME = file.FileName; + fileInfo.FILE_TYPE = file.FileType; + + if (string.IsNullOrWhiteSpace(file.FileCategory)) + { + if (TaskBaseTypeEnum.BC.ToString() == taskInfo.TASK_BASE_TYPE) + { + fileInfo.FILE_CATEGORY = TaskFileCategoryEnum.BC.ToString(); + fileInfo.FILE_CATEGORY_NAME = TaskFileCategoryEnum.BC.GetDescription(); + } + 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(); + } + } + else + { + TaskFileCategoryEnum fileCategoryEnum = TaskFileCategoryEnum.NONE; + + System.Enum.TryParse(file.FileCategory, out fileCategoryEnum); + + fileInfo.FILE_CATEGORY = fileCategoryEnum.ToString(); + fileInfo.FILE_CATEGORY_NAME = fileCategoryEnum.GetDescription(); + } + + if (string.IsNullOrWhiteSpace(fileInfo.FILE_NAME)) + { + var fileModel = new FileInfo(file.FilePath); + + fileInfo.FILE_NAME = fileModel.Name; + fileInfo.FILE_TYPE = fileModel.Extension?.Replace(".", ""); + } + + await tenantDb.Insertable(fileInfo).ExecuteCommandAsync(); + }); + } + #endregion + + #region 邮件 + //邮件 + if (info.Main.EmailList != null && info.Main.EmailList.Count > 0) + { + info.Main.EmailList.ForEach(async email => + { + var emailInfo = new TaskEmail(); + + emailInfo.Id = SnowFlakeSingle.Instance.NextId(); + emailInfo.TASK_PKID = taskInfo.Id; + + emailInfo.CreateTime = taskInfo.CreateTime; + emailInfo.CreateBy = taskInfo.CreateBy; + + emailInfo.MAIL_PATH = email.MailPath; + + await tenantDb.Insertable(emailInfo).ExecuteCommandAsync(); + }); + } + #endregion + + + #region BC 任务 + if (info.Main.TaskType == TaskBaseTypeEnum.BC || info.Main.TaskType == TaskBaseTypeEnum.BC_MODIFY + || info.Main.TaskType == TaskBaseTypeEnum.CANCELLATION) + { + + } + #endregion + + var taskNo = await tenantDb.Queryable().Where(a => a.Id == taskInfo.Id).Select(a => a.TASK_NO).FirstAsync(); + //回写任务号 + var result = new DataResult(ResultCode.Success, "新增任务成功", taskNo); + + return result; + } + catch (Exception ex) + { + _logger.LogError(ex, "任务台:初始化任务的过程中发生未知异常"); + return DataResult.Failed(ex.Message); + } + } + #region 私有方法 + + /// + /// 保存文件并返回文件完整路径 + /// + /// 文件二进制流 + /// 批次号 + /// 文件类型 + /// 附件类型 bcfiles-BC文件 sofile-订舱附件 + /// 返回文件完整路径 + private async Task SaveFile(byte[] fileBytes, string batchNo, + PrintFileTypeEnum printFileType, string attachFileType = "sofiles") + { + var basePath = AppSetting.app(new string[] { "FileSettings", "BasePath" }); + var relativePath = AppSetting.app(new string[] { "FileSettings", "RelativePath" }); + + if (!string.IsNullOrWhiteSpace(attachFileType)) + relativePath += $"\\{attachFileType}"; + + string? dirAbs; + if (string.IsNullOrEmpty(basePath)) + { + dirAbs = Path.Combine(environment.WebRootPath, relativePath); + } + else + { + dirAbs = Path.Combine(basePath, relativePath); + } + + if (!Directory.Exists(dirAbs)) + Directory.CreateDirectory(dirAbs); + + var fileType = string.Empty; + if (printFileType == PrintFileTypeEnum.PDF) + { + fileType = ".pdf"; + } + else if (printFileType == PrintFileTypeEnum.XLSX) + { + fileType = ".xlsx"; + } + else if (printFileType == PrintFileTypeEnum.DOCX) + { + fileType = ".docx"; + } + else if (printFileType == PrintFileTypeEnum.XLS) + { + fileType = ".xls"; + } + else if (printFileType == PrintFileTypeEnum.DOC) + { + fileType = ".doc"; + } + + var id = SnowFlakeSingle.Instance.NextId(); + var fileSaveName = $"{id}{fileType}".ToLower(); + + string fileRelaPath = Path.Combine(relativePath, fileSaveName).ToLower(); + string fileAbsPath = Path.Combine(dirAbs, fileSaveName).ToLower(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + relativePath = relativePath.Replace("\\", "/"); + fileRelaPath = fileRelaPath.Replace("\\", "/"); + fileAbsPath = fileAbsPath.Replace("\\", "/"); + } + + _logger.LogInformation("批次={no} 生成文件保存路径完成 路由={filePath} 服务器系统={system}", batchNo, fileRelaPath, RuntimeInformation.OSDescription); + + await File.WriteAllBytesAsync(fileAbsPath, fileBytes); + + string bookFilePath; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + bookFilePath = System.Text.RegularExpressions.Regex.Match(fileAbsPath, relativePath.Replace("/", "\\/") + ".*").Value; + } + else + { + bookFilePath = System.Text.RegularExpressions.Regex.Match(fileAbsPath, relativePath.Replace("\\", "\\\\") + ".*").Value; + } + + return bookFilePath; + } + + /// + /// 获取文件类型 + /// + /// 文件完成路径 + /// 返回文件类型枚举 + private PrintFileTypeEnum GetFileType(string fileName) + { + PrintFileTypeEnum fileType = PrintFileTypeEnum.PDF; + + switch (Path.GetExtension(fileName).ToLower()) + { + case ".pdf": + fileType = PrintFileTypeEnum.PDF; + break; + case ".xlsx": + fileType = PrintFileTypeEnum.XLSX; + break; + case ".docx": + fileType = PrintFileTypeEnum.DOCX; + break; + case ".xls": + fileType = PrintFileTypeEnum.XLS; + break; + case ".doc": + fileType = PrintFileTypeEnum.DOC; + break; + } + + return fileType; + } + + #endregion + } +} diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs new file mode 100644 index 00000000..52b3b127 --- /dev/null +++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs @@ -0,0 +1,30 @@ +using DS.Module.Core; +using DS.WMS.Core.TaskPlat.Dtos; +using DS.WMS.Core.TaskPlat.Interface; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using NPOI.SS.Formula.Functions; + +namespace DS.WMS.TaskApi.Controllers; + + +/// +/// 任务台相关接口 +/// +public class TaskManageController : ApiController +{ + private readonly ITaskManageService taskManageService; + + + public TaskManageController(ITaskManageService taskManageService) + { + this.taskManageService = taskManageService; + } + + [HttpPost("CreateTaskJob")] + public async Task CreateTaskJob(TaskManageOrderMessageInfo info) + { + var result = await taskManageService.InitTaskJob(info); + return result; + } +} \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.TaskApi/DS.WMS.TaskApi.csproj b/ds-wms-service/DS.WMS.TaskApi/DS.WMS.TaskApi.csproj index e092a2c6..64bed9c8 100644 --- a/ds-wms-service/DS.WMS.TaskApi/DS.WMS.TaskApi.csproj +++ b/ds-wms-service/DS.WMS.TaskApi/DS.WMS.TaskApi.csproj @@ -12,7 +12,6 @@ - diff --git a/ds-wms-service/DS.WMS.Test/SaasTest.cs b/ds-wms-service/DS.WMS.Test/SaasTest.cs index 3aef5590..0db4bfde 100644 --- a/ds-wms-service/DS.WMS.Test/SaasTest.cs +++ b/ds-wms-service/DS.WMS.Test/SaasTest.cs @@ -7,6 +7,7 @@ using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Info.Entity; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Entity; +using DS.WMS.Core.TaskPlat.Entity; using Mapster; using Masuit.Tools.Strings; using Microsoft.Extensions.DependencyInjection; @@ -196,6 +197,8 @@ public class SaasTest 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(TaskEmail)); Assert.True(true); } } \ No newline at end of file