贾荣国
2 years ago
21 changed files with 1168 additions and 19 deletions
@ -0,0 +1,113 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Scp.WebApi.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// QAD发货单明细(ASN detail) SupplierAsnDetailInput
|
||||
|
/// </summary>
|
||||
|
public class AsnDetDTO :EntityDtoBase<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 送货单号(ASN number)(Asn number)
|
||||
|
/// </summary>
|
||||
|
public virtual string AsnNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单号(Purchase order number)
|
||||
|
/// </summary>
|
||||
|
public virtual string PoNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单行(Purchase order line)
|
||||
|
/// </summary>
|
||||
|
public virtual int PoLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号(Part number)(Part number)
|
||||
|
/// </summary>
|
||||
|
public virtual string PartCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 批次(Lot number)
|
||||
|
/// </summary>
|
||||
|
public virtual string Lot { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 送货总量(Quantity)
|
||||
|
/// </summary>
|
||||
|
public virtual decimal Qty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产日期(Production date)
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? ProductionDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 器具型号(Ware class)
|
||||
|
/// </summary>
|
||||
|
public virtual string WareClass { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 器具号(Ware code)
|
||||
|
/// </summary>
|
||||
|
public virtual string WareCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标准包装量(Standard pack quantity)
|
||||
|
/// </summary>
|
||||
|
public virtual decimal StdPackQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购单位(Purchase um)
|
||||
|
/// </summary>
|
||||
|
public virtual string PoUm { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 基本单位(Base um)
|
||||
|
/// </summary>
|
||||
|
public virtual string LocUm { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 转换率(Um conversion)
|
||||
|
/// </summary>
|
||||
|
public virtual decimal UmConv { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料类型(Part type)
|
||||
|
/// </summary>
|
||||
|
public virtual string PartType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商批号(Vendor batch)
|
||||
|
/// </summary>
|
||||
|
public virtual string Supplierlot { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 状态(Status)
|
||||
|
/// </summary>
|
||||
|
public virtual string Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标签代码(Label code)
|
||||
|
/// </summary>
|
||||
|
public virtual string LabelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 完整条码数据(Full barcode string)
|
||||
|
/// </summary>
|
||||
|
public virtual string EntireBarCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 托盘标签代码(Pallet label code)
|
||||
|
/// </summary>
|
||||
|
public virtual string PalletLabelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注(Remark)
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Scp.WebApi.Asns; |
||||
|
using Win_in.Sfs.Scp.WebApi.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// QAD发货单主表(ASN Master) SupplierAsnCreateInput ISupplierAsnAppService
|
||||
|
/// </summary>
|
||||
|
public class AsnMstrDTO:EntityDtoBase<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
public virtual long UID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 公司(Company code)
|
||||
|
/// </summary>
|
||||
|
public virtual string Company { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工厂(Site)
|
||||
|
/// </summary>
|
||||
|
public virtual string Site { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 送货单号(ASN number)
|
||||
|
/// </summary>
|
||||
|
public virtual string AsnNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单号(Purchase order number)
|
||||
|
/// </summary>
|
||||
|
public virtual string PoNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商(Vendor)
|
||||
|
/// </summary>
|
||||
|
public virtual string VendorCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 联系人(Contacts name)
|
||||
|
/// </summary>
|
||||
|
public virtual string Contacts { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 联系电话(Phone)
|
||||
|
/// </summary>
|
||||
|
public virtual string Phone { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车牌号(Truck license plate number)
|
||||
|
/// </summary>
|
||||
|
public virtual string TruckNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓库(Warehouse)(Warehouse)
|
||||
|
/// </summary>
|
||||
|
public virtual string Whse { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 收货口(Dock)
|
||||
|
/// </summary>
|
||||
|
public virtual string Dock { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发货日期(Shipping date)
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? ShipDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购单到期日(Due date)
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? DueDate { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 时间窗口
|
||||
|
/// </summary>
|
||||
|
public string TimeWindow { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 状态
|
||||
|
/// </summary>
|
||||
|
public string Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注(Remark)
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
public virtual List<AsnDetDTO> Details { get; set; } = new List<AsnDetDTO>(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi.Asns |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// QAD发货单(ASN Master)
|
||||
|
/// </summary>
|
||||
|
public interface IAsnAppService : IApplicationService |
||||
|
{ |
||||
|
Task<ListResultDto<AsnMstrDTO>> GetUnreadListAsync(string site, int count, bool autoUpdateStatus); |
||||
|
|
||||
|
Task<ListResultDto<AsnMstrDTO>> GetListAsync(string site, long beginUid, long endUid); |
||||
|
|
||||
|
Task<ListResultDto<AsnMstrDTO>> GetListAsync(string site, DateTime beginDate, DateTime endDate); |
||||
|
|
||||
|
Task<ActionResult<AsnMstrDTO>> GetAsync(string site, long uid); |
||||
|
|
||||
|
Task<ActionResult<AsnMstrDTO>> GetAsync(string site, string number); |
||||
|
|
||||
|
Task<ActionResult<AsnMstrDTO>> UpdateStatusAsync(string site, string number, EnumExchangeDataStatus status); |
||||
|
} |
||||
|
} |
@ -0,0 +1,325 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text.Json; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Threading.Tasks.Dataflow; |
||||
|
using AutoMapper; |
||||
|
using AutoMapper.Configuration; |
||||
|
using FluentValidation; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Scp.v1.Domain; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Volo.Abp.Clients; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.Validation; |
||||
|
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration; |
||||
|
using Volo.Abp.TenantManagement; |
||||
|
using Win_in.Sfs.Scp.WebApi.Asns; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using System.Security.Cryptography; |
||||
|
using IdentityModel; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// ASN服务(AsnMstr Service)
|
||||
|
/// </summary>
|
||||
|
[Authorize] |
||||
|
[Route(RouteConsts.AsnMstr)] |
||||
|
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] |
||||
|
|
||||
|
public class AsnAppService : ReadOnlyAppService<AsnMstr, AsnMstrDTO, Guid, RequestDTO>, IAsnAppService |
||||
|
{ |
||||
|
private readonly IAsnRepository _asnRepository; |
||||
|
private readonly ITenantRepository _tenantRepository; |
||||
|
private readonly IOptions<AsnOptions> _options; |
||||
|
|
||||
|
public AsnAppService( |
||||
|
IAsnRepository repository |
||||
|
, ITenantRepository tenantRepository |
||||
|
, IOptions<AsnOptions> options |
||||
|
|
||||
|
) : base(repository) |
||||
|
{ |
||||
|
_asnRepository = repository; |
||||
|
_tenantRepository = tenantRepository; |
||||
|
_options = options; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按ID获取ASN (Get AsnMstr by ID)
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">唯一ID(unique ID)</param>
|
||||
|
/// <returns></returns>
|
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("{id}")] |
||||
|
[HiddenApi] |
||||
|
public override async Task<AsnMstrDTO> GetAsync(Guid id) |
||||
|
{ |
||||
|
return await base.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 按条件获取ASN分页列表 (Get AsnMstr paged list by request condition)
|
||||
|
/// </summary>
|
||||
|
/// <param name="requestDTO">请求条件DTO(Request condition DTO)</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet] |
||||
|
[Route("paged-list")] |
||||
|
[HiddenApi] |
||||
|
public override async Task<PagedResultDto<AsnMstrDTO>> GetListAsync(RequestDTO requestDTO) |
||||
|
{ |
||||
|
return await base.GetListAsync(requestDTO); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取未读ASN列表(Get unread AsnMstr list)
|
||||
|
/// </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("unread-list")] |
||||
|
public async Task<ListResultDto<AsnMstrDTO>> GetUnreadListAsync(string site, int count, bool autoUpdateStatus) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
if (count < 1 || count > _options.Value.MaxCount) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"Count must between 1 and {_options.Value.MaxCount}"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
var entities = await _asnRepository.GetUnreadListAsync(site, count, autoUpdateStatus); |
||||
|
|
||||
|
var dtos = BuildDtos(entities); |
||||
|
|
||||
|
return new ListResultDto<AsnMstrDTO>(dtos); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据UID范围获取ASN列表(Get AsnMstr list by UID range)
|
||||
|
/// </summary>
|
||||
|
/// <param name="site">地点(Site)</param>
|
||||
|
/// <param name="beginUid">开始UID(Begin UID)</param>
|
||||
|
/// <param name="endUid">结束UID(End UID)</param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="BadHttpRequestException"></exception>
|
||||
|
[HttpGet] |
||||
|
[Route("between-uid")] |
||||
|
public async Task<ListResultDto<AsnMstrDTO>> GetListAsync(string site, long beginUid, long endUid) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
if (endUid < beginUid) |
||||
|
{ |
||||
|
throw new UserFriendlyException("beginUid can not bigger than endUid"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
var entities = await _asnRepository.GetListAsync(p => p.Site == site && p.UID >= beginUid && p.UID <= endUid); |
||||
|
|
||||
|
var dtos = BuildDtos(entities); |
||||
|
|
||||
|
return new ListResultDto<AsnMstrDTO>(dtos); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据日期范围获取ASN列表(Get AsnMstr list by date range)
|
||||
|
/// </summary>
|
||||
|
/// <param name="site">地点(Site)</param>
|
||||
|
/// <param name="beginDate">开始日期(Begin date)</param>
|
||||
|
/// <param name="endDate">结束日期(End date)</param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="BadHttpRequestException"></exception>
|
||||
|
[HttpGet] |
||||
|
[Route("between-date")] |
||||
|
public async Task<ListResultDto<AsnMstrDTO>> GetListAsync(string site, DateTime beginDate, DateTime endDate) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
if (endDate < beginDate) |
||||
|
{ |
||||
|
throw new UserFriendlyException("beginDate can not after endDate"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
var entities = await _asnRepository.GetListAsync(p => p.Site == site && p.EffectiveDate >= beginDate && p.EffectiveDate <= endDate); |
||||
|
|
||||
|
var dtos = BuildDtos(entities); |
||||
|
|
||||
|
return new ListResultDto<AsnMstrDTO>(dtos); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据UID获取ASN(Get AsnMstr by UID)
|
||||
|
/// </summary>
|
||||
|
/// <param name="site">地点(Site)</param>
|
||||
|
/// <param name="uid">UID(UID)</param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="BadHttpRequestException"></exception>
|
||||
|
[HttpGet] |
||||
|
[Route("by-uid")] |
||||
|
public async Task<ActionResult<AsnMstrDTO>> GetAsync(string site, long uid) |
||||
|
{ |
||||
|
AsnMstr entity; |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
entity = await _asnRepository.FirstOrDefaultAsync(p => p.Site == site && p.UID == uid); |
||||
|
|
||||
|
if (entity == null) |
||||
|
{ |
||||
|
|
||||
|
throw new UserFriendlyException($"ASN of {uid} in {site} is not found"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
var dto = BuildDto(entity); |
||||
|
|
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据单据编号获取ANS(Get AsnMstr by asn number)
|
||||
|
/// </summary>
|
||||
|
/// <param name="site">地点(Site)</param>
|
||||
|
/// <param name="number">单据编号(Asn number)</param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="BadHttpRequestException"></exception>
|
||||
|
[HttpGet] |
||||
|
[Route("by-number")] |
||||
|
public async Task<ActionResult<AsnMstrDTO>> GetAsync(string site, string number) |
||||
|
{ |
||||
|
AsnMstr entity; |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
|
||||
|
entity = await _asnRepository.FirstOrDefaultAsync(p => p.Site == site && p.AsnNbr == number); |
||||
|
|
||||
|
if (entity == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"ASN of {number} in {site} is not found"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
var dto = BuildDto(entity); |
||||
|
|
||||
|
return dto; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据单据编号更新ASN状态(Update AsnMstr Status by asn number)
|
||||
|
/// </summary>
|
||||
|
/// <param name="site">地点(Site)</param>
|
||||
|
/// <param name="number">单据编号(Asn number)</param>
|
||||
|
/// <param name="status">状态(Status)
|
||||
|
/// 0: 新增(new)
|
||||
|
/// 1: 处理中(Processing)
|
||||
|
/// 2: 完成(Finish)
|
||||
|
/// 9: 搁置(Hold)
|
||||
|
/// -1: 错误(Error)
|
||||
|
/// </param>
|
||||
|
/// <returns></returns>
|
||||
|
/// <exception cref="BadHttpRequestException"></exception>
|
||||
|
[HttpPost] |
||||
|
[Route("update-status")] |
||||
|
public async Task<ActionResult<AsnMstrDTO>> UpdateStatusAsync(string site, string number, EnumExchangeDataStatus status) |
||||
|
{ |
||||
|
AsnMstr entity; |
||||
|
try |
||||
|
{ |
||||
|
Validator.CheckSite(_tenantRepository, site); |
||||
|
|
||||
|
|
||||
|
entity = await _asnRepository.FirstOrDefaultAsync(p => p.Site == site && p.AsnNbr == number); |
||||
|
|
||||
|
if (entity == null) |
||||
|
{ |
||||
|
throw new UserFriendlyException($"ASN of {number} in {site} is not found"); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
throw new AbpValidationException(new List<ValidationResult> |
||||
|
{ |
||||
|
new(ex.Message) |
||||
|
}); |
||||
|
} |
||||
|
var result = await _asnRepository.UpdateStatusAsync(entity.Id, status); |
||||
|
|
||||
|
var dto = BuildDto(result); |
||||
|
|
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
private List<AsnMstrDTO> BuildDtos(List<AsnMstr> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<AsnMstr>, List<AsnMstrDTO>>(entities); |
||||
|
return dtos; |
||||
|
} |
||||
|
|
||||
|
private AsnMstrDTO BuildDto(AsnMstr entity) |
||||
|
{ |
||||
|
var dto = ObjectMapper.Map<AsnMstr, AsnMstrDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,118 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// QAD发货单明细(ASN detail) SupplierAsnDetailInput
|
||||
|
/// </summary>
|
||||
|
public class AsnDet : CreationAuditedEntity<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 自增长数字主键
|
||||
|
/// </summary>
|
||||
|
//public virtual int uid { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 送货单号
|
||||
|
/// </summary>
|
||||
|
public virtual string AsnNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单号
|
||||
|
/// </summary>
|
||||
|
public virtual string PoNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单行
|
||||
|
/// </summary>
|
||||
|
public virtual int PoLine { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料号
|
||||
|
/// </summary>
|
||||
|
public virtual string PartCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 批次
|
||||
|
/// </summary>
|
||||
|
public virtual string Lot { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 送货总量
|
||||
|
/// </summary>
|
||||
|
public virtual decimal Qty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产日期
|
||||
|
/// </summary>
|
||||
|
public virtual DateTime? ProductionDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 器具型号
|
||||
|
/// </summary>
|
||||
|
public virtual string WareClass { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 器具号
|
||||
|
/// </summary>
|
||||
|
public virtual string WareCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标准包装量
|
||||
|
/// </summary>
|
||||
|
public virtual decimal StdPackQty { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购单位
|
||||
|
/// </summary>
|
||||
|
public virtual string PoUm { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 基本单位
|
||||
|
/// </summary>
|
||||
|
public virtual string LocUm { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 转换率
|
||||
|
/// </summary>
|
||||
|
public virtual decimal UmConv { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物料类型
|
||||
|
/// </summary>
|
||||
|
public virtual string PartType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商批号
|
||||
|
/// </summary>
|
||||
|
public virtual string Supplierlot { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 状态(0:Closed,1:Open)
|
||||
|
/// </summary>
|
||||
|
public virtual string Status { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 标签代码
|
||||
|
/// </summary>
|
||||
|
public virtual string LabelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 完整条码数据
|
||||
|
/// </summary>
|
||||
|
public virtual string EntireBarCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 托盘标签代码
|
||||
|
/// </summary>
|
||||
|
public virtual string PalletLabelCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,96 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Win_in.Sfs.Scp.WebApi.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// QAD发货单主表(ASN Master) SupplierAsnCreateInput ISupplierAsnAppService
|
||||
|
/// </summary>
|
||||
|
public class AsnMstr : EntityBase<Guid> |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 自增长数字主键
|
||||
|
/// </summary>
|
||||
|
public virtual long UID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 公司
|
||||
|
/// </summary>
|
||||
|
public virtual string Company { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工厂
|
||||
|
/// </summary>
|
||||
|
public virtual string Site { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 送货单号
|
||||
|
/// </summary>
|
||||
|
public virtual string AsnNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 要货计划单号
|
||||
|
/// </summary>
|
||||
|
public virtual string RpNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购订单号
|
||||
|
/// </summary>
|
||||
|
public virtual string PoNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 供应商
|
||||
|
/// </summary>
|
||||
|
public virtual string VendorCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 联系人
|
||||
|
/// </summary>
|
||||
|
public virtual string Contacts { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 联系电话
|
||||
|
/// </summary>
|
||||
|
public virtual string Phone { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 车牌号
|
||||
|
/// </summary>
|
||||
|
public virtual string TruckNbr { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓库
|
||||
|
/// </summary>
|
||||
|
public virtual string Whse { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 收货口
|
||||
|
/// </summary>
|
||||
|
public virtual string Dock { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发货日期
|
||||
|
/// </summary>
|
||||
|
public DateTime? ShipDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 到货日期
|
||||
|
/// </summary>
|
||||
|
public DateTime? DueDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 时间窗口
|
||||
|
/// </summary>
|
||||
|
public string TimeWindow { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
public virtual string Remark { get; set; } |
||||
|
|
||||
|
|
||||
|
public virtual List<AsnDet> Details { get; set; } = new List<AsnDet>(); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
namespace Win_in.Sfs.Scp.WebApi |
||||
|
{ |
||||
|
public class ScpWebApiConsts |
||||
|
{ |
||||
|
public const string ASN = "ASN"; |
||||
|
public const string NO_PO_ASN = "NoPoASN"; |
||||
|
} |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace>Win_in.Sfs.Scp.WebApi</RootNamespace> |
||||
|
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.Validation" Version="4.4.2" /> |
||||
|
|
||||
|
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="4.4.2" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="4.4.2" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<EmbeddedResource Include="Localization\WebApi\*.json" /> |
||||
|
<Content Remove="Localization\WebApi\*.json" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="5.0.*" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
@ -0,0 +1,16 @@ |
|||||
|
/* |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi.Asns |
||||
|
{ |
||||
|
public interface IAsnRepository : IRepository<AsnMstr, Guid> |
||||
|
{ |
||||
|
Task<List<AsnMstr>> GetUnreadListAsync(string site, int count, bool autoUpdateStatus); |
||||
|
|
||||
|
Task<AsnMstr> UpdateStatusAsync(Guid id, EnumExchangeDataStatus status); |
||||
|
} |
||||
|
} |
||||
|
*/ |
@ -0,0 +1,69 @@ |
|||||
|
/* |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Scp.WebApi.Asns; |
||||
|
|
||||
|
namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore; |
||||
|
|
||||
|
public class AsnRepository : EfCoreRepository<WebApiDbContext, AsnMstr, Guid>, IAsnRepository |
||||
|
{ |
||||
|
private const string Reader = "QAD Agent"; |
||||
|
|
||||
|
public AsnRepository(IDbContextProvider<WebApiDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public async Task<List<AsnMstr>> GetUnreadListAsync(string site, int count, bool autoUpdateStatus) |
||||
|
{ |
||||
|
var dbSet = await GetDbSetAsync(); |
||||
|
var list = await dbSet |
||||
|
.Where(p => p.Site == site && p.Status == EnumExchangeDataStatus.New) |
||||
|
.OrderBy(p => p.Id) |
||||
|
.Take(count) |
||||
|
.ToListAsync(); |
||||
|
|
||||
|
if (autoUpdateStatus) |
||||
|
{ |
||||
|
foreach (var entity in list) |
||||
|
{ |
||||
|
entity.SetSuccess(Reader); |
||||
|
await UpdateAsync(entity); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public async Task<AsnMstr> UpdateStatusAsync(Guid id, EnumExchangeDataStatus status) |
||||
|
{ |
||||
|
var entity = await base.GetAsync(id); |
||||
|
switch (status) |
||||
|
{ |
||||
|
case EnumExchangeDataStatus.New: |
||||
|
entity.Reset(); |
||||
|
break; |
||||
|
case EnumExchangeDataStatus.Processing: |
||||
|
entity.SetProcessing(); |
||||
|
break; |
||||
|
case EnumExchangeDataStatus.Finish: |
||||
|
entity.SetSuccess(Reader); |
||||
|
break; |
||||
|
case EnumExchangeDataStatus.Hold: |
||||
|
entity.SetHold(); |
||||
|
break; |
||||
|
case EnumExchangeDataStatus.Error: |
||||
|
entity.SetError(Reader, EnumExchangeDataErrorCode.Exception, ""); |
||||
|
break; |
||||
|
default: |
||||
|
throw new ArgumentOutOfRangeException(nameof(status), status, null); |
||||
|
} |
||||
|
return await UpdateAsync(entity); |
||||
|
} |
||||
|
} |
||||
|
*/ |
Loading…
Reference in new issue