21 changed files with 350 additions and 5 deletions
@ -0,0 +1,29 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
[Display(Name = "库位组")] |
|||
|
|||
public class LocationDeliveryDTO : SfsBaseDataDTOBase |
|||
{ |
|||
/// <summary>
|
|||
/// 来源库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源库位")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标库位")] |
|||
public string ToLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配送方式
|
|||
/// </summary>
|
|||
[Display(Name = "配送方式")] |
|||
public EnumLocationDeliveryType EnumLocationDeliveryType { get; set; } |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public interface ILocationDeliveryAppService |
|||
: ISfsBaseDataAppServiceBase<LocationDeliveryDTO, SfsBaseDataRequestInputBase, LocationDeliveryEditInput> |
|||
{ |
|||
} |
@ -0,0 +1,27 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public class LocationDeliveryEditInput : SfsBaseDataWithWarehouseCreateOrUpdateInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 来源库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源库位")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标库位")] |
|||
public string ToLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配送方式
|
|||
/// </summary>
|
|||
[Display(Name = "配送方式")] |
|||
public EnumLocationDeliveryType EnumLocationDeliveryType { get; set; } |
|||
} |
@ -0,0 +1,42 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
[Display(Name = "库位配送方式")] |
|||
public class LocationDeliveryImportInput : SfsBaseDataImportInputBase |
|||
{ |
|||
/// <summary>
|
|||
/// 来源库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
[StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
[StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string ToLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配送方式
|
|||
/// </summary>
|
|||
[Display(Name = "配送方式")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
[StringLength(SfsEfCorePropertyConst.NameLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public EnumLocationDeliveryType EnumLocationDeliveryType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
[Display(Name = "备注")] |
|||
[StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] |
|||
public string Remark { 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 LocationDeliveryPermissions |
|||
{ |
|||
|
|||
public const string Default = BasedataPermissions.GroupName + "." + nameof(LocationDelivery); |
|||
public const string Create = Default + "." + BasedataPermissions.CreateStr; |
|||
public const string Update = Default + "." + BasedataPermissions.UpdateStr; |
|||
public const string Delete = Default + "." + BasedataPermissions.DeleteStr; |
|||
|
|||
public static void AddLocationDeliveryPermission(this PermissionGroupDefinition permissionGroup) |
|||
{ |
|||
var LocationDeliveryPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(LocationDelivery))); |
|||
LocationDeliveryPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr)); |
|||
LocationDeliveryPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr)); |
|||
LocationDeliveryPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr)); |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Threading.Tasks; |
|||
|
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.Caching; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Basedata.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application; |
|||
|
|||
[Authorize] |
|||
[Route($"{BasedataConsts.RootPath}location-group")] |
|||
|
|||
public class LocationDeliveryAppService |
|||
: SfsBaseDataAppServiceBase<LocationDelivery, LocationDeliveryDTO, SfsBaseDataRequestInputBase, LocationDeliveryEditInput, LocationDeliveryImportInput> |
|||
, ILocationDeliveryAppService |
|||
{ |
|||
|
|||
private readonly IAreaAppService _areaAppService; |
|||
|
|||
private readonly ILocationDeliveryManager _manager; |
|||
public LocationDeliveryAppService( |
|||
ILocationDeliveryRepository repository |
|||
, IDistributedCache<LocationDeliveryDTO> cache |
|||
, ILocationDeliveryManager manager |
|||
, IAreaAppService areaAppService |
|||
) : base(repository, cache) |
|||
{ |
|||
_areaAppService = areaAppService; |
|||
base.CreatePolicyName = LocationDeliveryPermissions.Create; |
|||
base.UpdatePolicyName = LocationDeliveryPermissions.Update; |
|||
base.DeletePolicyName = LocationDeliveryPermissions.Delete; |
|||
|
|||
_manager = manager; |
|||
} |
|||
|
|||
protected override async Task ValidateImportModelAsync(LocationDeliveryImportInput importInput, List<ValidationResult> validationRresult) |
|||
{ |
|||
await base.ValidateImportModelAsync(importInput, validationRresult).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
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 LocationDeliveryAutoMapperProfile() |
|||
{ |
|||
CreateMap<LocationDelivery, LocationDeliveryDTO>() |
|||
.ReverseMap(); |
|||
|
|||
CreateMap<LocationDeliveryImportInput, LocationDelivery>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
; |
|||
|
|||
CreateMap<LocationDelivery, LocationDeliveryImportInput>() |
|||
.Ignore(x => x.ReportStatus) |
|||
.Ignore(x => x.ReportReason); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
public enum EnumLocationDeliveryType |
|||
{ |
|||
/// <summary>
|
|||
/// 正常
|
|||
/// </summary>
|
|||
[Display(Name = "正常")] Normal = 1, |
|||
|
|||
/// <summary>
|
|||
/// Agv
|
|||
/// </summary>
|
|||
[Display(Name = "Agv")] Agv = 2 |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface ILocationDeliveryManager : IDomainService, IBulkImportService<LocationDelivery> |
|||
{ |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface ILocationDeliveryRepository : ISfsBaseDataRepositoryBase<LocationDelivery>, ISfsBulkRepositoryBase<LocationDelivery> |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
/// <summary>
|
|||
/// 配送方式
|
|||
/// </summary>
|
|||
public class LocationDelivery : SfsBaseDataAggregateRootBase |
|||
{ |
|||
/// <summary>
|
|||
/// 来源库位
|
|||
/// </summary>
|
|||
[Display(Name = "来源库位")] |
|||
public string FromLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 目标库位
|
|||
/// </summary>
|
|||
[Display(Name = "目标库位")] |
|||
public string ToLocationCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 配送方式
|
|||
/// </summary>
|
|||
[Display(Name = "配送方式")] |
|||
public EnumLocationDeliveryType EnumLocationDeliveryType{ get; set; } |
|||
} |
@ -0,0 +1,33 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public class LocationDeliveryManager : DomainService, ILocationDeliveryManager |
|||
{ |
|||
private readonly ILocationDeliveryRepository _repository; |
|||
|
|||
private readonly IWarehouseRepository _warehourseRepository; |
|||
private readonly IAreaRepository _areaRepository; |
|||
|
|||
public LocationDeliveryManager(ILocationDeliveryRepository repository, IWarehouseRepository warehourseRepository, IAreaRepository areaRepository) |
|||
{ |
|||
_repository = repository; |
|||
_warehourseRepository = warehourseRepository; |
|||
_areaRepository = areaRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<LocationDelivery> mergeEntities, List<LocationDelivery> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
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 LocationDeliveryDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureLocationDelivery(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<LocationDelivery>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(LocationDelivery), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsBase(); |
|||
|
|||
//Properties
|
|||
|
|||
b.Property(q => q.FromLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
|||
b.Property(q => q.ToLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); |
|||
|
|||
b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength); |
|||
|
|||
b.HasIndex(q => new { q.FromLocationCode,q.ToLocationCode }).IsUnique(); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Win_in.Sfs.Basedata.Domain; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.EntityFrameworkCore; |
|||
|
|||
public class LocationDeliveryEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, LocationDelivery>, ILocationDeliveryRepository, ISfsBulkRepositoryBase<LocationDelivery> |
|||
{ |
|||
public LocationDeliveryEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
Loading…
Reference in new issue