Browse Source

备件价格单

master
mahao 1 year ago
parent
commit
ac20d903ff
  1. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  3. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  4. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  7. 73
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  8. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs
  9. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SA.cs
  10. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs

27
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -293,58 +293,55 @@ public class PriceListBJExportDto
/// <summary>
/// 客户备件价格导入
/// </summary>
[Importer(HeaderRowIndex = 22)]
public class PriceListBJImportDto
{
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "客户零件号")]
[ImporterHeader(Name = "Part No.")]
[ImporterHeader(Name = "客户零件号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "客户零件号")]
[ImporterHeader(Name = "Total Price")]
[Display(Name = "价格")]
[ImporterHeader(Name = "价格")]
public decimal Price { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
[ImporterHeader(Name = "Valid From")]
[ImporterHeader(Name = "开始时间")]
public DateTime BeginDate { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结束时间")]
[ImporterHeader(Name = "Valid To")]
[ImporterHeader(Name = "结束时间")]
public DateTime EndDate { set; get; }
/// <summary>
/// 客户编码
/// </summary>
[Display(Name = "客户零件号")]
[ImporterHeader(Name = "Plant")]
[Display(Name = "客户编码")]
[ImporterHeader(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "客户零件号")]
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 1, Cell = 1)]
public string Date { get; set; }
[Display(Name = "合同签订时间")]
[ImporterHeader(Name = "合同签订时间")]
public DateTime Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "客户零件号")]
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 2, Cell = 1)]
[Display(Name = "合同号")]
[ImporterHeader(Name = "合同号")]
public string ContractNo { get; set; }
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -5,6 +5,7 @@ using System.LinqAsync;
using System.Security.Policy;
using System.Threading.Tasks;
using AutoMapper;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -306,6 +307,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var bbacCanSa = new BBAC_CAN_SA()
{
BillNum = bbacCanSaBillNum,
InvGroupNum = bbacCanSaBillNum,
SettleBillNum = bbacSaBillNum,
State = SettleBillState.,
BusinessType = _businessType
@ -323,6 +325,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacSaDetails.ForEach(bbacSaDetail =>
{
bbacSaDetail.SetId(GuidGenerator.Create());
List<string> lus = bbacSaDetail.LU.Split(" ").ToList();
bbacSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
@ -379,10 +382,9 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
#region 添加入库
await _bbacSaRepository.InsertAsync(bbacSa);
await _bbacSaDetailRepository.InsertManyAsync(bbacSaDetails);
await _bbacSaDetailRepository.DbContext.BulkInsertAsync(bbacSaDetails);
if (bbacCanSaDetails.Count > 0)
{
bbacCanSa.InvGroupNum = bbacCanSaDetails.Count.ToString();
bbacCanSaDetails.ForEach(bbacCanSaDetail =>
{
bbacCanSaDetail.BillNum = bbacCanSaDetail.InvGroupNum = bbacCanSaBillNum;
@ -390,7 +392,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
});
await _bbacCanSaRepository.InsertAsync(bbacCanSa);
await _bbacCanSaDetailRepository.InsertManyAsync(bbacCanSaDetails);
await _bbacCanSaDetailRepository.DbContext.BulkInsertAsync(bbacCanSaDetails);
}
if (bbacNotSaDetails.Count > 0)
{

10
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -305,6 +306,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var hbpoCanSa = new HBPO_CAN_SA()
{
BillNum = hbpoCanSaBillNum,
InvGroupNum = hbpoCanSaBillNum,
SettleBillNum = hbpoSaBillNum,
State = SettleBillState.,
BusinessType = _businessType,
@ -323,6 +325,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
List<string> lus = hbpoSaDetail.LU.Split(" ").ToList();
hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
@ -379,21 +382,20 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
#region 添加入库
await _hbpoSaRepository.InsertAsync(hbpoSa).ConfigureAwait(false);
await _hbpoSaDetailRepository.InsertManyAsync(hbpoSaDetails).ConfigureAwait(false);
await _hbpoSaDetailRepository.DbContext.BulkInsertAsync(hbpoSaDetails).ConfigureAwait(false);
if (hbpoCanSaDetails.Count > 0)
{
hbpoCanSa.InvGroupNum = hbpoCanSaDetails.Count.ToString();
hbpoCanSaDetails.ForEach(hbpoCanSaDetail =>
{
hbpoCanSaDetail.BillNum = hbpoCanSaDetail.InvGroupNum = hbpoCanSaBillNum;
});
await _hbpoCanSaRepository.InsertAsync(hbpoCanSa).ConfigureAwait(false);
await _hbpoCanSaDetailRepository.InsertManyAsync(hbpoCanSaDetails).ConfigureAwait(false);
await _hbpoCanSaDetailRepository.DbContext.BulkInsertAsync(hbpoCanSaDetails).ConfigureAwait(false);
}
if (hbpoNotSaDetails.Count > 0)
{
await _hbpoNotSaDetailRepository.InsertManyAsync(hbpoNotSaDetails).ConfigureAwait(false);
await _hbpoNotSaDetailRepository.DbContext.BulkInsertAsync(hbpoNotSaDetails).ConfigureAwait(false);
}
if (materialRelationships.Count > 0)
{

37
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -67,6 +67,11 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
/// </summary>
private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository;
/// <summary>
/// 备件价格仓储
/// </summary>
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _priceBjListRepository;
/// <summary>
/// 客户零件关系仓储
/// </summary>
@ -86,6 +91,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> pubCanSaDetailRepository,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> pubNotSaDetailRepository,
INormalEfCoreRepository<PriceList, Guid> priceListRepository,
INormalEfCoreRepository<PriceListBJ, Guid> priceBjListRepository,
INormalEfCoreRepository<MaterialRelationship, Guid> materialRelationshipRepository,
INormalEfCoreRepository<TB_RePartsRelationship, Guid> tbRePartsRelationshipRepository,
IDistributedCache<PUB_SA> cache,
@ -100,6 +106,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
_pubCanSaDetailRepository = pubCanSaDetailRepository;
_pubNotSaDetailRepository = pubNotSaDetailRepository;
_priceListRepository = priceListRepository;
_priceBjListRepository = priceBjListRepository;
_materialRelationshipRepository = materialRelationshipRepository;
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
@ -460,9 +467,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
var materialRelationships = new List<MaterialRelationship>();
#region 处理结算数据
//销售价格
var priceListEntitys = await _priceListRepository.GetAllAsync().ConfigureAwait(false);
pubSaDetails.ForEach(importPubSaDetail =>
{
importPubSaDetail.SetId(GuidGenerator.Create());
@ -479,11 +483,30 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType;
importPubSaDetail.Site = "XX工厂";
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime);
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList();
if (businessType == EnumBusinessType.BeiJian)
{
//备件销售价格
var priceListEntitys = _priceBjListRepository.Where(t => lus.Contains(t.LU)).ToList();
pubSaDetails.ForEach(importPubSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginDate && importPubSaDetail.SettleDate <= t.EndDate);
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
}
else
{
//销售价格
var priceListEntitys = _priceListRepository.Join(lus, a => a.LU, b => b, (a, b) => a).ToList();
pubSaDetails.ForEach(importPubSaDetail =>
{
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate >= t.BeginTime && importPubSaDetail.SettleDate <= t.EndTime);
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
}
//导入的零件号集合
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct();

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs

@ -36,7 +36,7 @@ public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
SyncDeliverBillType = EnumDeliverBjBmpBillType.4S备件,
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.
EnumDeliverSubBillType.4S备件BBAC
},
BusinessType = EnumBusinessType.BeiJian
};

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -36,7 +36,7 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
SyncDeliverBillType = EnumDeliverBjBmpBillType.,
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.
EnumDeliverSubBillType.BBAC
},
BusinessType = EnumBusinessType.YinDuJian
};

73
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -562,8 +562,7 @@ namespace Win.Sfs.SettleAccount
/// </summary>
private void CreateMapPriceListBJ()
{
CreateMap<PriceListBJImportDto, PriceListBJ>()
.ForMember(x => x.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture)));
CreateMap<PriceListBJImportDto, PriceListBJ>();
CreateMap<PriceListBJ, PriceListBJDto>().ReverseMap();
CreateMap<PriceListBJ, PriceListBJRequestDto>().ReverseMap();
@ -1128,37 +1127,6 @@ namespace Win.Sfs.SettleAccount
/// </summary>
private void CreateMapSeSync()
{
CreateMap<TM_BJBMPT_JIT_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
@ -1168,7 +1136,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
@ -1179,7 +1147,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
@ -1187,7 +1155,38 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.OrderNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_OTHER_RECORD, PUB_SE_DETAIL>()
@ -1196,7 +1195,7 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.PN, y => y.MapFrom(d => d.DeliveryIndex))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs

@ -153,4 +153,9 @@ public class BBAC_SA_DETAIL:SA_BASE
{
}
public void SetId(Guid id)
{
Id = id;
}
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SA.cs

@ -142,4 +142,9 @@ public class HBPO_SA_DETAIL : SA_BASE
public HBPO_SA_DETAIL()
{
}
public void SetId(Guid id)
{
Id = id;
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs

@ -203,4 +203,6 @@ public enum EnumDeliverSubBillType
HBPO = 8,
JIT直供件BBAC = 9,
JIT直供件HBPO = 10,
BBAC = 11,
4S备件BBAC = 12,
}

Loading…
Cancel
Save