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;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
@ -7,7 +8,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// QAD发货单明细(ASN detail) SupplierAsnDetailInput /// QAD发货单明细(ASN detail) SupplierAsnDetailInput
/// </summary> /// </summary>
public class AsnDetDTO :EntityDtoBase<Guid> public class AsnDetDTO : EntityDto
{ {
/// <summary> /// <summary>
/// 送货单号(ASN number)(Asn number) /// 送货单号(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;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Asns; using Win_in.Sfs.Scp.WebApi.Asns;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -9,8 +10,13 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// QAD发货单主表(ASN Master) SupplierAsnCreateInput ISupplierAsnAppService /// QAD发货单主表(ASN Master) SupplierAsnCreateInput ISupplierAsnAppService
/// </summary> /// </summary>
public class AsnMstrDTO:EntityDtoBase<Guid> public class AsnMstrDTO:EntityDto
{ {
/// <summary>
///
/// </summary>
public virtual string TraceId { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -31,6 +37,11 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary> /// </summary>
public virtual string AsnNbr { get; set; } public virtual string AsnNbr { get; set; }
/// <summary>
/// 要货计划号(Request plan number)
/// </summary>
public virtual string RpNbr { get; set; }
/// <summary> /// <summary>
/// 采购订单号(Purchase order number) /// 采购订单号(Purchase order number)
/// </summary> /// </summary>
@ -41,6 +52,11 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary> /// </summary>
public virtual string VendorCode { get; set; } public virtual string VendorCode { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary> /// <summary>
/// 联系人(Contacts name) /// 联系人(Contacts name)
/// </summary> /// </summary>
@ -83,10 +99,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary> /// </summary>
public string TimeWindow { get; set; } public string TimeWindow { get; set; }
/// <summary>
/// 状态
/// </summary>
public string Status { get; set; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(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> public interface IX12AsnAppService : IReadOnlyAppService<X12AsnDTO,Guid,RequestDTO>
{ {
Task<ListResultDto<X12AsnDTO>> GetUnreadListAsync(string site, int count,bool autoUpdateStatus); 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); 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 IdentityModel;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp; using Volo.Abp;
using System.Drawing;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
{ {
@ -122,15 +123,15 @@ namespace Win_in.Sfs.Scp.WebApi
} }
/// <summary> /// <summary>
/// 获取未读无POASN列表(Get unread Asn listwithout PO) /// 获取未读无PO ASN列表(Get unread Asn list without PO)
/// </summary> /// </summary>
/// <param name="site">地点(Site)</param> /// <param name="site">地点(Site)</param>
/// <param name="count">数量(Count)</param> /// <param name="count">数量(Count)</param>
/// <param name="autoUpdateStatus">是否自动更新状态(Auto update data status to finish)</param> /// <param name="autoUpdateStatus">是否自动更新状态(Auto update data status to finish)</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[Route("nopo-unread-list")] [Route("nopo/unread-list")]
public async Task<ListResultDto<X12AsnDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus) public async Task<ListResultDto<AsnMstrDTO>> GetNoPoUnreadListAsync(string site, int count, bool autoUpdateStatus)
{ {
try try
{ {
@ -151,10 +152,85 @@ namespace Win_in.Sfs.Scp.WebApi
var entities = await _x12AsnRepository.GetNoPoUnreadListAsync(site, count, autoUpdateStatus); 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> /// <summary>
@ -352,6 +428,24 @@ namespace Win_in.Sfs.Scp.WebApi
return dtos; 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) private X12AsnDTO BuildDto(X12Asn entity)
{ {
var dto = ObjectMapper.Map<X12Asn, X12AsnDTO>(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> <RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace>
<PreserveCompilationReferences>true</PreserveCompilationReferences> <PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> <UserSecretsId>Win_in.Sfs.Scp.WebApi-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<AssemblyVersion>1.22.0706.1</AssemblyVersion> <AssemblyVersion>1.22.0711.1</AssemblyVersion>
<FileVersion>1.22.0706.1</FileVersion> <FileVersion>1.22.0711.1</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

Loading…
Cancel
Save