diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs index ae0d3281..8a82159f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs @@ -5,9 +5,11 @@ using Coravel.Invocable; using EFCore.BulkExtensions; using LinqToDB; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; +using Win.Sfs.SettleAccount.Entities.BQ.Vmi; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { @@ -42,6 +44,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs using var serviceScope = _serviceProvider.CreateScope(); var db = serviceScope.ServiceProvider.GetRequiredService(); + + await HandDelEdiDataAsync().ConfigureAwait(false); var seDetailGroup = db.Set() @@ -90,7 +94,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { await transaction.RollbackAsync().ConfigureAwait(false); } + + } + //var ediReturnQuery = db.Set().FromSqlRaw("SELECT a.* FROM Set_BBAC_SE_DETAIL a right join (SELECT PN,CustomerPartCodeNoSpace,sum(Qty) as Qty FROM Set_BBAC_SE_DETAIL group by PN,CustomerPartCodeNoSpace having sum(Qty)=0) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace"); + var ediReturnQuery = db.Set().FromSqlRaw("select * from (SELECT a.* FROM [dbo].[Set_BBAC_SE_EDI] a right join (SELECT PN,CustomerPartCodeNoSpace,sum(Qty) as Qty FROM Set_BBAC_SE_DETAIL group by PN,CustomerPartCodeNoSpace having sum(Qty)=0) b on a.PN=b.PN and a.CustomerPartCodeNoSpace=b.CustomerPartCodeNoSpace and a.IsHaveSeData=1) c where c.id is not null"); + var ediReturnEntities = ediReturnQuery.ToList(); + if(ediReturnEntities.Count>0) + { + ediReturnEntities.ForEach(t => t.IsHaveSeData = false); + await db.BulkUpdateAsync(ediReturnEntities).ConfigureAwait(false); } + } ///