221 changed files with 35750 additions and 137 deletions
@ -0,0 +1,13 @@ |
|||||
|
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.ErpLocations; |
||||
|
|
||||
|
public class ErpLocationLinq2DbRepository : Linq2DbCrudRepository<locmout>, IErpLocationLinq2DbRepository |
||||
|
{ |
||||
|
public ErpLocationLinq2DbRepository(TyrpDb tyrpDb) : base(tyrpDb) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
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.ErpLocationItems; |
||||
|
public class ErpLocationItemLinq2DbRepository : Linq2DbCrudRepository<locdout>, IErpLocationItemLinq2DbRepository |
||||
|
{ |
||||
|
public ErpLocationItemLinq2DbRepository(TyrpDb tyrpDb) : base(tyrpDb) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
public class ErpLocationManager : DomainService, IErpLocationManager |
||||
|
{ |
||||
|
private readonly IErpLocationLinq2DbRepository _repository; |
||||
|
|
||||
|
public ErpLocationManager(IErpLocationLinq2DbRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
public virtual async Task<List<locmout>> GetToBeProcessedListAsync() |
||||
|
{ |
||||
|
var products = await _repository.GetListAsync().ConfigureAwait(false); |
||||
|
return products.ToList(); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
public interface IErpLocationLinq2DbRepository : ILinq2DbRepository<locmout> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
public interface IErpLocationManager |
||||
|
{ |
||||
|
Task<List<locmout>> GetToBeProcessedListAsync(); |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
|
||||
|
public class locmout : Entity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 储位
|
||||
|
/// </summary>
|
||||
|
public string locmout_loc { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 储位类型
|
||||
|
/// </summary>
|
||||
|
public string locmout_stat2 { get; set; } |
||||
|
|
||||
|
|
||||
|
public override object[] GetKeys() |
||||
|
{ |
||||
|
return new object[] { locmout_loc }; |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public class ErpLocationItemManager : DomainService, IErpLocationItemManager |
||||
|
{ |
||||
|
private readonly IErpLocationItemLinq2DbRepository _repository; |
||||
|
|
||||
|
public ErpLocationItemManager(IErpLocationItemLinq2DbRepository repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
public virtual async Task<List<locdout>> GetToBeProcessedListAsync() |
||||
|
{ |
||||
|
var locdouts = await _repository.GetListAsync().ConfigureAwait(false); |
||||
|
return locdouts.ToList(); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface IErpLocationItemLinq2DbRepository : ILinq2DbRepository<locdout> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; |
||||
|
public interface IErpLocationItemManager |
||||
|
{ |
||||
|
Task<List<locdout>> GetToBeProcessedListAsync(); |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
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; |
||||
|
public class locdout : Entity |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 储位
|
||||
|
/// </summary>
|
||||
|
public string locdout_loc { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 零件
|
||||
|
/// </summary>
|
||||
|
public string locdout_part { get; set; } |
||||
|
|
||||
|
|
||||
|
public override object[] GetKeys() |
||||
|
{ |
||||
|
return new object[] { locdout_loc, locdout_part }; |
||||
|
} |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
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.ErpLocation; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class ErpLocationConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<ErpLocationConverter> _logger; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
|
||||
|
public ErpLocationConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager |
||||
|
, IObjectMapper objectMapper |
||||
|
, ILogger<ErpLocationConverter> logger, |
||||
|
IIncomingFromExternalManager incomingFromExternalManager) |
||||
|
{ |
||||
|
_incomingToWmsManager = incomingToWmsManager; |
||||
|
_objectMapper = objectMapper; |
||||
|
_logger = logger; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList) |
||||
|
{ |
||||
|
if (!incomingFromExternalList.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("No ErpLocations"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//按流水号创建单据
|
||||
|
var erpLocationRequestList = await BuildIncomingToWmsOfErpLocationRequestAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
await _incomingToWmsManager.CreateManyAsync(erpLocationRequestList).ConfigureAwait(false); |
||||
|
//归档
|
||||
|
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
private async Task<List<IncomingToWms>> BuildIncomingToWmsOfErpLocationRequestAsync(List<IncomingFromExternal> incomingDataList) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var incomingToWmsList = new List<IncomingToWms>(); |
||||
|
foreach (var item in incomingDataList) |
||||
|
{ |
||||
|
var incomingToWms = new IncomingToWms() |
||||
|
{ |
||||
|
DataType = item.DataType, |
||||
|
DataAction = item.DataAction, |
||||
|
SourceSystem = item.SourceSystem, |
||||
|
DataIdentityCode = item.SourceDataGroupCode, |
||||
|
}; |
||||
|
incomingToWms.SetEffectiveDate(item.EffectiveDate); |
||||
|
var exchangeErpLocationRequest = JsonSerializer.Deserialize<ErpLocationExchangeDto>(item.DestinationDataContent); |
||||
|
var wmsErpLocationRequest = _objectMapper.Map<ErpLocationExchangeDto, ErpLocationEditInput>(exchangeErpLocationRequest); |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsErpLocationRequest); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
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.ErpLocationItem; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
|
||||
|
public class ErpLocationItemConverter : IIncomingConverter |
||||
|
{ |
||||
|
private readonly IIncomingToWmsManager _incomingToWmsManager; |
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
private readonly ILogger<ErpLocationItemConverter> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
|
||||
|
public ErpLocationItemConverter( |
||||
|
IIncomingToWmsManager incomingToWmsManager, |
||||
|
IObjectMapper objectMapper, |
||||
|
ILogger<ErpLocationItemConverter> 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 exchangeErpLocationItem = JsonSerializer.Deserialize<ErpLocationItemExchangeDto>(first.DestinationDataContent); |
||||
|
var wmsErpLocationItem = _objectMapper.Map<ErpLocationItemExchangeDto, ErpLocationItemEditInput>(exchangeErpLocationItem); |
||||
|
incomingToWms.DataContent = JsonSerializer.Serialize(wmsErpLocationItem); |
||||
|
incomingToWmsList.Add(incomingToWms); |
||||
|
} |
||||
|
return incomingToWmsList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
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.ErpLocationItem; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class ErpLocationItemReader : IReader |
||||
|
{ |
||||
|
private readonly IErpLocationItemManager _ilocdoutManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<ErpLocationItemReader> _logger; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
public ErpLocationItemReader( |
||||
|
IErpLocationItemManager ilocdoutManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, IGuidGenerator guidGenerator |
||||
|
, ILogger<ErpLocationItemReader> logger |
||||
|
, IConfiguration configuration |
||||
|
) |
||||
|
{ |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_configuration = configuration; |
||||
|
_ilocdoutManager = ilocdoutManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从Tyrp读取待处理locdout
|
||||
|
var toBeProcessedIssue = await _ilocdoutManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
if (!toBeProcessedIssue.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("未读到EOS开账数据"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//locdout逐一转换为locdout
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromBomAsync(toBeProcessedIssue); |
||||
|
await _incomingFromExternalManager.CreateBulkAsync(incomingDataList).ConfigureAwait(false); |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private List<IncomingFromExternal> BuildIncomingFromExternalFromBomAsync(List<locdout> toBeProcessedIssue) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var locdout in toBeProcessedIssue) |
||||
|
{ |
||||
|
var incomingData = BuildIncomingFromExternal(locdout); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var bm = BuildScrapNoteOrderExchangeMes(locdout); |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(bm); |
||||
|
incomingData.SetId(_guidGenerator.Create()); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
return incomingDataList; |
||||
|
} |
||||
|
private IncomingFromExternal BuildIncomingFromExternal(locdout locdout) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
|
||||
|
DataType = EnumIncomingDataType.ErpLocationItem.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = locdout.locdout_loc, |
||||
|
SourceDataGroupCode = locdout.locdout_loc, |
||||
|
SourceDataDetailCode = locdout.locdout_part, |
||||
|
SourceDataContent = JsonSerializer.Serialize(locdout), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(TyrpIncomingBackgroundWorker), |
||||
|
DestinationSystem = EnumSystemType.ERP.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static ErpLocationItemExchangeDto BuildScrapNoteOrderExchangeMes(locdout locdout) |
||||
|
{ |
||||
|
|
||||
|
var cust = new ErpLocationItemExchangeDto() |
||||
|
{ |
||||
|
ErpLocationCode = locdout.locdout_loc, |
||||
|
ItemCode = locdout.locdout_part, |
||||
|
}; |
||||
|
|
||||
|
return cust; |
||||
|
} |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
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.ErpLocation; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Incoming; |
||||
|
|
||||
|
public class ErpLocationReader : IReader |
||||
|
{ |
||||
|
private readonly IErpLocationManager _erpLocationManager; |
||||
|
private readonly IIncomingFromExternalManager _incomingFromExternalManager; |
||||
|
private readonly ILogger<ErpLocationReader> _logger; |
||||
|
|
||||
|
public ErpLocationReader( |
||||
|
IErpLocationManager erpLocationManager |
||||
|
, IIncomingFromExternalManager incomingFromExternalManager |
||||
|
, ILogger<ErpLocationReader> logger |
||||
|
) |
||||
|
{ |
||||
|
_erpLocationManager = erpLocationManager; |
||||
|
_incomingFromExternalManager = incomingFromExternalManager; |
||||
|
_logger = logger; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<List<IncomingFromExternal>> ReadAsync() |
||||
|
{ |
||||
|
//从MES读取待处理locmout
|
||||
|
var toBeProcessedDatas = await _erpLocationManager.GetToBeProcessedListAsync().ConfigureAwait(false); |
||||
|
if (!toBeProcessedDatas.Any()) |
||||
|
{ |
||||
|
_logger.LogInformation("no erpLocations"); |
||||
|
return new List<IncomingFromExternal>(); |
||||
|
} |
||||
|
//locmout逐一转换为ErpLocation
|
||||
|
var incomingDataList = BuildIncomingFromExternalFromShipAsync(toBeProcessedDatas); |
||||
|
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); |
||||
|
|
||||
|
return incomingDataList; |
||||
|
} |
||||
|
|
||||
|
private static List<IncomingFromExternal> BuildIncomingFromExternalFromShipAsync(List<locmout> toBeProcessedDatas) |
||||
|
{ |
||||
|
var incomingDataList = new List<IncomingFromExternal>(); |
||||
|
foreach (var item in toBeProcessedDatas) |
||||
|
{ |
||||
|
var incomingData = BuildIncomingFromExternal(item); |
||||
|
|
||||
|
incomingData.SetEffectiveDate(DateTime.Now); |
||||
|
incomingData.SetSuccess(); |
||||
|
try |
||||
|
{ |
||||
|
var erpLocationNote = BuildErpLocationCreateInput(item); |
||||
|
incomingData.DestinationDataContent = JsonSerializer.Serialize(erpLocationNote); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); |
||||
|
} |
||||
|
|
||||
|
incomingDataList.Add(incomingData); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
return incomingDataList; |
||||
|
} |
||||
|
|
||||
|
private static IncomingFromExternal BuildIncomingFromExternal(locmout locmout) |
||||
|
{ |
||||
|
var incomingData = new IncomingFromExternal() |
||||
|
{ |
||||
|
DataType = EnumIncomingDataType.ErpLocation.ToString(), |
||||
|
DataAction = EnumExchangeDataAction.Add, |
||||
|
SourceSystem = EnumSystemType.ERP.ToString(), |
||||
|
SourceDataId = locmout.locmout_loc, |
||||
|
SourceDataGroupCode = locmout.locmout_loc, |
||||
|
SourceDataDetailCode = locmout.locmout_loc, |
||||
|
SourceDataContent = JsonSerializer.Serialize(locmout), |
||||
|
WriteTime = DateTime.Now, |
||||
|
Writer = nameof(TyrpIncomingBackgroundWorker), |
||||
|
|
||||
|
DestinationSystem = EnumSystemType.WMS.ToString(), |
||||
|
}; |
||||
|
return incomingData; |
||||
|
} |
||||
|
|
||||
|
private static ErpLocationExchangeDto BuildErpLocationCreateInput(locmout locmout) |
||||
|
{ |
||||
|
|
||||
|
var erpLocation = new ErpLocationExchangeDto() |
||||
|
{ |
||||
|
Code = locmout.locmout_loc, |
||||
|
Name = locmout.locmout_loc, |
||||
|
Type = locmout.locmout_stat2, |
||||
|
WarehouseCode = locmout.locmout_stat2, |
||||
|
|
||||
|
}; |
||||
|
return erpLocation; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.WMS.ErpLocation; |
||||
|
|
||||
|
public class ErpLocationExchangeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 代码
|
||||
|
/// </summary>
|
||||
|
|
||||
|
[Display(Name = "代码")] |
||||
|
[Required] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Code { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 名称
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "名称")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 描述
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "描述")] |
||||
|
[StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Description { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "类型")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓库代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "仓库代码")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WarehouseCode { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.DataExchange.WMS.ErpLocationItem; |
||||
|
public class ErpLocationItemExchangeDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 储位代码
|
||||
|
/// </summary>
|
||||
|
|
||||
|
[Display(Name = "储位代码")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ErpLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物品代码")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ItemCode { get; set; } |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Xml.Linq; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Boms.DTOs; |
||||
|
public class BomComponentDTO |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
[Display(Name = "根物料号")] |
||||
|
public string Root { get; set; } |
||||
|
[Display(Name = "物料号")] |
||||
|
public string Component { get; set; } |
||||
|
[Display(Name = "单位")] |
||||
|
public string ComponentUom { get; set; } |
||||
|
[Display(Name = "用量")] |
||||
|
public decimal ComponentQty { get; set; } |
||||
|
|
||||
|
[Display(Name = "父物料号")] |
||||
|
public string ParentComponent { get; set; } |
||||
|
[Display(Name = "合计数量")] |
||||
|
public decimal SumQty { get; set; } |
||||
|
|
||||
|
[Display(Name = "层数")] |
||||
|
public int Level { get; set; } |
||||
|
public List<BomComponent> SubComponents { get; set; } |
||||
|
|
||||
|
[Display(Name = "拆解路径")] |
||||
|
public string Path { set; get; } |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
[Display(Name = "物料和储位对应关系")] |
||||
|
|
||||
|
public class ErpLocationItemDTO : SfsBaseDataDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物料代码")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[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 ErpLocationCode { get; set; } |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
public static class ErpLocationItemPermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = BasedataPermissions.GroupName + "." + nameof(ErpLocationItem); |
||||
|
public const string Create = Default + "." + BasedataPermissions.CreateStr; |
||||
|
public const string Update = Default + "." + BasedataPermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + BasedataPermissions.DeleteStr; |
||||
|
|
||||
|
public static void AddErpLocationItemPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var erpLocationItemPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(ErpLocationItem))); |
||||
|
erpLocationItemPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr)); |
||||
|
erpLocationItemPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr)); |
||||
|
erpLocationItemPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
public interface IErpLocationItemAppService : ISfsBaseDataAppServiceBase<ErpLocationItemDTO, SfsBaseDataRequestInputBase, ErpLocationItemEditInput>, ISfsUpsertAppService<ErpLocationItemEditInput> |
||||
|
{ |
||||
|
Task<ErpLocationItemDTO> CheckItemErpLocationIsAvailable(string itemCode, string erpLocationCode); |
||||
|
Task<List<ErpLocationItemDTO>> GetListByItemCodeAsync(string itemCode); |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
public class ErpLocationItemEditInput : SfsBaseDataCreateOrUpdateInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "物料代码")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[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 ErpLocationCode { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
[Display(Name = "物料和储位对应关系")] |
||||
|
public class ErpLocationItemImportInput : SfsBaseDataImportInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
[Display(Name = "物料代码")] |
||||
|
[Required(ErrorMessage = "{0}不能为空")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 储位代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "储位代码")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ErpLocationCode { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,113 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
using Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application; |
||||
|
|
||||
|
[Authorize] |
||||
|
[Route($"{BasedataConsts.RootPath}erplocation-item")] |
||||
|
|
||||
|
public class ErpLocationItemAppService |
||||
|
: SfsBaseDataAppServiceBase<ErpLocationItem, ErpLocationItemDTO, SfsBaseDataRequestInputBase, ErpLocationItemEditInput, ErpLocationItemImportInput> |
||||
|
, IErpLocationItemAppService |
||||
|
{ |
||||
|
private readonly IErpLocationItemManager _manager; |
||||
|
private new readonly IErpLocationItemRepository _repository; |
||||
|
|
||||
|
public ErpLocationItemAppService( |
||||
|
IErpLocationItemRepository repository |
||||
|
, IDistributedCache<ErpLocationItemDTO> cache |
||||
|
, IErpLocationItemManager manager |
||||
|
, IItemBasicAppService itemBasicAppService) : base(repository, cache) |
||||
|
{ |
||||
|
base.CreatePolicyName = ErpLocationItemPermissions.Create; |
||||
|
base.UpdatePolicyName = ErpLocationItemPermissions.Update; |
||||
|
base.DeletePolicyName = ErpLocationItemPermissions.Delete; |
||||
|
_repository = repository; |
||||
|
_manager = manager; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用来重写 新增实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="UserFriendlyException"></exception>
|
||||
|
[HttpPost("")] |
||||
|
[UnitOfWork] |
||||
|
public override async Task<ErpLocationItemDTO> CreateAsync(ErpLocationItemEditInput input) |
||||
|
{ |
||||
|
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false); |
||||
|
Check.NotNull(itemBasic, "物品代码", $"物品 {input.ItemCode} 不存在"); |
||||
|
|
||||
|
var erpLocation = await ErpLocationAppService.GetByCodeAsync(input.ErpLocationCode).ConfigureAwait(false); |
||||
|
Check.NotNull(erpLocation, "储位代码", $"储位 {input.ErpLocationCode} 不存在"); |
||||
|
|
||||
|
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == input.ItemCode && p.ErpLocationCode == input.ErpLocationCode).ConfigureAwait(false); |
||||
|
|
||||
|
if(entity != null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"物品{input.ItemCode}和储位{input.ErpLocationCode} 对应关系已存在"); |
||||
|
} |
||||
|
|
||||
|
return await base.CreateAsync(input).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检查物料和储位对应关系是否存在
|
||||
|
/// </summary>
|
||||
|
/// <param name="itemCode"></param>
|
||||
|
/// <param name="erpLocationCode"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("check-item-erplocation-is-available")] |
||||
|
public virtual async Task<ErpLocationItemDTO> CheckItemErpLocationIsAvailable(string itemCode,string erpLocationCode) |
||||
|
{ |
||||
|
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == itemCode && p.ErpLocationCode== erpLocationCode).ConfigureAwait(false); |
||||
|
|
||||
|
if (entity == null) |
||||
|
{ |
||||
|
if (await SettingManager.IsTrueAsync(BasedataSettings.ErpLocationItem.NotFoundReturnInfinity).ConfigureAwait(false)) |
||||
|
{ |
||||
|
|
||||
|
entity = new ErpLocationItem() |
||||
|
{ |
||||
|
ItemCode = itemCode, |
||||
|
ErpLocationCode= erpLocationCode |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
var dto = ObjectMapper.Map<ErpLocationItem, ErpLocationItemDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("upsert")] |
||||
|
public virtual async Task UpsertAsync(ErpLocationItemEditInput input) |
||||
|
{ |
||||
|
var entity = ObjectMapper.Map<ErpLocationItemEditInput, ErpLocationItem>(input); |
||||
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[HttpGet("list/by-item")] |
||||
|
public virtual async Task<List<ErpLocationItemDTO>> GetListByItemCodeAsync(string itemCode) |
||||
|
{ |
||||
|
var entities = await _repository.GetListAsync(c => c.ItemCode == itemCode).ConfigureAwait(false); |
||||
|
var dtos = ObjectMapper.Map<List<ErpLocationItem>, List<ErpLocationItemDTO>>(entities); |
||||
|
return dtos; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application; |
||||
|
|
||||
|
public partial class BasedataApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void ErpLocationItemAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<ErpLocationItem, ErpLocationItemDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<ErpLocationItemImportInput, ErpLocationItem>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Remark) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
; |
||||
|
|
||||
|
CreateMap<ErpLocationItemEditInput, ErpLocationItem>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x=>x.Id) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
; |
||||
|
CreateMap<ErpLocationItemEditInput, ErpLocationItem>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
||||
|
} |
||||
|
} |
@ -0,0 +1,73 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
|
||||
|
public class SingletonCacheList<T> |
||||
|
{ |
||||
|
private static volatile SingletonCacheList<T> instance; |
||||
|
private static object syncRoot = new object(); |
||||
|
private List<T> cacheList; |
||||
|
|
||||
|
private SingletonCacheList() |
||||
|
{ |
||||
|
cacheList = new List<T>(); |
||||
|
} |
||||
|
|
||||
|
public static SingletonCacheList<T> Instance |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
if (instance == null) |
||||
|
{ |
||||
|
lock (syncRoot) |
||||
|
{ |
||||
|
if (instance == null) |
||||
|
{ |
||||
|
instance = new SingletonCacheList<T>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return instance; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void Add(T item) |
||||
|
{ |
||||
|
cacheList.Add(item); |
||||
|
} |
||||
|
|
||||
|
public void Remove(T item) |
||||
|
{ |
||||
|
cacheList.Remove(item); |
||||
|
} |
||||
|
|
||||
|
public bool Contains(T item) |
||||
|
{ |
||||
|
return cacheList.Contains(item); |
||||
|
} |
||||
|
|
||||
|
public T this[int index] |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
return cacheList[index]; |
||||
|
} |
||||
|
set |
||||
|
{ |
||||
|
cacheList[index] = value; |
||||
|
} |
||||
|
} |
||||
|
public int Count() |
||||
|
{ |
||||
|
return cacheList.Count(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
|
||||
|
public enum EnumBomSelectedType |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 树状
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "树装")] |
||||
|
Tree = 0, |
||||
|
/// <summary>
|
||||
|
/// 一维
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "一维")] |
||||
|
Dimension = 1, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 最终子节点
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "最终子节点")] |
||||
|
Last = 2, |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Boms; |
||||
|
public class BomComponent |
||||
|
{ |
||||
|
public string Root { get; set; } |
||||
|
public string Component { get; set; } |
||||
|
public string ComponentUom { get; set; } |
||||
|
public decimal ComponentQty { get; set; } |
||||
|
|
||||
|
|
||||
|
public string ParentComponent { get; set; } |
||||
|
|
||||
|
public decimal SumQty { get; set; } |
||||
|
public int Level { get; set; } |
||||
|
public List<BomComponent> SubComponents { get; set; } |
||||
|
|
||||
|
|
||||
|
public string Path { set; get; } |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Caches; |
||||
|
public static class Cache |
||||
|
{ |
||||
|
public static List<Bom> Boms = new List<Bom>(); |
||||
|
public static async void BomsLifeCycle(int lifetime) |
||||
|
{ |
||||
|
var reassigner = new Reassigner(DateTime.Now,new TimeSpan(0,5,0)); |
||||
|
await reassigner.RunAsync(() => { |
||||
|
Boms.Clear(); |
||||
|
}).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
public class Reassigner |
||||
|
{ |
||||
|
private readonly TimeSpan _interval; |
||||
|
private DateTime _lasttime; |
||||
|
public Reassigner(DateTime lasttime, TimeSpan interval) |
||||
|
{ |
||||
|
_lasttime = lasttime; |
||||
|
_interval = interval; |
||||
|
} |
||||
|
|
||||
|
public async Task RunAsync(Action p_action) |
||||
|
{ |
||||
|
while (true) |
||||
|
{ |
||||
|
// 获取当前时间
|
||||
|
var currentTime = DateTime.Now; |
||||
|
// 计算上次重新赋值到现在的时间间隔
|
||||
|
var elapsed = currentTime - _lasttime; |
||||
|
// 检查时间间隔是否满足条件
|
||||
|
if (elapsed >= _interval) |
||||
|
{ |
||||
|
p_action(); |
||||
|
// 重新赋值
|
||||
|
//_value = await GetValueAsync();
|
||||
|
// 更新最后更新时间
|
||||
|
_lasttime = currentTime; |
||||
|
} |
||||
|
|
||||
|
// 等待下一刻钟
|
||||
|
await Task.Delay(_interval); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,21 @@ |
|||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
public class ErpLocationItem : SfsBaseDataAggregateRootBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 物料代码
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 储位代码
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string ErpLocationCode { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
public class ErpLocationItemManager : DomainService, IErpLocationItemManager |
||||
|
{ |
||||
|
private readonly IErpLocationItemRepository _repository; |
||||
|
|
||||
|
private readonly IItemBasicRepository _itemBasicRepository; |
||||
|
|
||||
|
public ErpLocationItemManager(IErpLocationItemRepository repository, IItemBasicRepository itemBasicRepository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
_itemBasicRepository = itemBasicRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行导入
|
||||
|
/// </summary>
|
||||
|
public virtual async Task ImportDataAsync(List<ErpLocationItem> mergeEntities, List<ErpLocationItem> deleteEntities = null) |
||||
|
{ |
||||
|
if (deleteEntities != null && deleteEntities.Count > 0) |
||||
|
{ |
||||
|
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.Domain.Services; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
public interface IErpLocationItemManager : IDomainService, IBulkImportService<ErpLocationItem> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Domain; |
||||
|
|
||||
|
public interface IErpLocationItemRepository : ISfsBaseDataRepositoryBase<ErpLocationItem>, ISfsBulkRepositoryBase<ErpLocationItem> |
||||
|
{ |
||||
|
public Task UpsertAsync(ErpLocationItem entity); |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.EntityFrameworkCore; |
||||
|
|
||||
|
public static class ErpLocationItemDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureErpLocationItem(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<ErpLocationItem>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(ErpLocationItem), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsBase(); |
||||
|
|
||||
|
//Properties
|
||||
|
|
||||
|
b.Property(q => q.ItemCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.ErpLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
|
||||
|
|
||||
|
//Relations
|
||||
|
//None
|
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.ItemCode, q.ErpLocationCode }).IsUnique(); |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.EntityFrameworkCore; |
||||
|
|
||||
|
public class ErpLocationItemEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, ErpLocationItem>, IErpLocationItemRepository, ISfsBulkRepositoryBase<ErpLocationItem> |
||||
|
{ |
||||
|
public ErpLocationItemEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public virtual async Task UpsertAsync(ErpLocationItem entity) |
||||
|
{ |
||||
|
var dbSet = await GetDbSetAsync().ConfigureAwait(false); |
||||
|
var exist = await dbSet.FirstOrDefaultAsync(p => p.ItemCode == entity.ItemCode&&p.ErpLocationCode == entity.ErpLocationCode).ConfigureAwait(false); |
||||
|
if (exist == null) |
||||
|
{ |
||||
|
var insRet = await InsertAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Caching; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Application; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Inventory.Domain.Acl.ErpLocationItem; |
||||
|
public class ErpLocationItemAclService |
||||
|
: AclServiceBase, IErpLocationItemAclService |
||||
|
{ |
||||
|
private readonly IErpLocationItemAppService _appService; |
||||
|
private readonly IDistributedCache<ErpLocationItemDTO> _cache; |
||||
|
|
||||
|
public ErpLocationItemAclService( |
||||
|
IErpLocationItemAppService appService |
||||
|
, IDistributedCache<ErpLocationItemDTO> cache |
||||
|
) |
||||
|
{ |
||||
|
_appService = appService; |
||||
|
_cache = cache; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ErpLocationItemDTO> GetFirstAsync(string itemCode, string locationCode) |
||||
|
{ |
||||
|
var dto = await _cache.GetOrAddItemAsync( |
||||
|
$"{itemCode}:{locationCode}", |
||||
|
async () => await GetFromAppServiceAsync(itemCode, locationCode).ConfigureAwait(false), |
||||
|
CacheMinutes).ConfigureAwait(false); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
private async Task<ErpLocationItemDTO> GetFromAppServiceAsync(string itemCode, string locationCode) |
||||
|
{ |
||||
|
return await _appService.CheckItemErpLocationIsAvailable(itemCode, locationCode).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Inventory.Domain.Acl.ErpLocationItem; |
||||
|
public interface IErpLocationItemAclService |
||||
|
{ |
||||
|
Task<ErpLocationItemDTO> GetFirstAsync(string itemCode, string locationCode); |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
public enum EnumMesStatus |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 执行中
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "执行中")] |
||||
|
Handling = 2, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已过时
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已过时")] |
||||
|
OverTime =3 , |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 有更新
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "有更新")] |
||||
|
Update = 4, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// WEI
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "未开启")] |
||||
|
New =1 , |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 三方库库移任务
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "三方库库移任务")] |
||||
|
public class ThirdLocationJobDTO : SfsJobDTOBase<ThirdLocationJobDetailDTO> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 要货申请单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "要货申请单号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求库位")] |
||||
|
public string RequestLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位")] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库区")] |
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位组")] |
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到ERP库位")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到仓库")] |
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工序")] |
||||
|
public string Operation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配送方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "配送方式")] |
||||
|
public EnumDistributionType DistributionType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整方式")] |
||||
|
public EnumTruncType TruncType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整后数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整后数量")] |
||||
|
public decimal RoundedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划拆分规则
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划拆分规则")] |
||||
|
public EnumPlannedSplitRule PlannedSplitRule { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划开始时间")] |
||||
|
public DateTime PlanBeginTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每次配送数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "每次配送数量")] |
||||
|
public decimal DeliveryQty { get; set; } |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface IThirdLocationJobAppService |
||||
|
: ISfsJobAppServiceBase<ThirdLocationJobDTO, SfsJobRequestInputBase, ThirdLocationJobCheckInput, ThirdLocationJobEditInput> |
||||
|
{ |
||||
|
Task<List<ThirdLocationJobDTO>> CheckJobExistByItemCodeAndLocationCode(string itemCode, string locationCode); |
||||
|
|
||||
|
Task CancelByMaterialRequestAsync(string thirdLocationNumber); |
||||
|
|
||||
|
Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType, |
||||
|
bool includeDetails = false, CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<ThirdLocationJobDTO>> GetByRequestNumberAsync(string requestNumber); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 保存拆箱时涉及的明细修改
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
Task<ThirdLocationJobDTO> SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input); |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobCheckInput : SfsJobCheckInputBase |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库区
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库区")] |
||||
|
public string ToLocationArea { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到库位组
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到库位组")] |
||||
|
public string ToLocationGroup { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到ERP库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到ERP库位")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToLocationErpCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到仓库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "到仓库")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ToWarehouseCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 在途库库位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "在途库库位")] |
||||
|
public string OnTheWayLocationCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工作中心
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工作中心")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string WorkStation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "工序")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Operation { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 配送方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "配送方式")] |
||||
|
public EnumDistributionType DistributionType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整方式
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整方式")] |
||||
|
public EnumTruncType TruncType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 取整后数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "取整后数量")] |
||||
|
public decimal RoundedQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划拆分规则
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划拆分规则")] |
||||
|
public EnumPlannedSplitRule PlannedSplitRule { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划开始时间")] |
||||
|
public DateTime PlanBeginTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 每次配送数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "每次配送数量")] |
||||
|
public decimal DeliveryQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 位置码
|
||||
|
/// </summary>
|
||||
|
public string PositionCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 推荐类型
|
||||
|
/// </summary>
|
||||
|
public EnumRecommendType RecommendType { get; set; } |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class ThirdLocationJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput<ThirdLocationJobDetailInput> |
||||
|
{ |
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 上游任务编号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "上游任务编号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string UpStreamJobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 要货单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "要货单号")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 叫料请求类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "叫料请求类型")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string RequestType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务类型")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public EnumJobType JobType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 是否自动完成
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "是否自动完成")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public bool IsAutoComplete { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 过期时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "过期时间")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime ExpiredTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务明细
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务明细")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public List<ThirdLocationJobDetailInput> Details { get; set; } = new(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "车间")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Workshop { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产线
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产线")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string ProdLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 使用在途库
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "使用在途库")] |
||||
|
public bool UseOnTheWayLocation { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class ThirdLocationJobPermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(ThirdLocationJob); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
//自动发料任务
|
||||
|
public const string AutoThirdLocationJob = StorePermissions.GroupName + "." + nameof(AutoThirdLocationJob); |
||||
|
|
||||
|
public static void AddThirdLocationJobPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var thirdLocationJobPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(ThirdLocationJob))); |
||||
|
thirdLocationJobPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
thirdLocationJobPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
thirdLocationJobPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
|
||||
|
permissionGroup.AddPermission(AutoThirdLocationJob, StorePermissionDefinitionProvider.L(nameof(AutoThirdLocationJob))); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class CustomerProductionReturnNotePermissions |
||||
|
{ |
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(CustomerProductionReturnNote); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
public static void AddCustomerProductionReturnNotePermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var CustomerProductionReturnNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(CustomerProductionReturnNote))); |
||||
|
CustomerProductionReturnNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
CustomerProductionReturnNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
CustomerProductionReturnNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退库记录-实体DTO
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退库记录")] |
||||
|
public class CustomerProductionReturnNoteDTO : SfsStoreDTOBase<CustomerProductionReturnNoteDetailDTO> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料单号")] |
||||
|
public string ProductionReturnRequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料时间")] |
||||
|
public DateTime ReturnTime { get; set; } |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退库记录-明细表-实体DTO
|
||||
|
/// </summary>
|
||||
|
public class CustomerProductionReturnNoteDetailDTO : SfsStoreRecommendToDetailWithFromToDTOBase |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface ICustomerProductionReturnNoteAppService : |
||||
|
ISfsStoreMasterReadOnlyAppServiceBase<CustomerProductionReturnNoteDTO, SfsStoreRequestInputBase, CustomerProductionReturnNoteDetailDTO, SfsStoreRequestInputBase> |
||||
|
{ |
||||
|
Task<CustomerProductionReturnNoteDTO> CreateAsync(CustomerProductionReturnNoteEditInput input); |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退库记录-明细表-实体DTO
|
||||
|
/// </summary>
|
||||
|
public class CustomerProductionReturnNoteDetailInput : SfsStoreRecommendToDetailWithFromToDTOBase |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退库记录-新增和更新基础DTO
|
||||
|
/// </summary>
|
||||
|
public class CustomerProductionReturnNoteEditInput : SfsStoreCreateOrUpdateInputBase |
||||
|
{ |
||||
|
#region Base
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料时间")] |
||||
|
public DateTime ReturnTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料申请单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料申请单号")] |
||||
|
public string ProductionReturnRequestNumber { get; set; } |
||||
|
#endregion
|
||||
|
|
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 退库记录单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退库记录单号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Number { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细列表")] |
||||
|
public List<CustomerProductionReturnNoteDetailInput> Details { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退库记录-实体DTO
|
||||
|
/// </summary>
|
||||
|
public class CustomerProductionReturnNoteImportInput : SfsStoreImportInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料时间")] |
||||
|
public DateTime ReturnTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 退料单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "退料单号")] |
||||
|
public string ProductionReturnRequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "采购订单号")] |
||||
|
public string PoNumber { get; set; } |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordDTO : SfsStoreDTOBase<MesRecordDetailDTO>, IHasNumber |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "类型")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
|
||||
|
public EnumMesStatus State { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求单号")] |
||||
|
public string ScrapRequestNumber { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordDetailDTO : SfsStoreDetailWithFromToDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 原因代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "原因代码")] |
||||
|
public string ReasonCode { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
using System.Threading; |
||||
|
|
||||
|
public interface IMesRecordAppService : ISfsStoreMasterReadOnlyAppServiceBase<MesRecordDTO, SfsStoreRequestInputBase, MesRecordDetailDTO, SfsStoreRequestInputBase> |
||||
|
{ |
||||
|
Task<MesRecordDTO> CreateAsync(MesRecordEditInput input); |
||||
|
|
||||
|
Task<PagedResultDto<MesRecordDTO>> GetListByTypeAsync( |
||||
|
SfsStoreRequestInputBase requestInput, |
||||
|
string type, |
||||
|
bool includeDetails = false, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue