学 赵
1 year ago
20 changed files with 11234 additions and 381 deletions
@ -0,0 +1,82 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Diagnostics; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Coravel.Invocable; |
||||
|
using LinqToDB; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using SettleAccount.Domain.BQ; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Win.Sfs.Shared.RepositoryBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// JisHBPO 发运数据与EDI数据对比
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(IgnoreApi = true)] |
||||
|
public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable |
||||
|
{ |
||||
|
private readonly IServiceProvider _serviceProvider; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// HBPO发运数据仓储
|
||||
|
/// </summary>
|
||||
|
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// HBPOEDI数据仓储
|
||||
|
/// </summary>
|
||||
|
private readonly INormalEfCoreRepository<HBPO_SE_EDI, Guid> _hbpoSeEdiRepository; |
||||
|
|
||||
|
public JisHBPOSeEdiCompareAppService( |
||||
|
IServiceProvider serviceProvider, |
||||
|
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository, INormalEfCoreRepository<HBPO_SE_EDI, Guid> hbpoSeEdiRepository) |
||||
|
{ |
||||
|
_serviceProvider = serviceProvider; |
||||
|
_hbpoSeDetailRepository = hbpoSeDetailRepository; |
||||
|
_hbpoSeEdiRepository = hbpoSeEdiRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行
|
||||
|
/// </summary>
|
||||
|
public async Task Invoke() |
||||
|
{ |
||||
|
Debug.WriteLine($"执行了:{this.GetType()}"); |
||||
|
using var serviceScope = _serviceProvider.CreateScope(); |
||||
|
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
||||
|
//var query = from se in db.Set<HBPO_SE_DETAIL>()
|
||||
|
// join edi in db.Set<HBPO_SE_EDI>() on new
|
||||
|
// {
|
||||
|
// se.LU,
|
||||
|
// se.PN,
|
||||
|
// se.Qty
|
||||
|
// } equals new
|
||||
|
// {
|
||||
|
// edi.LU,
|
||||
|
// edi.PN,
|
||||
|
// edi.Qty
|
||||
|
// }
|
||||
|
// where se.IsHaveEdiData == false && edi.IsHaveSeData == false
|
||||
|
// select new
|
||||
|
// {
|
||||
|
// se,
|
||||
|
// edi
|
||||
|
// };
|
||||
|
var query = db.Set<HBPO_SE_DETAIL>().Join(db.Set<HBPO_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<HBPO_SE_DETAIL>().UpdateRange(ses); |
||||
|
db.Set<HBPO_SE_EDI>().UpdateRange(edis); |
||||
|
await db.SaveChangesAsync().ConfigureAwait(false); |
||||
|
|
||||
|
Debug.WriteLine($"处理数量:{query.Count()}"); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,64 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202308101 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("6c0cbeb6-6530-4ede-ac96-d0f294f76086")); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "PartCode", |
||||
|
table: "Set_PUB_SA_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "PartCode", |
||||
|
table: "Set_HBPO_SA_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "PartCode", |
||||
|
table: "Set_BBAC_SA_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
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("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "3f981885343b41278337f1b6de40088b", 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("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "PartCode", |
||||
|
table: "Set_PUB_SA_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "PartCode", |
||||
|
table: "Set_HBPO_SA_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "PartCode", |
||||
|
table: "Set_BBAC_SA_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("6c0cbeb6-6530-4ede-ac96-d0f294f76086"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4d0aea6c7eb24ecf908624ef4ffc315a", 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 }); |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,67 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202308102 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9")); |
||||
|
|
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_SA_DETAIL", |
||||
|
type: "bit", |
||||
|
nullable: false, |
||||
|
defaultValue: false); |
||||
|
|
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_NOT_SA_DETAIL", |
||||
|
type: "bit", |
||||
|
nullable: false, |
||||
|
defaultValue: false); |
||||
|
|
||||
|
migrationBuilder.AddColumn<bool>( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_CAN_SA_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("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 }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("96b1beec-0eef-4ae5-880b-23678addb759")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_SA_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_NOT_SA_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "IsMaiDan", |
||||
|
table: "Set_BBAC_CAN_SA_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("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "3f981885343b41278337f1b6de40088b", 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