jianghaiqing 3 weeks ago
commit ac34f341eb

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -56,8 +56,8 @@ namespace DS.WMS.Core.Application.Entity
/// <summary>
/// 币别
/// </summary>
[SugarColumn(ColumnDescription = "币别", IsNullable = true, Length = 3)]
public string? Currency { get; set; }
[SugarColumn(ColumnDescription = "币别", Length = 3)]
public string Currency { get; set; }
/// <summary>
/// 所属分部

@ -137,5 +137,11 @@ namespace DS.WMS.Core.Application.Entity
/// </summary>
[SugarColumn(IsIgnore = true)]
public BusinessType BusinessType { get; set; }
/// <summary>
/// 金额已分配
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool Assigned { get; set; }
}
}

@ -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)

@ -43,6 +43,11 @@ namespace DS.WMS.Core.Invoice.Dtos
/// </summary>
public string lrfsf { get; set; } = "0";
/// <summary>
/// 确认类型Y同意N不同意C撤销
/// </summary>
public string? qrlx { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (InvoiceId == null && string.IsNullOrEmpty(orderNo))

@ -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; }
/// <summary>
/// 推送方式

@ -55,4 +55,20 @@ namespace DS.WMS.Core.Invoice.Dtos
/// </summary>
public string orderNo { get; set; }
}
/// <summary>
/// 冲红确认单
/// </summary>
public class SetRedConfirmation
{
/// <summary>
/// 红字确认单状态
/// </summary>
public string hzqrxxztDm { get; set; }
/// <summary>
/// 请求标识
/// </summary>
public string senid { get; set; }
}
}

@ -247,10 +247,10 @@ namespace DS.WMS.Core.Invoice.Entity
public string? RedCode { get; set; }
/// <summary>
/// 红票发票
/// 红票发票ID
/// </summary>
[SugarColumn(ColumnDescription = "红票发票号", IsNullable = true, Length = 50)]
public string? RedNO { get; set; }
[SugarColumn(ColumnDescription = "红票发票ID", IsNullable = true)]
public long? RedId { get; set; }
/// <summary>
/// 是否被冲红
@ -264,11 +264,11 @@ namespace DS.WMS.Core.Invoice.Entity
[SugarColumn(ColumnDescription = "冲红原因", Length = 100, IsNullable = true)]
public string? RedReason { get; set; }
/// <summary>
/// 冲红确认单ID
/// </summary>
[SugarColumn(ColumnDescription = "冲红确认单ID", IsNullable = true)]
public long? RedBillId { get; set; }
///// <summary>
///// 冲红确认单ID
///// </summary>
//[SugarColumn(ColumnDescription = "冲红确认单ID", IsNullable = true)]
//public long? RedBillId { get; set; }
/// <summary>
/// 收款币别

@ -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<ICommonService> CommonService;
readonly Lazy<InvoiceService<Entity.Invoice>> InvoiceService;
/// <summary>
/// 初始化并加载配置
/// </summary>
@ -34,7 +38,8 @@ namespace DS.WMS.Core.Invoice.Method
public InvoiceIssuanceService(IServiceProvider provider) : base(provider)
{
var config = provider.GetRequiredService<IConfiguration>();
CommonService = new Lazy<ICommonService>(provider.GetRequiredService<ICommonService>());
InvoiceService = new Lazy<InvoiceService<Entity.Invoice>>(provider.GetRequiredService<InvoiceService<Entity.Invoice>>());
}
/// <summary>
@ -179,16 +184,10 @@ namespace DS.WMS.Core.Invoice.Method
if (invoices.Count > 0)
return result2;
//var result = await api.PostAsync<InvoiceResult<InvoiceQuery>>("/api/Invoice/GetInvoiceState", new { guid = sn });
//调用查询API获取发票号
var order = await TenantDb.Queryable<Entity.Invoice>().Where(x => x.SN == sn).FirstAsync();
//如果开票中所属机构为空,则取用户的orgId
var userOrgId = (order.SaleDeptId != null && order.SaleDeptId > 0) ? order.SaleDeptId : User.OrgId;
var orgauthinfo = Db.Queryable<SysOrg>().LeftJoin<SysOrgAuth>((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<InvoiceResult<InvoiceQuery>>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/GetInvoiceState", new { guid = sn });
var result = await api.PostAsync<InvoiceResult<InvoiceQuery>>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/GetInvoiceState", new { guid = sn });
if (!result.Succeeded)
return DataResult.Failed(result.Message, result.MultiCode);
@ -226,8 +225,6 @@ namespace DS.WMS.Core.Invoice.Method
};
invoices.Add(inv);
if (string.IsNullOrEmpty(inv.ApiStatus))
{
switch (item.State)
{
case 1:
@ -241,6 +238,20 @@ namespace DS.WMS.Core.Invoice.Method
break;
}
}
await TenantDb.Ado.BeginTranAsync();
try
{
var billNumbers = invoices.Select(x => x.BillNO);
//获取发票费用明细ID
var ids = await TenantDb.Queryable<Entity.Invoice>()
.InnerJoin<ApplicationDetail>((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)
{
//删除蓝票费用明细
await InvoiceService.Value.DeleteDetailAsync(ids);
}
await TenantDb.Updateable(invoices).WhereColumns(x => x.BillNO)
@ -251,6 +262,15 @@ namespace DS.WMS.Core.Invoice.Method
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
/// <returns></returns>
public async Task<DataResult> ReverseAsync(InvoiceReversalRequest request)
{
var invoice = await TenantDb.Queryable<Entity.Invoice>()
var blueInvoice = await TenantDb.Queryable<Entity.Invoice>().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 redInvoice = blueInvoice.DeepClone();
var sequence = CommonService.Value.GetSequenceNext<Entity.Invoice>();
redInvoice.BillNO = sequence.Data;
redInvoice.SN = request.senid;
redInvoice.Type = InvoiceType.Red;
var req = new InvoiceReversalRequest
redInvoice.Details ??= [];
if (redInvoice.Details.Count == 0)
redInvoice.Details.AddRange(blueInvoice.Details);
foreach (var detail in redInvoice.Details)
{
orderNo = invoice.BillNO,
chyyDm = request.chyyDm,
lrfsf = request.lrfsf,
senid = ""//待完善
};
detail.ApplyAmount = 0 - detail.ApplyAmount;
detail.OriginalAmount = 0 - detail.OriginalAmount;
}
try
{
//如果开票中所属机构为空,则取用户的orgId
var userOrgId = (invoice.SaleDeptId != null && invoice.SaleDeptId > 0) ? invoice.SaleDeptId : User.OrgId;
var userOrgId = (blueInvoice.SaleDeptId != null && blueInvoice.SaleDeptId > 0) ? blueInvoice.SaleDeptId : User.OrgId;
//接口请求key密钥
var orgauthinfo = Db.Queryable<SysOrgAuth>().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<InvoiceResult<string>>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/RedInvoicing", req);
request.orderNo = blueInvoice.BillNO; //蓝票业务号
var result = await api.PostAsync<InvoiceResult<SetRedConfirmation>>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/RedInvoicing", request);
if (result.Data == null || !result.Data.success)
return DataResult.Failed(result.Data == null ? "请求失败" : result.Data.msg);
if (!result.Succeeded)
return DataResult.Failed(result.Message, result.MultiCode);
request.qrlx = "Y";
result = await api.PostAsync<InvoiceResult<SetRedConfirmation>>(AppSetting.app(["InvoiceApi", "BaseUrl"]) + "/api/Invoice/RedInvoicing", request);
if (result.Data == null || !result.Data.success)
return DataResult.Failed(result.Data == null ? "请求失败" : result.Data.msg);
var invResult = result.Data;
JObject? jObj = JObject.Parse(invResult.data);
if (invResult.success)
return DataResult.Failed(invResult.msg);
invoice.IsSetRed = true;
invoice.RedReason = request.Reason;
await TenantDb.Updateable(invoice).UpdateColumns(x => new { x.IsSetRed, x.RedReason }).ExecuteCommandAsync();
return DataResult.Success;
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));
}
}
/// <summary>

@ -303,7 +303,7 @@ namespace DS.WMS.Core.Invoice.Method
return DataResult<TEntity>.FailedWithDesc(nameof(MultiLanguageConst.InconsistentTaxRates));
}
//转换为费用明细
//转换为费用明细
var detail = new ApplicationDetail
{
ApplicationId = invoice.Id,
@ -327,10 +327,8 @@ 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<TEntity>.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.Assigned = true;
}
}
else
{
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<CodeInvoice>()
.Where(ci => currencies.Contains(ci.DefaultCurrency))
.OrderBy(ci => ci.IsDefault)
.Where(ci => currencies.Contains(ci.DefaultCurrency) && ci.IsDefault)
.Select(ci => new
{
ci.Id,

@ -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<SeaExport>().Where(x => x.SourceCode == SOURCE_CODE && SqlFunc.Between(x.ETD, startDate, endDate) && !x.Deleted)
var list = await tenantDb.Queryable<SeaExport>().Where(x => x.SourceCode == SOURCE_CODE && x.SourceDetailName == SOURCE_DETAIL_CODE && SqlFunc.Between(x.ETD, startDate, endDate) && !x.Deleted)
.LeftJoin<InfoClient>((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)
{
@ -119,12 +120,14 @@ namespace DS.WMS.Core.QuarztJobs
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());

@ -90,7 +90,7 @@ namespace DS.WMS.Core.QuarztJobs
Month = today.ToString("yyyy.MM")
};
var list = await tenantDb.Queryable<SeaExport>().Where(x => !x.Deleted && x.IsChangeETD == false)//x.ContractClientName == "WSL" && && SqlFunc.Between(x.ETD, startDate, endDate)
var list = await tenantDb.Queryable<SeaExport>().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()
{

@ -49,12 +49,16 @@ namespace DS.WMS.Core.Settlement.Method
ApplicationNO = x.ApplicationNO,
SettlementNO = x.SettlementNO,
SettlementTypeName = x.SettlementType.StlName, //结算方式
RMBAmount = SqlFunc.Subqueryable<ApplicationDetail>().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<ApplicationDetail>().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<ApplicationDetail>().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<DataResult> 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<PaymentApplication>().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<ApplicationSettlement> 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<ApplicationDetail>().Where(x => ids.Contains(x.Id) && x.Category == DetailCategory.PaidApplication)
//获取申请明细
var details = TenantDb.Queryable<ApplicationDetail>().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;
}

@ -286,5 +286,43 @@ namespace DS.WMS.Core.Settlement.Method
.UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount })
.ExecuteCommandAsync();
}
//还原发票费用明细
protected override async Task OnDeleteDetailAsync(List<ApplicationSettlement> 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<ApplicationDetail>().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();
}
}
}
}

@ -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<ApplicationDetail>().And(x => ids.Contains(x.ApplicationId) && x.Category == detailCategory);
Expressionable<ApplicationDetail>? 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<ApplicationDetail>();
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<ApplicationDetail>().Where(expr.ToExpression())
var detailCategory = settlement.Mode == SettlementMode.Payment ? DetailCategory.PaidApplication : DetailCategory.ChargeApplication;
details1 = await TenantDb.Queryable<ApplicationDetail>()
.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<TEntity>.Failed("结算单据与费用明细不一致");
@ -161,7 +163,6 @@ namespace DS.WMS.Core.Settlement.Method
return DataResult<TEntity>.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<TEntity>.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<TEntity>.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<TEntity>.Failed("人民币结算金额不能大于剩余人民币金额");
if (doc.SettlementRMB < totalRMB)
{
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 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<TEntity>.Failed("美元结算金额不能大于剩余美元金额");
if (doc.SettlementUSD < totalUSD)
{
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
if (doc.SettlementRMB.HasValue)
{
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<TEntity>.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<TEntity>.Failed("其他结算金额不能大于剩余其他金额");
if (doc.SettlementOther < total)
if (doc.SettlementUSD.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;
var usdDetails = details2.Where(x => x.OriginalCurrency == FeeCurrency.USD_CODE).ToList();
result = AssignAmount(usdDetails, doc.SettlementUSD.Value, settlement.Currency);
if (!result.Succeeded)
return DataResult<TEntity>.Failed(result.Message, result.MultiCode);
}
else
if (doc.SettlementOther.HasValue)
{
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<TEntity>.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<ApplicationDetail>().Where(x => x.ApplicationId == settlement.Id)
.SumAsync(x => x.ApplyAmount);
//计算结算总金额
settlement.Amount = await TenantDb.Queryable<ApplicationDetail>().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<ApplicationDetail> 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;
}
/// <summary>
/// 用于结算单的状态检查
/// </summary>
@ -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)

@ -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);

@ -82,7 +82,7 @@ namespace DS.WMS.Core.TaskPlat.Method
/// <param name="columns">需要更新状态的列</param>
public async Task SetTaskStatus(long[] taskIds, params Expression<Func<TaskBaseInfo, bool>>[] 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
/// <param name="userInfo">人员信息列表</param>
public async Task SetTaskOwner(long[] taskIds, List<RecvUserInfo> 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
/// <param name="bsno">业务主键</param>
public async Task<DataResult> 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<TaskBaseInfo>().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);

@ -100,7 +100,7 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task<DataResult> SetTaskUserStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime, List<RecvUserInfo> 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<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> 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<Func<TaskBaseInfo, bool>>[] 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<DataResult> 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();

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -23,7 +23,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

@ -7,6 +7,7 @@
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore" />
<add assembly="DS.Module.UserModule" />
</extensions>
<targets>
@ -23,7 +24,7 @@
<!-- 任务台相关日志 -->
<target xsi:type="File" name="taskflow" fileName="..\TaskLogs\nlog-taskflow-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring} ${newline}" />
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}" />
</targets>
<rules>

Loading…
Cancel
Save