mahao
1 year ago
15 changed files with 6320 additions and 200 deletions
@ -0,0 +1,42 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
||||
|
using Win.Sfs.Shared.RepositoryBase; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers; |
||||
|
/// <summary>
|
||||
|
/// 客户零件关系
|
||||
|
/// </summary>
|
||||
|
public class MaterialRelationshipManager : DomainService |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 客户零件关系仓储
|
||||
|
/// </summary>
|
||||
|
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _materialRelationshipRepository; |
||||
|
|
||||
|
public MaterialRelationshipManager(INormalEfCoreRepository<MaterialRelationship, Guid> materialRelationshipRepository) |
||||
|
{ |
||||
|
_materialRelationshipRepository = materialRelationshipRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 添加零件关系
|
||||
|
/// </summary>
|
||||
|
public async Task AddNewMaterialRelationships(IEnumerable<MaterialRelationship> materialRelationships) |
||||
|
{ |
||||
|
//客户零件号和厂内零件号
|
||||
|
var luRePartCodes = materialRelationships.Select(t => new { t.ErpMaterialCode, t.SettleMaterialCode }).Distinct().ToList(); |
||||
|
var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository, |
||||
|
a => new { a.ErpMaterialCode, a.SettleMaterialCode }, |
||||
|
b => new { b.ErpMaterialCode, b.SettleMaterialCode }, |
||||
|
(a, b) => a).ToList(); |
||||
|
var noHaveLuRePartCodes = materialRelationships.Except(haveLuRePartCodes).ToList(); |
||||
|
if (noHaveLuRePartCodes.Any()) |
||||
|
{ |
||||
|
await _materialRelationshipRepository.InsertManyAsync(noHaveLuRePartCodes).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,368 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202308153 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("75ce4934-06de-4cac-a1f0-536935975b38")); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "Num", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
newName: "PartDesc"); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "Num", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
newName: "PartDesc"); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<DateTime>( |
||||
|
name: "BillTime", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(DateTime), |
||||
|
oldType: "datetime2"); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "BillNum", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "BillType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "DeliverBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "DeliverSubBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Factory", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "JISNum", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "ProType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "State", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "SubBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "TransType", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<DateTime>( |
||||
|
name: "BillTime", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(DateTime), |
||||
|
oldType: "datetime2"); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "BillNum", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "BillType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "DeliverBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "DeliverSubBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Factory", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "JISNum", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "ProType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "State", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "SubBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "TransType", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
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("c085a562-1da9-4dd3-8e65-85e4518f1383"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4b83550d90bf425493e93dcd552a0bd1", 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("c085a562-1da9-4dd3-8e65-85e4518f1383")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BillNum", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BillType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "DeliverBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "DeliverSubBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Factory", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "JISNum", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ProType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "State", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "SubBillType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "TransType", |
||||
|
table: "Set_HBPO_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BillNum", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BillType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "DeliverBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "DeliverSubBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Factory", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "JISNum", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ProType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "State", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "SubBillType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "TransType", |
||||
|
table: "Set_BBAC_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "PartDesc", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
newName: "Num"); |
||||
|
|
||||
|
migrationBuilder.RenameColumn( |
||||
|
name: "PartDesc", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
newName: "Num"); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<DateTime>( |
||||
|
name: "BillTime", |
||||
|
table: "Set_HBPO_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), |
||||
|
oldClrType: typeof(DateTime), |
||||
|
oldType: "datetime2", |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<DateTime>( |
||||
|
name: "BillTime", |
||||
|
table: "Set_BBAC_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), |
||||
|
oldClrType: typeof(DateTime), |
||||
|
oldType: "datetime2", |
||||
|
oldNullable: 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("75ce4934-06de-4cac-a1f0-536935975b38"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "8e865c8947ea4381b1b48c3ee4d572b4", 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