Browse Source

[fix]调整无PO ASN返回格式

master
贾荣国 2 years ago
parent
commit
ff1a906387
  1. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/AsnDetDTO.cs
  2. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/AsnMstrDTO.cs
  3. 7
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs
  4. 104
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs
  5. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/AsnDetDTO.cs

@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi
@ -7,7 +8,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary>
/// QAD发货单明细(ASN detail) SupplierAsnDetailInput
/// </summary>
public class AsnDetDTO :EntityDtoBase<Guid>
public class AsnDetDTO : EntityDto
{
/// <summary>
/// 送货单号(ASN number)(Asn number)

23
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/AsnMstrDTO.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Asns;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -9,8 +10,13 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary>
/// QAD发货单主表(ASN Master) SupplierAsnCreateInput ISupplierAsnAppService
/// </summary>
public class AsnMstrDTO:EntityDtoBase<Guid>
public class AsnMstrDTO:EntityDto
{
/// <summary>
///
/// </summary>
public virtual string TraceId { get; set; }
/// <summary>
///
/// </summary>
@ -31,6 +37,11 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary>
public virtual string AsnNbr { get; set; }
/// <summary>
/// 要货计划号(Request plan number)
/// </summary>
public virtual string RpNbr { get; set; }
/// <summary>
/// 采购订单号(Purchase order number)
/// </summary>
@ -41,6 +52,11 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary>
public virtual string VendorCode { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 联系人(Contacts name)
/// </summary>
@ -83,10 +99,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary>
public string TimeWindow { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary>
/// 备注(Remark)

7
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Asns/IX12AsnAppService.cs

@ -15,7 +15,12 @@ namespace Win_in.Sfs.Scp.WebApi
public interface IX12AsnAppService : IReadOnlyAppService<X12AsnDTO,Guid,RequestDTO>
{
Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(string site, int count,bool autoUpdateStatus);
Task<ListResultDto<X12AsnDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus);
Task<ListResultDto<AsnMstrDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus);
Task<ActionResult<AsnMstrDTO>> GetNoPoUnreadFirstAsync(string site);
Task<ActionResult<AsnMstrDTO>> GetNoPoAsync(string site, long uid);
Task<ListResultDto<X12AsnDTO>> GetListAsync(string site, long beginUid,long endUid);

104
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Asns/X12AsnAppService.cs

@ -29,6 +29,7 @@ using System.Security.Cryptography;
using IdentityModel;
using Microsoft.Extensions.Options;
using Volo.Abp;
using System.Drawing;
namespace Win_in.Sfs.Scp.WebApi
{
@ -122,15 +123,15 @@ namespace Win_in.Sfs.Scp.WebApi
}
/// <summary>
/// 获取未读无POASN列表(Get unread Asn listwithout PO)
/// 获取未读无PO ASN列表(Get unread Asn list without PO)
/// </summary>
/// <param name="site">地点(Site)</param>
/// <param name="count">数量(Count)</param>
/// <param name="autoUpdateStatus">是否自动更新状态(Auto update data status to finish)</param>
/// <returns></returns>
[HttpGet]
[Route("nopo-unread-list")]
public async Task<ListResultDto<X12AsnDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus)
[Route("nopo/unread-list")]
public async Task<ListResultDto<AsnMstrDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus)
{
try
{
@ -151,10 +152,85 @@ namespace Win_in.Sfs.Scp.WebApi
var entities = await _x12AsnRepository.GetNoPoUnreadListAsync(site, count, autoUpdateStatus);
var dtos = BuildDtos(entities);
// var dtos = BuildDtos(entities);
return new ListResultDto<X12AsnDTO>(dtos);
var dtos = BuildAsnMstrDtos(entities);
return new ListResultDto<AsnMstrDTO>(dtos);
}
/// <summary>
/// 获取首个未读无PO ASN,并更新状态为已读(Get first unread Asn without PO and update status to read)
/// </summary>
/// <param name="site">地点</param>
/// <returns></returns>
/// <exception cref="AbpValidationException"></exception>
[HttpGet]
[Route("nopo/unread-first")]
public async Task<ActionResult<AsnMstrDTO>> GetNoPoUnreadFirstAsync(string site)
{
try
{
Validator.CheckSite(_tenantRepository, site);
}
catch (Exception ex)
{
throw new AbpValidationException(new List<ValidationResult>
{
new(ex.Message)
});
}
var entities = await _x12AsnRepository.GetNoPoUnreadListAsync(site, 1, true);
if (entities == null || entities.Count == 0)
{
return new OkResult();
}
// var dtos = BuildDtos(entities);
var dto = BuildAsnMstrDto(entities[0]);
return dto;
}
/// <summary>
/// 根据UID获取无PO ASN(Get Asn without PO by UID)
/// </summary>
/// <param name="site">地点(Site)</param>
/// <param name="uid">UID(UID)</param>
/// <returns></returns>
/// <exception cref="BadHttpRequestException"></exception>
[HttpGet]
[Route("nopo/by-uid")]
public async Task<ActionResult<AsnMstrDTO>> GetNoPoAsync(string site,long uid)
{
X12Asn entity;
try
{
Validator.CheckSite(_tenantRepository, site);
entity = await _x12AsnRepository.FirstOrDefaultAsync(p => p.Site == site && p.DataType==ScpWebApiConsts.NO_PO_ASN && p.UID == uid);
if (entity == null)
{
throw new UserFriendlyException($"No Po ASN of {uid} in {site} is not found");
}
}
catch (Exception ex)
{
throw new AbpValidationException(new List<ValidationResult>
{
new(ex.Message)
});
}
var dto = BuildAsnMstrDto(entity);
return dto;
}
/// <summary>
@ -352,6 +428,24 @@ namespace Win_in.Sfs.Scp.WebApi
return dtos;
}
private List<AsnMstrDTO> BuildAsnMstrDtos(List<X12Asn> entities)
{
var dtos = new List<AsnMstrDTO>();
foreach (var entity in entities)
{
var dto = BuildAsnMstrDto(entity);
dtos.Add(dto);
}
return dtos;
}
private AsnMstrDTO BuildAsnMstrDto(X12Asn entity)
{
var dto = JsonSerializer.Deserialize<AsnMstrDTO>(entity.JsonString);
dto.TraceId = $"{dto.Site}-{dto.UID}-{DateTime.Now.Ticks}";
return dto;
}
private X12AsnDTO BuildDto(X12Asn entity)
{
var dto = ObjectMapper.Map<X12Asn, X12AsnDTO>(entity);

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj

@ -7,8 +7,8 @@
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<AssemblyVersion>1.22.0706.1</AssemblyVersion>
<FileVersion>1.22.0706.1</FileVersion>
<AssemblyVersion>1.22.0711.1</AssemblyVersion>
<FileVersion>1.22.0711.1</FileVersion>
</PropertyGroup>
<ItemGroup>

Loading…
Cancel
Save