58 changed files with 21916 additions and 323 deletions
File diff suppressed because it is too large
@ -0,0 +1,68 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Migrations |
|||
{ |
|||
public partial class Store_AddColumn : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "Type", |
|||
table: "Store_TransferNote", |
|||
type: "nvarchar(64)", |
|||
maxLength: 64, |
|||
nullable: false, |
|||
defaultValue: "", |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(64)", |
|||
oldMaxLength: 64, |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "WarehouseCode", |
|||
table: "Store_PurchaseReceiptNote", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "WarehouseCode", |
|||
table: "Store_InspectRequest", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "CountPrint", |
|||
table: "Store_DeliverNote", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "WarehouseCode", |
|||
table: "Store_PurchaseReceiptNote"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "WarehouseCode", |
|||
table: "Store_InspectRequest"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "CountPrint", |
|||
table: "Store_DeliverNote"); |
|||
|
|||
migrationBuilder.AlterColumn<string>( |
|||
name: "Type", |
|||
table: "Store_TransferNote", |
|||
type: "nvarchar(64)", |
|||
maxLength: 64, |
|||
nullable: true, |
|||
oldClrType: typeof(string), |
|||
oldType: "nvarchar(64)", |
|||
oldMaxLength: 64); |
|||
} |
|||
} |
|||
} |
@ -1,78 +1,78 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.Uow; |
|||
using Win_in.Sfs.Shared.Event; |
|||
using Win_in.Sfs.Wms.Store.Domain; |
|||
//using System.Collections.Generic;
|
|||
//using System.Linq;
|
|||
//using System.Threading.Tasks;
|
|||
//using Volo.Abp.EventBus;
|
|||
//using Volo.Abp.Uow;
|
|||
//using Win_in.Sfs.Shared.Event;
|
|||
//using Win_in.Sfs.Wms.Store.Domain;
|
|||
|
|||
namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; |
|||
//namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
|
|||
|
|||
public class IssueNoteEventHandler |
|||
: StoreEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<IssueNote>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<IssueNote>>> |
|||
, ILocalEventHandler<SfsConfirmedEntityEventData<IssueNote>> |
|||
{ |
|||
private readonly IMaterialRequestManager _materialRequestManager; |
|||
//public class IssueNoteEventHandler
|
|||
// : StoreEventHandlerBase
|
|||
// , ILocalEventHandler<SfsCreatedEntityEventData<IssueNote>>
|
|||
// , ILocalEventHandler<SfsCreatedEntityEventData<List<IssueNote>>>
|
|||
// , ILocalEventHandler<SfsConfirmedEntityEventData<IssueNote>>
|
|||
//{
|
|||
// private readonly IMaterialRequestManager _materialRequestManager;
|
|||
|
|||
public IssueNoteEventHandler( |
|||
IMaterialRequestManager materialRequestManager |
|||
) |
|||
{ |
|||
_materialRequestManager = materialRequestManager; |
|||
} |
|||
// public IssueNoteEventHandler(
|
|||
// IMaterialRequestManager materialRequestManager
|
|||
// )
|
|||
// {
|
|||
// _materialRequestManager = materialRequestManager;
|
|||
// }
|
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData<IssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
// [UnitOfWork]
|
|||
// public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData<IssueNote> eventData)
|
|||
// {
|
|||
// var entity = eventData.Entity;
|
|||
|
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
|
|||
// }
|
|||
|
|||
private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote entity) |
|||
{ |
|||
var receiveQtyGroup = entity.Details |
|||
.GroupBy(p => new { p.ItemCode, p.ToLocationCode }) |
|||
.Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) |
|||
.ToList(); |
|||
// private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote entity)
|
|||
// {
|
|||
// var receiveQtyGroup = entity.Details
|
|||
// .GroupBy(p => new { p.ItemCode, p.ToLocationCode })
|
|||
// .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) })
|
|||
// .ToList();
|
|||
|
|||
var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); |
|||
// var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
|
|||
|
|||
//更新叫料请求的已收数量
|
|||
foreach (var materialRequestDetail in materialRequest.Details) |
|||
{ |
|||
var receiveQty = receiveQtyGroup.FirstOrDefault(p => |
|||
p.ItemCode == materialRequestDetail.ItemCode && |
|||
p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; |
|||
if (receiveQty != null) |
|||
{ |
|||
materialRequestDetail.ReceivedQty += receiveQty.Value; |
|||
} |
|||
} |
|||
// //更新叫料请求的已收数量
|
|||
// foreach (var materialRequestDetail in materialRequest.Details)
|
|||
// {
|
|||
// var receiveQty = receiveQtyGroup.FirstOrDefault(p =>
|
|||
// p.ItemCode == materialRequestDetail.ItemCode &&
|
|||
// p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty;
|
|||
// if (receiveQty != null)
|
|||
// {
|
|||
// materialRequestDetail.ReceivedQty += receiveQty.Value;
|
|||
// }
|
|||
// }
|
|||
|
|||
await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false); |
|||
} |
|||
// await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false);
|
|||
// }
|
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
if (!entity.UseOnTheWayLocation) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
// [UnitOfWork]
|
|||
// public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueNote> eventData)
|
|||
// {
|
|||
// var entity = eventData.Entity;
|
|||
// if (!entity.UseOnTheWayLocation)
|
|||
// {
|
|||
// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
|
|||
// }
|
|||
|
|||
} |
|||
// }
|
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<IssueNote>> eventData) |
|||
{ |
|||
var entities = eventData.Entity; |
|||
foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation)) |
|||
{ |
|||
await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
// [UnitOfWork]
|
|||
// public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<IssueNote>> eventData)
|
|||
// {
|
|||
// var entities = eventData.Entity;
|
|||
// foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation))
|
|||
// {
|
|||
// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false);
|
|||
// }
|
|||
// }
|
|||
//}
|
|||
|
@ -0,0 +1,57 @@ |
|||
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.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.BusinessRequest; |
|||
|
|||
public class ScrapNoteEventHandler |
|||
: StoreInventoryEventHandlerBase |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<ScrapNote>> |
|||
, ILocalEventHandler<SfsCreatedEntityEventData<List<ScrapNote>>> |
|||
{ |
|||
private readonly IScrapRequestManager _scrapRequestManager; |
|||
|
|||
public ScrapNoteEventHandler(IScrapRequestManager scrapRequestManager) |
|||
{ |
|||
_scrapRequestManager = scrapRequestManager; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<ScrapNote> eventData) |
|||
{ |
|||
var entity = eventData.Entity; |
|||
if (!string.IsNullOrEmpty(entity.ScrapRequestNumber)) |
|||
{ |
|||
var scrapRequest = await _scrapRequestManager.GetByNumberAsync(entity.ScrapRequestNumber) |
|||
.ConfigureAwait(false); |
|||
|
|||
await _scrapRequestManager.CompleteAsync(scrapRequest).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<ScrapNote>> eventData) |
|||
{ |
|||
var entitys = eventData.Entity; |
|||
foreach (var entity in entitys) |
|||
{ |
|||
if (string.IsNullOrEmpty(entity.ScrapRequestNumber)) |
|||
{ |
|||
var scrapRequest = await _scrapRequestManager.GetByNumberAsync(entity.ScrapRequestNumber) |
|||
.ConfigureAwait(false); |
|||
|
|||
await _scrapRequestManager.CompleteAsync(scrapRequest).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue