Browse Source

修改销售价格

pull/1/head
mahao 1 year ago
parent
commit
e71c8d8ee5
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 67
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  3. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -215,7 +215,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
var _ls = entityList.Where(p=>p.EndTime.ToString().Contains("9999")).OrderByDescending(p => p.BeginTime).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
foreach (var itm in _ls)

67
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -16,14 +16,18 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public decimal SapPrice { set; get; }
}
public class PriceList:FullAuditedAggregateRootBase<Guid>
/// <summary>
/// 销售价格
/// </summary>
public class PriceList : FullAuditedAggregateRootBase<Guid>
{
public PriceList()
{ }
public PriceList(Guid Id,DateTime beginDate, DateTime endDate, decimal price, string materialCode, int type,Guid parentId,string version, string customerCode) :base(Id)
public PriceList(Guid Id, DateTime beginDate, DateTime endDate, decimal price, string materialCode, int type, Guid parentId, string version, string customerCode) : base(Id)
{
BeginDate = beginDate;
EndDate = endDate;
BeginTime = beginDate;
EndTime = endDate;
Price = price;
MaterialCode = materialCode;
Type = type;
@ -32,45 +36,70 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
CustomerCode = customerCode;
}
public void Set(DateTime beginDate, DateTime endDate, decimal price, string materialCode, int type,string customerCode)
public void Set(DateTime beginDate, DateTime endDate, decimal price, string materialCode, int type, string customerCode)
{
BeginDate = beginDate;
EndDate = endDate;
BeginTime = beginDate;
EndTime = endDate;
Price = price;
MaterialCode = materialCode;
Type = type;
CustomerCode = customerCode;
}
public void Update(Guid id,string version)
public void Update(Guid id, string version)
{
Id = id;
Version = version;
}
[Display(Name = "客户")]
public string CustomerCode { get; set; }
/// <summary>
///版本
/// 零件号
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
[Display(Name = "零件号")]
public string LU { get; set; }
/// <summary>
/// 价格
/// </summary>
[Display(Name = "价格")]
public Decimal Price { set; get; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginDate { set; get; }
public DateTime BeginTime { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结算时间")]
public DateTime EndDate { set; get; }
[Display(Name = "结束时间")]
public DateTime EndTime { set; get; }
/// <summary>
/// 价格
/// 客户编码
/// </summary>
[Display(Name = "价格")]
public Decimal Price { set; get; }
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public string BusinessType { get; set; }
/// <summary>
///版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
[Display(Name = "客户")]
public string CustomerCode { get; set; }
/// <summary>
/// 物料编号

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

@ -87,7 +87,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode,itm1.CustomerCode } equals new { itm2.Type, itm2.MaterialCode, itm2.CustomerCode }
where itm1.Price != itm2.Price
select new PriceList(itm2.Id, itm2.BeginDate, itm2.EndDate, itm1.Price, itm2.MaterialCode, itm2.Type, itm2.ParentId, itm2.Version, itm1.CustomerCode);
select new PriceList(itm2.Id, itm2.BeginTime, itm2.EndTime, itm1.Price, itm2.MaterialCode, itm2.Type, itm2.ParentId, itm2.Version, itm1.CustomerCode);
if (update.Count() > 0)
{
@ -122,7 +122,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public virtual async Task<PriceList> CreateAsync(PriceList input)
{
var entity = new PriceList(
GuidGenerator.Create(), input.BeginDate, input.EndDate, input.Price, input.MaterialCode, input.Type,input.ParentId,input.Version,input.CustomerCode
GuidGenerator.Create(), input.BeginTime, input.EndTime, input.Price, input.MaterialCode, input.Type,input.ParentId,input.Version,input.CustomerCode
);
return await _repository.InsertAsync(entity);
@ -134,7 +134,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
var entity = await _repository.GetAsync(id);
entity.Set(
input.BeginDate, input.EndDate, input.Price, input.MaterialCode, input.Type,input.CustomerCode
input.BeginTime, input.EndTime, input.Price, input.MaterialCode, input.Type,input.CustomerCode
);
return await _repository.UpdateAsync(entity);

Loading…
Cancel
Save