diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs index 0a6598c3..5bbd5503 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs @@ -30,21 +30,6 @@ namespace Win.Sfs.SettleAccount.Entities.BT_Car [ImporterHeader(Name = "物料凭证号")] public string MaterialVoucherNo { get; set; } - /// - ///会计年度 - /// - [ImporterHeader(Name = "会计年度")] - public string Year { get; set; } - /// - /// 期间 - /// - [ImporterHeader(Name = "期间")] - public string Period { set; get; } - /// - /// 版本号 - /// - [ImporterHeader(Name = "版本号")] - public string Version { set; get; } /// /// 看板号 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs index 5eccabe0..c48b1537 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs @@ -84,12 +84,13 @@ namespace Win.Sfs.SettleAccount.Entities.BT_Car await _query.BatchDeleteAsync(); //插入数据前检验 var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.KanbanNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), KanbanNumber = p.Key.KanbanNumber, MaterialCode = p.Key.MaterialCode }); + var _group = entityList.GroupBy(x => new { x.Factory, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory }); foreach (var itm in _group) { - if (string.IsNullOrEmpty(itm.KanbanNumber)) + if (itm.Factory != "001") { - checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的零件号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.KanbanNumber), string.Empty)); + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + break; } } var _id = GuidGenerator.Create(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs index 57a9c452..dd7b82be 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs @@ -84,12 +84,13 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_F await _query.BatchDeleteAsync(); //插入数据前检验 var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.HQHKanBan, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), HQHKanBan = p.Key.HQHKanBan, MaterialCode = p.Key.MaterialCode }); + var _group = entityList.GroupBy(x => new { x.Factory, x.HQHKanBan, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory, HQHKanBan = p.Key.HQHKanBan }); foreach (var itm in _group) { - if (string.IsNullOrEmpty(itm.HQHKanBan)) + if (itm.Factory != "F") { - checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的物料号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.HQHKanBan), string.Empty)); + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + break; } } var _id = GuidGenerator.Create(); @@ -97,8 +98,15 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_F _bomList.Add(new HQ_F_PlatformVersion(_id, branchId, year, period, version, customerCode)); foreach (var itm in entityList) { - //赋值上主键ID - itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + if (string.IsNullOrEmpty(itm.HQHKanBan) && itm.StorageLocationDesc.Contains("备品库")) + { + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version,"BJ"); + } + else + { + //赋值上主键ID + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + } } if (checkList.Count > 0) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs index 178e5fc1..cea4e52d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs @@ -82,14 +82,16 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H //删除明细 var _query = _repository.Where(p => p.Version == version); await _query.BatchDeleteAsync(); + //插入数据前检验 var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.HQHKanBan, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), HQHKanBan = p.Key.HQHKanBan, MaterialCode = p.Key.MaterialCode }); + var _group = entityList.GroupBy(x => new { x.Factory, x.HQHKanBan, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory, HQHKanBan = p.Key.HQHKanBan }); foreach (var itm in _group) { - if (string.IsNullOrEmpty(itm.HQHKanBan)) + if (itm.Factory != "H") { - checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的物料号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.HQHKanBan), string.Empty)); + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + break; } } var _id = GuidGenerator.Create(); @@ -97,8 +99,15 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H _bomList.Add(new HQ_H_PlatformVersion(_id, branchId, year, period, version, customerCode)); foreach (var itm in entityList) { - //赋值上主键ID - itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + if (string.IsNullOrEmpty(itm.HQHKanBan) && itm.StorageLocationDesc.Contains("备品库")) + { + //赋值上主键ID + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, "BJ");//备品库没有看板号,需要特殊标识一下BJ,已经和客户确认 + } + else + { + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + } } if (checkList.Count > 0) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_M/HQ_M_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_M/HQ_M_PlatformAppService.cs index c0c13f65..cb1e58c1 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_M/HQ_M_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_M/HQ_M_PlatformAppService.cs @@ -84,12 +84,13 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_M await _query.BatchDeleteAsync(); //插入数据前检验 var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.HQMKanBan, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), Type = p.Key.HQMKanBan, MaterialCode = p.Key.MaterialCode }); + var _group = entityList.GroupBy(x => new { x.Factory, x.HQMKanBan, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory, HQHKanBan = p.Key.HQMKanBan }); foreach (var itm in _group) { - if (string.IsNullOrEmpty(itm.Type)) + if (itm.Factory != "M") { - checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的物料号{0},其看板号{1}有空,请检查!", itm.MaterialCode, itm.Type), string.Empty)); + checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + break; } } var _id = GuidGenerator.Create(); @@ -97,8 +98,15 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_M _bomList.Add(new HQ_M_PlatformVersion(_id, branchId, year, period, version, customerCode)); foreach (var itm in entityList) { - //赋值上主键ID - itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + if (string.IsNullOrEmpty(itm.HQMKanBan) && itm.StorageLocationDesc.Contains("备品库")) + { + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version,"BJ"); + } + else + { + //赋值上主键ID + itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + } } if (checkList.Count > 0) { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 2b62117f..51cd3ac8 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -86,6 +86,7 @@ using Win.Sfs.SettleAccount.Entities.WMSSparePart; using Win.Sfs.SettleAccount.Entities.HQ_H; using Win.Sfs.SettleAccount.Entities.HQ_M; using Win.Sfs.SettleAccount.Entities.HQ_F; +using Win.Sfs.SettleAccount.Entities.BT_Car; namespace Win.Sfs.SettleAccount { @@ -235,11 +236,39 @@ namespace Win.Sfs.SettleAccount CreateMapHQ_F_Platform(); CreateMapHQ_F_PlatformVersion(); + //一汽轿车 + CreateMapBT_Car_Platform(); + CreateMapBT_Car_PlatformVersion(); #endregion } #region PG-派格映射 + /// + /// 红旗F平台导入 + /// + private void CreateMapBT_Car_Platform() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + } + + /// + /// 红旗F平台-版本 + /// + private void CreateMapBT_Car_PlatformVersion() + + { + CreateMap().ReverseMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + } /// /// 红旗F平台导入 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs index 2b673fc8..ac90c240 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs @@ -13,6 +13,16 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_F public HQ_F_Platform() { } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version,string kanban) + { + Period = peroid; + Year = year; + Id = guid; + Version = version; + BranchId = branchId; + HQHKanBan = kanban; + } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) { Period = peroid; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs index c34f59d0..84d0d014 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs @@ -13,6 +13,16 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H public HQ_H_Platform() { } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version,string kanban) + { + Period = peroid; + Year = year; + Id = guid; + Version = version; + BranchId = branchId; + HQHKanBan = kanban; + } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) { Period = peroid; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Platform.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Platform.cs index 779fb3b9..8ae8dd06 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Platform.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Platform.cs @@ -13,6 +13,15 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_M public HQ_M_Platform() { } + public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version,string kanban) + { + Period = peroid; + Year = year; + Id = guid; + Version = version; + BranchId = branchId; + HQMKanBan = kanban; + } public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) { Period = peroid; diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 1523b99f..19fded44 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -421,59 +421,6 @@ namespace Win.Sfs.SettleAccount } - - - - - /// - /// 一汽轿车平台验收结算明细-导入 - /// - /// - /// - private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) - { - - builder.Entity(b => - { - - b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema); - - b.ConfigureByConvention(); - b.Property(x => x.HQCarKanBan).HasMaxLength(150);//看板号(一汽轿车没有看板号) - b.Property(x => x.MaterialVoucherNo).HasMaxLength(150); - b.Property(x => x.Factory).HasMaxLength(50); - b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); - b.Property(x => x.ExternalKanbanNumber).HasMaxLength(50); - b.Property(x => x.KanbanNumber).HasMaxLength(150);//看板编号 - b.Property(x => x.Period).HasMaxLength(50); - b.Property(x => x.Year).HasMaxLength(50); - b.Property(x => x.Version).HasMaxLength(50); - b.Property(x => x.Supplier).HasMaxLength(50); - b.Property(x => x.StorageLocation).HasMaxLength(50); - b.Property(x => x.StorageLocationDesc).HasMaxLength(150); - //创建组合索引 - b.HasIndex(x => new { x.Version, x.KanbanNumber, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); - - }); - } - - private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) - { - - builder.Entity(b => - { - b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema); - b.ConfigureByConvention(); - b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); - b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength); - b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); - }); - - } - - /// /// 红旗工厂F平台验收结算明细-导入 /// @@ -488,7 +435,7 @@ namespace Win.Sfs.SettleAccount b.ToTable($"{options.TablePrefix}_HQ_F_Platform", options.Schema); b.ConfigureByConvention(); - b.Property(x => x.HQHKanBan).IsRequired().HasMaxLength(150);//必填项 + b.Property(x => x.HQHKanBan).HasMaxLength(150);//看板号有空的情况,如备品库 b.Property(x => x.MaterialVoucherNo).HasMaxLength(150); b.Property(x => x.Factory).HasMaxLength(50); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); @@ -502,7 +449,7 @@ namespace Win.Sfs.SettleAccount b.Property(x => x.StorageLocationDesc).HasMaxLength(150); b.Property(x => x.AcceptanceNo).HasMaxLength(50); //创建组合索引 - b.HasIndex(x => new { x.Version, x.HQHKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); + //b.HasIndex(x => new { x.Version, x.HQHKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); }); } @@ -550,7 +497,7 @@ namespace Win.Sfs.SettleAccount b.Property(x => x.StorageLocation).HasMaxLength(50); b.Property(x => x.StorageLocationDesc).HasMaxLength(150); //创建组合索引 - b.HasIndex(x => new { x.Version, x.KanbanNumber, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); + //b.HasIndex(x => new { x.Version, x.KanbanNumber, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); }); } @@ -614,7 +561,7 @@ namespace Win.Sfs.SettleAccount b.ToTable($"{options.TablePrefix}_HQ_M_Platform", options.Schema); b.ConfigureByConvention(); - b.Property(x => x.HQMKanBan).IsRequired().HasMaxLength(150);//必填项 + b.Property(x => x.HQMKanBan).HasMaxLength(150);//有空的情况 b.Property(x => x.MaterialVoucherNo).HasMaxLength(150); b.Property(x => x.Factory).HasMaxLength(50); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); @@ -627,7 +574,7 @@ namespace Win.Sfs.SettleAccount b.Property(x => x.StorageLocation).HasMaxLength(50); b.Property(x => x.StorageLocationDesc).HasMaxLength(150); //创建组合索引 - b.HasIndex(x => new { x.Version, x.HQMKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); + //b.HasIndex(x => new { x.Version, x.HQMKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); }); } @@ -662,7 +609,8 @@ namespace Win.Sfs.SettleAccount b.ToTable($"{options.TablePrefix}_HQ_H_Platform", options.Schema); b.ConfigureByConvention(); - b.Property(x => x.HQHKanBan).IsRequired().HasMaxLength(150);//必填项 + //b.Property(x => x.HQHKanBan).IsRequired().HasMaxLength(150);//必填项 + b.Property(x => x.HQHKanBan).HasMaxLength(150);//有空的情况 b.Property(x => x.MaterialVoucherNo).HasMaxLength(150); b.Property(x => x.Factory).HasMaxLength(50); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); @@ -677,7 +625,7 @@ namespace Win.Sfs.SettleAccount b.Property(x => x.AcceptanceNo).HasMaxLength(50); //创建组合索引 - b.HasIndex(x => new { x.Version, x.HQHKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); + //b.HasIndex(x => new { x.Version, x.HQHKanBan, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); }); }