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
index 6277a018..36e32783 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/ProfitAccounting.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/Report/ProfitAccounting.cs
@@ -1,5 +1,5 @@
-using DS.Module.Core;
-using DS.WMS.Core.TaskInteraction.Dtos;
+using DS.WMS.Core.TaskInteraction.Dtos;
+using SqlSugar;
namespace DS.WMS.Core.Fee.Dtos.Report
{
@@ -8,6 +8,11 @@ namespace DS.WMS.Core.Fee.Dtos.Report
///
public class ProfitAccounting
{
+ ///
+ /// ID
+ ///
+ public long Id { get; set; }
+
///
/// 客户编号
///
@@ -268,7 +273,8 @@ namespace DS.WMS.Core.Fee.Dtos.Report
///
/// 费用组
///
- public List FeeGroups { get; set; } = [];
+ [SugarColumn(IsIgnore = true)]
+ public List FeeGroups { get; set; } = [];
///
/// 客户账期(结算日期)
@@ -318,14 +324,15 @@ namespace DS.WMS.Core.Fee.Dtos.Report
///
/// 费用统计
///
- public FeeAuditStatistics Statistics { get; set; }
+ [SugarColumn(IsIgnore = true)]
+ public FeeAuditStatistics? Statistics { get; set; }
}
///
- /// 费用组
+ /// 费用项
///
- public class FeeGroup
+ public class AccountingItem
{
///
/// 费用名称
@@ -333,34 +340,33 @@ namespace DS.WMS.Core.Fee.Dtos.Report
public string FeeName { get; set; }
///
- /// 待审核费用
+ /// 应收金额
///
- public List Items { get; set; }
- }
+ public string RecvAmount { get; set; }
- ///
- /// 费用项
- ///
- public class AccountingItem
- {
///
- /// 费用类型
+ /// 应收结算对象
///
- public FeeType FeeType { get; set; }
+ public string RecvCustomerName { get; set; }
///
- /// 金额
+ /// 应收备注
///
- public decimal Amount { get; set; }
+ public string? RecvRemark { get; set; }
///
- /// 结算对象
+ /// 应付金额
///
- public string CustomerName { get; set; }
+ public string PayAmount { get; set; }
///
- /// 备注
+ /// 应收结算对象
///
- public string? Remark { get; set; }
+ public string PayCustomerName { get; set; }
+
+ ///
+ /// 应收备注
+ ///
+ public string? PayRemark { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
index c2c71c86..e87fb968 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Interface/IFeeRecordService.cs
@@ -115,7 +115,6 @@ public interface IFeeRecordService
///
/// 回写业务表费用状态
///
- ///
/// 业务ID
/// 业务类型
///
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
index ab6fae58..5e654056 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/ProfitAccountingReport.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/ReportProviders/ProfitAccountingReport.cs
@@ -25,6 +25,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
form = await context.TenantDb.Queryable().Where(s => s.Id == context.BusinessId)
.Select(s => new ProfitAccounting
{
+ Id = s.Id,
ETDValue = s.ETD,
Operator = s.OperatorName,
CustomerService = s.CustomerServiceName,
@@ -66,56 +67,86 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
x.RemarkType,
x.Remark
}).ToListAsync();
- form.InternalRemark = remarks.Find(x => x.RemarkType == "1")?.Remark;
- form.CabinRemark = remarks.Find(x => x.RemarkType == "2")?.Remark;
- form.BookingRemark = remarks.Find(x => x.RemarkType == "3")?.Remark;
+ form.InternalRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "1").Select(x => x.Remark));
+ form.CabinRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "2").Select(x => x.Remark));
+ form.BookingRemark = string.Join(Environment.NewLine, remarks.Where(x => x.RemarkType == "3").Select(x => x.Remark));
var list = await context.TenantDb.Queryable().Where(x => x.BusinessId == context.BusinessId && x.BusinessType == context.BusinessType)
.WhereIF(context.Ids != null && context.Ids.Length > 0, x => context.Ids.Contains(x.Id))
- .Select().ToListAsync();
+ .OrderByDescending(x => x.Currency).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
+ AccountingItem? item = form.FeeGroups.Find(x => x.FeeName == fee.FeeName);
+ string amount = $"{GetSymbol(fee.Currency)}{Math.Round(fee.Amount.GetValueOrDefault(), 0, MidpointRounding.AwayFromZero)}";
+ if (fee.FeeType == FeeType.Receivable)
{
- 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
+ if (item == null || string.IsNullOrEmpty(item.RecvAmount))
{
- FeeName = fee.FeeName,
- Items = [item]
- };
-
- form.FeeGroups.Add(group);
- }
- else if (group.Items.Exists(x => x.FeeType == fee.FeeType))
- {
- group = new FeeGroup
+ item = new AccountingItem
+ {
+ FeeName = fee.FeeName,
+ RecvAmount = amount,
+ RecvCustomerName = fee.CustomerName,
+ RecvRemark = fee.Remark
+ };
+ form.FeeGroups.Add(item);
+ }
+ else
{
- FeeName = fee.FeeName,
- Items = [item]
- };
- form.FeeGroups.Add(group);
+ item.RecvAmount = amount;
+ item.RecvCustomerName = fee.CustomerName;
+ item.RecvRemark = fee.Remark;
+ }
}
else
{
- group.Items.Add(item);
+ if (item == null || string.IsNullOrEmpty(item.PayAmount))
+ {
+ item = new AccountingItem
+ {
+ FeeName = fee.FeeName,
+ PayAmount = amount,
+ PayCustomerName = fee.CustomerName,
+ PayRemark = fee.Remark
+ };
+ form.FeeGroups.Add(item);
+ }
+ else
+ {
+ item.PayAmount = amount;
+ item.PayCustomerName = fee.CustomerName;
+ item.PayRemark = fee.Remark;
+ }
}
}
}
}
- return form ?? new ProfitAccounting { Statistics = new FeeAuditStatistics(new List()) };
+ return form ?? new ProfitAccounting { Statistics = new FeeAuditStatistics([]) };
+ }
+
+ static char GetSymbol(string currency)
+ {
+ char symbol = default;
+ switch (currency)
+ {
+ case "RMB":
+ symbol = '¥';
+ break;
+
+ case "USD":
+ symbol = '$';
+ break;
+
+ default:
+ break;
+ }
+
+ return symbol;
}
}
}
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
index 7712eaab..faae8c49 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs
@@ -78,6 +78,19 @@ namespace DS.WMS.FeeApi.Controllers
return DataResult.Success(stat);
}
+ ///
+ /// 订单费用统计
+ ///
+ /// 业务ID
+ /// /// 业务类型
+ ///
+ [HttpGet, Route("OrderFeeStatistics")]
+ public async Task> OrderStatisticsAsync(long bsId, BusinessType bsType)
+ {
+ var stat = await _feeService.GetFeeStatisticsAsync(bsId, bsType);
+ return DataResult.Success(stat);
+ }
+
///
/// 保存费用
///