Browse Source

红旗及轿车后端代码

branch_ccpg_220107
44673626 3 years ago
parent
commit
4d62a12193
  1. 15
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BT_Car/BT_Car_PlatformImportDto.cs
  2. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BT_Car/BT_Car_PlatformAppService.cs
  3. 18
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs
  4. 19
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs
  5. 18
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_M/HQ_M_PlatformAppService.cs
  6. 29
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  7. 10
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Platform.cs
  8. 10
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs
  9. 9
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Platform.cs
  10. 68
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

15
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; }
/// <summary>
///会计年度
/// </summary>
[ImporterHeader(Name = "会计年度")]
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
[ImporterHeader(Name = "期间")]
public string Period { set; get; }
/// <summary>
/// 版本号
/// </summary>
[ImporterHeader(Name = "版本号")]
public string Version { set; get; }
/// <summary>
/// 看板号
/// </summary>

7
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<ErrorExportDto>();
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();

18
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<ErrorExportDto>();
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)
{

19
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<ErrorExportDto>();
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)
{

18
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<ErrorExportDto>();
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)
{

29
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-派格映射
/// <summary>
/// 红旗F平台导入
/// </summary>
private void CreateMapBT_Car_Platform()
{
CreateMap<BT_Car_Platform, BT_Car_PlatformDto>().ReverseMap();
CreateMap<BT_Car_Platform, BT_Car_PlatformRequestDto>().ReverseMap();
CreateMap<BT_Car_Platform, BT_Car_PlatformImportDto>().ReverseMap();
CreateMap<BT_Car_Platform, BT_Car_PlatformExportDto>().ReverseMap();
CreateMap<BT_Car_Platform, BT_Car_PlatformExportDto>().ReverseMap();
}
/// <summary>
/// 红旗F平台-版本
/// </summary>
private void CreateMapBT_Car_PlatformVersion()
{
CreateMap<BT_Car_PlatformVersion, BT_Car_PlatformVersionDto>().ReverseMap();
CreateMap<BT_Car_PlatformVersion, BT_Car_PlatformVersionCreateDto>();
CreateMap<BT_Car_PlatformVersion, BT_Car_PlatformVersionUpdateDto>();
CreateMap<BT_Car_PlatformVersionCreateDto, BT_Car_PlatformVersion>();
CreateMap<BT_Car_PlatformVersionUpdateDto, BT_Car_PlatformVersion>();
}
/// <summary>
/// 红旗F平台导入

10
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;

10
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;

9
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;

68
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -421,59 +421,6 @@ namespace Win.Sfs.SettleAccount
}
/// <summary>
/// 一汽轿车平台验收结算明细-导入
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HQ_Car_Platform>(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<HQ_Car_PlatformVersion>(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);
});
}
/// <summary>
/// 红旗工厂F平台验收结算明细-导入
/// </summary>
@ -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);
});
}

Loading…
Cancel
Save