From 47ec50983f701124c3b9436cda25c9a11c201084 Mon Sep 17 00:00:00 2001 From: cjy Date: Tue, 3 Sep 2024 10:12:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8F=90=E7=AE=B1=E5=B0=8F=E7=A5=A8=E3=80=81VGM=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E4=BB=BB=E5=8A=A1=E6=B7=BB=E5=8A=A0=E4=BA=8B=E5=8A=A1?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HangfireJob/Method/OpJobService.cs | 123 ++++++++++-------- ds-wms-service/DS.WMS.JobService/Program.cs | 2 +- 2 files changed, 70 insertions(+), 55 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs index 7ec7bb06..89e73dc8 100644 --- a/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs +++ b/ds-wms-service/DS.WMS.Core/HangfireJob/Method/OpJobService.cs @@ -56,17 +56,7 @@ namespace DS.WMS.Core.HangfireJob.Method _logger.Error("海运出口信息不存在!"); throw new Exception("海运出口信息不存在!"); } - - var orderUrl = tenantDb.Queryable().First(x => x.BusinessId == bookingId); - if (orderUrl == null) - { - orderUrl = new BookingOrderUrl() - { - BusinessId = bookingId - }; - tenantDb.Insertable(orderUrl).ExecuteCommand(); - } - + //if (!string.IsNullOrEmpty(orderUrl.UrlVgm)) //{ // return await Task.FromResult(DataResult.Success(new string[] { orderUrl.UrlVgm, orderUrl.UrlVgmSi })); @@ -210,25 +200,42 @@ namespace DS.WMS.Core.HangfireJob.Method _logger.Error(jobjResp.GetStringValue("message")); throw new Exception(jobjResp.GetStringValue("message")); } + try + { + tenantDb.Ado.BeginTran(); + var orderUrl = tenantDb.Queryable().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"); - orderUrl.UrlVgm = memoData.GetStringValue("vgmUrl"); - orderUrl.UrlVgmSi = memoData.GetStringValue("vgmAndSiUrl"); - tenantDb.Updateable(orderUrl).ExecuteCommand(); - - - //货运动态 - var bookingStatus = new BookingStatusLog() + //货运动态 + var bookingStatus = new BookingStatusLog() + { + BusinessId = bookingId, + Status = $"生成VGM链接", + Group = "ship", + OpTime = DateTime.Now, + MBLNO = order.MBLNO + }; + tenantDb.Insertable(bookingStatus).ExecuteCommand(); + tenantDb.Ado.CommitTran(); + } + catch (Exception ex) { - BusinessId = bookingId, - Status = $"生成VGM链接", - Group = "ship", - OpTime = DateTime.Now, - MBLNO = order.MBLNO - }; - tenantDb.Insertable(bookingStatus).ExecuteCommand(); + tenantDb.Ado.RollbackTran(); + throw new Exception(ex.ToString()); + } } public void TxxpLinkJob(BaseJobReq req) @@ -238,17 +245,7 @@ namespace DS.WMS.Core.HangfireJob.Method var bookingId = req.Id; var order = tenantDb.Queryable().First(x => x.Id == bookingId); - - var orderUrl = tenantDb.Queryable().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) { @@ -377,26 +374,44 @@ namespace DS.WMS.Core.HangfireJob.Method _logger.Error(jobjResp.GetStringValue("message")); throw new Exception(jobjResp.GetStringValue("message")); } + try + { + tenantDb.Ado.BeginTran(); + var orderUrl = tenantDb.Queryable().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; - tenantDb.Updateable(orderUrl).ExecuteCommand(); + //保存url + 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, - Status = $"{(addUrlFlag ? "生成" : "更新")}提箱小票链接", - Group = "ship", - OpTime = DateTime.Now, - MBLNO = order.MBLNO - }; - tenantDb.Insertable(bookingStatus).ExecuteCommand(); + tenantDb.Ado.RollbackTran(); + throw new Exception(ex.ToString()); + } } } } diff --git a/ds-wms-service/DS.WMS.JobService/Program.cs b/ds-wms-service/DS.WMS.JobService/Program.cs index d76204b2..41ea0e49 100644 --- a/ds-wms-service/DS.WMS.JobService/Program.cs +++ b/ds-wms-service/DS.WMS.JobService/Program.cs @@ -31,7 +31,7 @@ builder.Logging.AddNLog("nlog.config"); //Autofacע builder.ConfigureContainer(new AutofacServiceProviderFactory(), builder => builder.RegisterModule(new AutofacModuleRegister())); -builder.Services.AddTransient(); +//builder.Services.AddTransient(); //builder.Services.AddExceptionHandler(); //ȫ쳣 builder.Services.AddControllers(options => { From ca79511919fc21f2de146e4abd555c726d387e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 3 Sep 2024 10:34:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=80=E6=9D=A5=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E9=93=B6=E8=A1=8C=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E5=8F=91?= =?UTF-8?q?=E7=A5=A8=E6=8A=AC=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Info/Method/ClientBankService.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs index 79a5a1ff..56055d00 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientBankService.cs @@ -30,10 +30,21 @@ public class ClientBankService : ServiceBase, IClientBankService { //序列化查询条件 var whereList = request.GetConditionalModels(Db); - var data = TenantDb.Queryable() + var result = TenantDb.Queryable() .Where(whereList) .Select().ToQueryPage(request.PageCondition); - return data; + + if (result.Data?.Count > 0) + { + var ids = result.Data.Select(x => x.Id); + var list = TenantDb.Queryable().Where(x => ids.Contains(x.RelativeId)).ToList(); + foreach (var item in result.Data) + { + item.InvoiceHeaders = list.FindAll(x => x.RelativeId == item.Id); + } + } + + return result; } /// From c30a9c356effafa170e5e3822fe9f8a010236e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 3 Sep 2024 11:23:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Method/ApplicationService`1.cs | 6 ++-- .../Method/InvoiceApplicationService.cs | 12 ++------ .../Method/PaymentApplicationService.cs | 2 +- .../Method/TaskInteraction/TaskMailService.cs | 28 +++++++++++-------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/ApplicationService`1.cs b/ds-wms-service/DS.WMS.Core/Application/Method/ApplicationService`1.cs index fff1230e..b2fced98 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/ApplicationService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/ApplicationService`1.cs @@ -44,7 +44,7 @@ namespace DS.WMS.Core.Application.Method /// public async Task> SaveAsync(TEntity application) { - TEntity dbValue = null; + TEntity? dbValue = null; if (application.Id > 0) { //修改需检查申请单状态 @@ -110,8 +110,6 @@ namespace DS.WMS.Core.Application.Method { detail.ApplicationId = application.Id; var fee = fees.Find(x => x.Id == detail.RecordId); - //detail.BusinessId = fee.BusinessId; - //detail.BusinessType = fee.BusinessType; detail.ExchangeRate = detail.ExchangeRate ?? fee.ExchangeRate; detail.FeeId = fee.FeeId; detail.FeeName = fee.FeeName; @@ -189,7 +187,7 @@ namespace DS.WMS.Core.Application.Method /// 提交的申请单 /// 数据库值,新增时为null /// - protected virtual DataResult EnsureApplication(TEntity application, TEntity dbValue) + protected virtual DataResult EnsureApplication(TEntity application, TEntity? dbValue) { return DataResult.Success; } 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 3d3375e0..c484e93c 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs @@ -305,12 +305,9 @@ namespace DS.WMS.Core.Application.Method CustomerAddTel = a.CustomerAddTel, CustomerBankId = a.CustomerBankId, - CustomerBankName = b1.BankName, - CustomerAccount = b1.Account, - + CustomerBankName = b1.BankName + " " + b1.Account, USDCustomerBankId = a.USDCustomerBankId, - USDCustomerBankName = b2.BankName, - USDCustomerAccount = b2.Account + USDCustomerBankName = b2.BankName + " " + b2.Account }).FirstAsync(); if (dto != null) @@ -434,14 +431,11 @@ namespace DS.WMS.Core.Application.Method 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) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSaveStatusError)); - if (application.Currency.IsNullOrEmpty()) - application.Currency = FeeCurrency.RMB_CODE; - return DataResult.Success; } diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs index 3534198f..6ece1721 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs @@ -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) { diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs index 78fbff77..4de9dc2e 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskMailService.cs @@ -7,7 +7,7 @@ using DS.WMS.Core.Op.Interface.TaskInteraction; namespace DS.WMS.Core.Op.Method.TaskInteraction { /// - /// 邮件配置服务 + /// 邮件模板配置服务 /// public class TaskMailService : ServiceBase, ITaskMailService { @@ -27,7 +27,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction public async Task>> GetListAsync(PageRequest request) { var whereList = request.GetConditionalModels(Db); - return await TenantDb.Queryable().Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC) + return await TenantDb.Queryable() + .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC) .Where(whereList).ToQueryPageAsync(request.PageCondition); } @@ -39,7 +40,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction public async Task> GetAsync(long id) { var entity = await TenantDb.Queryable() - .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(); return DataResult.Success(entity); @@ -53,8 +54,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction public async Task GetAsync(string name) { return await TenantDb.Queryable() - .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.Attachments).Includes(x => x.CC) - .Where(x => x.Name == name).FirstAsync(); + .Includes(x => x.Receiver).Includes(x => x.Sender).Includes(x => x.CC).Includes(x => x.Attachments) + .Where(x => x.Name.Contains(name)).FirstAsync(); } /// @@ -73,11 +74,15 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction taskMail.Sender ??= 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 { - 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) @@ -86,8 +91,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction foreach (var item in list) item.TaskMailId = taskMail.Id; - await TenantDb.Deleteable().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync(); - await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync(); + //await TenantDb.Deleteable().Where(x => x.TaskMailId == taskMail.Id).ExecuteCommandAsync(); + //await TenantDb.Insertable(taskMail.Attachments).ExecuteCommandAsync(); + + await TenantDb.Storageable(taskMail.Attachments).DefaultAddElseUpdate().ExecuteCommandAsync(); } await TenantDb.Ado.CommitTranAsync(); @@ -113,7 +120,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction try { await TenantDb.DeleteNav(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(); await TenantDb.Ado.CommitTranAsync(); @@ -127,6 +134,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction } } - } }