Browse Source

修改 采购收货 供应商发货

集成Redis
郑渤旭[Irelia] 2 years ago
parent
commit
d2eec1e3cc
  1. 4
      be/Hosts/Core.Host/Win_in.Sfs.Core.Host/Win_in.Sfs.Core.HttpApi.Host.csproj
  2. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs
  3. 37
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  4. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj
  5. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs
  6. 11
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAutoMapperProfile.cs
  7. 46
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Orders/PurchaseOrderAutoMapperProfile.cs
  8. 118
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
  9. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Plans/SupplierAsnEventHandler.cs
  10. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs
  11. 8
      build/src/docker/publish/settings/appsettings.Development.json

4
be/Hosts/Core.Host/Win_in.Sfs.Core.Host/Win_in.Sfs.Core.HttpApi.Host.csproj

@ -81,8 +81,8 @@
<Folder Include="scripts\" />
</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\CoreHost.zip' -Force)" />
</Target>
</Target>-->
</Project>

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs

@ -13,6 +13,7 @@ using DocumentFormat.OpenXml;
using Irony;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport;
using Win_in.Sfs.Shared.Domain.Shared;

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

@ -29,11 +29,13 @@ using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus.Local;
using Volo.Abp.SettingManagement;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
namespace Win_in.Sfs.Shared.Application;
@ -71,6 +73,8 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
protected IHttpContextAccessor HttpContextAccessor => LazyServiceProvider.LazyGetRequiredService<IHttpContextAccessor>();
protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService<ILocalEventBus>();
/// <summary>
///
/// </summary>
@ -556,6 +560,8 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
}
}
await PublishCreatedAsync(entityDict.Keys.ToList());
// 创建导入报告
var reportFile = ExportImportService.GetImportReport(inputFileBytes, modelDict);
// 创建返回值
@ -574,19 +580,24 @@ 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>
/// <param name="entities"></param>
/// <returns></returns>
private async Task PublishCreatedAsync(List<TEntity> entities)
{
try
{
await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(entities),true).ConfigureAwait(false);
}
catch (Exception ex)
{
Logger.LogDebug($"{typeof(TEntity).Name} Created Event:{ex.Message}", null);
Console.WriteLine(ex.Source);
throw;
}
}
/// <summary>
/// 用来重写 导入数据时可以加工数据

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/Win_in.Sfs.Shared.Application.csproj

@ -40,6 +40,7 @@
<ProjectReference Include="..\..\..\FileStorage\src\Win_in.Sfs.FileStorage.Application.Contracts\Win_in.Sfs.FileStorage.Application.Contracts.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Shared.Application.Contracts\Win_in.Sfs.Shared.Application.Contracts.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Shared.Domain\Win_in.Sfs.Shared.Domain.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Shared.Event\Win_in.Sfs.Shared.Event.csproj" />
</ItemGroup>
<ItemGroup>

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs

@ -64,6 +64,7 @@ public class SupplierAsnAppService :
return ObjectMapper.Map<SupplierAsn, SupplierAsnDTO>(resultEntity);
}
private async Task<SupplierAsnDTO> CreateFromFileAsync(SupplierAsnEditInput input)
{
var entity = ObjectMapper.Map<SupplierAsnEditInput, SupplierAsn>(input);

11
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAutoMapperProfile.cs

@ -15,20 +15,17 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<SupplierAsnEditInput, SupplierAsn>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.Number)
.Ignore(x => x.RpNumber)
.Ignore(x => x.PoNumber)
.Ignore(x => x.SupplierCode)
.Ignore(x => x.Details)
.Ignore(x => x.ActiveDate)
.Ignore(x => x.Id);
CreateMap<SupplierAsnDetail, SupplierAsnDetailDTO>();
CreateMap<SupplierAsnDetail, SupplierAsnDetailDTO>()
;
CreateMap<SupplierAsnDetailInput, SupplierAsnDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)
.Ignore(x => x.Id);
.Ignore(x => x.Id)
;
}
}

46
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Orders/PurchaseOrderAutoMapperProfile.cs

@ -0,0 +1,46 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event;
public partial class StoreEventAutoMapperProfile : Profile
{
private void PurchaseOrderAutoMapperProfile()
{
// 采购订单 > 发货单
#region SupplierAsn, PurchaseOrderCreateInput
CreateMap<PurchaseOrder, SupplierAsnEditInput>()
.Ignore(x => x.Status)
.Ignore(x => x.TruckNumber)
.Ignore(x => x.DockCode)
.Ignore(x => x.ShipDate)
.Ignore(x => x.PlanArriveDate)
.Ignore(x => x.TimeWindow)
.Ignore(x => x.Ctype)
.Ignore(x => x.PlanUserCode)
.Ignore(x => x.CreateType)
.Ignore(x => x.RpNumber)
.Ignore(x => x.PoNumber)
;
#endregion
// 采购订单-详情 > 发货单-详情
#region PurchaseOrderDetail, SupplierAsnDetailInput
CreateMap<PurchaseOrderDetail, SupplierAsnDetailInput>()
.Ignore(x => x.PoNumber)
.Ignore(x => x.RecommendErpCode)
.Ignore(x => x.PlanUserCode)
.Ignore(x => x.PackingCode)
.Ignore(x => x.ContainerCode)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
;
#endregion
}
}

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

@ -1,20 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Domain.Acl.ItemBasic;
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>>>
: StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<PurchaseOrder>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<PurchaseOrder>>>
{
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.PurchaseOrder;
private readonly ISupplierAsnAppService _supplierAsnAppService;
private readonly ILabelDefinitionAppService _labelDefinitionAppService;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly IItemPackAppService _itemPackAppService;
private readonly ISupplierItemAppService _supplierItemAppService;
private readonly IDockAppService _dockAppService;
public PurchaseOrderEventHandler(ISupplierAsnAppService supplierAsnAppService,
ILabelDefinitionAppService labelDefinitionAppService,
IItemBasicAppService itemBasicAppService,
IItemPackAppService itemPackAppService,
ISupplierItemAppService supplierItemAppService,
IDockAppService dockAppService)
{
_supplierAsnAppService = supplierAsnAppService;
_labelDefinitionAppService = labelDefinitionAppService;
_itemBasicAppService = itemBasicAppService;
_itemPackAppService = itemPackAppService;
_supplierItemAppService = supplierItemAppService;
_dockAppService = dockAppService;
}
//创建采购订单
[UnitOfWork]
@ -22,7 +49,7 @@ public class PurchaseOrderEventHandler
{
var entity = eventData.Entity;
await CreateSupplierAsn(entity);
await CreateSupplierAsnAsync(entity).ConfigureAwait(false);
}
//批量创建
@ -31,17 +58,86 @@ public class PurchaseOrderEventHandler
{
var entities = eventData.Entity;
entities.ForEach(async p =>
foreach (var entity in entities)
{
await CreateSupplierAsn(p).ConfigureAwait(false);
});
await CreateSupplierAsnAsync(entity).ConfigureAwait(false);
}
}
#region 业务 创建采购订单后>创建收货单
#region 业务 创建采购订单后 > 创建收货单
private async Task CreateSupplierAsn(PurchaseOrder purchaseOrder)
//创建供应商到货
private async Task CreateSupplierAsnAsync(PurchaseOrder purchaseOrder)
{
var supplierAsnDto = await BuildSupplierAsnAsync(purchaseOrder).ConfigureAwait(false);
await _supplierAsnAppService.CreateAsync(supplierAsnDto).ConfigureAwait(false);
}
//构造供应商到货DTO
private async Task<SupplierAsnEditInput> BuildSupplierAsnAsync(PurchaseOrder purchaseOrder)
{
var supplierAsnEditInput= ObjectMapper.Map<PurchaseOrder, SupplierAsnEditInput>(purchaseOrder);
//收货口 //todo 处理有问题是否要和供应商关联
var dock = await _dockAppService.GetAllListByFilterAsync(
new SfsBaseDataRequestInputBase() { Condition = new Condition(), MaxResultCount = 99, SkipCount = 0, Sorting = string.Empty }, true).ConfigureAwait(false);
supplierAsnEditInput.DockCode = dock.First().Code;
//要货单号
supplierAsnEditInput.RpNumber = "无";
//生效日期
supplierAsnEditInput.ActiveDate = Clock.Now;
//一次性返回所有箱码
var generateManyAsync =await _labelDefinitionAppService
.GenerateManyAsync(EnumLabelType.PurchaseLabel.ToString(), Clock.Now.ToString(SharedConst.TimeFormat),
supplierAsnEditInput.Details.Count).ConfigureAwait(false);
//所有的物品Code
var itemCodes = purchaseOrder.Details.GroupBy(p => p.ItemCode).Select(p => p.Key);
//一次性返回所有物品信息
var itemBasicDtos=await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
var ItemPacks = new List<ItemPackDTO>();//一次性返回所有物品包装信息
var supplierItemDtos = new List<SupplierItemDTO>();//一次性返回所有供应商物品信息
foreach (var itemCode in itemCodes)//查询
{
var itemPackDtos = await _itemPackAppService.GetListByItemCodeAsync(itemCode).ConfigureAwait(false);
var itemPackDto = itemPackDtos.First();
var supplierItem = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(purchaseOrder.SupplierCode, itemCode).ConfigureAwait(false);
ItemPacks.Add(itemPackDto);
supplierItemDtos.Add(supplierItem);
}
//赋值 详情表
supplierAsnEditInput.Details.ForEach(detail =>
{
//添加箱码
var pakcingCode=generateManyAsync.First();
detail.PackingCode = pakcingCode;
generateManyAsync.Remove(pakcingCode);
//添加物品信息
var itemBasicDto= itemBasicDtos.First(p=>p.Code==detail.ItemCode);
detail.ItemName= itemBasicDto.Name;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2= itemBasicDto.Desc2;
//标包
var itemPack = ItemPacks.First(p => p.ItemCode == detail.ItemCode); //todo 一个物品多个包装?怎么取值
detail.StdPackQty = itemPack.Qty;
//供应商物品
var supplierItemDto=supplierItemDtos.First(p =>
p.ItemCode == detail.ItemCode && p.SupplierCode == supplierAsnEditInput.SupplierCode);
detail.SupplierPackQty = supplierItemDto.SupplierPackQty;
detail.SupplierPackUom= supplierItemDto.SupplierPackUom;
});
return supplierAsnEditInput;
}
#endregion

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Plans/SupplierAsnEventHandler.cs

@ -57,9 +57,6 @@ public class SupplierAsnEventHandler
switch (entity.CreateType)
{
case EnumSupplierAsnCreateType.Import:
//创建采购订单
await CreatePurchaseOrderAsync(entity).ConfigureAwait(false);
//创建标签
await CreateLabelAsync(entity).ConfigureAwait(false);
break;
@ -72,7 +69,7 @@ public class SupplierAsnEventHandler
}
//创建收货请求(到货通知)
await CreatePurchaseReceiptRequestAsync(entity).ConfigureAwait(false);
//await CreatePurchaseReceiptRequestAsync(entity).ConfigureAwait(false);
}
/// <summary>

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs

@ -6,6 +6,11 @@ public partial class StoreEventAutoMapperProfile : Profile
{
public StoreEventAutoMapperProfile()
{
#region Orders
//采购订单
PurchaseOrderAutoMapperProfile();
#endregion
PurchaseReceiptRequestAutoMapperProfile();
InspectRequestAutoMapperProfile();
BackFlushNoteAutoMapperProfile();
@ -44,13 +49,9 @@ public partial class StoreEventAutoMapperProfile : Profile
TransferRequestAutoMapperProfile();
TransferNoteAutoMapperProfile();
NoOkConvertOkNoteAutoMapperProfile();
ScrapRequestMapperProfile();
ProductReceiptRequestMapperProfile();
CountAdjustRequestAutoMapperProfile();
InventoryInitialNoteAutoMapperProfile();
#region Jobs

8
build/src/docker/publish/settings/appsettings.Development.json

@ -113,13 +113,13 @@
"BaseUrl": "http://dev.ccwin-in.com:21293/"
},
"BaseData": {
"BaseUrl": "http://dev.ccwin-in.com:59094/"
"BaseUrl": "http://dev.ccwin-in.com:21294/"
},
"Default": {
"BaseUrl": "http://dev.ccwin-in.com:21293"
},
"FileStorage": {
"BaseUrl": "http://dev.ccwin-in.com:59092/"
"BaseUrl": "http://dev.ccwin-in.com:21292/"
},
"Inventory": {
"BaseUrl": "http://localhost:59095/"
@ -128,10 +128,10 @@
"BaseUrl": "http://localhost:59095/"
},
"Label": {
"BaseUrl": "http://dev.ccwin-in.com:59092/"
"BaseUrl": "http://dev.ccwin-in.com:21292/"
},
"Message": {
"BaseUrl": "http://dev.ccwin-in.com:59092/"
"BaseUrl": "http://dev.ccwin-in.com:21292/"
},
"Store": {
"BaseUrl": "http://localhost:59095/"

Loading…
Cancel
Save