From 1fb0ed9ed42ea4bd65100c404f6a56b54afe19fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 4 Sep 2023 10:19:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ/Syncs/PendingDeductionService.cs | 35 ++++++++++++------- .../SettleAccountApplicationModule.cs | 4 ++- .../Entities/BQ/Managers/INV_MNG.cs | 9 ----- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs index b55db613..62e11260 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs @@ -21,6 +21,7 @@ using TaskJob.Interfaces; using Volo.Abp.Application.Services; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; +using Volo.Abp.Emailing; using Volo.Abp.Uow; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; @@ -33,12 +34,16 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, protected readonly SettleAccountDbContext _dbcontext; + private readonly IEmailSender _emailSender; + public PendingDeductionService( - SettleAccountDbContext dbcontext - + SettleAccountDbContext dbcontext, + + IEmailSender emailSender ) { + _emailSender = emailSender; _dbcontext = dbcontext; } @@ -49,6 +54,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, var billList = property.Where(p => p.Name == "BillNumList").FirstOrDefault().Value; var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value; var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value; + var email = property.Where(p => p.Name == "CurrentUserEmail").FirstOrDefault().Value; var list = billList.Split(","); var projectList = _dbcontext.Set().Where(p => p.Project == "库位"); @@ -76,7 +82,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; } } - Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false); } // var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件 @@ -93,7 +99,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; } } - Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false); } var detailist1 = _dbcontext.Set().Where(p => list.Contains(p.BillNum) ).ToList(); @@ -112,7 +118,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "ZhiGongJianBBAC顺义").Description; } } - Sync(zgbbaclist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); + Sync(zgbbaclist, EnumDeliverBjBmpBillType.JIT直供件,email, isout == "out" ? true : false); var ydlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); if (ydlist.Count > 0) { @@ -123,7 +129,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "YinDuJian").Description; } } - Sync(ydlist, EnumDeliverBjBmpBillType.印度件, isout == "out" ? true : false); + Sync(ydlist, EnumDeliverBjBmpBillType.印度件, email,isout == "out" ? true : false); } var bjlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList(); if (bjlist.Count > 0) @@ -135,7 +141,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "BeiJian").Description; } } - Sync(bjlist, EnumDeliverBjBmpBillType.北汽4S备件, isout == "out" ? true : false); + Sync(bjlist, EnumDeliverBjBmpBillType.北汽4S备件,email ,isout == "out" ? true : false); } } } @@ -149,7 +155,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = "CC017"; } } - Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + Sync(detailist, EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false); var mdetail = _dbcontext.Set().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件 foreach (var itm in mdetail) { @@ -158,7 +164,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = "CC017"; } } - Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); + Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false); var detailist1 = _dbcontext.Set().Where(p => list.Contains(p.BillNum)).ToList(); var zgbbaclist = detailist1.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianHBPO).ToList(); foreach (var itm in zgbbaclist) @@ -168,7 +174,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, itm.Extend2 = "CC017"; } } - Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); + Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件,email,isout == "out" ? true : false); } return id.ToString(); @@ -189,10 +195,8 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, // return pageCount; //} - public void Sync(List p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new() + public void Sync(List p_ls, EnumDeliverBjBmpBillType bussinessType,string p_email ,bool flag=true) where T : PD_BASE,new() { - - var query = from itm in p_ls select new VmiLog() { @@ -290,6 +294,11 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, _dbcontext.BulkUpdate(hbpoList); } } + + + + // _emailSender.SendAsync(e) + // 提交事务 transaction.Commit(); } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs index 0030ff59..934e41e5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs @@ -9,6 +9,8 @@ using Volo.Abp.AutoMapper; using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring.Minio; using Volo.Abp.Dapper; +using Volo.Abp.Emailing.Smtp; +using Volo.Abp.Emailing; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Identity; using Volo.Abp.Modularity; @@ -44,7 +46,7 @@ namespace Win.Sfs.SettleAccount ConfigureJson(context); //context.Services.AddTransient(typeof(INormalEfCoreRepository<,>), //typeof(SettleAccountNormalEfCoreRepository<,>)); - + context.Services.AddTransient(); context.Services.AddTransient(implementationFactory => { Func accesor = key => diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index a2e12a2b..e62b7828 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -415,12 +415,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers { return await _repository.Where(p => invs.Contains(p.InvbillNum)).ToListAsync(); } - - - - - - /// /// 客户已收票 /// @@ -724,9 +718,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers extend3: string.Empty, extend4: itm.PartCode, p_businessType:itm.BusinessType - - - ); entity.RELU = string.IsNullOrEmpty(itm.RealPartCode) ? itm.PartCode : itm.RealPartCode;//厂内替换零件号 entity.Extend2 = itm.ErpLoc;//ERP库位