zhangxiaofeng 3 months ago
commit 183b3afdd5

@ -44,7 +44,7 @@ namespace DS.WMS.Core.Application.Method
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<TEntity>> SaveAsync(TEntity application) public async Task<DataResult<TEntity>> SaveAsync(TEntity application)
{ {
TEntity dbValue = null; TEntity? dbValue = null;
if (application.Id > 0) if (application.Id > 0)
{ {
//修改需检查申请单状态 //修改需检查申请单状态
@ -110,8 +110,6 @@ namespace DS.WMS.Core.Application.Method
{ {
detail.ApplicationId = application.Id; detail.ApplicationId = application.Id;
var fee = fees.Find(x => x.Id == detail.RecordId); var fee = fees.Find(x => x.Id == detail.RecordId);
//detail.BusinessId = fee.BusinessId;
//detail.BusinessType = fee.BusinessType;
detail.ExchangeRate = detail.ExchangeRate ?? fee.ExchangeRate; detail.ExchangeRate = detail.ExchangeRate ?? fee.ExchangeRate;
detail.FeeId = fee.FeeId; detail.FeeId = fee.FeeId;
detail.FeeName = fee.FeeName; detail.FeeName = fee.FeeName;
@ -189,7 +187,7 @@ namespace DS.WMS.Core.Application.Method
/// <param name="application">提交的申请单</param> /// <param name="application">提交的申请单</param>
/// <param name="dbValue">数据库值新增时为null</param> /// <param name="dbValue">数据库值新增时为null</param>
/// <returns></returns> /// <returns></returns>
protected virtual DataResult EnsureApplication(TEntity application, TEntity dbValue) protected virtual DataResult EnsureApplication(TEntity application, TEntity? dbValue)
{ {
return DataResult.Success; return DataResult.Success;
} }

@ -305,12 +305,9 @@ namespace DS.WMS.Core.Application.Method
CustomerAddTel = a.CustomerAddTel, CustomerAddTel = a.CustomerAddTel,
CustomerBankId = a.CustomerBankId, CustomerBankId = a.CustomerBankId,
CustomerBankName = b1.BankName, CustomerBankName = b1.BankName + " " + b1.Account,
CustomerAccount = b1.Account,
USDCustomerBankId = a.USDCustomerBankId, USDCustomerBankId = a.USDCustomerBankId,
USDCustomerBankName = b2.BankName, USDCustomerBankName = b2.BankName + " " + b2.Account
USDCustomerAccount = b2.Account
}).FirstAsync(); }).FirstAsync();
if (dto != null) if (dto != null)
@ -434,14 +431,11 @@ namespace DS.WMS.Core.Application.Method
return list; return list;
} }
protected override DataResult EnsureApplication(InvoiceApplication application, InvoiceApplication dbValue) protected override DataResult EnsureApplication(InvoiceApplication application, InvoiceApplication? dbValue)
{ {
if (dbValue != null && dbValue.Status != InvoiceApplicationStatus.Pending && dbValue.Status != InvoiceApplicationStatus.AuditRejected) if (dbValue != null && dbValue.Status != InvoiceApplicationStatus.Pending && dbValue.Status != InvoiceApplicationStatus.AuditRejected)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSaveStatusError)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSaveStatusError));
if (application.Currency.IsNullOrEmpty())
application.Currency = FeeCurrency.RMB_CODE;
return DataResult.Success; return DataResult.Success;
} }

@ -400,7 +400,7 @@ namespace DS.WMS.Core.Application.Method
} }
protected override DataResult EnsureApplication(PaymentApplication application, PaymentApplication dbValue) protected override DataResult EnsureApplication(PaymentApplication application, PaymentApplication? dbValue)
{ {
if (dbValue != null) if (dbValue != null)
{ {

@ -56,17 +56,7 @@ namespace DS.WMS.Core.HangfireJob.Method
_logger.Error("海运出口信息不存在!"); _logger.Error("海运出口信息不存在!");
throw new Exception("海运出口信息不存在!"); throw new Exception("海运出口信息不存在!");
} }
var orderUrl = tenantDb.Queryable<BookingOrderUrl>().First(x => x.BusinessId == bookingId);
if (orderUrl == null)
{
orderUrl = new BookingOrderUrl()
{
BusinessId = bookingId
};
tenantDb.Insertable(orderUrl).ExecuteCommand();
}
//if (!string.IsNullOrEmpty(orderUrl.UrlVgm)) //if (!string.IsNullOrEmpty(orderUrl.UrlVgm))
//{ //{
// return await Task.FromResult(DataResult<string[]>.Success(new string[] { orderUrl.UrlVgm, orderUrl.UrlVgmSi })); // return await Task.FromResult(DataResult<string[]>.Success(new string[] { orderUrl.UrlVgm, orderUrl.UrlVgmSi }));
@ -210,25 +200,42 @@ namespace DS.WMS.Core.HangfireJob.Method
_logger.Error(jobjResp.GetStringValue("message")); _logger.Error(jobjResp.GetStringValue("message"));
throw new Exception(jobjResp.GetStringValue("message")); throw new Exception(jobjResp.GetStringValue("message"));
} }
try
{
tenantDb.Ado.BeginTran();
var orderUrl = tenantDb.Queryable<BookingOrderUrl>().First(x => x.BusinessId == bookingId);
if (orderUrl == null)
{
orderUrl = new BookingOrderUrl()
{
BusinessId = bookingId
};
tenantDb.Insertable(orderUrl).ExecuteCommand();
}
//保存url
var memoData = jobjResp.GetJObjectValue("memoData");
orderUrl.UrlVgm = memoData.GetStringValue("vgmUrl");
orderUrl.UrlVgmSi = memoData.GetStringValue("vgmAndSiUrl");
tenantDb.Updateable(orderUrl).ExecuteCommand();
//保存url //货运动态
var memoData = jobjResp.GetJObjectValue("memoData"); var bookingStatus = new BookingStatusLog()
orderUrl.UrlVgm = memoData.GetStringValue("vgmUrl"); {
orderUrl.UrlVgmSi = memoData.GetStringValue("vgmAndSiUrl"); BusinessId = bookingId,
tenantDb.Updateable(orderUrl).ExecuteCommand(); Status = $"生成VGM链接",
Group = "ship",
OpTime = DateTime.Now,
//货运动态 MBLNO = order.MBLNO
var bookingStatus = new BookingStatusLog() };
tenantDb.Insertable(bookingStatus).ExecuteCommand();
tenantDb.Ado.CommitTran();
}
catch (Exception ex)
{ {
BusinessId = bookingId, tenantDb.Ado.RollbackTran();
Status = $"生成VGM链接", throw new Exception(ex.ToString());
Group = "ship", }
OpTime = DateTime.Now,
MBLNO = order.MBLNO
};
tenantDb.Insertable(bookingStatus).ExecuteCommand();
} }
public void TxxpLinkJob(BaseJobReq req) public void TxxpLinkJob(BaseJobReq req)
@ -238,17 +245,7 @@ namespace DS.WMS.Core.HangfireJob.Method
var bookingId = req.Id; var bookingId = req.Id;
var order = tenantDb.Queryable<SeaExport>().First(x => x.Id == bookingId); var order = tenantDb.Queryable<SeaExport>().First(x => x.Id == bookingId);
var orderUrl = tenantDb.Queryable<BookingOrderUrl>().First(x => x.BusinessId == bookingId);
if (orderUrl == null)
{
orderUrl = new BookingOrderUrl()
{
BusinessId = bookingId
};
tenantDb.Insertable(orderUrl).ExecuteCommand();
}
//校验船公司 //校验船公司
if (string.IsNullOrEmpty(order.Carrier) || order.CarrierId == 0) if (string.IsNullOrEmpty(order.Carrier) || order.CarrierId == 0)
{ {
@ -377,26 +374,44 @@ namespace DS.WMS.Core.HangfireJob.Method
_logger.Error(jobjResp.GetStringValue("message")); _logger.Error(jobjResp.GetStringValue("message"));
throw new Exception(jobjResp.GetStringValue("message")); throw new Exception(jobjResp.GetStringValue("message"));
} }
try
{
tenantDb.Ado.BeginTran();
var orderUrl = tenantDb.Queryable<BookingOrderUrl>().First(x => x.BusinessId == bookingId);
if (orderUrl == null)
{
orderUrl = new BookingOrderUrl()
{
BusinessId = bookingId
};
tenantDb.Insertable(orderUrl).ExecuteCommand();
}
var addUrlFlag = string.IsNullOrEmpty(orderUrl.UrlTxxp) ? true : false; //新生成还是更新链接
//保存url
var addUrlFlag = string.IsNullOrEmpty(orderUrl.UrlTxxp) ? true : false; //新生成还是更新链接 //保存url
//保存url var txxpUrl = jobjResp.GetStringValue("data");
orderUrl.UrlTxxp = txxpUrl;
//保存url tenantDb.Updateable(orderUrl).ExecuteCommand();
var txxpUrl = jobjResp.GetStringValue("data");
orderUrl.UrlTxxp = txxpUrl;
tenantDb.Updateable(orderUrl).ExecuteCommand();
//货运动态 //货运动态
var bookingStatus = new BookingStatusLog() var bookingStatus = new BookingStatusLog()
{
BusinessId = bookingId,
Status = $"{(addUrlFlag ? "" : "")}提箱小票链接",
Group = "ship",
OpTime = DateTime.Now,
MBLNO = order.MBLNO
};
tenantDb.Insertable(bookingStatus).ExecuteCommand();
tenantDb.Ado.CommitTran();
}
catch (Exception ex)
{ {
BusinessId = bookingId, tenantDb.Ado.RollbackTran();
Status = $"{(addUrlFlag ? "" : "")}提箱小票链接", throw new Exception(ex.ToString());
Group = "ship", }
OpTime = DateTime.Now,
MBLNO = order.MBLNO
};
tenantDb.Insertable(bookingStatus).ExecuteCommand();
} }
} }
} }

@ -30,10 +30,21 @@ public class ClientBankService : ServiceBase, IClientBankService
{ {
//序列化查询条件 //序列化查询条件
var whereList = request.GetConditionalModels(Db); var whereList = request.GetConditionalModels(Db);
var data = TenantDb.Queryable<InfoClientBank>() var result = TenantDb.Queryable<InfoClientBank>()
.Where(whereList) .Where(whereList)
.Select<ClientBankRes>().ToQueryPage(request.PageCondition); .Select<ClientBankRes>().ToQueryPage(request.PageCondition);
return data;
if (result.Data?.Count > 0)
{
var ids = result.Data.Select(x => x.Id);
var list = TenantDb.Queryable<InvoiceHeader>().Where(x => ids.Contains(x.RelativeId)).ToList();
foreach (var item in result.Data)
{
item.InvoiceHeaders = list.FindAll(x => x.RelativeId == item.Id);
}
}
return result;
} }
/// <summary> /// <summary>

@ -7,7 +7,7 @@ using DS.WMS.Core.Op.Interface.TaskInteraction;
namespace DS.WMS.Core.Op.Method.TaskInteraction namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
/// <summary> /// <summary>
/// 邮件配置服务 /// 邮件模板配置服务
/// </summary> /// </summary>
public class TaskMailService : ServiceBase, ITaskMailService public class TaskMailService : ServiceBase, ITaskMailService
{ {
@ -27,7 +27,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request) public async Task<DataResult<List<BusinessTaskMail>>> GetListAsync(PageRequest request)
{ {
var whereList = request.GetConditionalModels(Db); var whereList = request.GetConditionalModels(Db);
return await TenantDb.Queryable<BusinessTaskMail>().Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC) return await TenantDb.Queryable<BusinessTaskMail>()
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC)
.Where(whereList).ToQueryPageAsync(request.PageCondition); .Where(whereList).ToQueryPageAsync(request.PageCondition);
} }
@ -39,7 +40,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public async Task<DataResult<BusinessTaskMail>> GetAsync(long id) public async Task<DataResult<BusinessTaskMail>> GetAsync(long id)
{ {
var entity = await TenantDb.Queryable<BusinessTaskMail>() var entity = await TenantDb.Queryable<BusinessTaskMail>()
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments).Includes(x => x.CC) .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC).Includes(x => x.Attachments)
.Where(x => x.Id == id).FirstAsync(); .Where(x => x.Id == id).FirstAsync();
return DataResult<BusinessTaskMail>.Success(entity); return DataResult<BusinessTaskMail>.Success(entity);
@ -53,8 +54,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public async Task<BusinessTaskMail> GetAsync(string name) public async Task<BusinessTaskMail> GetAsync(string name)
{ {
return await TenantDb.Queryable<BusinessTaskMail>() return await TenantDb.Queryable<BusinessTaskMail>()
.Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments).Includes(x => x.CC) .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC).Includes(x => x.Attachments)
.Where(x => x.Name == name).FirstAsync(); .Where(x => x.Name.Contains(name)).FirstAsync();
} }
/// <summary> /// <summary>
@ -73,11 +74,15 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
taskMail.Sender ??= new(); taskMail.Sender ??= new();
taskMail.CC ??= new(); taskMail.CC ??= new();
taskMail = await TenantDb.InsertNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteReturnEntityAsync(); taskMail = await TenantDb.InsertNav(taskMail)
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC)
.ExecuteReturnEntityAsync();
} }
else else
{ {
await TenantDb.UpdateNav(taskMail).Include(x => x.Receiver).Include(x => x.Sender).ExecuteCommandAsync(); await TenantDb.UpdateNav(taskMail)
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC)
.ExecuteCommandAsync();
} }
if (taskMail.Attachments?.Count > 0) if (taskMail.Attachments?.Count > 0)
@ -86,8 +91,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
foreach (var item in list) foreach (var item in list)
item.TaskMailId = taskMail.Id; item.TaskMailId = taskMail.Id;
await TenantDb.Deleteable<BusinessTaskAttachment>().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync(); //await TenantDb.Deleteable<BusinessTaskAttachment>().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync();
await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync(); //await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync();
await TenantDb.Storageable(taskMail.Attachments).DefaultAddElseUpdate().ExecuteCommandAsync();
} }
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
@ -113,7 +120,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
try try
{ {
await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id)) await TenantDb.DeleteNav<BusinessTaskMail>(x => model.Ids.Contains(x.Id))
.Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.Attachments) .Include(x => x.Receiver).Include(x => x.Sender).Include(x => x.CC).Include(x => x.Attachments)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
@ -127,6 +134,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
} }
} }
} }
} }

@ -31,7 +31,7 @@ builder.Logging.AddNLog("nlog.config");
//Autofac注入 //Autofac注入
builder.ConfigureContainer(new AutofacServiceProviderFactory(), builder => builder.RegisterModule(new AutofacModuleRegister())); builder.ConfigureContainer(new AutofacServiceProviderFactory(), builder => builder.RegisterModule(new AutofacModuleRegister()));
builder.Services.AddTransient<IProblemDetailsWriter, SampleProblemDetailsWriter>(); //builder.Services.AddTransient<IProblemDetailsWriter, SampleProblemDetailsWriter>();
//builder.Services.AddExceptionHandler<GlobalExceptionsFilter>(); //全局异常 //builder.Services.AddExceptionHandler<GlobalExceptionsFilter>(); //全局异常
builder.Services.AddControllers(options => builder.Services.AddControllers(options =>
{ {

Loading…
Cancel
Save