50 changed files with 1349 additions and 220 deletions
@ -0,0 +1,14 @@ |
|||||
|
using Win_in.Sfs.Wms.DataExchange.Dapper.Fawtyg.Tyrp; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Dapper.Fawtyg.Tyrp.Bases; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.LinqToDB.Fawtyg.Tyrp.PurchasePrices; |
||||
|
public class PurchasePriceLinq2DbRepository : |
||||
|
Linq2DbCrudRepository<ismout>, |
||||
|
IPurchasePriceLinq2DbRepository |
||||
|
{ |
||||
|
public PurchasePriceLinq2DbRepository(TyrpDb tyrpDb) : base(tyrpDb) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Dapper.Fawtyg.Tyrp.Bases; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Dapper.Fawtyg.Tyrp; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.LinqToDB.Fawtyg.Tyrp.SalePrices; |
||||
|
|
||||
|
public class SalePriceLinq2DbRepository : |
||||
|
Linq2DbCrudRepository<spriceout>, |
||||
|
ISalePriceLinq2DbRepository |
||||
|
{ |
||||
|
public SalePriceLinq2DbRepository(TyrpDb tyrpDb) : base(tyrpDb) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface IPurchasePriceLinq2DbRepository : ILinq2DbRepository<ismout> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface IPurchasePriceManager |
||||
|
{ |
||||
|
Task<List<ismout>> GetToBeProcessedListAsync(); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public class PurchasePriceManager : DomainService, IPurchasePriceManager |
||||
|
{ |
||||
|
private readonly IPurchasePriceLinq2DbRepository _repository; |
||||
|
public PurchasePriceManager(IPurchasePriceLinq2DbRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public async Task<List<ismout>> GetToBeProcessedListAsync() |
||||
|
{ |
||||
|
var purchaseprice = await _repository.GetListAsync().ConfigureAwait(false); |
||||
|
return purchaseprice.ToList(); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
/// <summary>
|
||||
|
/// 采购价格
|
||||
|
/// </summary>
|
||||
|
public class ismout : Entity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
public string ismout_part { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商代码
|
||||
|
/// </summary>
|
||||
|
public string ismout_vend { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购价格
|
||||
|
/// </summary>
|
||||
|
public decimal ismout_price { get; set; } |
||||
|
|
||||
|
public override object[] GetKeys() |
||||
|
{ |
||||
|
return new object[] { ismout_part, ismout_vend }; |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface ISalePriceLinq2DbRepository : ILinq2DbRepository<spriceout> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface ISalePriceManager |
||||
|
{ |
||||
|
Task<List<spriceout>> GetToBeProcessedListAsync(); |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
public class SalePriceManager : DomainService, ISalePriceManager |
||||
|
{ |
||||
|
private readonly ISalePriceLinq2DbRepository _repository; |
||||
|
public SalePriceManager(ISalePriceLinq2DbRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public async Task<List<spriceout>> GetToBeProcessedListAsync() |
||||
|
{ |
||||
|
var saleprice = await _repository.GetListAsync().ConfigureAwait(false); |
||||
|
return saleprice.ToList(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
/// <summary>
|
||||
|
/// 销售价格
|
||||
|
/// </summary>
|
||||
|
public class spriceout : Entity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
public string spriceout_part { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户代码
|
||||
|
/// </summary>
|
||||
|
public string spriceout_cust { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 销售价格
|
||||
|
/// </summary>
|
||||
|
public decimal spriceout_price { get; set; } |
||||
|
|
||||
|
public override object[] GetKeys() |
||||
|
{ |
||||
|
return new object[] { spriceout_part, spriceout_cust }; |
||||
|
} |
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.PurchasePrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class PurchasePriceConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<PurchasePriceConverter> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
|
||||
|
public PurchasePriceConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager, |
||||
|
IObjectMapper objectMapper, |
||||
|
ILogger<PurchasePriceConverter> logger, |
||||
|
IGuidGenerator guidGenerator |
||||
|
, |
||||
|
IIncomingFromExternalManager incomingFromExternalManager |
||||
|
|
||||
|
) |
||||
|
{ |
||||
|
_incomingToWmsManager = incomingToWmsManager; |
||||
|
_objectMapper = objectMapper; |
||||
|
_logger = logger; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
} |
||||
|
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) |
||||
|
{ |
||||
|
if (!incomingFromExternalList.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("无采购价格转换"); |
||||
|
return; |
||||
|
} |
||||
|
var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
await _incomingToWmsManager.CreateBulkAsync(incomingToWmsDataList).ConfigureAwait(false); |
||||
|
//归档
|
||||
|
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
private async Task<List<IncomingToWms>> BuildIncomingToWmsOfPurchaseOrderAsync(List<IncomingFromExternal> incomingDataList) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var incomingToWmsList = new List<IncomingToWms>(); |
||||
|
var groups = incomingDataList.GroupBy(p => p.SourceDataGroupCode); |
||||
|
foreach (var group in groups) |
||||
|
{ |
||||
|
var first = group.First(); |
||||
|
var incomingToWms = new IncomingToWms() |
||||
|
{ |
||||
|
DataType = first.DataType, |
||||
|
DataAction = first.DataAction, |
||||
|
SourceSystem = first.SourceSystem, |
||||
|
DataIdentityCode = first.SourceDataGroupCode, |
||||
|
}; |
||||
|
incomingToWms.SetId(_guidGenerator.Create()); |
||||
|
incomingToWms.SetEffectiveDate(first.EffectiveDate); |
||||
|
var exchangePurchasePrice = JsonSerializer.Deserialize<PurchasePriceExchangeDto>(first.DestinationDataContent); |
||||
|
var wmsPurchasePrice = _objectMapper.Map<PurchasePriceExchangeDto, PurchasePriceSheetEditInput>(exchangePurchasePrice); |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsPurchasePrice); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,133 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.PurchasePrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class PurchasePriceReader : IReader |
||||
|
{ |
||||
|
private readonly IPurchasePriceManager _iPurchasePriceManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<PurchasePriceReader> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
private readonly IPurchasePriceSheetAppService _purchasePriceAppService; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
public PurchasePriceReader( |
||||
|
IPurchasePriceManager iPurchasePriceManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, IGuidGenerator guidGenerator |
||||
|
, ILogger<PurchasePriceReader> logger |
||||
|
, IConfiguration configuration, |
||||
|
IPurchasePriceSheetAppService purchasePriceSheetAppService, |
||||
|
IObjectMapper objectMapper |
||||
|
) |
||||
|
{ |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_configuration = configuration; |
||||
|
_iPurchasePriceManager = iPurchasePriceManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
_purchasePriceAppService = purchasePriceSheetAppService; |
||||
|
_objectMapper = objectMapper; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从Tyrp读取待处理PurchasePrice
|
||||
|
var toBeProcessedPurchasePrices = await _iPurchasePriceManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
if (!toBeProcessedPurchasePrices.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no PurchasePrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//获取wms采购单价数据
|
||||
|
SfsBaseDataRequestInputBase input = new SfsBaseDataRequestInputBase(); |
||||
|
var wmsPurchasePrices = await _purchasePriceAppService.GetAllListByFilterAsync(input).ConfigureAwait(false); |
||||
|
var wmsToPurchasePriceExchangeDtos = _objectMapper.Map<List<PurchasePriceSheetDTO>, List<PurchasePriceExchangeDto>>(wmsPurchasePrices); |
||||
|
List<PurchasePriceExchangeDto> eosToBomExchangeDtos = new List<PurchasePriceExchangeDto>(); |
||||
|
foreach (var toBeProcessedPurchasePrice in toBeProcessedPurchasePrices) |
||||
|
{ |
||||
|
var purchasePrice = BuildScrapNoteOrderExchangeMes(toBeProcessedPurchasePrice); |
||||
|
eosToBomExchangeDtos.Add(purchasePrice); |
||||
|
} |
||||
|
//和wms和eos数据进行比较,获取需要处理得数据
|
||||
|
var updateDatas = eosToBomExchangeDtos.Except(wmsToPurchasePriceExchangeDtos).ToList(); |
||||
|
if (!updateDatas.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no PurchasePrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//PurchasePrice逐一转换为PurchasePrice
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromBomAsync(updateDatas, toBeProcessedPurchasePrices); |
||||
|
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private List<IncomingFromExternal> BuildIncomingFromExternalFromBomAsync(List<PurchasePriceExchangeDto> updateDatas,List<ismout> toBeProcessedPurchasePrices) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var data in updateDatas) |
||||
|
{ |
||||
|
var item = toBeProcessedPurchasePrices.FirstOrDefault(r => r.ismout_part == data.ItemCode && r.ismout_vend == data.SupplierCode); |
||||
|
var incomingData = BuildIncomingFromExternal(item); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(data); |
||||
|
incomingData.SetId(_guidGenerator.Create()); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private IncomingFromExternal BuildIncomingFromExternal(ismout PurchasePrice) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
|
||||
|
DataType = EnumIncomingDataType.PurchasePrice.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = PurchasePrice.ismout_part, |
||||
|
SourceDataGroupCode = PurchasePrice.ismout_part, |
||||
|
SourceDataDetailCode = PurchasePrice.ismout_vend, |
||||
|
SourceDataContent = JsonSerializer.Serialize(PurchasePrice), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(TyrpIncomingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static PurchasePriceExchangeDto BuildScrapNoteOrderExchangeMes(ismout PurchasePrice) |
||||
|
{ |
||||
|
|
||||
|
var price = new PurchasePriceExchangeDto() |
||||
|
{ |
||||
|
ItemCode = PurchasePrice.ismout_part, |
||||
|
SupplierCode = PurchasePrice.ismout_vend, |
||||
|
PurchasePrice = PurchasePrice.ismout_price, |
||||
|
Description = "接口同步", |
||||
|
}; |
||||
|
return price; |
||||
|
} |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.SalePrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
public class SalePriceConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<SalePriceConverter> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
|
||||
|
public SalePriceConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager, |
||||
|
IObjectMapper objectMapper, |
||||
|
ILogger<SalePriceConverter> logger, |
||||
|
IGuidGenerator guidGenerator |
||||
|
, |
||||
|
IIncomingFromExternalManager incomingFromExternalManager |
||||
|
|
||||
|
) |
||||
|
{ |
||||
|
_incomingToWmsManager = incomingToWmsManager; |
||||
|
_objectMapper = objectMapper; |
||||
|
_logger = logger; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
} |
||||
|
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) |
||||
|
{ |
||||
|
if (!incomingFromExternalList.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("无销售价格转换"); |
||||
|
return; |
||||
|
} |
||||
|
var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
await _incomingToWmsManager.CreateBulkAsync(incomingToWmsDataList).ConfigureAwait(false); |
||||
|
//归档
|
||||
|
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
private async Task<List<IncomingToWms>> BuildIncomingToWmsOfPurchaseOrderAsync(List<IncomingFromExternal> incomingDataList) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var incomingToWmsList = new List<IncomingToWms>(); |
||||
|
var groups = incomingDataList.GroupBy(p => p.SourceDataGroupCode); |
||||
|
foreach (var group in groups) |
||||
|
{ |
||||
|
var first = group.First(); |
||||
|
var incomingToWms = new IncomingToWms() |
||||
|
{ |
||||
|
DataType = first.DataType, |
||||
|
DataAction = first.DataAction, |
||||
|
SourceSystem = first.SourceSystem, |
||||
|
DataIdentityCode = first.SourceDataGroupCode, |
||||
|
}; |
||||
|
incomingToWms.SetId(_guidGenerator.Create()); |
||||
|
incomingToWms.SetEffectiveDate(first.EffectiveDate); |
||||
|
var exchangeSalePrice = JsonSerializer.Deserialize<SalePriceExchangeDto>(first.DestinationDataContent); |
||||
|
var wmsSalePrice = _objectMapper.Map<SalePriceExchangeDto, SalePriceSheetEditInput>(exchangeSalePrice); |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsSalePrice); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.SalePrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
public class SalePriceReader : IReader |
||||
|
{ |
||||
|
private readonly ISalePriceManager _iSalePriceManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<SalePriceReader> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
private readonly ISalePriceSheetAppService _SalePriceAppService; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
public SalePriceReader( |
||||
|
ISalePriceManager iSalePriceManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, IGuidGenerator guidGenerator |
||||
|
, ILogger<SalePriceReader> logger |
||||
|
, IConfiguration configuration, |
||||
|
ISalePriceSheetAppService SalePriceSheetAppService, |
||||
|
IObjectMapper objectMapper |
||||
|
) |
||||
|
{ |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_configuration = configuration; |
||||
|
_iSalePriceManager = iSalePriceManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
_SalePriceAppService = SalePriceSheetAppService; |
||||
|
_objectMapper = objectMapper; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从Tyrp读取待处理SalePrice
|
||||
|
var toBeProcessedSalePrices = await _iSalePriceManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
if (!toBeProcessedSalePrices.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no SalePrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//获取wms销售单价数据
|
||||
|
SfsBaseDataRequestInputBase input = new SfsBaseDataRequestInputBase(); |
||||
|
var wmsSalePrices = await _SalePriceAppService.GetAllListByFilterAsync(input).ConfigureAwait(false); |
||||
|
var wmsToSalePriceExchangeDtos = _objectMapper.Map<List<SalePriceSheetDTO>, List<SalePriceExchangeDto>>(wmsSalePrices); |
||||
|
List<SalePriceExchangeDto> eosToBomExchangeDtos = new List<SalePriceExchangeDto>(); |
||||
|
foreach (var toBeProcessedSalePrice in toBeProcessedSalePrices) |
||||
|
{ |
||||
|
var SalePrice = BuildScrapNoteOrderExchangeMes(toBeProcessedSalePrice); |
||||
|
eosToBomExchangeDtos.Add(SalePrice); |
||||
|
} |
||||
|
//和wms和eos数据进行比较,获取需要处理得数据
|
||||
|
var updateDatas = eosToBomExchangeDtos.Except(wmsToSalePriceExchangeDtos).ToList(); |
||||
|
if (!updateDatas.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no SalePrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//SalePrice逐一转换为SalePrice
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromBomAsync(updateDatas, toBeProcessedSalePrices); |
||||
|
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private List<IncomingFromExternal> BuildIncomingFromExternalFromBomAsync(List<SalePriceExchangeDto> updateDatas, List<spriceout> toBeProcessedSalePrices) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var data in updateDatas) |
||||
|
{ |
||||
|
var item = toBeProcessedSalePrices.FirstOrDefault(r => r.spriceout_part == data.ItemCode && r.spriceout_cust == data.CustomerCode); |
||||
|
var incomingData = BuildIncomingFromExternal(item); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(data); |
||||
|
incomingData.SetId(_guidGenerator.Create()); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private IncomingFromExternal BuildIncomingFromExternal(spriceout SalePrice) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
|
||||
|
DataType = EnumIncomingDataType.SalePrice.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = SalePrice.spriceout_part, |
||||
|
SourceDataGroupCode = SalePrice.spriceout_part, |
||||
|
SourceDataDetailCode = SalePrice.spriceout_cust, |
||||
|
SourceDataContent = JsonSerializer.Serialize(SalePrice), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(TyrpIncomingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static SalePriceExchangeDto BuildScrapNoteOrderExchangeMes(spriceout SalePrice) |
||||
|
{ |
||||
|
|
||||
|
var price = new SalePriceExchangeDto() |
||||
|
{ |
||||
|
ItemCode = SalePrice.spriceout_part, |
||||
|
CustomerCode = SalePrice.spriceout_cust, |
||||
|
SalePrice = SalePrice.spriceout_price, |
||||
|
Description = "接口同步", |
||||
|
}; |
||||
|
return price; |
||||
|
} |
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.StdCostPrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class StdCostPriceConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<StdCostPriceConverter> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
|
||||
|
public StdCostPriceConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager, |
||||
|
IObjectMapper objectMapper, |
||||
|
ILogger<StdCostPriceConverter> logger, |
||||
|
IGuidGenerator guidGenerator |
||||
|
, |
||||
|
IIncomingFromExternalManager incomingFromExternalManager |
||||
|
|
||||
|
) |
||||
|
{ |
||||
|
_incomingToWmsManager = incomingToWmsManager; |
||||
|
_objectMapper = objectMapper; |
||||
|
_logger = logger; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
} |
||||
|
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) |
||||
|
{ |
||||
|
if (!incomingFromExternalList.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("无标准成本价格转换"); |
||||
|
return; |
||||
|
} |
||||
|
var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
await _incomingToWmsManager.CreateBulkAsync(incomingToWmsDataList).ConfigureAwait(false); |
||||
|
//归档
|
||||
|
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
private async Task<List<IncomingToWms>> BuildIncomingToWmsOfPurchaseOrderAsync(List<IncomingFromExternal> incomingDataList) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var incomingToWmsList = new List<IncomingToWms>(); |
||||
|
var groups = incomingDataList.GroupBy(p => p.SourceDataGroupCode); |
||||
|
foreach (var group in groups) |
||||
|
{ |
||||
|
var first = group.First(); |
||||
|
var incomingToWms = new IncomingToWms() |
||||
|
{ |
||||
|
DataType = first.DataType, |
||||
|
DataAction = first.DataAction, |
||||
|
SourceSystem = first.SourceSystem, |
||||
|
DataIdentityCode = first.SourceDataGroupCode, |
||||
|
}; |
||||
|
incomingToWms.SetId(_guidGenerator.Create()); |
||||
|
incomingToWms.SetEffectiveDate(first.EffectiveDate); |
||||
|
var exchangeStdCostPrice = JsonSerializer.Deserialize<StdCostPriceExchangeDto>(first.DestinationDataContent); |
||||
|
var wmsStdCostPrice = _objectMapper.Map<StdCostPriceExchangeDto, StdCostPriceSheetEditInput>(exchangeStdCostPrice); |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsStdCostPrice); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.StdCostPrice; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
public class StdCostPriceReader : IReader |
||||
|
{ |
||||
|
private readonly IProductManager _productManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<StdCostPriceReader> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
private readonly IStdCostPriceSheetAppService _StdCostPriceAppService; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
public StdCostPriceReader( |
||||
|
IProductManager productManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, IGuidGenerator guidGenerator |
||||
|
, ILogger<StdCostPriceReader> logger |
||||
|
, IConfiguration configuration, |
||||
|
IStdCostPriceSheetAppService StdCostPriceSheetAppService, |
||||
|
IObjectMapper objectMapper |
||||
|
) |
||||
|
{ |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_configuration = configuration; |
||||
|
_productManager = productManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
_StdCostPriceAppService = StdCostPriceSheetAppService; |
||||
|
_objectMapper = objectMapper; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从ERP读取待处理part
|
||||
|
var toBeProcessedProducts = await _productManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
if (!toBeProcessedProducts.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no StdCostPrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//获取wms标准成本单价数据
|
||||
|
SfsBaseDataRequestInputBase input = new SfsBaseDataRequestInputBase(); |
||||
|
var wmsStdCostPrices = await _StdCostPriceAppService.GetAllListByFilterAsync(input).ConfigureAwait(false); |
||||
|
var wmsToStdCostPriceExchangeDtos = _objectMapper.Map<List<StdCostPriceSheetDTO>, List<StdCostPriceExchangeDto>>(wmsStdCostPrices); |
||||
|
List<StdCostPriceExchangeDto> eosToBomExchangeDtos = new List<StdCostPriceExchangeDto>(); |
||||
|
foreach (var toBeProcessedProduct in toBeProcessedProducts) |
||||
|
{ |
||||
|
var StdCostPrice = BuildScrapNoteOrderExchangeMes(toBeProcessedProduct); |
||||
|
eosToBomExchangeDtos.Add(StdCostPrice); |
||||
|
} |
||||
|
//和wms和eos数据进行比较,获取需要处理得数据
|
||||
|
var updateDatas = eosToBomExchangeDtos.Except(wmsToStdCostPriceExchangeDtos).ToList(); |
||||
|
if (!updateDatas.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no StdCostPrices"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//StdCostPrice逐一转换为StdCostPrice
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromBomAsync(updateDatas, toBeProcessedProducts); |
||||
|
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private List<IncomingFromExternal> BuildIncomingFromExternalFromBomAsync(List<StdCostPriceExchangeDto> updateDatas, List<mes_product> toBeProcessedProducts) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var data in updateDatas) |
||||
|
{ |
||||
|
var item = toBeProcessedProducts.FirstOrDefault(r => r.mes_product_part == data.ItemCode); |
||||
|
var incomingData = BuildIncomingFromExternal(item); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(data); |
||||
|
incomingData.SetId(_guidGenerator.Create()); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private IncomingFromExternal BuildIncomingFromExternal(mes_product product) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
|
||||
|
DataType = EnumIncomingDataType.StdCostPrice.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = product.mes_product_part_ser.ToString(), |
||||
|
SourceDataGroupCode = product.mes_product_part, |
||||
|
SourceDataDetailCode = product.mes_product_part, |
||||
|
SourceDataContent = JsonSerializer.Serialize(product), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(TyrpIncomingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static StdCostPriceExchangeDto BuildScrapNoteOrderExchangeMes(mes_product product) |
||||
|
{ |
||||
|
|
||||
|
var price = new StdCostPriceExchangeDto() |
||||
|
{ |
||||
|
ItemCode = product.mes_product_part, |
||||
|
StdCostPrice = product.mes_product_price_std, |
||||
|
Description = "接口同步", |
||||
|
}; |
||||
|
return price; |
||||
|
} |
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
using System.ComponentModel; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.Bom; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.WMS.PurchasePrice; |
||||
|
public class PurchasePriceExchangeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
|
||||
|
[Display(Name = "物品代码")] |
||||
|
[Required] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "供应商编号")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string SupplierCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 价格单描述
|
||||
|
/// </summary>
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户简称
|
||||
|
/// </summary>
|
||||
|
public decimal PurchasePrice { get; set; } |
||||
|
|
||||
|
public override bool Equals(object obj) |
||||
|
{ |
||||
|
if (obj is PurchasePriceExchangeDto) |
||||
|
{ |
||||
|
PurchasePriceExchangeDto purchaseprice = obj as PurchasePriceExchangeDto; |
||||
|
return ItemCode == purchaseprice.ItemCode && SupplierCode == purchaseprice.SupplierCode && PurchasePrice == purchaseprice.PurchasePrice; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
public override int GetHashCode() |
||||
|
{ |
||||
|
return ItemCode.GetHashCode() ^ SupplierCode.GetHashCode() ^ PurchasePrice.GetHashCode(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using IdentityServer4.Models; |
||||
|
using System.Xml.Linq; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.WMS.SalePrice; |
||||
|
|
||||
|
public class SalePriceExchangeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
|
||||
|
[Display(Name = "物品代码")] |
||||
|
[Required] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 客户编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "客户编号")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string CustomerCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 价格单描述
|
||||
|
/// </summary>
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 销售价格
|
||||
|
/// </summary>
|
||||
|
public decimal SalePrice { get; set; } |
||||
|
|
||||
|
public override bool Equals(object obj) |
||||
|
{ |
||||
|
if (obj is SalePriceExchangeDto) |
||||
|
{ |
||||
|
SalePriceExchangeDto saleprice = obj as SalePriceExchangeDto; |
||||
|
return ItemCode == saleprice.ItemCode && CustomerCode == saleprice.CustomerCode && SalePrice == saleprice.SalePrice; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
public override int GetHashCode() |
||||
|
{ |
||||
|
return ItemCode.GetHashCode() ^ CustomerCode.GetHashCode() ^ SalePrice.GetHashCode(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using IdentityServer4.Models; |
||||
|
using System.Xml.Linq; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.WMS.StdCostPrice; |
||||
|
public class StdCostPriceExchangeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
|
||||
|
[Display(Name = "物品代码")] |
||||
|
[Required] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ItemCode { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 价格单描述
|
||||
|
/// </summary>
|
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标准成本价
|
||||
|
/// </summary>
|
||||
|
public decimal StdCostPrice { get; set; } |
||||
|
|
||||
|
public override bool Equals(object obj) |
||||
|
{ |
||||
|
if (obj is StdCostPriceExchangeDto) |
||||
|
{ |
||||
|
StdCostPriceExchangeDto scp = obj as StdCostPriceExchangeDto; |
||||
|
return ItemCode == scp.ItemCode && StdCostPrice == scp.StdCostPrice; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
public override int GetHashCode() |
||||
|
{ |
||||
|
return ItemCode.GetHashCode() ^ StdCostPrice.GetHashCode(); |
||||
|
} |
||||
|
} |
@ -1,6 +1,9 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
public interface ISalePriceSheetAppService : ISfsBaseDataAppServiceBase<SalePriceSheetDTO, SfsBaseDataRequestInputBase, SalePriceSheetEditInput> |
public interface ISalePriceSheetAppService : ISfsBaseDataAppServiceBase<SalePriceSheetDTO, SfsBaseDataRequestInputBase, SalePriceSheetEditInput> |
||||
{ |
{ |
||||
|
Task<SalePriceSheetDTO> GetByItemCodeAndCustomerCode(string itemCode, string customerCode); |
||||
|
Task UpsertAsyncByInterface(SalePriceSheetEditInput input); |
||||
} |
} |
||||
|
@ -1,5 +1,10 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
public interface IStdCostPriceSheetAppService : ISfsBaseDataAppServiceBase<StdCostPriceSheetDTO, SfsBaseDataRequestInputBase, StdCostPriceSheetEditInput> |
public interface IStdCostPriceSheetAppService : ISfsBaseDataAppServiceBase<StdCostPriceSheetDTO, SfsBaseDataRequestInputBase, StdCostPriceSheetEditInput> |
||||
{ |
{ |
||||
|
Task<StdCostPriceSheetDTO> GetByItemCode(string itemCode); |
||||
|
Task UpsertAsyncByInterface(StdCostPriceSheetEditInput input); |
||||
} |
} |
||||
|
@ -1,6 +1,8 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
namespace Win_in.Sfs.Basedata.Domain; |
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
public interface IPurchasePriceSheetRepository : ISfsBaseDataRepositoryBase<PurchasePriceSheet> |
public interface IPurchasePriceSheetRepository : ISfsBaseDataRepositoryBase<PurchasePriceSheet> |
||||
{ |
{ |
||||
|
Task UpsertAsyncByInterface(PurchasePriceSheet entity); |
||||
} |
} |
||||
|
@ -1,6 +1,8 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
namespace Win_in.Sfs.Basedata.Domain; |
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
public interface ISalePriceSheetRepository : ISfsBaseDataRepositoryBase<SalePriceSheet> |
public interface ISalePriceSheetRepository : ISfsBaseDataRepositoryBase<SalePriceSheet> |
||||
{ |
{ |
||||
|
Task UpsertAsyncByInterface(SalePriceSheet entity); |
||||
} |
} |
||||
|
@ -1,5 +1,8 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
namespace Win_in.Sfs.Basedata.Domain; |
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
public interface IStdCostPriceSheetRepository : ISfsBaseDataRepositoryBase<StdCostPriceSheet> |
public interface IStdCostPriceSheetRepository : ISfsBaseDataRepositoryBase<StdCostPriceSheet> |
||||
{ |
{ |
||||
|
Task UpsertAsyncByInterface(StdCostPriceSheet entity); |
||||
} |
} |
||||
|
Loading…
Reference in new issue