mahao
1 year ago
6 changed files with 5520 additions and 2 deletions
@ -0,0 +1,44 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Coravel.Invocable; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using SettleAccount.Domain.BQ; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// JisBBAC 发运数据与EDI数据对比
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(IgnoreApi = true)] |
||||
|
public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable |
||||
|
{ |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
public JisBBACSeEdiCompareAppService(IServiceProvider serviceProvider) |
||||
|
{ |
||||
|
_serviceProvider = serviceProvider; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行
|
||||
|
/// </summary>
|
||||
|
public async Task Invoke() |
||||
|
{ |
||||
|
using var serviceScope = _serviceProvider.CreateScope(); |
||||
|
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
||||
|
var query = db.Set<BBAC_SE_DETAIL>().Join(db.Set<BBAC_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false); |
||||
|
var ses = query.Select(t => t.se); |
||||
|
var edis = query.Select(t => t.edi); |
||||
|
|
||||
|
ses.ForEach(t => t.IsHaveEdiData = true); |
||||
|
edis.ForEach(t => t.IsHaveSeData = true); |
||||
|
|
||||
|
db.Set<BBAC_SE_DETAIL>().UpdateRange(ses); |
||||
|
db.Set<BBAC_SE_EDI>().UpdateRange(edis); |
||||
|
await db.SaveChangesAsync().ConfigureAwait(false); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,56 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202308103 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("96b1beec-0eef-4ae5-880b-23678addb759")); |
||||
|
|
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsHaveSeData", |
||||
|
table: "Set_BBAC_SE_EDI", |
||||
|
type: "bit", |
||||
|
nullable: false, |
||||
|
defaultValue: false); |
||||
|
|
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsHaveEdiData", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "bit", |
||||
|
nullable: false, |
||||
|
defaultValue: false); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiBalance", |
||||
|
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
||||
|
values: new object[] { new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "1d0093aa74814ffd982671a5ac362c52", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("824c911a-6915-42a3-8bb2-bcb4aca93545")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsHaveSeData", |
||||
|
table: "Set_BBAC_SE_EDI"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsHaveEdiData", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiBalance", |
||||
|
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
||||
|
values: new object[] { new Guid("96b1beec-0eef-4ae5-880b-23678addb759"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "ebf2d34687e14358a9d63dbe3df7abd3", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue