diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs index 7e682981..8d163c00 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeAudit.cs @@ -540,32 +540,16 @@ namespace DS.WMS.Core.Fee.Dtos /// public decimal? InvoiceAmount { get; set; } - /// - /// 未开票金额 - /// - public decimal? InvoiceAmountRest { get { return InvoiceAmount.HasValue ? Amount - InvoiceAmount.Value : null; } } - /// /// Desc:申请金额 /// public decimal? OrderAmount { get; set; } - /// - /// Desc:申请开票金额 - /// - public decimal? OrderInvoiceAmount { get; set; } - /// - /// 是否机密费用 - /// - public bool? IsOpen { get; set; } /// /// 对帐编号 /// public string DebitNo { get; set; } - /// - /// 是否对帐 - /// - public bool IsDebit { get; set; } + /// /// 是否垫付费用 /// @@ -617,36 +601,16 @@ namespace DS.WMS.Core.Fee.Dtos /// public decimal Tax { get; set; } - /// - /// 申请结算金额 - /// - public decimal OrderSettlementAmount { get; set; } - /// /// 含税单价 /// public decimal TaxUnitPrice { get; set; } - /// - /// 申请发票开票金额 - /// - public decimal OrderInvSettlementAmount { get; set; } - - /// - /// 是否财务费用 - /// - public bool IsAcc { get; set; } - /// /// 核算单位 /// public string SaleOrg { get; set; } - /// - /// 核算单位Id - /// - public long SaleOrgId { get; set; } - /// /// 创建人 /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeStatistics.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeStatistics.cs index 2f07c379..43727535 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeStatistics.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/FeeStatistics.cs @@ -10,17 +10,17 @@ namespace DS.WMS.Core.Fee.Dtos public class FeeStatItem { /// - /// 应收款总计(人民币合计) + /// 应收款总计(RMB) /// public decimal ReceivableTotal { get; set; } /// - /// 应付款总计(人民币合计) + /// 应付款总计(RMB) /// public decimal PayableTotal { get; set; } /// - /// 利润总计 + /// 利润总计(RMB) /// public decimal ProfitTotal { get { return ReceivableTotal - PayableTotal; } } @@ -39,6 +39,21 @@ namespace DS.WMS.Core.Fee.Dtos } } + /// + /// 应收利润率(利润/应收) + /// + public string RecvProfitMargin + { + get + { + if (ReceivableTotal == 0) + return string.Empty; + + //利润率=利润÷应付/应收×100% + return string.Concat(Math.Round(ProfitTotal / ReceivableTotal * 100, 2, MidpointRounding.AwayFromZero), "%"); + } + } + /// /// 人民币应收款 /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/CostAccountingForm.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/CostAccounting.cs similarity index 95% rename from ds-wms-service/DS.WMS.Core/Fee/Dtos/CostAccountingForm.cs rename to ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/CostAccounting.cs index c3f0f6b8..3d0c9746 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/CostAccountingForm.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/CostAccounting.cs @@ -1,16 +1,12 @@ using DS.Module.Core; -namespace DS.WMS.Core.Fee.Dtos +namespace DS.WMS.Core.Fee.Dtos.Report { /// /// 费用核算单 /// - public class CostAccountingForm + public class CostAccounting { - //public long BusinessId { get; set; } - - //public BusinessType BusinessType { get; set; } - /// /// 业务编号 /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/DebitNote.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/DebitNote.cs new file mode 100644 index 00000000..3beaf2d9 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/DebitNote.cs @@ -0,0 +1,109 @@ +namespace DS.WMS.Core.Fee.Dtos.Report +{ + /// + /// 费用确认单 + /// + public class DebitNote + { + /// + /// 委托单位 + /// + public string CustomerName { get; set; } + + /// + /// 委托编号 + /// + public string CustomerNo { get; set; } + + /// + /// 主提单号 + /// + public string MBLNO { get; set; } + + /// + /// 分提单号 + /// + public string HBLNO { get; set; } + + /// + /// 起运港 + /// + public string LoadPort { get; set; } + + /// + /// 目的港 + /// + public string DischargePort { get; set; } + + /// + /// 开船日期 + /// + public DateTime? ETD { get; set; } + + /// + /// 箱型箱量 + /// + public string CntrTotal { get; set; } + + /// + /// 船名 + /// + public string Vessel { get; set; } + + /// + /// 航次 + /// + public string Voyno { get; set; } + + /// + /// 费用明细 + /// + public List Items { get; set; } = []; + } + + /// + /// 费用项 + /// + public class DebitNoteItem + { + /// + /// 费用名称 + /// + public string FeeName { get; set; } + + /// + /// 计费单位 + /// + public string? Unit { get; set; } + + /// + /// 数量 + /// + public int Quantity { get; set; } + + /// + /// 币种 + /// + public string Currency { get; set; } + + /// + /// 单价 + /// + public decimal UnitPrice { get; set; } + + /// + /// USD金额 + /// + public decimal AmountUSD { get; set; } + + /// + /// RMB金额 + /// + public decimal AmountRMB { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/ProfitAccounting.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/ProfitAccounting.cs new file mode 100644 index 00000000..76372240 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/ProfitAccounting.cs @@ -0,0 +1,250 @@ +using DS.Module.Core; +using DS.WMS.Core.Op.Entity; + +namespace DS.WMS.Core.Fee.Dtos.Report +{ + /// + /// 利润核算单 + /// + public class ProfitAccounting + { + /// + /// 客户编号 + /// + public string CustomerCode { get; set; } + + /// + /// 业务编号 + /// + public string CustomerNo { get; set; } + + /// + /// 主提单号 + /// + public string MBLNO { get; set; } + + /// + /// 分提单号 + /// + public string HBLNO { get; set; } + + /// + /// 约主名称 + /// + public string ContractClientName { get; set; } + + /// + /// 运费协议号(约号) + /// + public string ContractNo { get; set; } + + /// + /// 船代 + /// + public string ShipAgency { get; set; } + + /// + /// 订舱代理(订舱口) + /// + public string Forwarder { get; set; } + + /// + /// 订舱代理联系人信息 + /// + public Contact? ForwarderContact { get; set; } + + /// + /// 委托单位 + /// + public string CustomerName { get; set; } + + /// + /// 委托单位联系人信息 + /// + public Contact? CustomerContact { get; set; } + + /// + /// 国内发货人 + /// + public string ShipperCn { get; set; } + + /// + /// 国内发货人联系人信息 + /// + public Contact? ShipperCNContact { get; set; } + + /// + /// 箱型箱量 + /// + public string CntrTotal { get; set; } + + /// + /// 品名 + /// + public string GoodsName { get; set; } + + /// + /// 海关代码 + /// + public string HSCode { get; set; } + + /// + /// 起运港 + /// + public string LoadPort { get; set; } + + /// + /// 目的港 + /// + public string DischargePort { get; set; } + + /// + /// 开船日期 + /// + public DateTime? ETD { get; set; } + + ///// + ///// 预抵日期 + ///// + //public DateTime? ETA { get; set; } + + /// + /// 实际开船日期 + /// + public DateTime? ATD { get; set; } + + ///// + ///// 实际到港日期 + ///// + //public DateTime? ATA { get; set; } + + /// + /// 截单日期 + /// + public DateTime? CloseDocDate { get; set; } + + /// + /// 截港日期 + /// + public DateTime? ClosingDate { get; set; } + + /// + /// 场站 + /// + public string Yard { get; set; } + + /// + /// 车队 + /// + public string Trucker { get; set; } + + /// + /// 报关行 + /// + public string Customser { get; set; } + + /// + /// 服务项目 + /// + public string ServiceItem { get; set; } + + /// + /// 内部备注 + /// + public string? Remark { get; set; } + + /// + /// 销售 + /// + public string Sale { get; set; } + + /// + /// 操作 + /// + public string Operator { get; set; } + + /// + /// 客服 + /// + public string CustomerService { get; set; } + + /// + /// 单证 + /// + public string Doc { get; set; } + + /// + /// 费用组 + /// + public List FeeGroups { get; set; } = []; + + /// + /// 客户账期(结算日期) + /// + public string AccountDate { get; set; } + + /// + /// 订舱口账期 + /// + public string ForwarderAccountDate { get; set; } + + /// + /// 占资时长 + /// + public int OccupatedDuration { get; set; } + + /// + /// TEU利润率 + /// + public string TEUProfitMargin { get; set; } + + /// + /// 预计资金使用成本 + /// + public int ECCU { get; set; } + + public FeeAuditStatistics Statistics { get; set; } + } + + /// + /// 费用组 + /// + public class FeeGroup + { + /// + /// 费用名称 + /// + public string FeeName { get; set; } + + /// + /// 待审核费用 + /// + public List Items { get; set; } + } + + /// + /// 费用项 + /// + public class AccountingItem + { + /// + /// 费用类型 + /// + public FeeType FeeType { get; set; } + + /// + /// 金额 + /// + public decimal Amount { get; set; } + + /// + /// 结算对象 + /// + public string CustomerName { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs index 09e3a304..3308b874 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -949,7 +949,7 @@ namespace DS.WMS.Core.Fee.Method User = User, ServiceProvider = ServiceProvider }; - var data = provider.GetDataAsync(context); + var data = await provider.GetDataAsync(context); if (context.ErrorResult == null) return DataResult.Success(data); diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/CostAccountingReport.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/CostAccountingReport.cs index da389dca..c4ef2d10 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/CostAccountingReport.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/CostAccountingReport.cs @@ -1,5 +1,6 @@ using DS.Module.Core; using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Fee.Dtos.Report; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Op.Entity; @@ -17,7 +18,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders { public async Task GetDataAsync(ReportContext context) { - CostAccountingForm? form = null; + CostAccounting? form = null; switch (context.BusinessType) { case BusinessType.OceanShippingExport: @@ -62,9 +63,9 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders } //获取海运出口打印数据 - static async Task GetOceanShippingExportAsync(ISqlSugarClient tenantDb, params long[] idArray) + static async Task GetOceanShippingExportAsync(ISqlSugarClient tenantDb, params long[] idArray) { - CostAccountingForm form = null; + CostAccounting form = null; var list = await tenantDb.Queryable().InnerJoin((x, y) => x.BusinessId == y.Id) .Where((x, y) => idArray.Contains(x.Id) //&& x.FeeStatus == FeeStatus.SettlementCompleted @@ -93,7 +94,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders return form; var item = list[0]; - form = new CostAccountingForm + form = new CostAccounting { BusinessNo = item.CustomerNo, AccountingPeriod = item.AccountDate, diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/DebitNoteReport.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/DebitNoteReport.cs new file mode 100644 index 00000000..53e10bea --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/DebitNoteReport.cs @@ -0,0 +1,54 @@ +using DS.Module.Core; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Fee.Dtos.Report; +using DS.WMS.Core.Fee.Entity; +using DS.WMS.Core.Fee.Interface; +using DS.WMS.Core.Op.Entity; +using Masuit.Tools.Systems; +using SqlSugar; + +namespace DS.WMS.Core.Fee.Method.ReportProviders +{ + /// + /// 费用确认单 + /// + public class DebitNoteReport : IReportProvider + { + public async Task GetDataAsync(ReportContext context) + { + DebitNote? form = null; + long id = context.Ids[0]; + switch (context.BusinessType) + { + case BusinessType.OceanShippingExport: + form = await context.TenantDb.Queryable().Where(s => s.Id == id).Select().FirstAsync(); + break; + case BusinessType.OceanShippingImport: + + break; + default: + context.ErrorResult = DataResult.Failed(string.Format(MultiLanguageConst.GetDescription( + MultiLanguageConst.BusinessNotSupported), context.BusinessType.GetDescription())); + break; + } + + if (form != null) + { + form.Items = await context.TenantDb.Queryable().Where(x => x.BusinessId == id && x.BusinessType == context.BusinessType) + .Select(x => new DebitNoteItem + { + FeeName = x.FeeName, + Unit = x.UnitText, + Quantity = (int)x.Quantity, + Currency = x.Currency, + AmountRMB = x.Currency == FeeCurrency.RMB_CODE ? x.Amount : 0, + AmountUSD = x.Currency == FeeCurrency.USD_CODE ? x.Amount : 0, + UnitPrice = x.TaxUnitPrice, + Remark = x.Remark + }).ToListAsync(); + } + + return form; + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/ProfitAccountingReport.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/ProfitAccountingReport.cs new file mode 100644 index 00000000..603d58ea --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/ProfitAccountingReport.cs @@ -0,0 +1,110 @@ +using DS.Module.Core; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Fee.Dtos.Report; +using DS.WMS.Core.Fee.Entity; +using DS.WMS.Core.Fee.Interface; +using DS.WMS.Core.Info.Entity; +using DS.WMS.Core.Op.Entity; +using Masuit.Tools.Systems; + +namespace DS.WMS.Core.Fee.Method.ReportProviders +{ + /// + /// 利润核算单 + /// + public class ProfitAccountingReport : IReportProvider + { + internal static readonly string[] CustomerTypes = ["booking", "controller", "shippercn"]; + + public async Task GetDataAsync(ReportContext context) + { + ProfitAccounting? form = null; + long id = context.Ids[0]; + switch (context.BusinessType) + { + case BusinessType.OceanShippingExport: + form = await context.TenantDb.Queryable().Where(s => s.Id == id) + .LeftJoin((s, c) => s.CustomerId == c.Id) + .Select((s, c) => new ProfitAccounting + { + CustomerCode = c.CodeName, + Sale = s.Sale, + Operator = s.OperatorName, + CustomerService = s.CustomerServiceName, + Doc = s.DocName + }, true).FirstAsync(); + break; + case BusinessType.OceanShippingImport: + + break; + default: + context.ErrorResult = DataResult.Failed(string.Format(MultiLanguageConst.GetDescription( + MultiLanguageConst.BusinessNotSupported), context.BusinessType.GetDescription())); + break; + } + + if (form != null) + { + var contacts = await context.TenantDb.Queryable().Where(c1 => c1.BusinessId == id && CustomerTypes.Contains(c1.CustomerType)) + .Select(x => new Contact + { + Name = x.Name, + Tel = x.Tel, + Mobile = x.Mobile, + Email = x.Email, + CustomerType = x.CustomerType + }).ToListAsync(); + + form.ForwarderContact = contacts.Find(x => x.CustomerType == "booking"); + form.CustomerContact = contacts.Find(x => x.CustomerType == "controller"); + form.ShipperCNContact = contacts.Find(x => x.CustomerType == "shippercn"); + + var list = await context.TenantDb.Queryable().Where(x => x.BusinessId == id && x.BusinessType == context.BusinessType) + .Select().ToListAsync(); + + if (list.Count > 0) + { + form.Statistics = new FeeAuditStatistics(list); + for (int i = 0; i < list.Count; i++) + { + var fee = list[i]; + var item = new AccountingItem + { + Amount = Math.Round(fee.Amount.GetValueOrDefault(), 0, MidpointRounding.AwayFromZero), + CustomerName = fee.CustomerName, + FeeType = fee.FeeType, + Remark = fee.Remark + }; + + var group = form.FeeGroups.Find(x => x.FeeName == fee.FeeName && x.Items?.Count < 2); + if (group == null) + { + group = new FeeGroup + { + FeeName = fee.FeeName, + Items = [item] + }; + + form.FeeGroups.Add(group); + } + else if (group.Items.Exists(x => x.FeeType == fee.FeeType)) + { + group = new FeeGroup + { + FeeName = fee.FeeName, + Items = [item] + }; + form.FeeGroups.Add(group); + } + else + { + group.Items.Add(item); + } + } + } + } + + return form; + } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/MailTemplateModel.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/MailTemplateModel.cs index 27e286f7..e6471e88 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/MailTemplateModel.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/MailTemplateModel.cs @@ -167,6 +167,11 @@ /// 邮箱 /// public string? Email { get; set; } + + /// + /// 类型 + /// + public string? CustomerType { get; set; } } /// diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs index f73793fc..0fabc900 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs @@ -200,7 +200,7 @@ namespace DS.WMS.FeeApi.Controllers } /// - /// 获取费用核算单打印信息 + /// 获取费用打印数据 /// /// 费用记录ID /// diff --git a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user index f2a959bf..73975b0c 100644 --- a/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user +++ b/ds-wms-service/DS.WMS.MainApi/DS.WMS.MainApi.csproj.user @@ -1,6 +1,6 @@  - D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml + D:\Source\Repos\DS8\ds-wms-service\DS.WMS.MainApi\Properties\PublishProfiles\FolderProfile.pubxml \ No newline at end of file