85 changed files with 1153 additions and 396 deletions
@ -0,0 +1,58 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
public class Backflu : Entity |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// MES写入时间
|
||||
|
/// </summary>
|
||||
|
public string scmout_dt_w { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 单据类型
|
||||
|
/// </summary>
|
||||
|
public string scmout_type { get; set; } |
||||
|
/// <summary>
|
||||
|
/// TYRP单号
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
public string scmout_nbr { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 料号
|
||||
|
/// </summary>
|
||||
|
public string scmout_part { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 追加码/预定交货日/序号/储位
|
||||
|
/// </summary>
|
||||
|
public string scmout_no { get; set; } |
||||
|
/// <summary>
|
||||
|
/// TYRP异动储位
|
||||
|
/// </summary>
|
||||
|
public string scmout_loc { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 库存交易年月
|
||||
|
/// </summary>
|
||||
|
public string scmout_ym { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 库存交易日
|
||||
|
/// </summary>
|
||||
|
public string scmout_date { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 数量
|
||||
|
/// </summary>
|
||||
|
public decimal scmout_qty { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 调入储位
|
||||
|
/// </summary>
|
||||
|
public string scmout_in_loc { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 有效码
|
||||
|
/// </summary>
|
||||
|
public string scmout_stat { get; set; } |
||||
|
|
||||
|
public override object[] GetKeys() |
||||
|
{ |
||||
|
return new object[] { scmout_nbr }; |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
public class BackfluManager : DomainService, IBackfluManager |
||||
|
{ |
||||
|
private readonly IBackfluRepository _repository; |
||||
|
public BackfluManager(IBackfluRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
public async Task<List<Backflu>> GetToBeProcessedListAsync() |
||||
|
{ |
||||
|
var Backflu = await _repository.GetListAsync().ConfigureAwait(false); |
||||
|
|
||||
|
return Backflu.ToList(); |
||||
|
} |
||||
|
public virtual async Task UpdateProcessedListAsync(List<Backflu> entities) |
||||
|
{ |
||||
|
foreach (var entitie in entities) |
||||
|
{ |
||||
|
entitie.scmout_stat = "N"; |
||||
|
await _repository.UpdateAsync(entitie).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
public interface IBackfluManager : IDomainService |
||||
|
{ |
||||
|
Task<List<Backflu>> GetToBeProcessedListAsync(); |
||||
|
Task UpdateProcessedListAsync(List<Backflu> entities); |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
public interface IBackfluRepository : IRepository<Backflu> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
|
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; |
||||
|
public static class BackfluDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureBackflu(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<Backflu>(b => |
||||
|
{ |
||||
|
//Configure table & schema Name
|
||||
|
b.ToTable(options.TablePrefix + "scmout", options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
b.Property(q => q.scmout_dt_w).HasMaxLength(20); |
||||
|
b.Property(q => q.scmout_type).HasMaxLength(6); |
||||
|
b.Property(q => q.scmout_nbr).HasMaxLength(12); |
||||
|
b.Property(q => q.scmout_part).HasMaxLength(20); |
||||
|
b.Property(q => q.scmout_no).HasMaxLength(10); |
||||
|
b.Property(q => q.scmout_loc).HasMaxLength(10); |
||||
|
b.Property(q => q.scmout_ym).HasMaxLength(6); |
||||
|
b.Property(q => q.scmout_date).HasMaxLength(8); |
||||
|
b.Property(q => q.scmout_qty).HasPrecision(10, 2); |
||||
|
b.Property(q => q.scmout_in_loc).HasMaxLength(10); |
||||
|
b.Property(q => q.scmout_stat).HasMaxLength(1); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; |
||||
|
public class BackfluEfCoreRepository : EfCoreRepository<MesDbContext, Backflu>, IBackfluRepository |
||||
|
{ |
||||
|
public BackfluEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider) |
||||
|
: base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,83 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
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.BackFlushNote; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; |
||||
|
|
||||
|
public class BackFluConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IItemBasicAppService _itemBasicAppService; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<BackFluConverter> _logger; |
||||
|
public BackFluConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager, |
||||
|
IItemBasicAppService itemBasicAppService, |
||||
|
IObjectMapper objectMapper, |
||||
|
ILogger<BackFluConverter> logger |
||||
|
, |
||||
|
IIncomingFromExternalManager incomingFromExternalManager |
||||
|
|
||||
|
) |
||||
|
{ |
||||
|
_incomingToWmsManager = incomingToWmsManager; |
||||
|
_itemBasicAppService = itemBasicAppService; |
||||
|
_objectMapper = objectMapper; |
||||
|
_logger = logger; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
} |
||||
|
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) |
||||
|
{ |
||||
|
if (!incomingFromExternalList.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no backflus"); |
||||
|
return; |
||||
|
} |
||||
|
var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
await _incomingToWmsManager.CreateManyAsync(incomingToWmsDataList).ConfigureAwait(false); |
||||
|
//归档
|
||||
|
await _incomingFromExternalManager.ArchiveBulkAsync(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.SetEffectiveDate(first.EffectiveDate); |
||||
|
var exchangeBack = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(first.DestinationDataContent); |
||||
|
var wmsBack = _objectMapper.Map<BackFlushNoteExchangeDto, BackFlushNoteEditInput>(exchangeBack); |
||||
|
wmsBack.Details = new List<BackFlushNoteDetailInput>(); |
||||
|
foreach (var incomingFromExternal in group.ToList()) |
||||
|
{ |
||||
|
var back = JsonSerializer.Deserialize<BackFlushNoteExchangeDto>(incomingFromExternal.DestinationDataContent); |
||||
|
var wmsBackDetail = _objectMapper.Map<BackFlushNoteDetailExchangeDto, BackFlushNoteDetailInput>(back.Detail); |
||||
|
|
||||
|
wmsBack.Details.Add(wmsBackDetail); |
||||
|
} |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsBack); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
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 Win_in.Sfs.Wms.DataExchange.Domain; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; |
||||
|
using Win_in.Sfs.Wms.DataExchange.Domain.Shared; |
||||
|
|
||||
|
using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; |
||||
|
|
||||
|
public class BackFluReader : IReader |
||||
|
{ |
||||
|
private readonly IBackfluManager _ibackfluManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<BackFluReader> _logger; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
public BackFluReader( |
||||
|
IBackfluManager ibackfuManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, ILogger<BackFluReader> logger |
||||
|
, IConfiguration configuration |
||||
|
) |
||||
|
{ |
||||
|
_ibackfluManager = ibackfuManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
_configuration = configuration; |
||||
|
} |
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从Tyrp读取待处理bom
|
||||
|
var BackFull = await _ibackfluManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
var toBeProcessedBack = BackFull.Where(p => p.scmout_stat == "Y").ToList(); |
||||
|
if (!toBeProcessedBack.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no backflus"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//bom逐一转换为bomNote
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromBomAsync(toBeProcessedBack); |
||||
|
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); |
||||
|
await _ibackfluManager.UpdateProcessedListAsync(toBeProcessedBack).ConfigureAwait(false); |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private List<IncomingFromExternal> BuildIncomingFromExternalFromBomAsync(List<Backflu> toBeProcessedIssue) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var backflu in toBeProcessedIssue) |
||||
|
{ |
||||
|
var incomingData = BuildIncomingFromExternal(backflu); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var bm = BuildScrapNoteOrderExchangeMes(backflu); |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(backflu); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private IncomingFromExternal BuildIncomingFromExternal(Backflu backflu) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
DataType = EnumIncomingDataType.BackFlush.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = backflu.scmout_type, |
||||
|
SourceDataGroupCode = backflu.scmout_nbr, |
||||
|
SourceDataDetailCode = backflu.scmout_part, |
||||
|
SourceDataContent = JsonSerializer.Serialize(backflu), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(MesIncomingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static BackFlushNoteExchangeDto BuildScrapNoteOrderExchangeMes(Backflu backflu) |
||||
|
{ |
||||
|
|
||||
|
var back = new BackFlushNoteExchangeDto() |
||||
|
{ |
||||
|
|
||||
|
ActiveDate = DateTime.ParseExact(backflu.scmout_dt_w, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), |
||||
|
ItemCode = backflu.scmout_part, |
||||
|
Number = backflu.scmout_nbr |
||||
|
}; |
||||
|
var bakcdetail = new BackFlushNoteDetailExchangeDto() |
||||
|
{ |
||||
|
Number = backflu.scmout_nbr, |
||||
|
ItemCode = backflu.scmout_part, |
||||
|
Qty = backflu.scmout_qty, |
||||
|
LocationErpCode = backflu.scmout_loc |
||||
|
}; |
||||
|
back.Detail = bakcdetail; |
||||
|
return back; |
||||
|
} |
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Auth.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
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.CountAdjustNote; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; |
||||
|
|
||||
|
public class WIPAdjusNoteConverter : IOutgoingConverter |
||||
|
{ |
||||
|
private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; |
||||
|
private readonly IOutgoingToExternalManager _outgoingToExternalManager; |
||||
|
private readonly ISupplierAsnAppService _supplierAsnAppService; |
||||
|
private readonly IDepartmentAppService _departmentAppService; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
|
||||
|
public WIPAdjusNoteConverter( |
||||
|
IOutgoingFromWmsManager outgoingFromWmsManager |
||||
|
, IOutgoingToExternalManager outgoingToExternalManager |
||||
|
, ISupplierAsnAppService supplierAsnAppService |
||||
|
, IDepartmentAppService departmentAppService |
||||
|
, IObjectMapper objectMapper |
||||
|
) |
||||
|
{ |
||||
|
_outgoingFromWmsManager = outgoingFromWmsManager; |
||||
|
_outgoingToExternalManager = outgoingToExternalManager; |
||||
|
_supplierAsnAppService = supplierAsnAppService; |
||||
|
_departmentAppService = departmentAppService; |
||||
|
_objectMapper = objectMapper; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<OutgoingToExternal>> ConvertAsync() |
||||
|
{ |
||||
|
var outgoingToExternalList = new List<OutgoingToExternal>(); |
||||
|
var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.WIPAdjust, EnumSystemType.ERP).ConfigureAwait(false); |
||||
|
foreach (var outgoingFromWms in outgoingFromWmsList) |
||||
|
{ |
||||
|
var wmsCountAdjust = JsonSerializer.Deserialize<CountAdjustNoteDTO>(outgoingFromWms.DataContent); |
||||
|
var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false); |
||||
|
var departmentCode = department == null ? "" : department.Code; |
||||
|
var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); |
||||
|
var detal = details.ToList(); |
||||
|
foreach (var detail in detal) |
||||
|
{ |
||||
|
//判断盘点数与库存数是否相等
|
||||
|
if (detail.CountQty != detail.InventoryQty) |
||||
|
{ |
||||
|
var outgoingToExternal = new OutgoingToExternal() |
||||
|
{ |
||||
|
DataType = outgoingFromWms.DataType, |
||||
|
DataAction = outgoingFromWms.DataAction, |
||||
|
SourceSystem = EnumSystemType.WMS.ToString(), |
||||
|
SourceDataId = wmsCountAdjust.Number, |
||||
|
SourceDataGroupCode = wmsCountAdjust.Number, |
||||
|
SourceDataDetailCode = details.FirstOrDefault().ItemCode, |
||||
|
Writer = nameof(TyrpOutgoingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
DestinationDataId = "", |
||||
|
}; |
||||
|
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); |
||||
|
var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).ConfigureAwait(false); |
||||
|
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue); |
||||
|
var arrive = BuildIssue(exchangeIssue, departmentCode); |
||||
|
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); |
||||
|
|
||||
|
outgoingToExternalList.Add(outgoingToExternal); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); |
||||
|
//将outgoingFromWms数据归档
|
||||
|
await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); |
||||
|
return outgoingToExternalList; |
||||
|
//插入到中间表OutgoingToExternal
|
||||
|
} |
||||
|
private CountAdjust BuildIssue(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode) |
||||
|
{ |
||||
|
var detail = exchangeCountAdjust.Detail; |
||||
|
var counta = new CountAdjust() |
||||
|
{ |
||||
|
mesout_asd_refc = departmentCode, |
||||
|
mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), |
||||
|
mesout_asd_type = "4041", |
||||
|
mesout_asd_part = detail.ItemCode, |
||||
|
mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), |
||||
|
mesout_asd_loc = string.Empty, |
||||
|
mesout_asd_code = detail.ReasonCode, |
||||
|
mesout_asd_qty = detail.CountQty + detail.InventoryQty, |
||||
|
mesout_asd_user = exchangeCountAdjust.Worker, |
||||
|
mesout_asd_k = string.Empty, |
||||
|
mesout_asd_stat = "Y" |
||||
|
}; |
||||
|
return counta; |
||||
|
} |
||||
|
|
||||
|
private async Task<CountAdjustNoteExchangeDto> BuildPurchaseReceiptExchangeDtoAsync( |
||||
|
CountAdjustNoteDTO wmsCountAdjust, CountAdjustNoteDetailExchangeDto wmsCountAdjustDetail) |
||||
|
{ |
||||
|
var exchangeCountAdjust = _objectMapper.Map<CountAdjustNoteDTO, CountAdjustNoteExchangeDto>(wmsCountAdjust); |
||||
|
|
||||
|
exchangeCountAdjust.Detail = wmsCountAdjustDetail; |
||||
|
return exchangeCountAdjust; |
||||
|
} |
||||
|
} |
@ -1,58 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.AspNetCore.Authorization; |
|
||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Volo.Abp.Account; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
using Win_in.Sfs.Auth.Application.Contracts; |
|
||||
using Win_in.Sfs.Wms.Pda.Authenticaitons; |
|
||||
using Win_in.Sfs.Wms.Pda.Models; |
|
||||
using PdaMenuDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuDto; |
|
||||
using PdaMenuGroupDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuGroupDto; |
|
||||
|
|
||||
namespace Win_in.Sfs.Wms.Pda.Controllers.Accounts; |
|
||||
|
|
||||
/// <summary>
|
|
||||
///
|
|
||||
/// </summary>
|
|
||||
[AllowAnonymous] |
|
||||
[ApiController] |
|
||||
[Route($"{PdaHostConst.ROOT_ROUTE}asfasf")] |
|
||||
|
|
||||
public class TestController: AbpController |
|
||||
{ |
|
||||
//private readonly IProfileAppService _profileAppService;
|
|
||||
//private readonly ITokenService _tokenService;
|
|
||||
private readonly IUserMenuAppService _userMenuAppService; |
|
||||
//private readonly IUserWorkGroupAppService _userWorkGroupAppService;
|
|
||||
|
|
||||
/// <summary>
|
|
||||
///
|
|
||||
/// </summary>
|
|
||||
/// <param name="profileAppService"></param>
|
|
||||
/// <param name="tokenService"></param>
|
|
||||
/// <param name="userMenuAppService"></param>
|
|
||||
/// <param name="userWorkGroupAppService"></param>
|
|
||||
public TestController( |
|
||||
IUserMenuAppService userMenuAppService |
|
||||
, IUserWorkGroupAppService userWorkGroupAppService |
|
||||
) |
|
||||
{ |
|
||||
//_profileAppService = profileAppService;
|
|
||||
//_tokenService = tokenService;
|
|
||||
_userMenuAppService = userMenuAppService; |
|
||||
//_userWorkGroupAppService = userWorkGroupAppService;
|
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Test
|
|
||||
/// </summary>
|
|
||||
/// <returns></returns>
|
|
||||
[HttpGet("Test")] |
|
||||
public virtual async Task<List<string>> Test() |
|
||||
{ |
|
||||
return new List<string>() { "sdfsdf'" }; |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,57 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class ItemTransformNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<ItemTransformNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<ItemTransformNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<ItemTransformNote>>> |
||||
|
{ |
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Item_Transform; |
||||
|
private const EnumTransSubType TransSubType = EnumTransSubType.Item_Transform; |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
|
||||
|
public ItemTransformNoteEventHandler(ILocationAppService locationAppService) |
||||
|
{ |
||||
|
_locationAppService = locationAppService; |
||||
|
} |
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<ItemTransformNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<ItemTransformNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<ItemTransformNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<ItemTransformNote>, List<ItemTransformNoteDTO>>(entities); |
||||
|
|
||||
|
foreach (var dto in dtos) |
||||
|
{ |
||||
|
dto.Type = TransSubType.ToString(); |
||||
|
} |
||||
|
|
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos); |
||||
|
await AddManyAsync(exchangeData); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAclService; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class TransferNoteEventHandler : |
||||
|
StoreDataExchangeEventHandlerBase<TransferNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<TransferNote>> |
||||
|
{ |
||||
|
private readonly Domain.Acl.Location.ILocationAclService _locationAclService; |
||||
|
|
||||
|
public TransferNoteEventHandler(ILocationAclService locationAclService) |
||||
|
{ |
||||
|
_locationAclService = locationAclService; |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<TransferNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<TransferNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<TransferNote>, List<TransferNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); |
||||
|
} |
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Acl.Location; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class WipWarehouseAdjustNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<WipWarehouseAdjustNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<WipWarehouseAdjustNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>>> |
||||
|
{ |
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.WipAdjust; |
||||
|
|
||||
|
private ILocationAclService _locationAclService; |
||||
|
|
||||
|
public WipWarehouseAdjustNoteEventHandler(ILocationAclService locationAclService) |
||||
|
{ |
||||
|
_locationAclService = locationAclService; |
||||
|
} |
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<WipWarehouseAdjustNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<WipWarehouseAdjustNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<WipWarehouseAdjustNote>, List<WipWarehouseAdjustNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); |
||||
|
} |
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue