From 5b292efc82a8ac5e86f0382998a9b7ab044779c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 16 Jul 2024 15:12:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=BC=80=E7=A5=A8?= =?UTF-8?q?=E7=B1=BB=E7=AD=BE=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.Core/Enums/ApplicationStatus.cs | 2 +- .../DS.Module.Core/Enums/Invoice.cs | 10 +- .../Application/Dtos/InvoiceApplicationDto.cs | 9 +- .../DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs | 5 + .../DS.WMS.Core/Invoice/Entity/Invoice.cs | 2 +- .../Invoice/Interface/IFreeInvoiceService.cs | 8 +- .../Interface/IGeneralInvoiceService.cs | 10 ++ .../Invoice/Interface/IInvoiceService`1.cs | 15 +++ .../Invoice/Method/FreeInvoiceService.cs | 8 ++ .../Invoice/Method/GeneralInvoiceService.cs | 82 ++++++++++++++++ .../Invoice/Method/InvoiceService`1.cs | 23 +++++ .../Controllers/FreeInvoiceController.cs | 44 --------- .../Controllers/GeneralInvoiceController.cs | 95 +++++++++++++++++++ .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 7 ++ 14 files changed, 264 insertions(+), 56 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Invoice/Interface/IGeneralInvoiceService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs create mode 100644 ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs diff --git a/ds-wms-service/DS.Module.Core/Enums/ApplicationStatus.cs b/ds-wms-service/DS.Module.Core/Enums/ApplicationStatus.cs index 52c08372..dec39293 100644 --- a/ds-wms-service/DS.Module.Core/Enums/ApplicationStatus.cs +++ b/ds-wms-service/DS.Module.Core/Enums/ApplicationStatus.cs @@ -80,7 +80,7 @@ namespace DS.Module.Core.Enums Invoiced = 4, /// - /// 已开出 + /// 部分开出 /// [Description("部分开出")] PartialInvoiced = 5 diff --git a/ds-wms-service/DS.Module.Core/Enums/Invoice.cs b/ds-wms-service/DS.Module.Core/Enums/Invoice.cs index a1144d71..47235e4f 100644 --- a/ds-wms-service/DS.Module.Core/Enums/Invoice.cs +++ b/ds-wms-service/DS.Module.Core/Enums/Invoice.cs @@ -7,17 +7,23 @@ namespace DS.Module.Core.Enums /// public enum InvoiceCategory { + /// + /// 普通发票 + /// + [Description("普通发票")] + General = 0, + /// /// 电子发票 /// [Description("电子发票")] - Electronic = 0, + Electronic = 1, /// /// 纸质发票 /// [Description("纸质发票")] - Paper = 1 + Paper = 2 } /// diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/InvoiceApplicationDto.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/InvoiceApplicationDto.cs index e803dd7c..184f1469 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Dtos/InvoiceApplicationDto.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/InvoiceApplicationDto.cs @@ -45,10 +45,17 @@ namespace DS.WMS.Core.Application.Dtos public string? AmountUppercase { get; set; } /// - /// 所属机构(公司) + /// 所属机构(公司)ID /// + [IgnoreDataMember] public long? OrgId { get; set; } + /// + /// 所属机构(公司) + /// + [IgnoreDataMember] + public string? OrgName { get; set; } + /// /// 客户地址电话 /// diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs index 2b5937bb..c32883ef 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs @@ -253,5 +253,10 @@ namespace DS.WMS.Core.Invoice.Dto /// 发票明细 /// public List? InvoiceDetails { get; set; } + + /// + /// 费用明细汇总 + /// + public List? Summary { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs b/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs index 8305b329..f62c277c 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs @@ -317,7 +317,7 @@ namespace DS.WMS.Core.Invoice.Entity /// 作废时间 /// [SugarColumn(ColumnDescription = "作废时间")] - public DateTime CancelTime { get; set; } + public DateTime? CancelTime { get; set; } /// /// 费用明细 diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs index b869ff81..8453dbff 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs @@ -1,7 +1,6 @@ using DS.Module.Core; using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Fee.Dtos; -using DS.WMS.Core.Invoice.Dto; namespace DS.WMS.Core.Invoice.Interface { @@ -24,11 +23,6 @@ namespace DS.WMS.Core.Invoice.Interface /// Task> GetFeesAsync(params BizItem[] items); - /// - /// 获取发票详情 - /// - /// 发票ID - /// - Task> GetAsync(long id); + } } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IGeneralInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IGeneralInvoiceService.cs new file mode 100644 index 00000000..0d108cbc --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IGeneralInvoiceService.cs @@ -0,0 +1,10 @@ +namespace DS.WMS.Core.Invoice.Interface +{ + /// + /// 标准开票 + /// + public interface IGeneralInvoiceService : IInvoiceService + { + + } +} diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceService`1.cs b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceService`1.cs index 2ec062cb..054972b6 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IInvoiceService`1.cs @@ -17,6 +17,13 @@ namespace DS.WMS.Core.Invoice.Interface /// Task>> GetListAsync(PageRequest request); + /// + /// 获取发票详情 + /// + /// 发票ID + /// + Task> GetAsync(long id); + /// /// 提交发票开票 /// @@ -45,5 +52,13 @@ namespace DS.WMS.Core.Invoice.Interface /// 发票ID /// Task SetLockAsync(bool isLocked, params long[] ids); + + /// + /// 设置发票的作废状态 + /// + /// 是否锁定 + /// 发票ID + /// + Task SetCancelAsync(bool isCancelled, params long[] ids); } } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs index 2ee80b26..fc2c90f5 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs @@ -52,6 +52,7 @@ namespace DS.WMS.Core.Invoice.Method FeeType = x.FeeType, ApplyAmount = x.ApplyAmount, ExchangeRate = x.ExchangeRate, + Currency = x.Currency, OriginalAmount = x.OriginalAmount, OriginalCurrency = x.OriginalCurrency, OriginalRate = x.OriginalRate, @@ -66,6 +67,13 @@ namespace DS.WMS.Core.Invoice.Method Voyage = x.Voyage, }).ToListAsync(); + invoice.Summary = invoice.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem + { + FeeType = x.Key.FeeType, + Currency = x.Key.Currency, + Amount = x.Sum(y => y.ApplyAmount) + }).ToList(); + invoice.InvoiceDetails = await TenantDb.Queryable().Where( x => x.ApplicationId == id && x.Category == DetailCategory.InvoiceIssuance).ToListAsync(); } diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs new file mode 100644 index 00000000..38aea391 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs @@ -0,0 +1,82 @@ +using DS.Module.Core; +using DS.Module.Core.Enums; +using DS.Module.Core.Extensions; +using DS.WMS.Core.Application.Dtos; +using DS.WMS.Core.Application.Entity; +using DS.WMS.Core.Invoice.Interface; +using DS.WMS.Core.Sys.Entity; +using SqlSugar; + +namespace DS.WMS.Core.Invoice.Method +{ + /// + /// 标准(按申请)开票实现 + /// + public class GeneralInvoiceService : InvoiceService, IGeneralInvoiceService + { + /// + /// 初始化 + /// + /// + public GeneralInvoiceService(IServiceProvider provider) : base(provider) + { + } + + /// + /// 获取付费申请分页列表 + /// + /// + /// + public async Task>> GetApplicationListAsync(PageRequest request) + { + var query = TenantDb.Queryable().Where(x => x.Status == InvoiceApplicationStatus.AuditPassed || x.Status == InvoiceApplicationStatus.PartialInvoiced) + .InnerJoin((a, d) => a.Id == d.ApplicationId && (d.OriginalAmount - d.OriginalProcessedAmount) != 0) + .Select(a => new InvoiceApplicationDto + { + Id = a.Id, + ApplicationNO = a.ApplicationNO, + Status = a.Status, + CustomerId = a.CustomerId, + CustomerName = a.CustomerName, //结算单位 + InvoiceHeader = a.InvoiceHeader, + ApplyAmount = a.ApplyAmount, + InvoiceAmount = a.InvoiceAmount, + Currency = a.Currency, + Category = a.Category, + OrgId = a.OrgId, //所属部门 + SaleDeptId = a.SaleDeptId, //所属分部 + CreateBy = a.CreateBy, //申请人 + CreateTime = a.CreateTime, //申请日期 + InvoiceRemark = a.InvoiceRemark, //开票要求 + Note = a.Note, + //原币金额 + OriginalAmountList = SqlFunc.Subqueryable().Where(y => a.Id == y.ApplicationId) + .GroupBy(y => y.OriginalCurrency).ToList(y => new CurrencyAmount { Currency = y.OriginalCurrency, Amount = y.OriginalAmount }) + }); + + var whereList = request.GetConditionalModels(Db); + var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition); + + if (result.Data.Count > 0) + { + var userIds = result.Data.Select(x => x.CreateBy).Distinct(); + var users = await Db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); + + var orgIds = result.Data.Where(x => x.SaleDeptId.HasValue).Select(x => x.SaleDeptId) + .Union(result.Data.Where(x => x.OrgId.HasValue).Select(x => x.OrgId)) + .Distinct(); + var orgs = await Db.Queryable().Where(x => orgIds.Contains(x.Id)).Select(x => new { x.Id, x.OrgName }).ToListAsync(); + + foreach (var item in result.Data) + { + item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; + + item.SaleDeptName = orgs.Find(x => x.Id == item.SaleDeptId)?.OrgName; + item.OrgName = orgs.Find(x => x.Id == item.OrgId)?.OrgName; + } + } + + return result; + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs index c2dfffb1..2246a39b 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs @@ -518,5 +518,28 @@ namespace DS.WMS.Core.Invoice.Method return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); } + + /// + /// 设置发票的作废状态 + /// + /// 是否锁定 + /// 发票ID + /// + public async Task SetCancelAsync(bool isCancelled, params long[] ids) + { + var dt = DateTime.Now; + var userId = long.Parse(User.UserId); + var list = ids.Select(x => new TEntity + { + Id = x, + IsCancelled = isCancelled, + CancelTime = isCancelled ? dt : null, + CancelUserId = isCancelled ? userId : null + }).ToList(); + int rows = await TenantDb.Updateable(list) + .UpdateColumns(x => new { x.IsCancelled, x.CancelTime, x.CancelUserId }).ExecuteCommandAsync(); + + return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs index 60f17693..2dbca283 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs @@ -1,5 +1,4 @@ using DS.Module.Core; -using DS.Module.Core.Data; using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Invoice.Dto; @@ -72,48 +71,5 @@ namespace DS.WMS.FeeApi.Controllers return await _service.SaveAsync(request); } - - /// - /// 删除发票明细 - /// - /// 发票明细ID - /// - [HttpPost, Route("DeleteDetail")] - public async Task DeleteDetailAsync([FromBody] IdModel model) - { - if (!ModelState.IsValid) - return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); - - return await _service.DeleteDetailAsync(model.Ids); - } - - /// - /// 删除发票 - /// - /// 发票ID - /// - [HttpPost, Route("Delete")] - public async Task DeleteAsync([FromBody] IdModel model) - { - if (!ModelState.IsValid) - return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); - - return await _service.DeleteAsync(model.Ids); - } - - /// - /// 设置发票的锁定状态 - /// - /// 发票ID - /// - [HttpPost, Route("SetLock")] - public async Task SetLockAsync([FromBody] IdModel model) - { - if (!ModelState.IsValid) - return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); - - bool isLocked = Convert.ToBoolean(model.Value); - return await _service.SetLockAsync(isLocked, model.Ids); - } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs new file mode 100644 index 00000000..79265a00 --- /dev/null +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs @@ -0,0 +1,95 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.Core.Invoice.Dto; +using DS.WMS.Core.Invoice.Dtos; +using DS.WMS.Core.Invoice.Entity; +using DS.WMS.Core.Invoice.Interface; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.FeeApi.Controllers +{ + /// + /// 标准(按申请)开票API + /// + public class GeneralInvoiceController : ApiController + { + readonly IGeneralInvoiceService _service; + + /// + /// 初始化 + /// + /// + public GeneralInvoiceController(IGeneralInvoiceService service) + { + _service = service; + } + + /// + /// 获取发票详情 + /// + /// 发票ID + /// + [HttpGet, Route("Get")] + public async Task> GetAsync(long id) + { + return await _service.GetAsync(id); + } + + /// + /// 提交发票开票 + /// + /// 请求参数 + /// + [HttpPost, Route("Save")] + public async Task> SaveAsync(InvoiceRequest request) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _service.SaveAsync(request); + } + + /// + /// 删除发票明细 + /// + /// 发票明细ID + /// + [HttpPost, Route("DeleteDetail")] + public async Task DeleteDetailAsync([FromBody] IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _service.DeleteDetailAsync(model.Ids); + } + + /// + /// 删除发票 + /// + /// 发票ID + /// + [HttpPost, Route("Delete")] + public async Task DeleteAsync([FromBody] IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _service.DeleteAsync(model.Ids); + } + + /// + /// 设置发票的锁定状态 + /// + /// 发票ID + /// + [HttpPost, Route("SetLock")] + public async Task SetLockAsync([FromBody] IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + bool isLocked = Convert.ToBoolean(model.Value); + return await _service.SetLockAsync(isLocked, model.Ids); + } + } +} diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index d3de5fe8..eacf544c 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -2798,3 +2798,10 @@ 2024-07-16 11:28:24.8156 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-07-16 11:28:24.8156 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-16 11:28:24.8313 Info Configuration initialized. +2024-07-16 14:04:36.2569 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-16 14:04:36.2882 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-16 14:04:36.2985 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-16 14:04:36.3120 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-16 14:04:36.3120 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-16 14:04:36.3120 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-16 14:04:36.3280 Info Configuration initialized. From b906766e08e353f44a3d04f09805b8dcdfe2ef21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 16 Jul 2024 15:15:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Invoice/Method/FreeInvoiceService.cs | 49 ------------------- .../Invoice/Method/InvoiceService`1.cs | 49 +++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs index fc2c90f5..23c777f2 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs @@ -32,55 +32,6 @@ namespace DS.WMS.Core.Invoice.Method { } - /// - /// 获取发票详情 - /// - /// 发票ID - /// - public async Task> GetAsync(long id) - { - var invoice = await TenantDb.Queryable().Select().FirstAsync(x => x.Id == id); - if (invoice != null) - { - invoice.Details = await CreateApplicationDetailQuery((d, f, s) => d.ApplicationId == id && d.Category == DetailCategory.InvoiceIssuance) - .Select(x => new ApplicationDetailDto - { - Id = x.Id, - ApplicationId = x.ApplicationId, - RecordId = x.RecordId, - FeeName = x.FeeName, - FeeType = x.FeeType, - ApplyAmount = x.ApplyAmount, - ExchangeRate = x.ExchangeRate, - Currency = x.Currency, - OriginalAmount = x.OriginalAmount, - OriginalCurrency = x.OriginalCurrency, - OriginalRate = x.OriginalRate, - CustomerNo = x.CustomerNo, - MBLNO = x.MBLNO, - ClientName = x.ClientName, - ETD = x.ETD, - SaleName = x.SaleName, - SourceName = x.SourceName, - LoadPort = x.LoadPort, - Vessel = x.Vessel, - Voyage = x.Voyage, - }).ToListAsync(); - - invoice.Summary = invoice.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem - { - FeeType = x.Key.FeeType, - Currency = x.Key.Currency, - Amount = x.Sum(y => y.ApplyAmount) - }).ToList(); - - invoice.InvoiceDetails = await TenantDb.Queryable().Where( - x => x.ApplicationId == id && x.Category == DetailCategory.InvoiceIssuance).ToListAsync(); - } - - return DataResult.Success(invoice); - } - /// /// 获取待开票的业务列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs index 2246a39b..8417d6be 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs @@ -113,6 +113,55 @@ namespace DS.WMS.Core.Invoice.Method return result; } + /// + /// 获取发票详情 + /// + /// 发票ID + /// + public async Task> GetAsync(long id) + { + var invoice = await TenantDb.Queryable().Select().FirstAsync(x => x.Id == id); + if (invoice != null) + { + invoice.Details = await CreateApplicationDetailQuery((d, f, s) => d.ApplicationId == id && d.Category == DetailCategory.InvoiceIssuance) + .Select(x => new ApplicationDetailDto + { + Id = x.Id, + ApplicationId = x.ApplicationId, + RecordId = x.RecordId, + FeeName = x.FeeName, + FeeType = x.FeeType, + ApplyAmount = x.ApplyAmount, + ExchangeRate = x.ExchangeRate, + Currency = x.Currency, + OriginalAmount = x.OriginalAmount, + OriginalCurrency = x.OriginalCurrency, + OriginalRate = x.OriginalRate, + CustomerNo = x.CustomerNo, + MBLNO = x.MBLNO, + ClientName = x.ClientName, + ETD = x.ETD, + SaleName = x.SaleName, + SourceName = x.SourceName, + LoadPort = x.LoadPort, + Vessel = x.Vessel, + Voyage = x.Voyage, + }).ToListAsync(); + + invoice.Summary = invoice.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem + { + FeeType = x.Key.FeeType, + Currency = x.Key.Currency, + Amount = x.Sum(y => y.ApplyAmount) + }).ToList(); + + invoice.InvoiceDetails = await TenantDb.Queryable().Where( + x => x.ApplicationId == id && x.Category == DetailCategory.InvoiceIssuance).ToListAsync(); + } + + return DataResult.Success(invoice); + } + /// /// 提交发票开票 /// From 6fdb2317a4ffc046990ab36cfd731645642271a2 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 16 Jul 2024 17:40:54 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=90=E5=8D=95=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=8F=8A=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Dtos/BillManageHistoryListRes.cs | 110 ++++++++++++++++++ ...ingStatusLog.cs => BookingStatusLogReq.cs} | 4 + .../Op/Dtos/BookingStatusLogRes.cs | 43 +++++++ .../Op/Dtos/SeaExportBillManageReq.cs | 8 +- .../Op/Dtos/SeaExportBillManageRes.cs | 13 ++- .../DS.WMS.Core/Op/Entity/SeaExport.cs | 19 +++ .../Op/Entity/SeaExportBillManage.cs | 10 +- .../Interface/ISeaExportBillManageService.cs | 14 +++ .../Op/Interface/ISeaExportService.cs | 8 ++ .../Op/Method/DataCallBackService.cs | 72 ++++++------ .../Op/Method/SeaExportBillManageService.cs | 75 ++++++++++++ .../DS.WMS.Core/Op/Method/SeaExportService.cs | 24 ++++ .../SeaExportBillManageController.cs | 27 +++++ .../Controllers/SeaExportController.cs | 14 +++ 14 files changed, 391 insertions(+), 50 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/BillManageHistoryListRes.cs rename ds-wms-service/DS.WMS.Core/Op/Dtos/{BookingStatusLog.cs => BookingStatusLogReq.cs} (93%) create mode 100644 ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogRes.cs diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BillManageHistoryListRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillManageHistoryListRes.cs new file mode 100644 index 00000000..68281ae1 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BillManageHistoryListRes.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + /// + /// 历史提单信息引入列表 + /// + public class BillManageHistoryListRes + { + /// + /// 主键Id + /// + public long Id { get; set; } + + /// + /// 主提单号 + /// + public string MBLNO { get; set; } + + /// + /// 分提单号 + /// + public string HBLNO { get; set; } + /// + /// 船名 t_code_vessel + /// + public string Vessel { get; set; } + + /// + /// 船名Id t_code_vessel + /// + public long VesselId { get; set; } + + /// + /// 航次 + /// + public string Voyno { get; set; } + + /// + /// 开船日期 + /// + public DateTime? ETD { get; set; } + + /// + /// 装货港代码 + /// + public long LoadPortId { get; set; } + + /// + /// 装货港 + /// + public string LoadPort { get; set; } + + /// + /// 卸货港代码 + /// + public long DischargePortId { get; set; } + + /// + /// 卸货港 + /// + public string DischargePort { get; set; } + + /// + /// 发货人 t_info_client CUSTNAME + /// + public long? ShipperId { get; set; } + /// + /// 发货人内容 + /// + public string ShipperContent { get; set; } + + /// + /// 收货人 t_info_client CUSTNAME + /// + public long? ConsigneeId { get; set; } + /// + /// 收货人内容 + /// + public string ConsigneeContent { get; set; } + + /// + /// 代理人 t_info_client CUSTNAME + /// + public long? AgentId { get; set; } + /// + /// 代理人内容 + /// + public string AgentContent { get; set; } + + /// + /// 录入日期 + /// + public DateTime CreateTime { get; set; } + + /// + /// 录入人Id + /// + public long CreateBy { get; set; } + + /// + /// 录入人 + /// + public string CreateByName { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLog.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogReq.cs similarity index 93% rename from ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLog.cs rename to ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogReq.cs index 75668de2..303e09eb 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLog.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogReq.cs @@ -46,6 +46,10 @@ namespace DS.WMS.Core.Op.Dtos } public class BookingStatusLogDetailDto { + /// + /// 主键Id + /// + public long Id { get; set; } /// /// 主单id /// diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogRes.cs new file mode 100644 index 00000000..f49db78a --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/BookingStatusLogRes.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.WMS.Core.Op.Dtos +{ + /// + /// 货运动态 + /// + public class BookingStatusLogRes + { + public long Id { get; set; } + + /// + /// 业务id + /// + public long BusinessId { get; set; } + /// + /// 状态 + /// + public string Status { get; set; } + /// + /// 状态时间 + /// + public DateTime? OpTime { get; set; } + /// + /// 类别 + /// + public string Group { get; set; } + /// + /// 状态分类 + /// + public string Type { get; set; } + /// + /// 提单号 + /// + public string MBLNO { get; set; } + + public List detail { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageReq.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageReq.cs index e1148d7b..58a7556b 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageReq.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageReq.cs @@ -36,10 +36,10 @@ namespace DS.WMS.Core.Op.Dtos /// public string HBLNO { get; set; } - /// - /// 模板Id - /// - public long TemplateId { get; set; } + ///// + ///// 模板Id + ///// + //public long TemplateId { get; set; } /// /// 提单类型 diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageRes.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageRes.cs index 0ee00d30..bc0a00e2 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageRes.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/SeaExportBillManageRes.cs @@ -21,16 +21,19 @@ namespace DS.WMS.Core.Op.Dtos /// 业务Id /// public long BusinessId { get; set; } - + /// + /// 主提单号 + /// + public string MBLNO { get; set; } /// /// 分提单号 /// public string HBLNO { get; set; } - /// - /// 模板Id - /// - public long TemplateId { get; set; } + ///// + ///// 模板Id + ///// + //public long TemplateId { get; set; } /// /// 提单类型 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 46c5c7c7..71269f23 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExport.cs @@ -1325,4 +1325,23 @@ public class SeaExport : BaseOrgModel /// [SqlSugar.SugarColumn(ColumnDescription = "车队联系人Id", IsNullable = false, DefaultValue = "0")] public long CarrierContactId { get; set; } + + + /// + /// 云港通ETD + /// + [SqlSugar.SugarColumn(ColumnDescription = "云港通ETD", IsNullable = true)] + public DateTime? YgtETD { get; set; } + + /// + /// StartATA + /// + [SqlSugar.SugarColumn(ColumnDescription = "StartATA", IsNullable = true)] + public DateTime? StartATA { get; set; } + + /// + /// StartETA + /// + [SqlSugar.SugarColumn(ColumnDescription = "StartETA", IsNullable = true)] + public DateTime? StartETA { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs index ea3cae35..6381e172 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/SeaExportBillManage.cs @@ -29,11 +29,11 @@ public class SeaExportBillManage : BaseOrgModel [SqlSugar.SugarColumn(ColumnDescription = "分提单号", IsNullable = true, Length = 30)] public string HBLNO { get; set; } - /// - /// 模板Id - /// - [SugarColumn(ColumnDescription = "模板Id")] - public long TemplateId { get; set; } + ///// + ///// 模板Id + ///// + //[SugarColumn(ColumnDescription = "模板Id")] + //public long TemplateId { get; set; } /// /// 提单类型 diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportBillManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportBillManageService.cs index 2d325bc4..d6e72184 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportBillManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportBillManageService.cs @@ -56,5 +56,19 @@ namespace DS.WMS.Core.Op.Interface /// 主表Id及箱信息Ids /// public DataResult BatchDelBillManageCtn(IdModel req); + + /// + /// 历史引入查询列表 + /// + /// + /// + public DataResult> GetBillManageHistoryList(PageRequest request); + + /// + /// 历史引入提单信息 + /// + /// 主表Id及历史提单Ids + /// + public Task ImportBillManageHistory(IdModel req); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs index 26ea8fa2..d32ca47b 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/ISeaExportService.cs @@ -174,4 +174,12 @@ public interface ISeaExportService /// public Task> ExcuteRuleEngine(string id); + + + /// + /// 订单及货运动态 + /// + /// + /// + public Task>> GetBookingStatusLogList(PageRequest request); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/DataCallBackService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/DataCallBackService.cs index f4c288ea..ec52697f 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/DataCallBackService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/DataCallBackService.cs @@ -371,42 +371,42 @@ namespace DS.WMS.Core.Op.Method // } //} } - //else if (item.Status == "ETD") - //{ - // if (order != null && item.OpTime != null && order.YgtETD != item.OpTime) - // { - // order.YgtETD = item.OpTime; - // await tenantDb.Updateable(order).UpdateColumns(x => new - // { - // x.YgtETD - // }).EnableDiffLogEvent().ExecuteCommandAsync(); - // //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); - // } - //} - //else if (item.Status == "ATA") - //{ - // if (order != null && item.OpTime != null && order.StartATA != item.OpTime) - // { - // order.StartATA = item.OpTime; - // await tenantDb.Updateable(order).UpdateColumns(x => new - // { - // x.StartATA - // }).EnableDiffLogEvent().ExecuteCommandAsync(); - // //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); - // } - //} - //else if (item.Status == "ETA") - //{ - // if (order != null && item.OpTime != null && order.StartETA != item.OpTime) - // { - // order.StartETA = item.OpTime; - // await tenantDb.Updateable(order).UpdateColumns(x => new - // { - // x.StartETA - // }).EnableDiffLogEvent().ExecuteCommandAsync(); - // //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); - // } - //} + else if (item.Status == "ETD") + { + if (order != null && item.OpTime != null && order.YgtETD != item.OpTime) + { + order.YgtETD = item.OpTime; + await tenantDb.Updateable(order).UpdateColumns(x => new + { + x.YgtETD + }).EnableDiffLogEvent().ExecuteCommandAsync(); + //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); + } + } + else if (item.Status == "ATA") + { + if (order != null && item.OpTime != null && order.StartATA != item.OpTime) + { + order.StartATA = item.OpTime; + await tenantDb.Updateable(order).UpdateColumns(x => new + { + x.StartATA + }).EnableDiffLogEvent().ExecuteCommandAsync(); + //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); + } + } + else if (item.Status == "ETA") + { + if (order != null && item.OpTime != null && order.StartETA != item.OpTime) + { + order.StartETA = item.OpTime; + await tenantDb.Updateable(order).UpdateColumns(x => new + { + x.StartETA + }).EnableDiffLogEvent().ExecuteCommandAsync(); + //await _bookingorderservice.SaveLog(newOrder, oldOrder, "运踪更新船期"); + } + } else if (item.Status == "MDGETA") { if (order != null && item.OpTime != null && order.ETA != item.OpTime) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBillManageService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBillManageService.cs index b3ba7a9e..f8bbf6e9 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBillManageService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportBillManageService.cs @@ -14,6 +14,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using DS.Module.Core.Data; +using DS.WMS.Core.Sys.Entity; +using DS.WMS.Core.Code.Dtos; +using DS.WMS.Core.Code.Entity; +using Microsoft.AspNet.SignalR.Hubs; namespace DS.WMS.Core.Op.Method { @@ -175,5 +179,76 @@ namespace DS.WMS.Core.Op.Method } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } + + + /// + /// 历史引入查询列表 + /// + /// + /// + public DataResult> GetBillManageHistoryList(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var users = db.Queryable().Select(x => new { x.Id, x.UserName }).ToList(); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var data = tenantDb.Queryable() + .Where(whereList) + .Select() + .Mapper(it => + { + it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName; + }) + .ToQueryPage(request.PageCondition); + return data; + } + + /// + /// 历史引入提单信息 + /// + /// 主表Id及历史提单Ids + /// + public async Task ImportBillManageHistory(IdModel req) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + var info = await tenantDb.Queryable().Where(x => x.Id ==long.Parse(req.Id)).FirstAsync(); + if (info.IsNull()) + return await Task.FromResult(DataResult.Failed("不存在的海运出口信息!", MultiLanguageConst.SeaExportExist)); + if (!tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).Any()) + return DataResult.Failed("提单信息不存在", MultiLanguageConst.ShippingBillManageNotExist); + + var list = await tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToListAsync(); + var newList = new List(); + foreach (var item in list) + { + var temp = new SeaExportBillManage() + { + BusinessId = long.Parse(req.Id), + ShipperContent = item.ShipperContent, + ShipperCode = item.ShipperCode, + ShipperCountry = item.ShipperCountry, + ShipperEmail = item.ShipperEmail, + ShipperTel = item.ShipperTel, + ConsigneeContent = item.ConsigneeContent, + ConsigneeCode = item.ConsigneeCode, + ConsigneeCountry = item.ConsigneeCountry, + ConsigneeEmail = item.ConsigneeEmail, + ConsigneeTel = item.ConsigneeTel, + NotifyPartyContent = item.NotifyPartyContent, + NotifyPartyCode = item.NotifyPartyCode, + NotifyPartyCountry = item.NotifyPartyCountry, + NotifyPartyEmail = item.NotifyPartyEmail, + NotifyPartyTel = item.NotifyPartyTel, + Marks = item.Marks, + Description = item.Description, + }; + + newList.Add(temp); + } + await tenantDb.Insertable(newList).ExecuteCommandAsync(); + + return await Task.FromResult(DataResult.Successed("导入成功",MultiLanguageConst.DataImportSuccess)); + + } } } 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 31cb02f7..db83bdd8 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -806,6 +806,9 @@ public partial class SeaExportService : ISeaExportService } + + + #region 删除 @@ -1018,4 +1021,25 @@ public partial class SeaExportService : ISeaExportService return entity; } #endregion + + /// + /// 订单及货运动态 + /// + /// + /// + public async Task>> GetBookingStatusLogList(PageRequest request) + { + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + //序列化查询条件 + var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); + var result = await tenantDb.Queryable() + .Select() + .Mapper(async it => + { + it.detail = await tenantDb.Queryable().Where(x => x.PId == it.Id).Select().ToListAsync(); + } + ).Where(whereList).ToQueryPageAsync(request.PageCondition); + + return result; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportBillManageController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportBillManageController.cs index 05b6368a..36415ea2 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportBillManageController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportBillManageController.cs @@ -100,4 +100,31 @@ public class SeaExportBillManageController : ApiController var res = _invokeService.BatchDelBillManageCtn(req); return res; } + + + /// + /// 历史引入查询列表 + /// + /// + /// + [HttpPost] + [Route("GetBillManageHistoryList")] + public DataResult> GetBillManageHistoryList([FromBody] PageRequest request) + { + var res = _invokeService.GetBillManageHistoryList(request); + return res; + } + /// + /// 历史引入提单信息 + /// + /// 主表Id及历史提单Ids + /// + [HttpPost] + [Route("ImportBillManageHistory")] + public async Task ImportBillManageHistory([FromBody] IdModel req) + { + var res = await _invokeService.ImportBillManageHistory(req); + return res; + } + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs index 1b5680f5..c172abdc 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportController.cs @@ -402,4 +402,18 @@ public class SeaExportController : ApiController { return await _invokeService.ExcuteRuleEngine(id); } + + /// + /// 订单及货运动态 + /// + /// + /// + [HttpPost] + [Route("GetBookingStatusLogList")] + public async Task>> GetBookingStatusLogList([FromBody] PageRequest request) + { + var res = await _invokeService.GetBookingStatusLogList(request); + return res; + } + } \ No newline at end of file From bfcc2b81b193ea2b00316b4fbb37eb4f153a4369 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 16 Jul 2024 18:16:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sys/Interface/IClientCommonService.cs | 6 ++++- .../Sys/Method/ClientCommonService.cs | 25 ++++++++++++++++++- .../Controllers/ClientCommonController.cs | 11 ++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs index 16a93508..b738ff4b 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/IClientCommonService.cs @@ -14,7 +14,11 @@ namespace DS.WMS.Core.Sys.Interface; /// public interface IClientCommonService { - + /// + /// 根据类型获取用户下拉列表 + /// + /// + public Task>> GetUserListByCode(string code = ""); /// /// 获取工厂信息下拉列表 /// diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs index a7ceb5c3..44ef302d 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs @@ -43,7 +43,30 @@ public class ClientCommonService : IClientCommonService user = _serviceProvider.GetRequiredService(); saasService = _serviceProvider.GetRequiredService(); } - + /// + /// 根据类型获取用户下拉列表 + /// + /// + public async Task>> GetUserListByCode(string code = "") + { + code = code.ToLower(); + var data = await db.Queryable() + .Where(a => a.Status == StatusEnum.Enable.ToEnumInt()) + .WhereIF(code == "operator", a => a.IsOperator == true) + .WhereIF(code == "doc", a => a.IsVouchingClerk == true) + .WhereIF(code == "sale", a => a.IsSale == true) + .WhereIF(code == "custom", a => a.IsCustom == true) + .WhereIF(code == "finance", a => a.IsFinancialStaff == true) + .WhereIF(code == "service", a => a.IsCustomerService == true) + .WhereIF(code == "driver", a => a.IsDriver == true) + .WhereIF(code == "dispatcher", a => a.IsDispatcher == true) + .Select(a => new ApiSelectViewModel + { + Label = a.UserName, + Value = a.Id, + }).ToListAsync(); + return DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess); + } /// /// 获取工厂信息下拉列表-客户端 /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs index 93de4177..7f94de00 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientCommonController.cs @@ -29,6 +29,17 @@ public class ClientCommonController : ApiController _invokeService = invokeService; } /// + /// 根据类型获取用户下拉列表 + /// + /// + [HttpGet] + [Route("GetUserListByCode")] + public async Task>> GetUserListByCode([FromQuery] string code = "") + { + var res = await _invokeService.GetUserListByCode(code); + return res; + } + /// /// 获取工厂信息下拉列表-客户端 /// ///