14 changed files with 273 additions and 12 deletions
@ -0,0 +1,40 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
|
||||
|
|
||||
|
[Display(Name = "器具容量占用信息")] |
||||
|
|
||||
|
public class EquipmentLocCapDTO : SfsBaseDataDTOBase, IHasCode |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 器具代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "器具代码")] |
||||
|
public string Code { get; set; } |
||||
|
/// 占用百分比
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "占用百分比")] |
||||
|
public decimal Percent { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 零件号
|
||||
|
/// </summary>
|
||||
|
public string PartCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 录入数量
|
||||
|
/// </summary>
|
||||
|
public decimal Qty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标包数量
|
||||
|
/// </summary>
|
||||
|
public decimal StdQty { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
public interface IEquipmentLocCapAppService |
||||
|
: ISfsBaseDataAppServiceBase<EquipmentLocCapDTO, SfsBaseDataRequestInputBase, EquipmentLocCapEditInput> |
||||
|
, ISfsGetByCodeAppService<EquipmentLocCapDTO> |
||||
|
, ISfsCheckAppService<EquipmentLocCapCheckInput> |
||||
|
, ISfsUpsertAppService<EquipmentLocCapEditInput> |
||||
|
{ |
||||
|
//Task<bool> CheckItemIsAvailable(string itemCode);
|
||||
|
//[HttpGet("check-item-is-available-no-select-sql")]
|
||||
|
//void CheckItemIsAvailable(EquipmentLocCapDTO EquipmentLocCapDTO);
|
||||
|
|
||||
|
//Task<List<EquipmentLocCapDTO>> GetListByNameAsync(string name);
|
||||
|
|
||||
|
//Task<EquipmentLocCapDTO> GetOrAddAsync(EquipmentLocCapEditInput input);
|
||||
|
|
||||
|
//Task<EnumItemManageType> GetManageTypeAsync(string itemCode);
|
||||
|
//Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
|
||||
|
|
||||
|
//Task UpsertAsyncByInterface(EquipmentLocCapEditInput input);
|
||||
|
//Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
public class EquipmentLocCapCheckInput |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 器具代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "器具代码")] |
||||
|
public string Code { get; set; } |
||||
|
/// 占用百分比
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "占用百分比")] |
||||
|
public decimal Percent { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
public class EquipmentLocCapEditInput : SfsBaseDataCreateOrUpdateInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 器具代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "器具代码")] |
||||
|
public string Code { get; set; } |
||||
|
/// 占用百分比
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "占用百分比")] |
||||
|
public decimal Percent { get; set; } |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
|
||||
|
[Display(Name = "器具容量")] |
||||
|
public class EquipmentLocCapImportInput : SfsBaseDataImportInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 器具代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "器具代码")] |
||||
|
public string Code { get; set; } |
||||
|
/// 占用百分比
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "占用百分比")] |
||||
|
public decimal Percent { get; set; } |
||||
|
//[Display(Name = "零件代码")]
|
||||
|
|
||||
|
//public string PartCode { get; set; }
|
||||
|
|
||||
|
//[Display(Name = "当前数量")]
|
||||
|
///// <summary>
|
||||
|
///// 录入数量
|
||||
|
///// </summary>
|
||||
|
//public decimal Qty { get; set; }
|
||||
|
//[Display(Name = "标包数量")]
|
||||
|
///// <summary>
|
||||
|
///// 标包数量
|
||||
|
///// </summary>
|
||||
|
//public decimal StdQty { get; set; }
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Caching; |
||||
|
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.Application.Contracts.ExportAndImport; |
||||
|
namespace Win_in.Sfs.Basedata.Application; |
||||
|
|
||||
|
[Authorize] |
||||
|
[Route($"{BasedataConsts.RootPath}EquipmentLocCap")] |
||||
|
public class EquipmentLocCapAppService |
||||
|
: SfsBaseDataWithCodeAppServiceBase<EquipmentLocCap, EquipmentLocCapDTO, SfsBaseDataRequestInputBase, EquipmentLocCapEditInput, EquipmentLocCapImportInput> |
||||
|
, IEquipmentLocCapAppService |
||||
|
{ |
||||
|
private readonly IEquipmentLocCapManager _manager; |
||||
|
private new readonly IEquipmentLocCapRepository _repository; |
||||
|
private readonly IExportImportService _importService; |
||||
|
public EquipmentLocCapAppService( |
||||
|
IEquipmentLocCapRepository repository, |
||||
|
IDistributedCache<EquipmentLocCapDTO> cache, |
||||
|
IExportImportService importService, |
||||
|
IEquipmentLocCapManager manager) |
||||
|
: base(repository, cache) |
||||
|
{ |
||||
|
_importService=importService; |
||||
|
_repository = repository; |
||||
|
_manager = manager; |
||||
|
base.CreatePolicyName = EquipmentPermissions.Create; |
||||
|
base.UpdatePolicyName = EquipmentPermissions.Update; |
||||
|
base.DeletePolicyName = EquipmentPermissions.Delete; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("check")] |
||||
|
//[Authorize(ErpLocationPermissions.Default)]
|
||||
|
public virtual async Task CheckAsync(string code, EquipmentLocCapCheckInput input) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
} |
||||
|
[HttpPost("upsert")] |
||||
|
|
||||
|
public virtual async Task UpsertAsync(EquipmentLocCapEditInput input) |
||||
|
{ |
||||
|
var entity = ObjectMapper.Map<EquipmentLocCapEditInput, EquipmentLocCap>(input); |
||||
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[Route("")] |
||||
|
public override async Task<EquipmentLocCapDTO> CreateAsync(EquipmentLocCapEditInput input) |
||||
|
{ |
||||
|
var query =await _repository.GetQueryableAsync().ConfigureAwait(false); |
||||
|
var first=query.FirstOrDefault(p => p.Code == input.Code); |
||||
|
if (first == null) |
||||
|
{ |
||||
|
var entity = ObjectMapper.Map<EquipmentLocCapEditInput, EquipmentLocCap>(input); |
||||
|
entity.Code = string.Format("{0}{1}", "Q", entity.Code); |
||||
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
||||
|
var entity1=_repository.WithDetails().FirstOrDefault(p => p.Code == input.Code); |
||||
|
return ObjectMapper.Map<EquipmentLocCap,EquipmentLocCapDTO>(entity1); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new UserFriendlyException($"已存在器具编号{input.Code}!"); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
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 EquipmentLocCapAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<EquipmentLocCap, EquipmentLocCapDTO>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
|
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<EquipmentLocCapImportInput, EquipmentLocCap>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Remark) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
.Ignore(x => x.StdQty) |
||||
|
.Ignore(x => x.PartCode) |
||||
|
.Ignore(x => x.Qty) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
|
||||
|
|
||||
|
.ForMember(p => p.Code, p => p.MapFrom(q =>q.Code)); |
||||
|
|
||||
|
//CreateMap<EquipmentLocCap, EquipmentLocCapImportInput>()
|
||||
|
|
||||
|
//CreateMap<EquipmentLocCap, EquipmentLocCapForDongyangExportDTO>()
|
||||
|
// .Ignore(x => x.ItemCategory)
|
||||
|
// .Ignore(x => x.Color);
|
||||
|
CreateMap<EquipmentLocCapEditInput, EquipmentLocCap>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.StdQty) |
||||
|
.Ignore(x => x.PartCode) |
||||
|
.Ignore(x => x.Qty) |
||||
|
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue