17 changed files with 549 additions and 1 deletions
@ -0,0 +1,29 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
/// <summary>
|
|||
/// 库位
|
|||
/// </summary>
|
|||
[Display(Name = "工作站库位对应关系")] |
|||
public class PostionLocationDTO : SfsBaseDataDTOBase, IHasCode, IHasName |
|||
{ |
|||
[Display(Name = "工作站编号")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[Display(Name = "名称")] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// WMS库位
|
|||
/// </summary>
|
|||
[Display(Name = "库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocationCode { get; set; } |
|||
} |
@ -0,0 +1,26 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Basedata.tests; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public interface IPostionLocationAppService |
|||
: ISfsBaseDataAppServiceBase<PostionLocationDTO, SfsBaseDataRequestInputBase, PostionLocationEditInput> |
|||
, ISfsGetByCodeAppService<PostionLocationDTO> |
|||
, ISfsUpsertAppService<PostionLocationEditInput> |
|||
{ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public class PostionLocationCheckInput |
|||
{ |
|||
[Display(Name = "工作站编号")] |
|||
|
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[Display(Name = "名称")] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// WMS库位
|
|||
/// </summary>
|
|||
[Display(Name = "库位")] |
|||
public string LocationCode { get; set; } |
|||
} |
@ -0,0 +1,25 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application.Contracts; |
|||
|
|||
public class PostionLocationEditInput : SfsBaseDataCreateOrUpdateInputBase |
|||
{ |
|||
[Display(Name = "工作站编号")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[Display(Name = "名称")] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// WMS库位
|
|||
/// </summary>
|
|||
[Display(Name = "库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocationCode { get; set; } |
|||
} |
@ -0,0 +1,28 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
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 PostionLocationImportInput : SfsBaseDataImportInputBase |
|||
{ |
|||
[Display(Name = "工作站编号")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[Display(Name = "名称")] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// WMS库位
|
|||
/// </summary>
|
|||
[Display(Name = "库位")] |
|||
[Required(ErrorMessage = "{0}是必填项")] |
|||
public string LocationCode { 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 PostionLocationPermissions |
|||
{ |
|||
|
|||
public const string Default = BasedataPermissions.GroupName + "." + nameof(PostionLocation); |
|||
public const string Create = Default + "." + BasedataPermissions.CreateStr; |
|||
public const string Update = Default + "." + BasedataPermissions.UpdateStr; |
|||
public const string Delete = Default + "." + BasedataPermissions.DeleteStr; |
|||
|
|||
public static void AddLPostionLocationPermission(this PermissionGroupDefinition permissionGroup) |
|||
{ |
|||
var lPostionLocationPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(PostionLocation))); |
|||
lPostionLocationPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr)); |
|||
lPostionLocationPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr)); |
|||
lPostionLocationPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr)); |
|||
} |
|||
} |
@ -0,0 +1,136 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq.Expressions; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
|
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Caching; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Validation; |
|||
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; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win_in.Sfs.Shared.Application.Contracts; |
|||
using Volo.Abp; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Application; |
|||
|
|||
[Authorize] |
|||
[Route($"{BasedataConsts.RootPath}PostionLocation")] |
|||
|
|||
public class PostionLocationAppService |
|||
: SfsBaseDataWithCodeAppServiceBase<PostionLocation, PostionLocationDTO, SfsBaseDataRequestInputBase, PostionLocationEditInput, PostionLocationImportInput> |
|||
|
|||
, IPostionLocationAppService |
|||
{ |
|||
|
|||
private readonly IPostionLocationManager _manager; |
|||
private readonly IPostionLocationRepository _repository; |
|||
private readonly ILocationAppService _locationAppService; |
|||
|
|||
|
|||
public PostionLocationAppService( |
|||
IPostionLocationRepository repository, |
|||
IPostionLocationManager manager |
|||
, IDistributedCache<PostionLocationDTO> cache |
|||
|
|||
, ILocationAppService locationAppService |
|||
|
|||
|
|||
|
|||
) : base(repository, cache) |
|||
{ |
|||
_locationAppService = locationAppService; |
|||
_manager = manager; |
|||
_repository = repository; |
|||
|
|||
|
|||
//_PostionLocationCapacityAppService = PostionLocationCapacityAppService;
|
|||
|
|||
base.CreatePolicyName = PostionLocationPermissions.Create; |
|||
base.UpdatePolicyName = PostionLocationPermissions.Update; |
|||
base.DeletePolicyName = PostionLocationPermissions.Delete; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
[HttpPost("list")] |
|||
public override async Task<PagedResultDto<PostionLocationDTO>> GetPagedListByFilterAsync( |
|||
SfsBaseDataRequestInputBase sfsRequestInput, |
|||
bool includeDetails = false, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
Expression<Func<PostionLocation, bool>> expression = sfsRequestInput.Condition.Filters?.Count > 0 |
|||
? sfsRequestInput.Condition.Filters.ToLambda<PostionLocation>() |
|||
: p => true; |
|||
var pageResult = await GetPagedListAsync( |
|||
expression, |
|||
sfsRequestInput.SkipCount, |
|||
sfsRequestInput.MaxResultCount, |
|||
sfsRequestInput.Sorting, |
|||
includeDetails, |
|||
cancellationToken).ConfigureAwait(false); |
|||
|
|||
//foreach (var item in pageResult.Items)
|
|||
//{
|
|||
// item.ItemCategoryDictionary = await GetItemCategory(item.Code).ConfigureAwait(false);
|
|||
//}
|
|||
|
|||
return pageResult; |
|||
} |
|||
|
|||
[HttpPost("get-or-add")] |
|||
public virtual async Task<PostionLocationDTO> GetOrAddAsync(PostionLocationEditInput input) |
|||
{ |
|||
await CheckLocationCode(input.LocationCode).ConfigureAwait(false); |
|||
var result = await _repository.FirstOrDefaultAsync(p => p.Code == input.Code).ConfigureAwait(false); |
|||
if (result == null) |
|||
{ |
|||
var entity = ObjectMapper.Map<PostionLocationEditInput, PostionLocation>(input); |
|||
result = await _repository.InsertAsync(entity, true).ConfigureAwait(false); |
|||
} |
|||
var dto = ObjectMapper.Map<PostionLocation, PostionLocationDTO>(result); |
|||
return dto; |
|||
} |
|||
[HttpPost("upsert")] |
|||
public async Task UpsertAsync(PostionLocationEditInput input) |
|||
{ |
|||
var entity= await _repository.GetAsync(p=>p.Code == input.Code).ConfigureAwait(false); |
|||
|
|||
if (entity != null) |
|||
{ |
|||
entity.Name = input.Name; |
|||
entity.LocationCode = input.LocationCode; |
|||
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|||
} |
|||
else |
|||
{ |
|||
entity.Code = input.Code; |
|||
entity.LocationCode = input.LocationCode; |
|||
entity.Name=input.Name; |
|||
await _repository.InsertAsync(entity, true).ConfigureAwait(false); |
|||
} |
|||
|
|||
} |
|||
private async Task CheckLocationCode(string p_location) |
|||
{ |
|||
|
|||
var list = await _locationAppService.GetByCodeAsync(p_location).ConfigureAwait(false); |
|||
if (list == null ) |
|||
{ |
|||
throw new UserFriendlyException($"{p_location}库位编码不存在,请查看库位信息!"); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
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 PostionLocationAutoMapperProfile() |
|||
{ |
|||
CreateMap<PostionLocation, PostionLocationDTO>() |
|||
.ReverseMap(); |
|||
|
|||
CreateMap<PostionLocationImportInput, PostionLocation>() |
|||
.IgnoreAuditedObjectProperties() |
|||
.Ignore(x => x.TenantId) |
|||
.Ignore(x => x.ExtraProperties) |
|||
.Ignore(x => x.ConcurrencyStamp) |
|||
//.Ignore(x => x.EnableMixItem)
|
|||
//.Ignore(x => x.EnableMixLot)
|
|||
//.Ignore(x => x.EnableMixStatus)
|
|||
//.Ignore(x => x.EnableNegative)
|
|||
//.Ignore(x => x.EnableKeepZero)
|
|||
//.Ignore(x => x.EnableOpportunityCount)
|
|||
//.Ignore(x => x.EnablePick)
|
|||
//.Ignore(x => x.EnableOverPick)
|
|||
//.Ignore(x => x.EnableWholeStore)
|
|||
//.Ignore(x => x.EnableBreakStore)
|
|||
//.Ignore(x => x.EnableShip)
|
|||
//.Ignore(x => x.EnableReceive)
|
|||
//.Ignore(x => x.EnableReturnToSupplier)
|
|||
//.Ignore(x => x.EnableReturnFromCustomer)
|
|||
//.Ignore(x => x.EnableSplitPallet)
|
|||
//.Ignore(x => x.EnableSplitBox)
|
|||
|
|||
; |
|||
|
|||
CreateMap<PostionLocation, PostionLocationImportInput>() |
|||
.Ignore(x => x.ReportStatus) |
|||
.Ignore(x => x.ReportReason); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IPostionLocationManager : IDomainService, IBulkImportService<PostionLocation> |
|||
{ |
|||
} |
@ -0,0 +1,8 @@ |
|||
using Win_in.Sfs.Shared.Domain; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public interface IPostionLocationRepository : ISfsBaseDataRepositoryBase<PostionLocation>, ISfsBulkRepositoryBase<PostionLocation> |
|||
{ |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Entities; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public class PostionLocation : SfsBaseDataAggregateRootBase, IHasCode, IHasName |
|||
{ |
|||
/// <summary>
|
|||
/// 代码
|
|||
/// </summary>
|
|||
[IgnoreUpdate] |
|||
[Display(Name ="工作站编号")] |
|||
public string Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
[Display(Name = "名称")] |
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// WMS库位
|
|||
/// </summary>
|
|||
[Display(Name ="库位")] |
|||
public string LocationCode { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 库位类型
|
|||
///// </summary>
|
|||
//public EnumLocationType Type { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// ERP系统库位代码
|
|||
///// </summary>
|
|||
//public string ErpLocationCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 仓库代码
|
|||
///// </summary>
|
|||
//public string WarehouseCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 区域代码
|
|||
///// </summary>
|
|||
//public string AreaCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 库位组代码
|
|||
///// </summary>
|
|||
//public string LocationGroupCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 工作组代码
|
|||
///// </summary>
|
|||
//public string WorkGroupCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 货架号
|
|||
///// </summary>
|
|||
//public string ShelfCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 行号
|
|||
///// </summary>
|
|||
//public int RowCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 列号
|
|||
///// </summary>
|
|||
//public int ColumnCode { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 默认库存状态
|
|||
///// </summary>
|
|||
//public EnumInventoryStatus DefaultInventoryStatus { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 拣料优先级
|
|||
///// </summary>
|
|||
//public int PickPriority { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 拣料顺序
|
|||
///// </summary>
|
|||
//public int PickOrder { get; set; }
|
|||
|
|||
//public bool EnableMixItem { get; set; } = true; // 可以混物品
|
|||
//public bool EnableMixLot { get; set; } = true; // 可以混批次
|
|||
//public bool EnableMixStatus { get; set; } = true; // 可以混状态
|
|||
//public bool EnableNegative { get; set; } = true; // 可以负库存
|
|||
//public bool EnableKeepZero { get; set; } = true; // 可以保留零库存
|
|||
//public bool EnableOpportunityCount { get; set; } = true; // 可以机会盘点
|
|||
//public bool EnablePick { get; set; } = true; // 可以领料
|
|||
//public bool EnableOverPick { get; set; } = true; // 可以过量领料
|
|||
//public bool EnableWholeStore { get; set; } = true; // 可以整包存储
|
|||
//public bool EnableBreakStore { get; set; } = true; // 可以散件存储
|
|||
//public bool EnableShip { get; set; } = true; // 可以发出
|
|||
//public bool EnableReceive { get; set; } = true; // 可以接收
|
|||
//public bool EnableReturnToSupplier { get; set; } = true; // 可以退货给供应商
|
|||
//public bool EnableReturnFromCustomer { get; set; } = true; // 可以接收客户退货
|
|||
//public bool EnableSplitBox { get; set; } = true; //是否可以拆箱
|
|||
//public bool EnableSplitPallet { get; set; } = true; //是否可以拆托
|
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Services; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Basedata.Domain; |
|||
|
|||
public class PostionLocationManager : DomainService, IPostionLocationManager |
|||
{ |
|||
private readonly IPostionLocationRepository _repository; |
|||
|
|||
private readonly IWarehouseRepository _warehourseRepository; |
|||
private readonly IAreaRepository _areaRepository; |
|||
private readonly ILocationGroupRepository _locationGroupRepository; |
|||
private readonly IWorkGroupRepository _workGroupRepository; |
|||
|
|||
public PostionLocationManager(IPostionLocationRepository repository, IWarehouseRepository warehourseRepository |
|||
, IAreaRepository areaRepository |
|||
, ILocationGroupRepository locationGroupRepository |
|||
, IWorkGroupRepository workGroupRepository |
|||
) |
|||
{ |
|||
_repository = repository; |
|||
_warehourseRepository = warehourseRepository; |
|||
_areaRepository = areaRepository; |
|||
_locationGroupRepository = locationGroupRepository; |
|||
_workGroupRepository = workGroupRepository; |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行导入
|
|||
/// </summary>
|
|||
public virtual async Task ImportDataAsync(List<PostionLocation> mergeEntities, List<PostionLocation> deleteEntities = null) |
|||
{ |
|||
if (deleteEntities != null && deleteEntities.Count > 0) |
|||
{ |
|||
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,31 @@ |
|||
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 PostionLocationDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigurePostionLocation(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options) |
|||
{ |
|||
builder.Entity<PostionLocation>(b => |
|||
{ |
|||
//Configure table & schema name
|
|||
b.ToTable(options.TablePrefix + nameof(Location), options.Schema); |
|||
//Configure ABP properties
|
|||
b.ConfigureByConvention(); |
|||
//Configure Sfs base properties
|
|||
b.ConfigureSfsBase(); |
|||
|
|||
//Properties
|
|||
|
|||
//Relations
|
|||
//None
|
|||
|
|||
//Indexes
|
|||
b.HasIndex(q => new { q.Code }).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 PostionLocationEfCoreRepository : SfsBaseDataEfCoreRepositoryBase<BasedataDbContext, PostionLocation>, IPostionLocationRepository, ISfsBulkRepositoryBase<PostionLocation> |
|||
{ |
|||
public PostionLocationEfCoreRepository(IDbContextProvider<BasedataDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
} |
Loading…
Reference in new issue