From 4fdb8b96d180598a5efde0a0a79a4cd2734425e2 Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Wed, 15 Nov 2023 13:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Api/Controllers/TestController.cs | 35 ------------------- src/WMS.Web.Domain/QuartzJob/BoxQuartzJob.cs | 6 ++-- .../DependencyInjection/AppBuilder.cs | 4 +-- .../OutStockTaskRepositories.cs | 21 +++++++---- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/src/WMS.Web.Api/Controllers/TestController.cs b/src/WMS.Web.Api/Controllers/TestController.cs index 6eda2ea1..0fdd219e 100644 --- a/src/WMS.Web.Api/Controllers/TestController.cs +++ b/src/WMS.Web.Api/Controllers/TestController.cs @@ -44,41 +44,6 @@ namespace WMS.Web.Api.Controllers [Route("hj")] public async Task TestHJ() { - OutStockTask entity = new OutStockTask() - { - DeliveryOrgId = 1, - ReceiptCustomerId = 1 - }; - try - { - var d = new OutStockTaskDetails(); - - d.MaterialId = 1; - d.AccruedQty = 1; - d.Erp_DetailId = 1; - d.SaleBillNo = "sdf34343"; - d.StockCode = "234"; - d.SubStockId =234; - d.SourceBillNos = new List() { "wwre", "32423" }; - entity.Details.Add(d); - } - catch (Exception ex) - { - - throw ex; - } - entity.Details.Add(new OutStockTaskDetails() - { - MaterialId = 1, - AccruedQty = 1, - Erp_DetailId = 1, - SaleBillNo = "ddddd", - StockCode = "ddd", - SubStockId = 1 - }); - - var b = await _outStockTaskRepositories.Add(entity, true); - var bc = await _outStockTaskRepositories.Get(entity.Id); // await _boxService.Sync(); //var res = await this._erpService.BillQueryForDeliveryNoticeOutStock(null,DateTime.Now.AddDays(-300)); //var result= await this._erpService.BillQueryForPurchaseInStock(); diff --git a/src/WMS.Web.Domain/QuartzJob/BoxQuartzJob.cs b/src/WMS.Web.Domain/QuartzJob/BoxQuartzJob.cs index 982291d8..614823f6 100644 --- a/src/WMS.Web.Domain/QuartzJob/BoxQuartzJob.cs +++ b/src/WMS.Web.Domain/QuartzJob/BoxQuartzJob.cs @@ -34,17 +34,17 @@ namespace WMS.Web.Domain.QuartzJob { //2.记录:开始时间 var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); - _logger.LogInformation($"出库单-同步金蝶入库单数据:执行开始时间->{begindatetime}"); + _logger.LogInformation($"箱信息-同步箱信息数据:执行开始时间->{begindatetime}"); //3.同步数据 var result = await _boxService.Sync(); //5.记录:结束时间 var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); - _logger.LogInformation($"出库单-同步金蝶入库单数据:执行结束时间->{begindatetime}"); + _logger.LogInformation($"箱信息-同步箱信息数据:执行结束时间->{begindatetime}"); } catch (Exception ex) { - _logger.LogInformation($"同步金蝶入库单数据:定时任务执行失败->{ex.Message}"); + _logger.LogInformation($"同步箱信息数据:定时任务执行失败->{ex.Message}"); } } diff --git a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs index 310c1374..945252ed 100644 --- a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs +++ b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs @@ -232,7 +232,7 @@ namespace WMS.Web.Repositories.DependencyInjection #region 出库任务单 var jobKey_out = new JobKey("OutStockOrderQuartzJob", options.QuartzJobValue); - q.AddJob(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob")); + q.AddJob(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob")); q.AddTrigger(t => t .WithIdentity("OutStockOrderQuartzJobTrigger") .ForJob(jobKey_out) @@ -244,7 +244,7 @@ namespace WMS.Web.Repositories.DependencyInjection #region 箱信息老ops var jobKey_box = new JobKey("BoxQuartzJob", options.QuartzJobValue); - q.AddJob(jobKey_box, j => j.WithDescription("BoxQuartzJob")); + q.AddJob(jobKey_box, j => j.WithDescription("BoxQuartzJob")); q.AddTrigger(t => t .WithIdentity("BoxQuartzJobTrigger") .ForJob(jobKey_box) diff --git a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs index 4e620696..95e19a33 100644 --- a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs @@ -216,6 +216,11 @@ namespace WMS.Web.Repositories /// public async Task<(List list, int total)> GetListAsync(OutStockTaskQueryRequest dto) { + List ids = new List(); + if (!string.IsNullOrEmpty(dto.SourceBillNo)) + ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync(); + + #region erp基础资料 List mIds = new List(); var materials_result = await _erpService.BillQueryForMaterial(); @@ -262,10 +267,8 @@ namespace WMS.Web.Repositories query = query.Where(w => mIds.Contains(w.detail.MaterialId)); if (dto.Ids.Count() > 0) query = query.Where(w => dto.Ids.Contains(w.detail.Id)); - if (!string.IsNullOrEmpty(dto.SourceBillNo)) - query = query.Where(w => w.detail.SourceBillNos.Contains(dto.SourceBillNo)); - //query = query.Where(w => EF.Functions.Like(w.detail.SourceBillNos, "%" + dto.SourceBillNo + "%")); - //query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo)); + if (ids.Count() != 0) + query = query.Where(w => ids.Contains(w.detail.Id)); if (dto.Type != null) query = query.Where(w => w.order.Type == (OutStockType)dto.Type); if (dto.Status != null) @@ -319,9 +322,12 @@ namespace WMS.Web.Repositories return new List(); var materials = materials_result.Data.ToList(); + List ids = new List(); + ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync(); + var list = await _context.OutStockTask.Include(x => x.Details) .Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") || - f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) && + ids.Contains(f.Id)) && (f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait)) .OrderByDescending(o => o.Id) .ToListAsync(); @@ -419,9 +425,12 @@ namespace WMS.Web.Repositories public async Task> GetOutStockTaskNosByNo(string billNo) { + List ids = new List(); + ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync(); + return await _context.OutStockTask.Include(x => x.Details) .Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") || - f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) && + ids.Contains(f.Id)) && (f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait)) .OrderByDescending(o => o.Id) .Select(s => s.BillNo)