diff --git a/ds-wms-service/DS.WMS.AdminApi/nlog.config b/ds-wms-service/DS.WMS.AdminApi/nlog.config
index b127ed49..897be241 100644
--- a/ds-wms-service/DS.WMS.AdminApi/nlog.config
+++ b/ds-wms-service/DS.WMS.AdminApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.CheckApi/nlog.config b/ds-wms-service/DS.WMS.CheckApi/nlog.config
index 8e52d1f4..93911131 100644
--- a/ds-wms-service/DS.WMS.CheckApi/nlog.config
+++ b/ds-wms-service/DS.WMS.CheckApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationBase.cs b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationBase.cs
index c6e4cad8..c49ba4f0 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationBase.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationBase.cs
@@ -56,8 +56,8 @@ namespace DS.WMS.Core.Application.Entity
///
/// 币别
///
- [SugarColumn(ColumnDescription = "币别", IsNullable = true, Length = 3)]
- public string? Currency { get; set; }
+ [SugarColumn(ColumnDescription = "币别", Length = 3)]
+ public string Currency { get; set; }
///
/// 所属分部
diff --git a/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetail.cs b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetail.cs
index a6596558..d33235a5 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetail.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetail.cs
@@ -137,5 +137,11 @@ namespace DS.WMS.Core.Application.Entity
///
[SugarColumn(IsIgnore = true)]
public BusinessType BusinessType { get; set; }
+
+ ///
+ /// 金额已分配
+ ///
+ [SugarColumn(IsIgnore = true)]
+ public bool Assigned { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
index f1ad5ad8..050d7504 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
@@ -329,9 +329,9 @@ namespace DS.WMS.Core.Application.Method
CustomerAddTel = a.CustomerAddTel,
CustomerBankId = a.CustomerBankId,
- CustomerBankName = b1.BankName + " " + b1.Account,
+ CustomerBankName = b1.BankName + " " + b1.BankAccountNo,
USDCustomerBankId = a.USDCustomerBankId,
- USDCustomerBankName = b2.BankName + " " + b2.Account
+ USDCustomerBankName = b2.BankName + " " + b2.BankAccountNo
}).FirstAsync();
if (dto != null)
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceAPIRequest.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceAPIRequest.cs
index b2df617d..b83c1961 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceAPIRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceAPIRequest.cs
@@ -43,6 +43,11 @@ namespace DS.WMS.Core.Invoice.Dtos
///
public string lrfsf { get; set; } = "0";
+ ///
+ /// 确认类型:Y:同意,N:不同意,C:撤销
+ ///
+ public string? qrlx { get; set; }
+
public IEnumerable Validate(ValidationContext validationContext)
{
if (InvoiceId == null && string.IsNullOrEmpty(orderNo))
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 9714923b..c15c923e 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceDto.cs
@@ -287,11 +287,9 @@ namespace DS.WMS.Core.Invoice.Dtos
public string? RedCode { get; set; }
- public string? RedNO { get; set; }
-
public string? RedReason { get; set; }
- public long? RedBillId { get; set; }
+ public long? RedId { get; set; }
///
/// 推送方式
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceResult.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceResult.cs
index 17f072e3..1bbd49c8 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceResult.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/InvoiceResult.cs
@@ -55,4 +55,20 @@ namespace DS.WMS.Core.Invoice.Dtos
///
public string orderNo { get; set; }
}
+
+ ///
+ /// 冲红确认单
+ ///
+ public class SetRedConfirmation
+ {
+ ///
+ /// 红字确认单状态
+ ///
+ public string hzqrxxztDm { get; set; }
+
+ ///
+ /// 请求标识
+ ///
+ public string senid { 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 10dae1c0..1b28dba5 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Entity/Invoice.cs
@@ -247,10 +247,10 @@ namespace DS.WMS.Core.Invoice.Entity
public string? RedCode { get; set; }
///
- /// 红票发票号
+ /// 红票发票ID
///
- [SugarColumn(ColumnDescription = "红票发票号", IsNullable = true, Length = 50)]
- public string? RedNO { get; set; }
+ [SugarColumn(ColumnDescription = "红票发票ID", IsNullable = true)]
+ public long? RedId { get; set; }
///
/// 是否被冲红
@@ -264,11 +264,11 @@ namespace DS.WMS.Core.Invoice.Entity
[SugarColumn(ColumnDescription = "冲红原因", Length = 100, IsNullable = true)]
public string? RedReason { get; set; }
- ///
- /// 冲红确认单ID
- ///
- [SugarColumn(ColumnDescription = "冲红确认单ID", IsNullable = true)]
- public long? RedBillId { get; set; }
+ /////
+ ///// 冲红确认单ID
+ /////
+ //[SugarColumn(ColumnDescription = "冲红确认单ID", IsNullable = true)]
+ //public long? RedBillId { get; set; }
///
/// 收款币别
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs
index 7a224203..d8ce2318 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs
@@ -5,11 +5,12 @@ using DS.WMS.Core.Application.Method;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Invoice.Interface;
+using DS.WMS.Core.QuarztJobs.Method;
using DS.WMS.Core.Sys.Entity;
+using DS.WMS.Core.Sys.Interface;
using Masuit.Tools;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Newtonsoft.Json.Linq;
using SqlSugar;
namespace DS.WMS.Core.Invoice.Method
@@ -27,6 +28,9 @@ namespace DS.WMS.Core.Invoice.Method
api = new ApiFox();
}
+ readonly Lazy CommonService;
+ readonly Lazy> InvoiceService;
+
///
/// 初始化并加载配置
///
@@ -34,7 +38,8 @@ namespace DS.WMS.Core.Invoice.Method
public InvoiceIssuanceService(IServiceProvider provider) : base(provider)
{
var config = provider.GetRequiredService();
-
+ CommonService = new Lazy(provider.GetRequiredService());
+ InvoiceService = new Lazy>(provider.GetRequiredService>());
}
///
@@ -123,7 +128,7 @@ namespace DS.WMS.Core.Invoice.Method
a.Key,
a.Secret
}).First();
- if (orgauthinfo==null)
+ if (orgauthinfo == null)
{
//未匹配到请求密钥,请检查
return DataResult.Failed("未匹配到请求密钥,请检查");
@@ -179,16 +184,10 @@ namespace DS.WMS.Core.Invoice.Method
if (invoices.Count > 0)
return result2;
- //var result = await api.PostAsync>("/api/Invoice/GetInvoiceState", new { guid = sn });
- //调用查询API获取发票号
-
-
var order = await TenantDb.Queryable().Where(x => x.SN == sn).FirstAsync();
-
//如果开票中所属机构为空,则取用户的orgId
var userOrgId = (order.SaleDeptId != null && order.SaleDeptId > 0) ? order.SaleDeptId : User.OrgId;
var orgauthinfo = Db.Queryable().LeftJoin((t, a) => t.Id == a.OrgId)
-
.Where((t, a) => t.Id == userOrgId)
.Select((t, a) => new
{
@@ -198,11 +197,11 @@ namespace DS.WMS.Core.Invoice.Method
if (orgauthinfo == null)
{
//未匹配到请求密钥,请检查
- return DataResult.Failed("未匹配到请求密钥,请检查");
+ return DataResult.Failed("未匹配到请求密钥,请检查");
}
api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
- var result = await api.PostAsync>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/GetInvoiceState", new { guid = sn });
+ var result = await api.PostAsync>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/GetInvoiceState", new { guid = sn });
if (!result.Succeeded)
return DataResult.Failed(result.Message, result.MultiCode);
@@ -226,31 +225,52 @@ namespace DS.WMS.Core.Invoice.Method
};
invoices.Add(inv);
- if (string.IsNullOrEmpty(inv.ApiStatus))
+ switch (item.State)
{
- switch (item.State)
- {
- case 1:
- inv.ApiStatus = "已提交待上传";
- break;
- case 2:
- inv.ApiStatus = "已上传待开票";
- break;
- case 3:
- inv.ApiStatus = "开票成功";
- break;
- }
+ case 1:
+ inv.ApiStatus = "已提交待上传";
+ break;
+ case 2:
+ inv.ApiStatus = "已上传待开票";
+ break;
+ case 3:
+ inv.ApiStatus = "开票成功";
+ break;
}
}
- await TenantDb.Updateable(invoices).WhereColumns(x => x.BillNO)
- .UpdateColumns(x => new
+ await TenantDb.Ado.BeginTranAsync();
+ try
+ {
+ var billNumbers = invoices.Select(x => x.BillNO);
+ //获取发票费用明细ID
+ var ids = await TenantDb.Queryable()
+ .InnerJoin((i, d) => i.Id == d.ApplicationId)
+ .Where((i, d) => billNumbers.Contains(i.BillNO) && i.Type == InvoiceType.Red)
+ .Select((i, d) => d.Id).ToArrayAsync();
+ if (ids.Length > 0)
{
- x.InvoiceNO,
- x.ApiCode,
- x.ApiStatus,
- x.PDFUrl
- }).ExecuteCommandAsync();
+ //删除蓝票费用明细
+ await InvoiceService.Value.DeleteDetailAsync(ids);
+ }
+
+ await TenantDb.Updateable(invoices).WhereColumns(x => x.BillNO)
+ .UpdateColumns(x => new
+ {
+ x.InvoiceNO,
+ x.ApiCode,
+ x.ApiStatus,
+ x.PDFUrl
+ }).ExecuteCommandAsync();
+
+ await TenantDb.Ado.CommitTranAsync();
+ }
+ catch (Exception ex)
+ {
+ await TenantDb.Ado.RollbackTranAsync();
+ await ex.LogAsync(Db);
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
+ }
}
result2.Data = invoices;
@@ -279,41 +299,70 @@ namespace DS.WMS.Core.Invoice.Method
///
public async Task ReverseAsync(InvoiceReversalRequest request)
{
- var invoice = await TenantDb.Queryable()
+ var blueInvoice = await TenantDb.Queryable().Includes(x => x.Details)
.WhereIF(request.InvoiceId.HasValue, x => x.Id == request.InvoiceId)
.WhereIF(!request.orderNo.IsNullOrEmpty(), x => x.BillNO == request.orderNo)
.FirstAsync();
- if (invoice == null)
- return DataResult.FailedWithDesc(MultiLanguageConst.EmptyData);
+ if (blueInvoice == null)
+ return DataResult.FailedWithDesc("发票ID或业务编号无效");
+ if (blueInvoice.Type == InvoiceType.Red)
+ return DataResult.FailedWithDesc("红票无法被冲红");
+ if (blueInvoice.IsSettled)
+ return DataResult.FailedWithDesc("此发票已结算");
- var req = new InvoiceReversalRequest
- {
- orderNo = invoice.BillNO,
- chyyDm = request.chyyDm,
- lrfsf = request.lrfsf,
- senid = ""//待完善
- };
-
- //如果开票中所属机构为空,则取用户的orgId
- var userOrgId = (invoice.SaleDeptId != null && invoice.SaleDeptId > 0) ? invoice.SaleDeptId : User.OrgId;
- //接口请求key密钥
- var orgauthinfo = Db.Queryable().Where(t => t.OrgId == userOrgId).First();
- api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
- api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
- var result = await api.PostAsync>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/RedInvoicing", req);
+ var redInvoice = blueInvoice.DeepClone();
+ var sequence = CommonService.Value.GetSequenceNext();
+ redInvoice.BillNO = sequence.Data;
+ redInvoice.SN = request.senid;
+ redInvoice.Type = InvoiceType.Red;
- if (!result.Succeeded)
- return DataResult.Failed(result.Message, result.MultiCode);
- var invResult = result.Data;
- JObject? jObj = JObject.Parse(invResult.data);
- if (invResult.success)
- return DataResult.Failed(invResult.msg);
+ redInvoice.Details ??= [];
+ if (redInvoice.Details.Count == 0)
+ redInvoice.Details.AddRange(blueInvoice.Details);
- invoice.IsSetRed = true;
- invoice.RedReason = request.Reason;
- await TenantDb.Updateable(invoice).UpdateColumns(x => new { x.IsSetRed, x.RedReason }).ExecuteCommandAsync();
- return DataResult.Success;
+ foreach (var detail in redInvoice.Details)
+ {
+ detail.ApplyAmount = 0 - detail.ApplyAmount;
+ detail.OriginalAmount = 0 - detail.OriginalAmount;
+ }
+
+ try
+ {
+ //如果开票中所属机构为空,则取用户的orgId
+ var userOrgId = (blueInvoice.SaleDeptId != null && blueInvoice.SaleDeptId > 0) ? blueInvoice.SaleDeptId : User.OrgId;
+ //接口请求key密钥
+ var orgauthinfo = Db.Queryable().Where(t => t.OrgId == userOrgId).First();
+ api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
+ api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
+ request.orderNo = blueInvoice.BillNO; //蓝票业务号
+ var result = await api.PostAsync>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/RedInvoicing", request);
+ if (result.Data == null || !result.Data.success)
+ return DataResult.Failed(result.Data == null ? "请求失败" : result.Data.msg);
+
+ request.qrlx = "Y";
+ result = await api.PostAsync>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/RedInvoicing", request);
+ if (result.Data == null || !result.Data.success)
+ return DataResult.Failed(result.Data == null ? "请求失败" : result.Data.msg);
+
+
+ await TenantDb.Insertable(redInvoice).ExecuteCommandAsync();
+ blueInvoice.RedCode = redInvoice.SN;
+ blueInvoice.RedId = redInvoice.Id;
+ blueInvoice.IsSetRed = true;
+ blueInvoice.RedReason = request.Reason;
+ await TenantDb.Updateable(blueInvoice).UpdateColumns(x => new { x.IsSetRed, x.RedId, x.RedReason }).ExecuteCommandAsync();
+
+ var result2 = DataResult.Success;
+ result2.Data = redInvoice;
+ return result2;
+ }
+ catch (Exception ex)
+ {
+ await TenantDb.Ado.RollbackTranAsync();
+ await ex.LogAsync(Db);
+ return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
+ }
}
///
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 e7e3aaf0..aa581e2b 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
@@ -303,7 +303,7 @@ namespace DS.WMS.Core.Invoice.Method
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.InconsistentTaxRates));
}
- //需转换为费用明细
+ //转换为费用明细
var detail = new ApplicationDetail
{
ApplicationId = invoice.Id,
@@ -327,9 +327,7 @@ namespace DS.WMS.Core.Invoice.Method
{
var er = app.ExchangeRates?.FirstOrDefault(x => x.Currency == detail.OriginalCurrency);
if (er != null)
- {
detail.ExchangeRate = er.ExchangeRate;
- }
}
invoice.Details.Add(detail);
@@ -362,6 +360,8 @@ namespace DS.WMS.Core.Invoice.Method
}
}
+
+ invoice.Details.RemoveAll(x => !x.Assigned);
}
//自由开票
else if (request.Invoice.Mode == InvoiceMode.Free)
@@ -508,6 +508,7 @@ namespace DS.WMS.Core.Invoice.Method
return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist);
invoice.BillNO = sequence.Data;
+ invoice.Type = InvoiceType.Blue;
//关联导航属性插入
await TenantDb.InsertNav(invoice).Include(x => x.Details).ExecuteCommandAsync();
}
@@ -529,7 +530,7 @@ namespace DS.WMS.Core.Invoice.Method
x.PushMode,
x.CellPhoneNO,
x.Email,
- //x.InvoiceRemark,
+ x.InvoiceRemark,
x.Note
}).ExecuteCommandAsync();
@@ -588,28 +589,48 @@ namespace DS.WMS.Core.Invoice.Method
if (invoiceAmount == 0)
return DataResult.Failed("开票金额不能为零");
- var totalAmount = details.Sum(x => x.OriginalAmount * x.ExchangeRate.GetValueOrDefault());
+ var totalAmount = details.Exists(x => x.Currency != FeeCurrency.RMB_CODE) ?
+ details.Sum(x => x.OriginalAmount) : details.Sum(x => x.ApplyAmount);
if (Math.Abs(invoiceAmount) > totalAmount)
return DataResult.Failed("申请开票金额不能大于剩余开票金额");
if (totalAmount != invoiceAmount) //非全额开票
{
- var rest = totalAmount - invoiceAmount;
+ decimal rest = invoiceAmount;
foreach (var detail in details)
{
- if (rest == 0)
+ if (rest <= 0)
break;
- detail.OriginalAmount = detail.OriginalAmount - rest;
- rest = detail.OriginalAmount - rest;
+ if (rest >= detail.OriginalAmount)
+ {
+ rest = rest - detail.OriginalAmount;
+ }
+ else
+ {
+ detail.OriginalAmount = rest;
+ rest = 0;
+ }
+
+ if (detail.Currency == FeeCurrency.RMB_CODE)
+ detail.ApplyAmount = detail.OriginalAmount;
+ else
+ detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
- detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
+ detail.Assigned = true;
}
}
else
{
- foreach (var detail in details)
- detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
+ foreach (var detail in details)
+ {
+ if (detail.Currency == FeeCurrency.RMB_CODE)
+ detail.ApplyAmount = detail.OriginalAmount;
+ else
+ detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
+
+ detail.Assigned = true;
+ }
}
return DataResult.Success;
@@ -629,8 +650,7 @@ namespace DS.WMS.Core.Invoice.Method
invoice.InvoiceDetails ??= [];
var currencies = invoice.Details.Select(x => x.OriginalCurrency).Distinct();
var codeList = await TenantDb.Queryable()
- .Where(ci => currencies.Contains(ci.DefaultCurrency))
- .OrderBy(ci => ci.IsDefault)
+ .Where(ci => currencies.Contains(ci.DefaultCurrency) && ci.IsDefault)
.Select(ci => new
{
ci.Id,
diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLReportJob.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLReportJob.cs
index 7396e0f4..2ab2de97 100644
--- a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLReportJob.cs
+++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLReportJob.cs
@@ -17,6 +17,7 @@ namespace DS.WMS.Core.QuarztJobs
public class WSLReportJob : IJob
{
const string SOURCE_CODE = "FOB-WSL";
+ const string SOURCE_DETAIL_CODE = "WSL Member";
static readonly ApiFox api;
ISqlSugarClient? db;
Microsoft.Extensions.Configuration.IConfiguration config;
@@ -56,7 +57,7 @@ namespace DS.WMS.Core.QuarztJobs
//时间计算
var today = DateTime.Now.Date;
var yesterday = today.AddDays(-1).Date;
-
+ var currentMonth = today.Month;
var lastMonth = today.AddMonths(-1);
var nextMonth = today.AddMonths(1);
@@ -88,7 +89,7 @@ namespace DS.WMS.Core.QuarztJobs
Month = today.ToString("yyyy.MM")
};
- var list = await tenantDb.Queryable().Where(x => x.SourceCode == SOURCE_CODE && SqlFunc.Between(x.ETD, startDate, endDate) && !x.Deleted)
+ var list = await tenantDb.Queryable().Where(x => x.SourceCode == SOURCE_CODE && x.SourceDetailName == SOURCE_DETAIL_CODE && SqlFunc.Between(x.ETD, startDate, endDate) && !x.Deleted)
.LeftJoin((x, y) => x.CustomerId == y.Id)
.Select((x, y) => new
{
@@ -97,7 +98,7 @@ namespace DS.WMS.Core.QuarztJobs
EnName = SqlFunc.IsNull(y.EnFullName, y.EnShortName),
x.ETD,
x.TEU
- }).ToListAsync();
+ }).OrderBy("EnName").ToListAsync();
if (list.Count == 0)
{
@@ -112,19 +113,21 @@ namespace DS.WMS.Core.QuarztJobs
{
x.BSNO,
x.TEU
- }).ToListAsync();
+ }).ToListAsync();
model.List = list.GroupBy(x => new { x.CustomerId, x.EnName }).Select(x => new WSLItem
{
CustomerId = x.Key.CustomerId,
CustomerName = x.Key.EnName,
Date = model.Date,
- YesterdayTeu = x.Where(x => x.ETD >= yesterday && x.ETD <= yesterday).Sum(x => x.TEU),
- TodayTeu = x.Where(x => x.ETD >= today && x.ETD <= today).Sum(x => x.TEU),
+ YesterdayTeu = x.Where(x => x.ETD.Value.Year == yesterday.Year && x.ETD.Value.Month == yesterday.Month && x.ETD <= yesterday).Sum(x => x.TEU),
+ TodayTeu = x.Where(x => x.ETD.Value.Year == today.Year && x.ETD.Value.Month == today.Month && x.ETD <= today).Sum(x => x.TEU),
NextMonthTEU = x.Where(x => x.ETD.Value.Year == nextMonth.Year && x.ETD.Value.Month == nextMonth.Month).Sum(x => x.TEU),
LastMonthTEU = x.Where(x => x.ETD.Value.Year == lastMonth.Year && x.ETD.Value.Month == lastMonth.Month).Sum(x => x.TEU),
}).ToList();
+
+
foreach (var item in model.List)
{
var ids2 = list.Where(x => x.CustomerId == item.CustomerId).Select(x => x.Id.ToString());
diff --git a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
index d8dc4042..d5275d5c 100644
--- a/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
+++ b/ds-wms-service/DS.WMS.Core/QuarztJobs/WSLWeeklyReportJob.cs
@@ -90,7 +90,7 @@ namespace DS.WMS.Core.QuarztJobs
Month = today.ToString("yyyy.MM")
};
- var list = await tenantDb.Queryable().Where(x => !x.Deleted && x.IsChangeETD == false)//x.ContractClientName == "WSL" && && SqlFunc.Between(x.ETD, startDate, endDate)
+ var list = await tenantDb.Queryable().Where(x => !x.Deleted && x.IsChangeETD == false && x.IsRefund == false)//x.ContractClientName == "WSL" && && SqlFunc.Between(x.ETD, startDate, endDate)
.OrderBy(x=>x.ETD)
.Select(x => new WSLWeeklyItem()
{
diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/ApplicationSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/ApplicationSettlementService.cs
index db9e38c3..19356d05 100644
--- a/ds-wms-service/DS.WMS.Core/Settlement/Method/ApplicationSettlementService.cs
+++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/ApplicationSettlementService.cs
@@ -49,12 +49,16 @@ namespace DS.WMS.Core.Settlement.Method
ApplicationNO = x.ApplicationNO,
SettlementNO = x.SettlementNO,
SettlementTypeName = x.SettlementType.StlName, //结算方式
+
RMBAmount = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.Id && y.Currency == FeeCurrency.RMB_CODE)
- .Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
+ .Select(y => SqlFunc.AggregateSum(y.OriginalAmount)),
+
USDAmount = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.Id && y.Currency == FeeCurrency.USD_CODE)
- .Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
+ .Select(y => SqlFunc.AggregateSum(y.OriginalAmount)),
+
OtherAmount = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.Id && y.Currency != FeeCurrency.RMB_CODE && y.Currency != FeeCurrency.USD_CODE)
- .Select(y => SqlFunc.AggregateSum(y.ApplyAmount)),
+ .Select(y => SqlFunc.AggregateSum(y.OriginalAmount)),
+
CustomerAccount = x.CustomerBank.AccountName + "/" + x.CustomerBank.Currency,
CustomerBankName = x.CustomerBank.BankName,
//未开票
@@ -171,7 +175,11 @@ namespace DS.WMS.Core.Settlement.Method
x.Id,
x.ApplicationId,
x.Currency,
+ x.OriginalCurrency,
x.ApplyAmount,
+ x.OriginalAmount,
+ x.ProcessedAmount,
+ x.OriginalProcessedAmount
}).ToListAsync();
foreach (var item in list)
@@ -181,12 +189,12 @@ namespace DS.WMS.Core.Settlement.Method
//申请金额
var details = appDetails.Where(x => x.ApplicationId == item.Id);
- item.RMBApplyAmount = details.Where(x => x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount);
- item.USDApplyAmount = details.Where(x => x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount);
+ item.RMBApplyAmount = details.Where(x => x.OriginalCurrency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount);
+ item.USDApplyAmount = details.Where(x => x.OriginalCurrency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount);
//本次结算金额
- item.RMBStlAmount = details.Where(x => appIds.Contains(x.Id) && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount);
- item.USDStlAmount = details.Where(x => appIds.Contains(x.Id) && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount);
+ item.RMBStlAmount = details.Where(x => appIds.Contains(x.Id) && x.OriginalCurrency == FeeCurrency.RMB_CODE).Sum(x => x.ProcessedAmount);
+ item.USDStlAmount = details.Where(x => appIds.Contains(x.Id) && x.OriginalCurrency == FeeCurrency.USD_CODE).Sum(x => x.ProcessedAmount);
//剩余结算金额
item.RMBStlRestAmount = (item.RMBApplyAmount - item.RMBStlAmount).GetValueOrDefault();
@@ -438,6 +446,9 @@ namespace DS.WMS.Core.Settlement.Method
protected override async Task PreSaveAsync(ApplicationSettlement settlement)
{
+ if (settlement.Details.Count == 0)
+ return DataResult.Success;
+
var appIds = settlement.Details.Select(x => x.RefId).Distinct();
var appList = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id))
.Select(x => new
@@ -501,8 +512,7 @@ namespace DS.WMS.Core.Settlement.Method
var list = settlement.Details.Select(x => new ApplicationDetail
{
Id = x.DetailId.Value,
- Category = DetailCategory.PaidApplication,
- ProcessedAmount = x.ApplyAmount,
+ ProcessedAmount = x.OriginalCurrency == settlement.Currency ? x.ApplyAmount : x.OriginalAmount,
OriginalProcessedAmount = x.OriginalAmount
}).ToList();
await TenantDb.Updateable(list)
@@ -563,20 +573,23 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult.Success;
}
+ //还原收/付费申请明细
protected override async Task OnDeleteDetailAsync(List settlements)
{
await base.OnDeleteDetailAsync(settlements);
- //还原收/付费申请明细
var list = settlements.FindAll(x => x.Mode == SettlementMode.Payment || x.Mode == SettlementMode.Charge);
if (list.Count > 0)
{
var items = list.SelectMany(x => x.Details);
var ids = items.Select(x => x.DetailId);
- var details = TenantDb.Queryable().Where(x => ids.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
+ //获取申请明细
+ var details = TenantDb.Queryable().Where(x => ids.Contains(x.Id))
.Select(x => new ApplicationDetail
{
Id = x.Id,
+ Currency = x.Currency,
+ OriginalCurrency = x.OriginalCurrency,
ApplicationId = x.ApplicationId,
ProcessedAmount = x.ProcessedAmount,
OriginalAmount = x.OriginalAmount,
@@ -586,7 +599,7 @@ namespace DS.WMS.Core.Settlement.Method
foreach (var detail in details)
{
var item = items.FirstOrDefault(x => x.DetailId == detail.Id);
- detail.ProcessedAmount -= item.ApplyAmount;
+ detail.ProcessedAmount -= detail.Currency == item.Currency ? item.ApplyAmount : item.OriginalAmount;
detail.OriginalProcessedAmount -= item.OriginalAmount;
}
diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/InvoiceSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/InvoiceSettlementService.cs
index cc7479e7..4f611b99 100644
--- a/ds-wms-service/DS.WMS.Core/Settlement/Method/InvoiceSettlementService.cs
+++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/InvoiceSettlementService.cs
@@ -286,5 +286,43 @@ namespace DS.WMS.Core.Settlement.Method
.UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount })
.ExecuteCommandAsync();
}
+
+ //还原发票费用明细
+ protected override async Task OnDeleteDetailAsync(List settlements)
+ {
+ await base.OnDeleteDetailAsync(settlements);
+
+ var list = settlements.FindAll(x => x.Mode == SettlementMode.InvoiceSettlement);
+ if (list.Count > 0)
+ {
+ var items = list.SelectMany(x => x.Details);
+ var ids = items.Select(x => x.DetailId);
+ //获取发票费用明细
+ var details = TenantDb.Queryable().Where(x => ids.Contains(x.Id))
+ .Select(x => new ApplicationDetail
+ {
+ Id = x.Id,
+ Currency = x.Currency,
+ OriginalCurrency = x.OriginalCurrency,
+ ApplicationId = x.ApplicationId,
+ ProcessedAmount = x.ProcessedAmount,
+ OriginalAmount = x.OriginalAmount,
+ OriginalProcessedAmount = x.OriginalProcessedAmount
+ }).ToList();
+
+ foreach (var detail in details)
+ {
+ var item = items.FirstOrDefault(x => x.DetailId == detail.Id);
+ //todo:检查币别折算?
+ detail.ProcessedAmount -= detail.Currency == item.Currency ? item.ApplyAmount : item.OriginalAmount;
+ detail.OriginalProcessedAmount -= item.OriginalAmount;
+ }
+
+ await TenantDb.Updateable(details)
+ .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount })
+ .ExecuteCommandAsync();
+ }
+ }
+
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs
index 959db397..94fb5f5a 100644
--- a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs
+++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs
@@ -98,6 +98,9 @@ namespace DS.WMS.Core.Settlement.Method
}
+ if (request.Documents != null)
+ request.Documents = request.Documents.FindAll(x => x.SettlementUSD.HasValue || x.SettlementRMB.HasValue || x.SettlementOther.HasValue);
+
//按付费/发票申请/自由业务结算
if (request.Documents?.Count > 0)
{
@@ -107,25 +110,26 @@ namespace DS.WMS.Core.Settlement.Method
settlement.CustomerId = first.CustomerId;
settlement.CustomerName = first.CustomerName;
}
-
var ids = request.Documents.Select(x => x.Id);
//收/付费申请结算
if (settlement.Mode == SettlementMode.Payment || settlement.Mode == SettlementMode.Charge)
{
- var detailCategory = settlement.Mode == SettlementMode.Payment ? DetailCategory.PaidApplication : DetailCategory.ChargeApplication;
- var expr = Expressionable.Create().And(x => ids.Contains(x.ApplicationId) && x.Category == detailCategory);
-
+ Expressionable? expr = null;
if (request.Documents.Any(x => x.SettlementRMB.GetValueOrDefault() == 0) || request.Documents.Any(x => x.SettlementUSD.GetValueOrDefault() == 0) ||
request.Documents.Any(x => x.SettlementOther.GetValueOrDefault() == 0)) //按币别结算
{
+ expr = Expressionable.Create();
+
if (request.Documents.Any(x => x.SettlementRMB.GetValueOrDefault() != 0))
- expr = expr.And(x => x.Currency == FeeCurrency.RMB_CODE);
+ expr = expr.Or(x => x.Currency == FeeCurrency.RMB_CODE);
if (request.Documents.Any(x => x.SettlementUSD.GetValueOrDefault() != 0))
- expr = expr.And(x => x.Currency == FeeCurrency.USD_CODE);
+ expr = expr.Or(x => x.Currency == FeeCurrency.USD_CODE);
}
-
- details1 = await TenantDb.Queryable().Where(expr.ToExpression())
+ var detailCategory = settlement.Mode == SettlementMode.Payment ? DetailCategory.PaidApplication : DetailCategory.ChargeApplication;
+ details1 = await TenantDb.Queryable()
+ .Where(x => ids.Contains(x.ApplicationId) && x.Category == detailCategory)
+ .WhereIF(expr != null, expr.ToExpression())
.Select(x => new ApplicationDetail
{
ApplicationId = settlement.Id,
@@ -150,8 +154,6 @@ namespace DS.WMS.Core.Settlement.Method
var details2 = details1.FindAll(x => x.OriginalCurrency != settlement.Currency);
foreach (var detail in details2)
{
- detail.Currency = settlement.Currency;
-
var doc = request.Documents.Find(x => x.Id == detail.RefId);
if (doc == null)
return DataResult.Failed("结算单据与费用明细不一致");
@@ -161,7 +163,6 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult.Failed($"未传入结算币别 {settlement.Currency} 与费用原币别 {detail.OriginalCurrency} 之间的汇率信息");
detail.ExchangeRate = exchange.ExchangeRate;
- //detail.ApplyAmount = Math.Round(exchange.ExchangeRate.GetValueOrDefault() * detail.OriginalAmount, 2, MidpointRounding.AwayFromZero);
}
}
}
@@ -207,7 +208,6 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult.Failed($"使用发票做结算时,非 {FeeCurrency.RMB_CODE} 的费用必须指定汇率");
detail.ExchangeRate = exchange.ExchangeRate;
- detail.ApplyAmount = Math.Round(exchange.ExchangeRate.GetValueOrDefault() * detail.OriginalAmount, 2, MidpointRounding.AwayFromZero);
}
}
}
@@ -253,7 +253,6 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult.Failed($"未传入结算币别 {settlement.Currency} 与费用原币别 {detail.OriginalCurrency} 之间的汇率信息");
detail.ExchangeRate = exchange.ExchangeRate;
- detail.ApplyAmount = Math.Round(exchange.ExchangeRate.GetValueOrDefault() * detail.OriginalAmount, 2, MidpointRounding.AwayFromZero);
}
}
}
@@ -265,99 +264,32 @@ namespace DS.WMS.Core.Settlement.Method
details1.Where(x => x.RefId == doc.Id).OrderBy(x => x.ApplyAmount) :
details1.Where(x => x.BusinessId == doc.Id && x.BusinessType == doc.BusinessType && x.CustomerName == doc.CustomerName).OrderBy(x => x.ApplyAmount);
- var rmbDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.RMB_CODE);
- var totalRMB = rmbDetails.Sum(x => x.OriginalAmount);
- doc.SettlementRMB ??= totalRMB;
-
- if (doc.SettlementRMB > totalRMB)
- return DataResult.Failed("人民币结算金额不能大于剩余人民币金额");
-
- if (doc.SettlementRMB < totalRMB)
+ if (doc.SettlementRMB.HasValue)
{
- var rest = totalRMB - doc.SettlementRMB.GetValueOrDefault();
- foreach (var detail in rmbDetails)
- {
- if (rest == 0)
- break;
-
- detail.OriginalAmount = detail.OriginalAmount - rest;
- if (detail.OriginalCurrency == settlement.Currency)
- {
- detail.ApplyAmount = detail.OriginalAmount;
- }
- else
- {
- var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
- detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
- }
-
- rest = detail.OriginalAmount - rest;
- }
+ var rmbDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.RMB_CODE).ToList();
+ result = AssignAmount(rmbDetails, doc.SettlementRMB.Value, settlement.Currency);
+ if (!result.Succeeded)
+ return DataResult.Failed(result.Message, result.MultiCode);
}
-
- var usdDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.USD_CODE);
- var totalUSD = usdDetails.Sum(x => x.OriginalAmount);
- doc.SettlementUSD ??= totalUSD;
-
- if (doc.SettlementUSD > totalUSD)
- return DataResult.Failed("美元结算金额不能大于剩余美元金额");
-
- if (doc.SettlementUSD < totalUSD)
+ if (doc.SettlementUSD.HasValue)
{
- var rest = totalUSD - doc.SettlementUSD.GetValueOrDefault();
- foreach (var detail in usdDetails)
- {
- if (rest == 0)
- break;
-
- detail.OriginalAmount = detail.OriginalAmount - rest;
- if (detail.OriginalCurrency == settlement.Currency)
- {
- detail.ApplyAmount = detail.OriginalAmount;
- }
- else
- {
- var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
- detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
- }
- rest = detail.OriginalAmount - rest;
- }
+ var usdDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.USD_CODE).ToList();
+ result = AssignAmount(usdDetails, doc.SettlementUSD.Value, settlement.Currency);
+ if (!result.Succeeded)
+ return DataResult.Failed(result.Message, result.MultiCode);
}
-
- var otherDetails = details2.Where(x => x.OriginalCurrency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE);
- var total = otherDetails.Sum(x => x.OriginalAmount);
- doc.SettlementOther ??= total;
-
- if (doc.SettlementOther > total)
- return DataResult.Failed("其他结算金额不能大于剩余其他金额");
-
- if (doc.SettlementOther < total)
+ if (doc.SettlementOther.HasValue)
{
- var rest = total - doc.SettlementOther.GetValueOrDefault();
- foreach (var detail in otherDetails)
- {
- if (rest == 0)
- break;
-
- detail.OriginalAmount = detail.OriginalAmount - rest;
- if (detail.OriginalCurrency == settlement.Currency)
- {
- detail.ApplyAmount = detail.OriginalAmount;
- }
- else
- {
- var er = doc.ExchangeRates.Find(x => x.Currency == detail.OriginalCurrency);
- detail.ApplyAmount = detail.OriginalAmount * er?.ExchangeRate ?? 1;
- }
- rest = detail.OriginalAmount - rest;
- }
+ var otherDetails = details2.Where(x => x.OriginalCurrency != FeeCurrency.RMB_CODE && x.OriginalCurrency != FeeCurrency.USD_CODE).ToList();
+ result = AssignAmount(otherDetails, doc.SettlementOther.Value, settlement.Currency);
+ if (!result.Succeeded)
+ return DataResult.Failed(result.Message, result.MultiCode);
}
}
}
-
if (details1?.Count > 0)
- settlement.Details.AddRange(details1);
+ settlement.Details.AddRange(details1.FindAll(x => x.Assigned));
//金额禁止为0
if (settlement.Details.Exists(x => x.ApplyAmount == 0 || x.OriginalAmount == 0))
@@ -422,9 +354,8 @@ namespace DS.WMS.Core.Settlement.Method
.ExecuteCommandAsync();
}
- //重新计算结算总金额
- settlement.Amount = await TenantDb.Queryable().Where(x => x.ApplicationId == settlement.Id)
- .SumAsync(x => x.ApplyAmount);
+ //计算结算总金额
+ settlement.Amount = await TenantDb.Queryable().Where(x => x.ApplicationId == settlement.Id).SumAsync(x => x.ApplyAmount);
await TenantDb.Updateable(settlement).UpdateColumns(x => x.Amount).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
@@ -439,6 +370,67 @@ namespace DS.WMS.Core.Settlement.Method
}
}
+ static DataResult AssignAmount(List details, decimal stlAmount, string currency)
+ {
+ if (details.Count == 0)
+ return DataResult.Success;
+
+ if (stlAmount == 0)
+ return DataResult.Failed("结算金额不能为零");
+
+ var totalAmount = details.Exists(x => x.Currency != currency) ?
+ details.Sum(x => x.OriginalAmount) : details.Sum(x => x.ApplyAmount);
+ if (Math.Abs(stlAmount) > totalAmount)
+ return DataResult.Failed("申请结算金额不能大于剩余结算金额");
+
+ if (totalAmount != stlAmount) //非全额结算
+ {
+ decimal rest = stlAmount;
+ foreach (var detail in details)
+ {
+ if (rest <= 0)
+ break;
+
+ if (rest >= detail.OriginalAmount)
+ {
+ rest = rest - detail.OriginalAmount;
+ }
+ else
+ {
+ detail.OriginalAmount = rest;
+ rest = 0;
+ }
+
+ if (detail.Currency == currency)
+ detail.ApplyAmount = detail.OriginalAmount;
+ else
+ {
+ detail.Currency = currency;
+ detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
+ }
+
+ detail.Assigned = true;
+ }
+ }
+ else
+ {
+ foreach (var detail in details)
+ {
+ if (detail.Currency == currency)
+ detail.ApplyAmount = detail.OriginalAmount;
+ else
+ {
+ detail.Currency = currency;
+ detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault();
+ }
+
+ detail.Assigned = true;
+ }
+ }
+
+ return DataResult.Success;
+ }
+
///
/// 用于结算单的状态检查
///
@@ -510,7 +502,9 @@ namespace DS.WMS.Core.Settlement.Method
ApplyAmount = x.ApplyAmount,
OriginalAmount = x.OriginalAmount,
ProcessedAmount = x.ProcessedAmount,
- OriginalProcessedAmount = x.OriginalProcessedAmount
+ OriginalProcessedAmount = x.OriginalProcessedAmount,
+ Currency = x.Currency,
+ OriginalCurrency = x.OriginalCurrency
}).ToListAsync();
if (details.Count == 0)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
@@ -579,7 +573,9 @@ namespace DS.WMS.Core.Settlement.Method
RecordId = x.RecordId,
DetailId = x.DetailId,
ApplyAmount = x.ApplyAmount,
- OriginalAmount = x.OriginalAmount
+ OriginalAmount = x.OriginalAmount,
+ Currency = x.Currency,
+ OriginalCurrency = x.OriginalCurrency
}).ToListAsync();
foreach (var app in apps)
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
index 9ce31e1f..2071d39f 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
@@ -3100,7 +3100,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
return DataResult.Failed("未获取到BC任务对象TaskBaseInfo");
}
- logger.LogInformation($"BCTaskCompleteThenNext taskBaseInfo.id={taskBaseInfo.Id};taskBaseInfo.OUT_BS_NO={taskBaseInfo.OUT_BS_NO}");
+ logger.LogInformation($"taskBaseInfo.id={taskBaseInfo.Id};taskBaseInfo.OUT_BS_NO={taskBaseInfo.OUT_BS_NO}");
await SetTaskStatus(taskBaseInfo, TaskStatusEnum.Complete, DateTime.Now, false);
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs
index c086a7ba..87ad7c12 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBaseService.cs
@@ -82,7 +82,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// 需要更新状态的列
public async Task SetTaskStatus(long[] taskIds, params Expression>[] columns)
{
- logger.LogInformation($"SetTaskStatus taskIds={string.Join(",", taskIds ?? [])}");
+ logger.LogInformation($"taskIds={string.Join(",", taskIds ?? [])}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
//任务不考虑OrgId,这里去掉
@@ -110,7 +110,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// 人员信息列表
public async Task SetTaskOwner(long[] taskIds, List userInfo)
{
- logger.LogInformation($"SetTaskOwner taskIds={string.Join(",", taskIds ?? [])};userInfo={JsonConvert.SerializeObject(userInfo)}");
+ logger.LogInformation($"taskIds={string.Join(",", taskIds ?? [])};userInfo={JsonConvert.SerializeObject(userInfo)}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
//任务不考虑OrgId,这里去掉
@@ -442,7 +442,7 @@ namespace DS.WMS.Core.TaskPlat.Method
TASK_TYPE_NAME = x.TASK_TYPE_NAME,
//CARRIER_ID = x.CARRIER_ID,
});
- logger.LogInformation($"MatchTask共查询出{taskList.Count}条待匹配的记录,taskList:{string.Join(',', taskList.Select(x => x.Id).Take(50))}");
+ //logger.LogInformation($"MatchTask共查询出{taskList.Count}条待匹配的记录,taskList:{string.Join(',', taskList.Select(x => x.Id).Take(50))}");
var allotSetCache = await allocationService.Value.GetAllList();
@@ -590,7 +590,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// 业务主键
public async Task SetTaskStatus(long taskBaseId, TaskStatusEnum taskStatusEnum, DateTime? statusTime, long? bsno = null)
{
- logger.LogInformation($"SetTaskStatus taskBaseId={taskBaseId};taskStatusEnum={taskStatusEnum};statusTime={statusTime};bsno={bsno}");
+ logger.LogInformation($"taskBaseId={taskBaseId};taskStatusEnum={taskStatusEnum};statusTime={statusTime};bsno={bsno}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
TaskBaseInfo taskInfo = await tenantDb.Queryable().ClearFilter(typeof(IOrgId))
@@ -615,7 +615,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
throw new ArgumentNullException(nameof(taskInfo));
}
- logger.LogInformation($"SetTaskStatus 通用 taskInfo={JsonConvert.SerializeObject(taskInfo)};taskStatusEnum={taskStatusEnum};statusTime={statusTime};isCheckAllChildTaskComplete={isCheckAllChildTaskComplete};bsno={bsno};taskDesc={taskDesc}");
+ logger.LogInformation($"通用方法 taskInfo={JsonConvert.SerializeObject(taskInfo)};taskStatusEnum={taskStatusEnum};statusTime={statusTime};isCheckAllChildTaskComplete={isCheckAllChildTaskComplete};bsno={bsno};taskDesc={taskDesc}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
index 335e5a4f..875501db 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -100,7 +100,7 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List userInfos,
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
{
- logger.LogInformation($"{nameof(SetTaskStatusWithBsno)} bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};userInfos={(userInfos == null ? "" : string.Join(',', userInfos ?? []))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
+ logger.LogInformation($"bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};taskStatusEnum={taskStatusEnum};statusTime={statusTime};userInfos={(userInfos == null ? "" : string.Join(',', userInfos ?? []))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
@@ -286,7 +286,7 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List userInfos, SqlSugarScopeProvider? tenantDb = null,
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null)
{
- logger.LogInformation($"TransferTask bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};userInfos={(userInfos == null ? "" : string.Join(',', userInfos))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
+ logger.LogInformation($"bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};userInfos={(userInfos == null ? "" : string.Join(',', userInfos))};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum}");
tenantDb ??= saasDbService.GetBizDbScopeById(user.TenantId);
@@ -401,7 +401,7 @@ namespace DS.WMS.Core.TaskPlat.Method
long? childBsno = null, TaskBaseTypeEnum? childTaskBaseTypeEnum = null,
params Expression>[] columns)
{
- logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum};");
+ logger.LogInformation($"bsno={bsno};taskBaseTypeEnum={taskBaseTypeEnum};childBsno={childBsno};childTaskBaseTypeEnum={childTaskBaseTypeEnum};");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
@@ -467,7 +467,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var bsnoStr = string.Join(',', bsnoList ?? []);
- logger.LogInformation($"SetTaskBaseInfoPropertyWithBsno 批量 bsno={bsnoStr};taskBaseTypeEnum={taskBaseTypeEnum};");
+ logger.LogInformation($"批量 bsno={bsnoStr};taskBaseTypeEnum={taskBaseTypeEnum};");
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var taskTypeStr = taskBaseTypeEnum.ToString();
@@ -519,13 +519,14 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
{
string batchNo = Guid.NewGuid().ToString();
- logger.LogInformation($"{nameof(InitTaskJob)} bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}");
+ logger.LogInformation($"bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}");
try
{
//Monitor.Enter(ImportLockObj);
if (info.Head.IsChild && info.Head.ChildBSNO == 0)
{
+ logger.LogInformation($"bsno={info?.Head.BSNO}; ChildBSNO={info?.Head?.ChildBSNO};info={JsonConvert.SerializeObject(info)}");
throw new Exception("创建子任务需要指定子任务的业务主键[info.Head.ChildBSNO]");
}
@@ -3914,7 +3915,7 @@ namespace DS.WMS.Core.TaskPlat.Method
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
result.bno = model.TASK_NO;
- logger.LogInformation($"InnerManualTask batchNo={batchNo};model.OUT_BS_NO={model.OUT_BS_NO};model.Id={model.Id};taskOperTypeEnum={taskOperTypeEnum};");
+ logger.LogInformation($"batchNo={batchNo};taskOperTypeEnum={taskOperTypeEnum};model={model};");
try
{
@@ -4222,7 +4223,7 @@ namespace DS.WMS.Core.TaskPlat.Method
var taskIdList = taskList.Select(x => x.Id).ToList();
- logger.LogInformation($"PullTask taskIdList={string.Join(",", taskIdList)}");
+ logger.LogInformation($"taskIdList={string.Join(",", taskIdList)}");
var taskTypeList = taskList.Where(x => x.TASK_SOURCE == TaskSourceEnum.WORK_FLOW.ToString() && x.OUT_BS_NO != null).Select(x => x.TASK_TYPE).Distinct().ToList();
diff --git a/ds-wms-service/DS.WMS.FeeApi/nlog.config b/ds-wms-service/DS.WMS.FeeApi/nlog.config
index 8e52d1f4..93911131 100644
--- a/ds-wms-service/DS.WMS.FeeApi/nlog.config
+++ b/ds-wms-service/DS.WMS.FeeApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.FinanceApi/nlog.config b/ds-wms-service/DS.WMS.FinanceApi/nlog.config
index 5ff430eb..2fade540 100644
--- a/ds-wms-service/DS.WMS.FinanceApi/nlog.config
+++ b/ds-wms-service/DS.WMS.FinanceApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.MainApi/nlog.config b/ds-wms-service/DS.WMS.MainApi/nlog.config
index 903b948c..8ff2c679 100644
--- a/ds-wms-service/DS.WMS.MainApi/nlog.config
+++ b/ds-wms-service/DS.WMS.MainApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.OpApi/nlog.config b/ds-wms-service/DS.WMS.OpApi/nlog.config
index af5a03ba..bd46fa13 100644
--- a/ds-wms-service/DS.WMS.OpApi/nlog.config
+++ b/ds-wms-service/DS.WMS.OpApi/nlog.config
@@ -23,7 +23,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />
diff --git a/ds-wms-service/DS.WMS.OpApi/wwwroot/templates/WSL.xlsx b/ds-wms-service/DS.WMS.OpApi/wwwroot/templates/WSL.xlsx
index 814066cf..21e51151 100644
Binary files a/ds-wms-service/DS.WMS.OpApi/wwwroot/templates/WSL.xlsx and b/ds-wms-service/DS.WMS.OpApi/wwwroot/templates/WSL.xlsx differ
diff --git a/ds-wms-service/DS.WMS.TaskApi/nlog.config b/ds-wms-service/DS.WMS.TaskApi/nlog.config
index 3edf57e2..60f43f92 100644
--- a/ds-wms-service/DS.WMS.TaskApi/nlog.config
+++ b/ds-wms-service/DS.WMS.TaskApi/nlog.config
@@ -7,6 +7,7 @@
+
@@ -23,7 +24,7 @@
+ layout="${longdate}|${uppercase:${level}}|${event-properties:item=EventId_Id}|aspnet-controller: ${aspnet-mvc-controller}|aspnet-action: ${aspnet-mvc-action}|processname:${processname}|appbasepath: ${aspnet-appbasepath}|${callsite}|${newline} |message: ${message} exception:${exception:format=tostring}" />