Browse Source

更新版本

dev_DY_CC
赵新宇 1 year ago
parent
commit
273575b339
  1. 17
      be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml
  2. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs
  3. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs
  4. 2
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs
  5. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
  6. 105
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs

17
be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs

@ -37,7 +37,7 @@ public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase
/// 库位编号
/// </summary>
[Display(Name = "库位代码")]
[Required(ErrorMessage = "{0}是必填项")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs

@ -37,7 +37,7 @@ public class EquipmentImportInput : SfsBaseDataImportInputBase
/// 库位编号
/// </summary>
[Display(Name = "库位代码")]
[Required(ErrorMessage = "{0}是必填项")]
//[Required(ErrorMessage = "{0}是必填项")]
public string LocCode { get; set; } = string.Empty;
/// <summary>
/// 状态

2
be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs

@ -23,7 +23,7 @@ public static class EquipmentDbContextModelCreatingExtensions
b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(true);
b.Property(q => q.Model).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.LocCode).HasMaxLength(SfsPropertyConst.CodeLength);
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
//Relations

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs

@ -17,6 +17,7 @@ namespace Win_in.Sfs.Wms.Store.Application;
using System.Collections.Generic;
using System.Linq;
using IdentityModel;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Shared.Domain;
@ -70,42 +71,25 @@ public class MesNoteAppService :
detail.StdPackQty = itemBasicDto.StdPackQty;
#region 添加校验
RecommendBalanceRequestInput rInput = new RecommendBalanceRequestInput();
rInput.ItemCode = detail.ItemCode;
rInput.Locations = new List<string>() { detail.FromLocationCode };
rInput.Qty = detail.Qty;
rInput.Statuses = new List<EnumInventoryStatus> { EnumInventoryStatus.OK };
var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false);
var first = balanceLst.FirstOrDefault();
if (first != null)
{
if (detail.Qty > first.Qty)
{ }
if (detail.Qty <= first.Qty)
{
throw new UserFriendlyException($"库存数量不足");
}
}
else
{
throw new UserFriendlyException($"库存数量不足");
}
#endregion
}
entity = await _repository.InsertAsync(entity).ConfigureAwait(false);

105
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/MesNoteEventHandler.cs

@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Event.Transaction;
namespace Win_in.Sfs.Wms.Store.Event.Transactions;
public class MesNoteEventHandler
: StoreInventoryEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<MesNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<MesNote>>>
{
private const EnumTransType TransType = EnumTransType.Scrap;
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<MesNote> eventData)
{
var entity = eventData.Entity;
await AddTransactionsAsync(new List<MesNote>() { entity }).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<MesNote>> eventData)
{
var entities = eventData.Entity;
await AddTransactionsAsync(entities).ConfigureAwait(false);
}
#region 私有
private async Task AddTransactionsAsync(List<MesNote> MesNotes)
{
//如果WMS管理报废库,生成库存转移
if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false))
{
var transferLogs = new List<TransferLogEditInput>();
foreach (var MesNote in MesNotes)
{
transferLogs.AddRange(BuildTransferLogs(MesNote));
}
await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
}
else
{
var transactions = new List<TransactionEditInput>();
foreach (var MesNote in MesNotes)
{
transactions.AddRange(BuildTransactions(MesNote));
}
await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false);
}
}
private List<TransferLogEditInput> BuildTransferLogs(MesNote MesNote)
{
var transferLogs = new List<TransferLogEditInput>();
foreach (var detail in MesNote.Details.Where(detail => detail.Qty != 0))
{
var transferLog = ObjectMapper.Map<MesNoteDetail, TransferLogEditInput>(detail);
transferLog.TransType = TransType;
transferLog.TransSubType = Enum.Parse<EnumTransSubType>(MesNote.Type);
transferLog.Worker = MesNote.Worker;
transferLog.DocNumber = MesNote.Number;
transferLog.JobNumber = MesNote.JobNumber;
transferLogs.Add(transferLog);
}
return transferLogs;
}
private List<TransactionEditInput> BuildTransactions(MesNote deliverNote)
{
var transactions = new List<TransactionEditInput>();
foreach (var detail in deliverNote.Details)
{
var transaction = ObjectMapper.Map<MesNoteDetail, TransactionEditInput>(detail);
transaction.TransType = TransType;
transaction.TransInOut = EnumTransInOut.Out;
transaction.Worker = deliverNote.Worker;
transaction.DocNumber = deliverNote.Number;
transaction.JobNumber = deliverNote.JobNumber;
transactions.Add(transaction);
}
return transactions;
}
#endregion
}
Loading…
Cancel
Save