|
|
@ -3,23 +3,15 @@ using System.Collections.Generic; |
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Office2010.ExcelAc; |
|
|
|
using DocumentFormat.OpenXml.Spreadsheet; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Volo.Abp.Users; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Event; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
|
using PurchaseOrderDetail = Win_in.Sfs.Wms.Store.Domain.PurchaseOrderDetail; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
@ -60,23 +52,24 @@ public class PurchaseOrderAppService : |
|
|
|
protected override async Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync( |
|
|
|
Dictionary<PurchaseOrder, EntityState> dictionary) |
|
|
|
{ |
|
|
|
var addList= dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|
|
|
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|
|
|
|
|
|
|
foreach (var purchaseOrder in addList) |
|
|
|
{ |
|
|
|
purchaseOrder.CreatorId = CurrentUser.Id; |
|
|
|
purchaseOrder.Worker = CurrentUser.Name; |
|
|
|
|
|
|
|
var supplierDto=await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); |
|
|
|
var supplierDto = |
|
|
|
await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); |
|
|
|
purchaseOrder.SupplierCode = supplierDto.Code; |
|
|
|
purchaseOrder.SupplierAddress = supplierDto.Address; |
|
|
|
purchaseOrder.SupplierName= supplierDto.Name; |
|
|
|
purchaseOrder.SupplierName = supplierDto.Name; |
|
|
|
|
|
|
|
foreach (var detail in purchaseOrder.Details) |
|
|
|
{ |
|
|
|
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
detail.ItemName= itemBasicDto.Name; |
|
|
|
detail.ItemName = itemBasicDto.Name; |
|
|
|
detail.ItemDesc1 = itemBasicDto.Desc1; |
|
|
|
detail.ItemDesc2 = itemBasicDto.Desc2; |
|
|
|
} |
|
|
@ -87,8 +80,6 @@ public class PurchaseOrderAppService : |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 【创建】采购订单
|
|
|
|
/// </summary>
|
|
|
@ -163,8 +154,6 @@ public class PurchaseOrderAppService : |
|
|
|
await _repository.UpdateAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
#region Function
|
|
|
|
|
|
|
|
[HttpPost("complete/{number}")] |
|
|
|
public async Task<PurchaseOrderDTO> CompleteAsync(string number) |
|
|
|
{ |
|
|
@ -173,9 +162,6 @@ public class PurchaseOrderAppService : |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("cancel/{id}")] |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
[HttpPost("{id}/detail/open/{detailId}")] |
|
|
|
public virtual async Task OpenDetailAsync(Guid id, Guid detailId) |
|
|
|
{ |
|
|
@ -188,13 +174,6 @@ public class PurchaseOrderAppService : |
|
|
|
await _purchaseOrderManager.CloseDetailAsync(id, detailId).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("check-status")] |
|
|
|
public virtual async Task CheckStatusAsync(string number) |
|
|
|
{ |
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert")] |
|
|
|
public virtual async Task UpsertAsync(PurchaseOrderEditInput input) |
|
|
|
{ |
|
|
@ -202,6 +181,27 @@ public class PurchaseOrderAppService : |
|
|
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("get-list-by-item-code")] |
|
|
|
public virtual async Task<List<PurchaseOrderDTO>> GetListByItemCodeAsync(string itemCode) |
|
|
|
{ |
|
|
|
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys); |
|
|
|
|
|
|
|
return dtos; |
|
|
|
} |
|
|
|
|
|
|
|
#region 校验
|
|
|
|
|
|
|
|
[HttpPost("check-status")] |
|
|
|
public virtual async Task CheckStatusAsync(string number) |
|
|
|
{ |
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task CheckImportInputBusinessAsync(PurchaseOrderImportInput importInput, |
|
|
|
EnumImportMethod importMethod, List<ValidationResult> validationRresult) |
|
|
|
{ |
|
|
@ -231,29 +231,20 @@ public class PurchaseOrderAppService : |
|
|
|
Check.NotNull(item, "供应商代码", "供应商不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
protected override async Task<PurchaseOrder> GetEntityAsync(PurchaseOrderImportInput importInput) |
|
|
|
{ |
|
|
|
return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task ImportDataAsync(List<PurchaseOrder> entites, List<PurchaseOrder> deleteEntities) |
|
|
|
{ |
|
|
|
await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Func<PurchaseOrderImportInput, object> GetEntityExpression() |
|
|
|
{ |
|
|
|
return t => t.Number; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
[HttpGet("get-list-by-item-code")] |
|
|
|
public virtual async Task<List<PurchaseOrderDTO>> GetListByItemCodeAsync(string itemCode) |
|
|
|
{ |
|
|
|
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) |
|
|
|
.ConfigureAwait(false); |
|
|
|
//protected override async Task<PurchaseOrder> GetEntityAsync(PurchaseOrderImportInput importInput)
|
|
|
|
//{
|
|
|
|
// return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false);
|
|
|
|
//}
|
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys); |
|
|
|
//protected virtual async Task ImportDataAsync(List<PurchaseOrder> entites, List<PurchaseOrder> deleteEntities)
|
|
|
|
//{
|
|
|
|
// await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
|
|
|
|
//}
|
|
|
|
|
|
|
|
return dtos; |
|
|
|
} |
|
|
|
//protected override Func<PurchaseOrderImportInput, object> GetEntityExpression()
|
|
|
|
//{
|
|
|
|
// return t => t.Number;
|
|
|
|
//}
|
|
|
|
} |
|
|
|