Browse Source

修改 采购订单 业务

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
0b55cb2779
  1. 4
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj
  2. 7
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  3. 16
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application.Contracts/ExportAndImport/ImportDetailAttribute.cs
  4. 17
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  5. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/DTOs/PurchaseOrderDetailDTO.cs
  6. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderDetailInput.cs
  7. 57
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs
  8. 95
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  9. 44
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderDetail.cs
  10. 20949
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.Designer.cs
  11. 6905
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.cs
  12. 2656
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs
  13. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

4
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj

@ -87,8 +87,8 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <!--<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)Win_in*.dll','$(TargetDir)Win_in*.pdb' -DestinationPath '$(SolutionDir)Output\StoreHost.zip' -Force)" /> <Exec Command="if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(TargetDir)Win_in*.dll','$(TargetDir)Win_in*.pdb' -DestinationPath '$(SolutionDir)Output\StoreHost.zip' -Force)" />
</Target> </Target>-->
</Project> </Project>

7
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql

@ -4159,6 +4159,13 @@ CREATE TABLE [Store_PurchaseOrderDetail] (
[ReceivedQty] decimal(18,6) NOT NULL, [ReceivedQty] decimal(18,6) NOT NULL,
[ReturnedQty] decimal(18,6) NOT NULL, [ReturnedQty] decimal(18,6) NOT NULL,
[PutAwayQty] decimal(18,6) NOT NULL, [PutAwayQty] decimal(18,6) NOT NULL,
[ContactUserCode] nvarchar(max) NULL,
[Lot] nvarchar(max) NULL,
[PlanArriveDate] datetime2 NOT NULL,
[Ctype] nvarchar(max) NULL,
[ProduceDate] datetime2 NOT NULL,
[ExpireDate] datetime2 NOT NULL,
[OrderRemark] nvarchar(max) NULL,
[CreationTime] datetime2 NOT NULL, [CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL, [CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL, [LastModificationTime] datetime2 NULL,

16
be/Modules/Shared/src/Win_in.Sfs.Shared.Application.Contracts/ExportAndImport/ImportDetailAttribute.cs

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win_in.Sfs.Shared.Application.Contracts.ExportAndImport;
/// <summary>
/// 导入模板是否是 详情 中的属性
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class ImportDetailAttribute:Attribute
{
public bool IsDetail { get; set; } = true;
}

17
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs

@ -12,6 +12,7 @@ using System.Threading.Tasks;
using AutoMapper.Internal; using AutoMapper.Internal;
using DocumentFormat.OpenXml.Math; using DocumentFormat.OpenXml.Math;
using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Vml.Office;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -26,6 +27,7 @@ using Volo.Abp.Caching;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus.Local;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
@ -553,6 +555,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
await SaveImportAsync(entityDict).ConfigureAwait(false); await SaveImportAsync(entityDict).ConfigureAwait(false);
} }
} }
// 创建导入报告 // 创建导入报告
var reportFile = ExportImportService.GetImportReport(inputFileBytes, modelDict); var reportFile = ExportImportService.GetImportReport(inputFileBytes, modelDict);
// 创建返回值 // 创建返回值
@ -571,6 +574,20 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
} }
} }
//private async Task<List<TEntity>> Publish()
//{
// try
// {
// await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities)).ConfigureAwait(false);
// }
// catch (Exception ex)
// {
// Logger.LogDebug($"{typeof(TEntity).Name} Created Event:{ex.Message}", null);
// Console.WriteLine(ex.Source);
// throw;
// }
//}
/// <summary> /// <summary>
/// 用来重写 导入数据时可以加工数据 /// 用来重写 导入数据时可以加工数据
/// </summary> /// </summary>

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/DTOs/PurchaseOrderDetailDTO.cs

@ -1,3 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -80,4 +81,45 @@ public class PurchaseOrderDetailDTO : SfsStoreDetailWithQtyDTOBase
[Display(Name = "已上架数量")] [Display(Name = "已上架数量")]
public decimal PutAwayQty { get; set; } public decimal PutAwayQty { get; set; }
/// <summary>
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
/// <summary>
/// 生产批次
/// </summary>
[Display(Name = "明细-生产批次")]
public string Lot { get; set; }
/// <summary>
/// 要求到货时间
/// </summary>
[Display(Name = "明细-要求到货时间")]
public DateTime PlanArriveDate { get; set; }
/// <summary>
/// 明细-类型 暂定:备件是B 辅材是F 生产为空
/// </summary>
[Display(Name = "明细-类型")]
public string Ctype { get; set; }
/// <summary>
/// 生产时间
/// </summary>
[Display(Name = "明细-生产时间")]
public DateTime ProduceDate { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "明细-过期时间")]
public DateTime ExpireDate { get; set; }
/// <summary>
/// 订单备注
/// </summary>
[Display(Name = "明细-订单备注")]
public string OrderRemark { get; set; }
} }

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderDetailInput.cs

@ -1,3 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -61,4 +62,45 @@ public class PurchaseOrderDetailInput : SfsStoreDetailWithQtyInputBase
[Display(Name = "已发货数量")] [Display(Name = "已发货数量")]
public decimal ShippedQty { get; set; } public decimal ShippedQty { get; set; }
/// <summary>
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
/// <summary>
/// 生产批次
/// </summary>
[Display(Name = "明细-生产批次")]
public string Lot { get; set; }
/// <summary>
/// 要求到货时间
/// </summary>
[Display(Name = "明细-要求到货时间")]
public DateTime PlanArriveDate { get; set; }
/// <summary>
/// 明细-类型 暂定:备件是B 辅材是F 生产为空
/// </summary>
[Display(Name = "明细-类型")]
public string Ctype { get; set; }
/// <summary>
/// 生产时间
/// </summary>
[Display(Name = "明细-生产时间")]
public DateTime ProduceDate { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "明细-过期时间")]
public DateTime ExpireDate { get; set; }
/// <summary>
/// 订单备注
/// </summary>
[Display(Name = "明细-订单备注")]
public string OrderRemark { get; set; }
} }

57
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs

@ -86,14 +86,12 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// 明细-订单行 /// 明细-订单行
/// </summary> /// </summary>
[Display(Name = "明细-订单行")] [Display(Name = "明细-订单行")]
[ImportDetail(IsDetail = true)]
public string PoLine { get; set; } public string PoLine { get; set; }
/// <summary> /// <summary>
/// 明细-物品代码 /// 明细-物品代码
/// </summary> /// </summary>
[Display(Name = "明细-物品代码")] [Display(Name = "明细-物品代码")]
[ImportDetail(IsDetail = true)]
public string ItemCode { get; set; } public string ItemCode { get; set; }
/// <summary> /// <summary>
@ -101,21 +99,18 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "明细-数量")] [Display(Name = "明细-数量")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImportDetail(IsDetail = true)]
public decimal Qty { get; set; } public decimal Qty { get; set; }
/// <summary> /// <summary>
/// 数量计量单位 /// 数量计量单位
/// </summary> /// </summary>
[Display(Name = "明细-数量计量单位")] [Display(Name = "明细-数量计量单位")]
[ImportDetail(IsDetail = true)]
public string Uom { get; set; } public string Uom { get; set; }
/// <summary> /// <summary>
/// 明细-标准包装数量 /// 明细-标准包装数量
/// </summary> /// </summary>
[Display(Name = "明细-标准包装数量")] [Display(Name = "明细-标准包装数量")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImportDetail(IsDetail = true)]
public decimal StdPackQty { get; set; } public decimal StdPackQty { get; set; }
/// <summary> /// <summary>
@ -123,14 +118,12 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "明细-供应商包装数量")] [Display(Name = "明细-供应商包装数量")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImportDetail(IsDetail = true)]
public decimal SupplierPackQty { get; set; } public decimal SupplierPackQty { get; set; }
/// <summary> /// <summary>
/// 明细-供应商包装单位 /// 明细-供应商包装单位
/// </summary> /// </summary>
[Display(Name = "明细-供应商包装单位")] [Display(Name = "明细-供应商包装单位")]
[ImportDetail(IsDetail = true)]
public string SupplierPackUom { get; set; } public string SupplierPackUom { get; set; }
/// <summary> /// <summary>
@ -138,9 +131,56 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "明细-转换率")] [Display(Name = "明细-转换率")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImportDetail(IsDetail = true)]
public decimal ConvertRate { get; set; } public decimal ConvertRate { get; set; }
/// <summary>
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
/// <summary>
/// 生产批次
/// </summary>
[Display(Name = "明细-生产批次")]
public string Lot { get; set; }
/// <summary>
/// 要求到货时间
/// </summary>
[Display(Name = "明细-要求到货时间")]
[ImporterHeader(Name = "明细-要求到货时间", Format = "yyyy-MM-dd HH:mm")]
[ExporterHeader(DisplayName = "明细-要求到货时间", Format = "yyyy-MM-dd HH:mm")]
[Required(ErrorMessage = "明细-要求到货时间是必填项")]
public DateTime PlanArriveDate { get; set; }
/// <summary>
/// 明细-类型 暂定:备件是B 辅材是F 生产为空
/// </summary>
[Display(Name = "明细-类型 备件是B 辅材是F 生产为空")]
public string Ctype { get; set; }
/// <summary>
/// 生产时间
/// </summary>
[Display(Name = "明细-生产时间")]
[ImporterHeader(Name = "明细-生产时间时间", Format = "yyyy-MM-dd HH:mm")]
[ExporterHeader(DisplayName = "明细-生产时间时间", Format = "yyyy-MM-dd HH:mm")]
[Required(ErrorMessage = "明细-生产时间时间是必填项")]
public DateTime ProduceDate { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "明细-过期时间")]
public DateTime ExpireDate { get; set; }
/// <summary>
/// 订单备注
/// </summary>
[Display(Name = "明细-订单备注")]
public string OrderRemark { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
@ -164,4 +204,5 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "联系人邮箱")] [Display(Name = "联系人邮箱")]
public string ContactEmail { get; set; } public string ContactEmail { get; set; }
} }

95
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -21,9 +20,9 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}purchase-order")] [Route($"{StoreConsts.RootPath}purchase-order")]
public class PurchaseOrderAppService : public class PurchaseOrderAppService :
SfsStoreWithDetailsAppServiceBase<PurchaseOrder, PurchaseOrderDTO, SfsStoreRequestInputBase, PurchaseOrderEditInput, PurchaseOrderDetail, PurchaseOrderDetailDTO, SfsStoreRequestInputBase, PurchaseOrderImportInput>, SfsStoreWithDetailsAppServiceBase<PurchaseOrder, PurchaseOrderDTO, SfsStoreRequestInputBase, PurchaseOrderEditInput,
PurchaseOrderDetail, PurchaseOrderDetailDTO, SfsStoreRequestInputBase, PurchaseOrderImportInput>,
IPurchaseOrderAppService IPurchaseOrderAppService
{ {
private new readonly IPurchaseOrderRepository _repository; private new readonly IPurchaseOrderRepository _repository;
@ -32,10 +31,9 @@ public class PurchaseOrderAppService :
public PurchaseOrderAppService( public PurchaseOrderAppService(
IPurchaseOrderRepository repository, IPurchaseOrderRepository repository,
IPurchaseOrderManager purchaseOrderManager IPurchaseOrderManager purchaseOrderManager
, ISupplierAppService supplierAppService , ISupplierAppService supplierAppService
) : base(repository) ) : base(repository)
{ {
_repository = repository; _repository = repository;
_purchaseOrderManager = purchaseOrderManager; _purchaseOrderManager = purchaseOrderManager;
@ -51,13 +49,14 @@ public class PurchaseOrderAppService :
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("")] [HttpPost("")]
//[Authorize(PurchaseOrderPermissions.Create)]
public override async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderEditInput input) public override async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderEditInput input)
{ {
if (string.IsNullOrWhiteSpace(input.Number)) if (string.IsNullOrWhiteSpace(input.Number))
{ {
input.Number = await _purchaseOrderManager.GenerateNumberAsync(nameof(PurchaseOrder), Clock.Normalize(input.ActiveDate)).ConfigureAwait(false); input.Number = await _purchaseOrderManager
.GenerateNumberAsync(nameof(PurchaseOrder), Clock.Normalize(input.ActiveDate)).ConfigureAwait(false);
} }
var entity = ObjectMapper.Map<PurchaseOrderEditInput, PurchaseOrder>(input); var entity = ObjectMapper.Map<PurchaseOrderEditInput, PurchaseOrder>(input);
await _purchaseOrderManager.CreateAsync(entity).ConfigureAwait(false); await _purchaseOrderManager.CreateAsync(entity).ConfigureAwait(false);
@ -65,68 +64,76 @@ public class PurchaseOrderAppService :
return ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(entity); return ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(entity);
} }
[HttpPost("{id}/detail")]
public virtual async Task UpdateDetailsAsync(string number, List<PurchaseOrderDetailUpdateInput> inputs)
{
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
if (entity == null || !entity.Details.Any())
{
return;
}
foreach (var input in inputs)
{
var detail = entity.Details.FirstOrDefault(p =>
(string.IsNullOrEmpty(p.PoLine) || p.PoLine == input.PoLine)
&& p.ItemCode == input.ItemCode);
if (detail == null)
{
continue;
}
detail.ShippedQty += input.ShippedQty;
detail.ReceivedQty += input.ReceivedQty;
detail.ReturnedQty += input.ReturnedQty;
detail.PutAwayQty += input.PutAwayQty;
}
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary> /// <summary>
/// 【批量创建】到货通知 (收货单) /// 【批量创建】采购订单
/// </summary> /// </summary>
/// <param name="inputs"></param> /// <param name="inputs"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("create-many")] [HttpPost("create-many")]
public async Task<List<PurchaseOrderDTO>> CreateManyAsync(List<PurchaseOrderEditInput> inputs) public async Task<List<PurchaseOrderDTO>> CreateManyAsync(List<PurchaseOrderEditInput> inputs)
{ {
foreach (var input in inputs) foreach (var input in inputs)
{ {
if (string.IsNullOrWhiteSpace(input.Number)) if (string.IsNullOrWhiteSpace(input.Number))
{ {
input.Number = await _purchaseOrderManager.GenerateNumberAsync(nameof(PurchaseOrder), Clock.Normalize(input.ActiveDate)).ConfigureAwait(false); input.Number = await _purchaseOrderManager
.GenerateNumberAsync(nameof(PurchaseOrder), Clock.Normalize(input.ActiveDate))
.ConfigureAwait(false);
} }
} }
var entityList = ObjectMapper.Map<List<PurchaseOrderEditInput>, List<PurchaseOrder>>(inputs); var entityList = ObjectMapper.Map<List<PurchaseOrderEditInput>, List<PurchaseOrder>>(inputs);
await _purchaseOrderManager.CreateManyAsync(entityList).ConfigureAwait(false); await _purchaseOrderManager.CreateManyAsync(entityList).ConfigureAwait(false);
return ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entityList); return ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entityList);
} }
/// <summary> /// <summary>
/// 用来重写 导入数据时可以加工数据 /// 用来重写 导入数据时可以加工数据
/// </summary> /// </summary>
/// <param name="dictionary"></param> /// <param name="dictionary"></param>
/// <returns></returns> /// <returns></returns>
protected override Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync(Dictionary<PurchaseOrder, EntityState> dictionary) protected override Task<Dictionary<PurchaseOrder, EntityState>> ImportProcessingEntityAsync(
Dictionary<PurchaseOrder, EntityState> dictionary)
{ {
return base.ImportProcessingEntityAsync(dictionary); return base.ImportProcessingEntityAsync(dictionary);
} }
[HttpPost("{id}/detail")]
public virtual async Task UpdateDetailsAsync(string number, List<PurchaseOrderDetailUpdateInput> inputs)
{
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
if (entity == null || !entity.Details.Any())
{
return;
}
foreach (var input in inputs)
{
var detail = entity.Details.FirstOrDefault(p =>
(string.IsNullOrEmpty(p.PoLine) || p.PoLine == input.PoLine)
&& p.ItemCode == input.ItemCode);
if (detail == null)
{
continue;
}
detail.ShippedQty += input.ShippedQty;
detail.ReceivedQty += input.ReceivedQty;
detail.ReturnedQty += input.ReturnedQty;
detail.PutAwayQty += input.PutAwayQty;
}
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region Function #region Function
[HttpPost("complete/{number}")] [HttpPost("complete/{number}")]
@ -166,12 +173,14 @@ public class PurchaseOrderAppService :
await _repository.UpsertAsync(entity).ConfigureAwait(false); await _repository.UpsertAsync(entity).ConfigureAwait(false);
} }
protected virtual async Task CheckImportInputBusinessAsync(PurchaseOrderImportInput importInput, EnumImportMethod importMethod, List<ValidationResult> validationRresult) protected virtual async Task CheckImportInputBusinessAsync(PurchaseOrderImportInput importInput,
EnumImportMethod importMethod, List<ValidationResult> validationRresult)
{ {
await CheckItemBasicAsync(importInput).ConfigureAwait(false); await CheckItemBasicAsync(importInput).ConfigureAwait(false);
await CheckWarehourseAsync(importInput).ConfigureAwait(false); await CheckWarehourseAsync(importInput).ConfigureAwait(false);
await CheckSupplierAsync(importInput).ConfigureAwait(false); await CheckSupplierAsync(importInput).ConfigureAwait(false);
} }
protected async Task CheckItemBasicAsync(PurchaseOrderImportInput importInput) protected async Task CheckItemBasicAsync(PurchaseOrderImportInput importInput)
{ {
var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
@ -185,6 +194,7 @@ public class PurchaseOrderAppService :
Check.NotNull(item, "仓库代码", "仓库不存在"); Check.NotNull(item, "仓库代码", "仓库不存在");
} }
protected async Task CheckSupplierAsync(PurchaseOrderImportInput importInput) protected async Task CheckSupplierAsync(PurchaseOrderImportInput importInput)
{ {
var item = await _supplierAppService.GetByCodeAsync(importInput.SupplierCode).ConfigureAwait(false); var item = await _supplierAppService.GetByCodeAsync(importInput.SupplierCode).ConfigureAwait(false);
@ -210,7 +220,8 @@ public class PurchaseOrderAppService :
[HttpGet("get-list-by-item-code")] [HttpGet("get-list-by-item-code")]
public virtual async Task<List<PurchaseOrderDTO>> GetListByItemCodeAsync(string itemCode) 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 entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode))
.ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys); var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(entitys);

44
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Orders/PurchaseOrders/PurchaseOrderDetail.cs

@ -1,3 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -65,4 +67,46 @@ public class PurchaseOrderDetail : SfsStoreDetailWithQtyEntityBase
/// 已上架数量 /// 已上架数量
/// </summary> /// </summary>
public decimal PutAwayQty { get; set; } public decimal PutAwayQty { get; set; }
/// <summary>
/// 筹措员代码
/// </summary>
[Display(Name = "明细-筹措员代码")]
public string ContactUserCode { get; set; }
/// <summary>
/// 生产批次
/// </summary>
[Display(Name = "明细-生产批次")]
public string Lot { get; set; }
/// <summary>
/// 要求到货时间
/// </summary>
[Display(Name = "明细-要求到货时间")]
public DateTime PlanArriveDate { get; set; }
/// <summary>
/// 明细-类型 暂定:备件是B 辅材是F 生产为空
/// </summary>
[Display(Name = "明细-类型")]
public string Ctype { get; set; }
/// <summary>
/// 生产时间
/// </summary>
[Display(Name = "明细-生产时间")]
public DateTime ProduceDate { get; set; }
/// <summary>
/// 过期时间
/// </summary>
[Display(Name = "明细-过期时间")]
public DateTime ExpireDate { get; set; }
/// <summary>
/// 订单备注
/// </summary>
[Display(Name = "明细-订单备注")]
public string OrderRemark { get; set; }
} }

20949
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.Designer.cs

File diff suppressed because it is too large

6905
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/20230401163806_Added_AddPurchaseOrder.cs

File diff suppressed because it is too large

2656
be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Migrations/StoreDbContextModelSnapshot.cs

File diff suppressed because it is too large

48
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs

@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event.Orders;
public class PurchaseOrderEventHandler
: StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<PurchaseOrder>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<PurchaseOrder>>>
{
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.PurchaseOrder;
//创建采购订单
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<PurchaseOrder> eventData)
{
var entity = eventData.Entity;
await CreateSupplierAsn(entity);
}
//批量创建
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<PurchaseOrder>> eventData)
{
var entities = eventData.Entity;
entities.ForEach(async p =>
{
await CreateSupplierAsn(p).ConfigureAwait(false);
});
}
#region 业务 创建采购订单后>创建收货单
private async Task CreateSupplierAsn(PurchaseOrder purchaseOrder)
{
}
#endregion
}
Loading…
Cancel
Save