|
|
|
@ -4,7 +4,6 @@ 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 DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
@ -22,7 +21,7 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
|
switch (context.BusinessType)
|
|
|
|
|
{
|
|
|
|
|
case BusinessType.OceanShippingExport:
|
|
|
|
|
form = await GetOceanShippingExportAsync(context.TenantDb, context.Ids);
|
|
|
|
|
form = await GetOceanShippingExportAsync(context.TenantDb, context.BusinessId, context.Ids ?? []);
|
|
|
|
|
break;
|
|
|
|
|
case BusinessType.OceanShippingImport:
|
|
|
|
|
|
|
|
|
@ -35,8 +34,9 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
|
|
|
|
|
|
if (form != null)
|
|
|
|
|
{
|
|
|
|
|
long UserId = long.Parse(context.User.UserId);
|
|
|
|
|
form.Creator = context.Db.Queryable<SysUser>().Where(x => x.Id == UserId).Select(x => x.UserName).First();
|
|
|
|
|
//long UserId = long.Parse(context.User.UserId);
|
|
|
|
|
//form.Creator = context.Db.Queryable<SysUser>().Where(x => x.Id == UserId).Select(x => x.UserName).First();
|
|
|
|
|
form.Creator = context.User.UserName;
|
|
|
|
|
|
|
|
|
|
form.ReceivableRMB = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.Amount);
|
|
|
|
|
form.PayableRMB = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.Amount);
|
|
|
|
@ -63,60 +63,31 @@ namespace DS.WMS.Core.Fee.Method.ReportProviders
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取海运出口打印数据
|
|
|
|
|
static async Task<CostAccounting> GetOceanShippingExportAsync(ISqlSugarClient tenantDb, params long[] idArray)
|
|
|
|
|
static async Task<CostAccounting?> GetOceanShippingExportAsync(ISqlSugarClient tenantDb, long bsId, params long[] ids)
|
|
|
|
|
{
|
|
|
|
|
CostAccounting form = null;
|
|
|
|
|
var list = await tenantDb.Queryable<FeeRecord>().InnerJoin<SeaExport>((x, y) => x.BusinessId == y.Id)
|
|
|
|
|
.Where((x, y) => idArray.Contains(x.Id)
|
|
|
|
|
//&& x.FeeStatus == FeeStatus.SettlementCompleted
|
|
|
|
|
).Select((x, y) => new
|
|
|
|
|
CostAccounting? form = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == bsId)
|
|
|
|
|
.Select(x => new CostAccounting
|
|
|
|
|
{
|
|
|
|
|
x.FeeType,
|
|
|
|
|
x.FeeName,
|
|
|
|
|
x.Currency,
|
|
|
|
|
x.ExchangeRate,
|
|
|
|
|
x.Amount,
|
|
|
|
|
x.CustomerName,
|
|
|
|
|
y.CustomerNo, //业务编号
|
|
|
|
|
y.AccountDate, //会计期间
|
|
|
|
|
y.ETA,
|
|
|
|
|
y.ETD,
|
|
|
|
|
y.Voyno,
|
|
|
|
|
y.MBLNO,
|
|
|
|
|
y.Carrier,
|
|
|
|
|
y.LoadPort,
|
|
|
|
|
y.DischargePort,
|
|
|
|
|
y.CntrTotal, //Volume
|
|
|
|
|
y.IssueType //放单方式
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
BusinessNo = x.CustomerNo,
|
|
|
|
|
AccountingPeriod = x.AccountDate,
|
|
|
|
|
Voy = x.Voyno,
|
|
|
|
|
POL = x.LoadPort,
|
|
|
|
|
POD = x.DischargePort,
|
|
|
|
|
Volume = x.CntrTotal, //Volume
|
|
|
|
|
ReleaseType = x.IssueType, //放单方式
|
|
|
|
|
PrintTime = SqlFunc.GetDate(),
|
|
|
|
|
|
|
|
|
|
if (list.Count == 0)
|
|
|
|
|
return form;
|
|
|
|
|
|
|
|
|
|
var item = list[0];
|
|
|
|
|
form = new CostAccounting
|
|
|
|
|
{
|
|
|
|
|
BusinessNo = item.CustomerNo,
|
|
|
|
|
AccountingPeriod = item.AccountDate,
|
|
|
|
|
ETA = item.ETA,
|
|
|
|
|
ETD = item.ETD,
|
|
|
|
|
Voy = item.Voyno,
|
|
|
|
|
MBLNo = item.MBLNO,
|
|
|
|
|
Carrier = item.Carrier,
|
|
|
|
|
POL = item.LoadPort,
|
|
|
|
|
POD = item.DischargePort,
|
|
|
|
|
Volume = item.CntrTotal,
|
|
|
|
|
ReleaseType = item.IssueType,
|
|
|
|
|
PrintTime = DateTime.Now,
|
|
|
|
|
Details = list.Select(x => new CostAccountingDetail
|
|
|
|
|
{
|
|
|
|
|
Amount = x.Amount,
|
|
|
|
|
Currency = x.Currency,
|
|
|
|
|
CustomerName = x.CustomerName,
|
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
|
Type = x.FeeType
|
|
|
|
|
}).ToList()
|
|
|
|
|
};
|
|
|
|
|
Details = SqlFunc.Subqueryable<FeeRecord>().Where(y => y.BusinessId == x.Id)
|
|
|
|
|
.WhereIF(ids.Length > 0, y => ids.Contains(y.Id))
|
|
|
|
|
.ToList(y => new CostAccountingDetail
|
|
|
|
|
{
|
|
|
|
|
Amount = y.Amount,
|
|
|
|
|
Currency = y.Currency,
|
|
|
|
|
CustomerName = y.CustomerName,
|
|
|
|
|
FeeName = y.FeeName,
|
|
|
|
|
Type = y.FeeType
|
|
|
|
|
})
|
|
|
|
|
}, true).FirstAsync();
|
|
|
|
|
|
|
|
|
|
return form;
|
|
|
|
|
}
|
|
|
|
|