7 changed files with 182 additions and 3 deletions
@ -0,0 +1,73 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Win_in.Sfs.Basedata.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Pda.Models; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
|||
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}store/purchase-return-request")] |
|||
public class PurchaseReturnRequestController : AbpController |
|||
{ |
|||
private readonly IPurchaseReturnRequestAppService _purchaseReturnRequestAppService; |
|||
private readonly ITransactionTypeAppService _transactionTypeAppService; |
|||
public PurchaseReturnRequestController(IPurchaseReturnRequestAppService purchaseReturnRequestAppService, |
|||
ITransactionTypeAppService transactionTypeAppService |
|||
) |
|||
{ |
|||
_purchaseReturnRequestAppService = purchaseReturnRequestAppService; |
|||
_transactionTypeAppService = transactionTypeAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建退货申请
|
|||
/// </summary>
|
|||
[HttpPost("create-many")] |
|||
public virtual async Task CreateManyAsync(List<PurchaseReturnRequestPdaInput> input) |
|||
{ |
|||
List<PurchaseReturnRequestEditInput> entitys = new List<PurchaseReturnRequestEditInput>(); |
|||
var groups = input.GroupBy(r => r.AsnNumber).ToList(); |
|||
foreach (var group in groups) |
|||
{ |
|||
var list = group.ToList(); |
|||
var entity = ObjectMapper.Map<PurchaseReturnRequestPdaInput, PurchaseReturnRequestEditInput>(list[0]); |
|||
await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); |
|||
entity.Details = new List<PurchaseReturnRequestDetailInput>(); |
|||
foreach (var item in list) |
|||
{ |
|||
var detail = ObjectMapper.Map<PurchaseReturnRequestPdaInput, PurchaseReturnRequestDetailInput>(list[0]); |
|||
entity.Details.Add(detail); |
|||
} |
|||
entitys.Add(entity); |
|||
} |
|||
await _purchaseReturnRequestAppService.CreateManyAsync(entitys).ConfigureAwait(false); ; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 赋值Request业务属性
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <returns></returns>
|
|||
private async Task SetRequestAutoPropertiesAsync(PurchaseReturnRequestEditInput entity) |
|||
{ |
|||
var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.PurchaseReturn, EnumTransSubType.None).ConfigureAwait(false); |
|||
|
|||
Check.NotNull(tranType, "事务类型", "事务类型不存在"); |
|||
|
|||
entity.AutoCompleteJob = tranType.AutoCompleteJob; |
|||
entity.AutoSubmit = tranType.AutoSubmitRequest; |
|||
entity.AutoAgree = tranType.AutoAgreeRequest; |
|||
entity.AutoHandle = tranType.AutoHandleRequest; |
|||
entity.DirectCreateNote = tranType.DirectCreateNote; |
|||
} |
|||
} |
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using DocumentFormat.OpenXml.Wordprocessing; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
public class PurchaseReturnRequestPdaInput : SfsStoreDetailWithLotPackingQtyLocationStatusInputBase, IHasPoLine |
|||
{ |
|||
/// <summary>
|
|||
/// 收货单号
|
|||
/// </summary>
|
|||
[Display(Name = "收货单号")] |
|||
public string RpNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 发货单号
|
|||
/// </summary>
|
|||
[Display(Name = "发货单号")] |
|||
public string AsnNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 订单号
|
|||
/// </summary>
|
|||
[Display(Name = "订单号")] |
|||
public string PoNumber { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 供应商代码
|
|||
/// </summary>
|
|||
[Display(Name = "供应商代码")] |
|||
public string SupplierCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 退货类型
|
|||
/// </summary>
|
|||
[Display(Name = "退货类型")] |
|||
public EnumPurchaseReturnType ReturnType { get; set; } = EnumPurchaseReturnType.AfterPuton; |
|||
|
|||
/// <summary>
|
|||
/// 订单行
|
|||
/// </summary>
|
|||
[Display(Name = "订单行")] |
|||
public string PoLine { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 供应商包装
|
|||
/// </summary>
|
|||
[Display(Name = "供应商包装")] |
|||
public decimal SupplierPackQty { get; set; } |
|||
|
|||
} |
Loading…
Reference in new issue