From 310ed29af2bf6403f5dd8bab92bd858382fe6a4d Mon Sep 17 00:00:00 2001 From: 18942506660 <18942506660@A18942506660> Date: Wed, 15 Nov 2023 09:55:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8D=95=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E5=8D=95=E8=B0=83=E6=95=B4=E4=B8=BA=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml | 10 +++++----- src/WMS.Web.Domain/Entitys/OutStockTask.cs | 9 ++------- src/WMS.Web.Domain/Entitys/OutStockTaskDetails.cs | 5 +++++ src/WMS.Web.Domain/Mappers/OutStockMapper.cs | 3 ++- .../Services/OutStockTaskService.cs | 15 +++++++-------- .../Configuration/RepositoryDbContext.cs | 4 ++++ .../OutStockTaskRepositories.cs | 8 ++++---- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index bb947823..57b610be 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -968,11 +968,6 @@ 单据编号 - - - 来源单号 - - 发货组织 @@ -1059,6 +1054,11 @@ 对应金蝶单据明细id(销售出库同步金蝶下推使用) + + + 来源单号(合并后有多个) + + 销售订单号 diff --git a/src/WMS.Web.Domain/Entitys/OutStockTask.cs b/src/WMS.Web.Domain/Entitys/OutStockTask.cs index 2c82782d..9792ab26 100644 --- a/src/WMS.Web.Domain/Entitys/OutStockTask.cs +++ b/src/WMS.Web.Domain/Entitys/OutStockTask.cs @@ -28,11 +28,6 @@ namespace WMS.Web.Domain.Entitys [Column("BillNo")] public string BillNo { get; set; } /// - /// 来源单号 - /// - [Column("SourceBillNo")] - public string SourceBillNo { get; set; } - /// /// 发货组织 /// [Column("DeliveryOrgId")] @@ -71,10 +66,10 @@ namespace WMS.Web.Domain.Entitys /// 明细 /// public List Details = new List(); - public void Create(OutStockType type, string sourceBillNo, int deliveryOrgId, int receiptCustomerId, DateTime createTime) + public void Create(OutStockType type, int deliveryOrgId, int receiptCustomerId, DateTime createTime) { this.Type = type; - this.SourceBillNo = sourceBillNo; + //this.SourceBillNos.Add(sourceBillNo); this.DeliveryOrgId = deliveryOrgId; this.ReceiptCustomerId = receiptCustomerId; this.CreateTime = createTime; diff --git a/src/WMS.Web.Domain/Entitys/OutStockTaskDetails.cs b/src/WMS.Web.Domain/Entitys/OutStockTaskDetails.cs index 6dca3b95..d76d5f9c 100644 --- a/src/WMS.Web.Domain/Entitys/OutStockTaskDetails.cs +++ b/src/WMS.Web.Domain/Entitys/OutStockTaskDetails.cs @@ -32,6 +32,11 @@ namespace WMS.Web.Domain.Entitys [Column("Erp_DetailId")] public int Erp_DetailId { get; set; } /// + /// 来源单号(合并后有多个) + /// + [Column("SourceBillNo")] + public List SourceBillNos { get; set; } + /// /// 销售订单号 /// [Column("SaleBillNo")] diff --git a/src/WMS.Web.Domain/Mappers/OutStockMapper.cs b/src/WMS.Web.Domain/Mappers/OutStockMapper.cs index 94d4b627..6cf9ac0b 100644 --- a/src/WMS.Web.Domain/Mappers/OutStockMapper.cs +++ b/src/WMS.Web.Domain/Mappers/OutStockMapper.cs @@ -24,7 +24,8 @@ namespace WMS.Web.Domain.Mappers CreateMap(); CreateMap(); - CreateMap(); + CreateMap() + .ForPath(x => x.SourceBillNos, ops => ops.MapFrom(x =>new List() { x.SourceBillNo })); } } } diff --git a/src/WMS.Web.Domain/Services/OutStockTaskService.cs b/src/WMS.Web.Domain/Services/OutStockTaskService.cs index 68903152..d2f92027 100644 --- a/src/WMS.Web.Domain/Services/OutStockTaskService.cs +++ b/src/WMS.Web.Domain/Services/OutStockTaskService.cs @@ -106,7 +106,7 @@ namespace WMS.Web.Domain.Services foreach (var e in erp_list) { //代表单据已经存在 那么就对单据进行修改 - var data = data_list.FirstOrDefault(f => f.SourceBillNo == e.SourceBillNo); + var data = data_list.FirstOrDefault(f => f.Details.SelectMany(s => s.SourceBillNos).Contains(e.SourceBillNo)); var detail = data.Details.FirstOrDefault(w => w.MaterialId == e.MaterialId); //存在就修改,没有就添加 if (detail != null) @@ -134,8 +134,7 @@ namespace WMS.Web.Domain.Services { var e = erp_list.FirstOrDefault(f => f.SourceBillNo == item); var dto = new OutStockTask(); - dto.SourceBillNo = e.SourceBillNo; - dto.Create((OutStockType)e.Type, e.SourceBillNo, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime); + dto.Create((OutStockType)e.Type, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime); //找到当前对应来源单据编号的集合数据 var current_erp_details = erp_list.Where(x => x.SourceBillNo == item).ToList(); @@ -282,15 +281,15 @@ namespace WMS.Web.Domain.Services foreach (var entity in taskList) { if (entity.Type == OutStockType.Sal) - DeliveryNotice_Nos.Add(entity.SourceBillNo); + DeliveryNotice_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos)); else if (entity.Type == OutStockType.Stkdirecttransfers) - TransferDirect_Nos.Add(entity.SourceBillNo); + TransferDirect_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos)); else if (entity.Type == OutStockType.StktransferInst) - TransferOut_Nos.Add(entity.SourceBillNo); + TransferOut_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos)); else if (entity.Type == OutStockType.Assembled) - AssembledApp_Nos.Add(entity.SourceBillNo); + AssembledApp_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos)); else if (entity.Type == OutStockType.Miscellaneous) - MisDeliveryOut_Nos.Add(entity.SourceBillNo); + MisDeliveryOut_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos)); } if (DeliveryNotice_Nos.Count() > 0) diff --git a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs index 952dad35..fbbfe081 100644 --- a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs +++ b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs @@ -112,6 +112,10 @@ namespace WMS.Web.Repositories.Configuration { ent.ToTable("t_erp_outstock_task_details"); ent.HasKey(x => x.Id); + + ent.Property(f => f.SourceBillNos).HasConversion( + v => JsonConvert.SerializeObject(v), + v => JsonConvert.DeserializeObject>(v)); }); #endregion diff --git a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs index af812d35..7f5a005c 100644 --- a/src/WMS.Web.Repositories/OutStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/OutStockTaskRepositories.cs @@ -263,7 +263,7 @@ namespace WMS.Web.Repositories if (dto.Ids.Count() > 0) query = query.Where(w => dto.Ids.Contains(w.detail.Id)); if (!string.IsNullOrEmpty(dto.SourceBillNo)) - query = query.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%")); + query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo)); if (dto.Type != null) query = query.Where(w => w.order.Type == (OutStockType)dto.Type); if (dto.Status != null) @@ -290,7 +290,7 @@ namespace WMS.Web.Repositories OutStockBeginTime = s.detail.OutStockBeginTime.DateToStringSeconds(), OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(), Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode), - SourceBillNo = s.order.SourceBillNo, + SourceBillNo = string.Join(",", s.detail.SourceBillNos.Select(x => x)), SaleBillNo = s.detail.SaleBillNo, DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId), ReceiptCustomer = s.order.Type == OutStockType.Sal @@ -319,7 +319,7 @@ namespace WMS.Web.Repositories var list = await _context.OutStockTask.Include(x => x.Details) .Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") || - EF.Functions.Like(f.SourceBillNo, "%" + billNo + "%")) && + f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) && (f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait)) .OrderByDescending(o => o.Id) .ToListAsync(); @@ -419,7 +419,7 @@ namespace WMS.Web.Repositories { return await _context.OutStockTask.Include(x => x.Details) .Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") || - EF.Functions.Like(f.SourceBillNo, "%" + billNo + "%")) && + f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) && (f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait)) .OrderByDescending(o => o.Id) .Select(s => s.BillNo)