唐明亮 2 years ago
parent
commit
790fbd5a8a
  1. 32
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs
  2. 199
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs
  3. 262
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
  4. 352
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs
  5. 5
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs
  6. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs
  7. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs
  8. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs
  9. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs
  10. 15
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
  11. 25
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs
  12. 18
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  13. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs
  14. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs
  15. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs
  16. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs
  17. 67
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs

32
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs

@ -8,6 +8,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers;
using System.Diagnostics.Metrics;
using System.Linq;
using Win_in.Sfs.Basedata.Application.Contracts;
@ -29,28 +30,28 @@ public class AsnTimeWindowController : AbpController
[HttpGet("asn-time-window")]
public virtual async Task<List<AsnTimeWindowDashboardDto>> GetAsnTimeWindowsAsync()
{
return await GetAsnTimeWindowDashboardsAsync().ConfigureAwait(false);
return await GetAsnTimeWindowDashboardsAsync();
}
private async Task<List<AsnTimeWindowDashboardDto>> GetAsnTimeWindowDashboardsAsync()
{
var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false);
var supplierAsns = await this.GetSupplierAsnsAsync();
var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct();
var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false);
var suppliers = await GetSuppliersAsync(supplierCodes);
var asnNumbers = supplierAsns.Select(t => t.Number);
var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers).ConfigureAwait(false);
var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers);
return ConvertToAsnTimeWindowDashboards(
return this.ConvertToAsnTimeWindowDashboards(
supplierAsns,
suppliers,
purchaseReceiptNotes);
}
private static List<AsnTimeWindowDashboardDto> ConvertToAsnTimeWindowDashboards(
private List<AsnTimeWindowDashboardDto> ConvertToAsnTimeWindowDashboards(
List<SupplierAsnDTO> supplierAsns,
List<SupplierDTO> suppliers,
List<PurchaseReceiptNoteDTO> purchaseReceiptNotes)
@ -70,16 +71,12 @@ public class AsnTimeWindowController : AbpController
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
if (supplier == null)
{
continue;
}
supplierShortName = supplier.ShortName;
if (dtos.Exists(t => t.TimeSpan == timeSpan && t.SupplierShortName == supplierShortName))
{
continue;
}
var purchaseReceiptNote =
purchaseReceiptNotes.FirstOrDefault(t => t.AsnNumber == supplierAsn.Number);
@ -111,17 +108,26 @@ public class AsnTimeWindowController : AbpController
endTime.AddDays(-1);
}
return await _supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime).ConfigureAwait(false);
return await this._supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime);
}
private async Task<List<SupplierDTO>> GetSuppliersAsync(IEnumerable<string> codes)
{
return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false);
return await this._supplierApp.GetByCodesAsync(codes);
}
private async Task<List<PurchaseReceiptNoteDTO>> GetPurchaseReceiptNotesAsync(IEnumerable<string> asnNumbers)
{
return await _purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false);
return await this._purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[HttpGet("get-server-date-time")]
public virtual async Task<string> GetServerDate()
{
return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}

199
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs

@ -2,151 +2,156 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Wms.Dashboard.Host.Models;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers;
using System.Linq;
using NUglify.Helpers;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
using System.Linq;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using NUglify.Helpers;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}material-request")]
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using static IdentityServer4.Models.IdentityResources;
public class MaterialRequestController : AbpController
{
private readonly IMaterialRequestAppService _materialRequestApp;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}material-request")]
private readonly IIssueNoteAppService _issueNoteApp;
public MaterialRequestController(IMaterialRequestAppService materialRequestApp, IIssueNoteAppService issueNoteApp)
public class MaterialRequestController : AbpController
{
_materialRequestApp = materialRequestApp;
_issueNoteApp = issueNoteApp;
}
private readonly IMaterialRequestAppService _materialRequestApp;
[HttpGet("un-handled-order-sum")]
public virtual async Task<MaterialRequestUnHandledOrderSumDto> GetUnHandledOrderSumAsync()
{
var dto = new MaterialRequestUnHandledOrderSumDto();
private readonly IIssueNoteAppService _issueNoteApp;
public MaterialRequestController(IMaterialRequestAppService materialRequestApp, IIssueNoteAppService issueNoteApp)
{
_materialRequestApp = materialRequestApp;
_issueNoteApp = issueNoteApp;
}
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
[HttpGet("un-handled-order-sum")]
public virtual async Task<MaterialRequestUnHandledOrderSumDto> GetUnHandledOrderSumAsync()
{
var dto = new MaterialRequestUnHandledOrderSumDto();
dto.Sum = list.Where(t => t.RequestStatus == EnumRequestStatus.New).Count();
var list = await GetMaterialRequestAsync();
return dto;
}
dto.Sum = list.Where(t => t.RequestStatus == EnumRequestStatus.New).Count();
[HttpGet("un-issued-item-qty-sum")]
public virtual async Task<MaterialRequestUnIssuedItemQtySumDto> GetUnIssuedItemQtySumAsync()
{
var dto = new MaterialRequestUnIssuedItemQtySumDto();
return dto;
}
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
[HttpGet("un-issued-item-qty-sum")]
public virtual async Task<MaterialRequestUnIssuedItemQtySumDto> GetUnIssuedItemQtySumAsync()
{
var dto = new MaterialRequestUnIssuedItemQtySumDto();
dto.Sum = list.Where(t => t.RequestStatus != EnumRequestStatus.New)
.Sum(t => t.Details.Sum(t1 => t1.Qty - t1.IssuedQty));
var list = await GetMaterialRequestAsync();
return dto;
}
dto.Sum = list.Where(t => t.RequestStatus != EnumRequestStatus.New)
.Sum(t => t.Details.Sum(t1 => t1.Qty - t1.IssuedQty));
[HttpGet("un-received-item-qty-by-item-list")]
public virtual async Task<List<MaterialRequestUnReceivedItemQtyByItemDto>>
GetUnIssuedItemQtySumByItemListAsync()
{
var dtos = new List<MaterialRequestUnReceivedItemQtyByItemDto>();
return dto;
}
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
[HttpGet("un-received-item-qty-by-item-list")]
public virtual async Task<List<MaterialRequestUnReceivedItemQtyByItemDto>>
GetUnIssuedItemQtySumByItemListAsync()
{
var dtos = new List<MaterialRequestUnReceivedItemQtyByItemDto>();
var list = await GetMaterialRequestAsync();
var details = new List<MaterialRequestDetailDTO>();
var details = new List<MaterialRequestDetailDTO>();
list.Where(t => t.RequestStatus != EnumRequestStatus.New).ForEach(
item =>
list.Where(t => t.RequestStatus != EnumRequestStatus.New).ForEach(
item =>
{
item.Details.ForEach(
detail =>
{
if (detail.IssuedQty - detail.ReceivedQty > 0)
{
if (detail.IssuedQty - detail.ReceivedQty > 0)
{
details.Add(detail);
}
});
details.Add(detail);
}
});
});
dtos = details.GroupBy(t => t.ItemCode).Select(
item => new MaterialRequestUnReceivedItemQtyByItemDto()
{
ItemCode = item.Key,
Sum = item.Sum(t => t.IssuedQty - t.ReceivedQty)
}).ToList();
dtos = details.GroupBy(t => t.ItemCode).Select(
item => new MaterialRequestUnReceivedItemQtyByItemDto()
{
ItemCode = item.Key,
Sum = item.Sum(t => t.IssuedQty - t.ReceivedQty)
}).ToList();
return dtos;
}
return dtos;
}
[HttpGet("item-qty-by-received-status-list")]
public virtual async Task<List<MaterialRequestItemQtyByReceivedStatusDto>> GetItemQtyByReceivedStatusListAsync()
{
var dtos = new List<MaterialRequestItemQtyByReceivedStatusDto>();
[HttpGet("item-qty-by-received-status-list")]
public virtual async Task<List<MaterialRequestItemQtyByReceivedStatusDto>> GetItemQtyByReceivedStatusListAsync()
{
var dtos = new List<MaterialRequestItemQtyByReceivedStatusDto>();
var ToBeIssuedQty = 0.0M;
var ToBeIssuedQty = 0.0M;
var ToBeReceivedQty = 0.0M;
var ToBeReceivedQty = 0.0M;
var Received = 0.0M;
var Received = 0.0M;
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
var list = await GetMaterialRequestAsync();
list.ForEach(
item =>
list.ForEach(
item =>
{
ToBeIssuedQty += item.Details.Sum(t => t.ToBeIssuedQty);
ToBeReceivedQty += item.Details.Sum(t => t.ToBeReceivedQty);
Received += item.Details.Sum(t => t.ReceivedQty);
});
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求未发", Sum = ToBeIssuedQty });
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "已发未收", Sum = ToBeReceivedQty });
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求已收", Sum = Received });
return dtos;
}
[HttpGet("un-received-item-list")]
public virtual async Task<List<MaterialRequestUnReceivedItemDto>> GetUnReceivedItemListAsync()
{
var dtos = new List<MaterialRequestUnReceivedItemDto>();
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求未发", Sum = ToBeIssuedQty });
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "已发未收", Sum = ToBeReceivedQty });
dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求已收", Sum = Received });
var notes = await GetIssueNotesAsync().ConfigureAwait(false);
return dtos;
}
foreach (var note in notes)
[HttpGet("un-received-item-list")]
public virtual async Task<List<MaterialRequestUnReceivedItemDto>> GetUnReceivedItemListAsync()
{
foreach (var noteDetail in note.Details)
var dtos = new List<MaterialRequestUnReceivedItemDto>();
var notes = await this.GetIssueNotesAsync();
foreach (var note in notes)
{
var dto = new MaterialRequestUnReceivedItemDto();
foreach (var noteDetail in note.Details)
{
var dto = new MaterialRequestUnReceivedItemDto();
dto.Number = note.RequestNumber;
dto.ItemCode = noteDetail.ItemCode;
dto.ItemDesc1 = noteDetail.ItemDesc1;
dto.PackingCode = noteDetail.FromPackingCode;
dto.IssuedQty = noteDetail.Qty;
dto.IssuedTime = note.ActiveDate;
dto.Number = note.RequestNumber;
dto.ItemCode = noteDetail.ItemCode;
dto.ItemDesc1 = noteDetail.ItemDesc1;
dto.PackingCode = noteDetail.FromPackingCode;
dto.IssuedQty = noteDetail.Qty;
dto.IssuedTime = note.ActiveDate;
dtos.Add(dto);
dtos.Add(dto);
}
}
}
return dtos;
}
return dtos;
}
private async Task<List<IssueNoteDTO>> GetIssueNotesAsync()
{
return await _issueNoteApp.GetListUnConfirmedByTypeAsync(EnumTransSubType.Issue_WIP.ToString()).ConfigureAwait(false);
}
private async Task<List<IssueNoteDTO>> GetIssueNotesAsync()
{
return await this._issueNoteApp.GetListUnConfirmedByTypeAsync(EnumTransSubType.Issue_WIP.ToString());
}
private async Task<List<MaterialRequestDTO>> GetMaterialRequestAsync()
{
return await _materialRequestApp.GetListByTypeAsync(EnumTransSubType.Issue_WIP.ToString()).ConfigureAwait(false);
private async Task<List<MaterialRequestDTO>> GetMaterialRequestAsync()
{
return await this._materialRequestApp.GetListByTypeAsync(EnumTransSubType.Issue_WIP.ToString());
}
}
}

262
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs

@ -1,174 +1,194 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Serilog;
using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.Dashboard.Host.Models;
using System;
using System.Linq;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")]
public class PlanAndActualController : AbpController
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
private readonly ISupplierAsnAppService _supplierAsnApp;
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteApp;
private readonly IPutawayNoteAppService _putawayNoteApp;
private readonly ISupplierAppService _supplierApp;
private readonly IItemSafetyStockAppService _itemSafetyStockApp;
public PlanAndActualController(ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteApp, IPutawayNoteAppService putawayNoteApp, ISupplierAppService supplierApp, IItemSafetyStockAppService itemSafetyStockApp)
{
_supplierAsnApp = supplierAsnApp;
_purchaseReceiptNoteApp = purchaseReceiptNoteApp;
_putawayNoteApp = putawayNoteApp;
_supplierApp = supplierApp;
_itemSafetyStockApp = itemSafetyStockApp;
}
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")]
[HttpGet("plan-actual-list")]
public virtual async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualListAsync()
public class PlanAndActualController : AbpController
{
return await GetPlanAndActualDashboardsAsync().ConfigureAwait(false);
}
private readonly ISupplierAsnAppService _supplierAsnApp;
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteApp;
private readonly IPutawayNoteAppService _putawayNoteApp;
private readonly ISupplierAppService _supplierApp;
private readonly IItemSafetyStockAppService _itemSafetyStockApp;
private readonly IPurchaseOrderAppService _purchaseOrderApp;
private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobApp;
public PlanAndActualController(ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteApp, IPutawayNoteAppService putawayNoteApp, ISupplierAppService supplierApp, IItemSafetyStockAppService itemSafetyStockApp, IPurchaseOrderAppService purchaseOrderApp, IPurchaseReceiptJobAppService purchaseReceiptJobApp)
{
_supplierAsnApp = supplierAsnApp;
_purchaseReceiptNoteApp = purchaseReceiptNoteApp;
_putawayNoteApp = putawayNoteApp;
_supplierApp = supplierApp;
_itemSafetyStockApp = itemSafetyStockApp;
_purchaseOrderApp = purchaseOrderApp;
_purchaseReceiptJobApp = purchaseReceiptJobApp;
}
private async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualDashboardsAsync()
{
var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false);
var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct();
[HttpGet("plan-actual-list")]
public virtual async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualListAsync()
{
return await GetPlanAndActualDashboardsAsync();
}
var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false);
private async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualDashboardsAsync()
{
var supplierAsns = await this.GetSupplierAsnsAsync();
var asnNumbers = supplierAsns.Select(t => t.Number);
var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct();
var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers).ConfigureAwait(false);
var suppliers = await GetSuppliersAsync(supplierCodes);
var putawayNotes = await GetPutawayNotesAsync(asnNumbers).ConfigureAwait(false);
var asnNumbers = supplierAsns.Select(t => t.Number);
var itemSafetyStorks = await GetItemSafetyStocksAsync(supplierAsns).ConfigureAwait(false);
var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers);
return ConvertToPlanAndActualDashboards(
supplierAsns,
suppliers,
purchaseReceiptNotes,
putawayNotes,
itemSafetyStorks);
}
var putawayNotes = await this.GetPutawayNotesAsync(asnNumbers);
private static List<PlanAndActualDashboardDto> ConvertToPlanAndActualDashboards(List<SupplierAsnDTO> supplierAsns, List<SupplierDTO> suppliers, List<PurchaseReceiptNoteDTO> purchaseReceiptNotes, List<PutawayNoteDTO> putawayNotes, List<ItemSafetyStockDTO> itemSafetyStorks)
{
var dtos = new List<PlanAndActualDashboardDto>();
var itemSafetyStorks = await this.GetItemSafetyStocksAsync(supplierAsns);
return await this.ConvertToPlanAndActualDashboards(
supplierAsns,
suppliers,
purchaseReceiptNotes,
putawayNotes,
itemSafetyStorks);
}
foreach (var supplierAsn in supplierAsns)
private async Task<List<PlanAndActualDashboardDto>> ConvertToPlanAndActualDashboards(List<SupplierAsnDTO> supplierAsns, List<SupplierDTO> suppliers, List<PurchaseReceiptNoteDTO> purchaseReceiptNotes, List<PutawayNoteDTO> putawayNotes, List<ItemSafetyStockDTO> itemSafetyStorks)
{
var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
var dtos = new List<PlanAndActualDashboardDto>();
var supplierShortName = string.Empty;
foreach (var supplierAsn in supplierAsns)
{
var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
var supplierShortName = string.Empty;
if (supplier == null)
{
continue;
}
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
supplierShortName = supplier.ShortName;
if (supplier == null)
continue;
foreach (var detail in supplierAsn.Details)
{
var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode);
supplierShortName = supplier.ShortName;
if (dto == null)
foreach (var detail in supplierAsn.Details)
{
dto = new PlanAndActualDashboardDto();
var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode);
dto.SupplierShortName = supplierShortName;
dto.ItemCode = detail.ItemCode;
dto.ItemDesc1 = detail.ItemDesc1;
dto.ItemName = detail.ItemName;
if (dto == null)
{
dto = new PlanAndActualDashboardDto();
var itemSafetyStork = itemSafetyStorks.FirstOrDefault(t => t.ItemCode == detail.ItemCode);
dto.SupplierShortName = supplierShortName;
dto.ItemCode = detail.ItemCode;
dto.ItemDesc1 = detail.ItemDesc1;
dto.ItemName = detail.ItemName;
if (itemSafetyStork != null)
{
dto.MaxQty = itemSafetyStork.MaxStock;
dto.MinQty = itemSafetyStork.MinStock;
}
var itemSafetyStork = itemSafetyStorks.FirstOrDefault(t => t.ItemCode == detail.ItemCode);
dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode, detail.Lot);
if (itemSafetyStork != null)
{
dto.MaxQty = itemSafetyStork.MaxStock;
dto.MinQty = itemSafetyStork.MinStock;
}
dtos.Add(dto);
}
var purchaseOrderDtos = await _purchaseOrderApp.GetListBySupplierCodeAsync(supplierAsn.SupplierCode, detail.ItemCode);
var supllierAsn = await _supplierAsnApp.GetForTodayListAsync();
var poNumberList = supllierAsn.Select(p => p.PoNumber).ToList();
dto.SupplierAsnCount += 1;
purchaseOrderDtos = purchaseOrderDtos.Where(p => poNumberList.Contains(p.Number)).ToList();
dto.PlanArriveQty += detail.Qty;
}
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
decimal allPutawayQty = 0;
decimal allReceiptQty = 0;
decimal allPlanArriveQty = 0;
private static decimal CountPutawayQty(List<PutawayNoteDTO> putawayNotes, string itemCode, string lot)
{
return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.ToLot == lot).Sum(t => t.Qty));
}
foreach (var purchaseOrderDTO in purchaseOrderDtos)
{
allPutawayQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.PutAwayQty);
allReceiptQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ReceivedQty);
allPlanArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ShippedQty);
}
private static decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
{
return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.HandledLot == lot).Sum(t => t.Qty));
}
dto.PutawayQty = allPutawayQty;
dto.PlanArriveQty = allPlanArriveQty;
dto.ReceiptQty = allReceiptQty;
private static int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
{
return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode && t.Lot == lot));
}
dtos.Add(dto);
}
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()
{
var startTime = DateTime.Today.AddHours(DashboardConst.AsnReceiptTimeLimitHour);
var purchaseReceiptJobDtos = await _purchaseReceiptJobApp.GetListBySupplierCodeOnTodayAsync(supplierAsn.SupplierCode);
dto.ReceiptNoteCount = purchaseReceiptJobDtos.Count(p => p.JobStatus == EnumJobStatus.Done);
var endTime = startTime.AddDays(1).AddSeconds(-1);
dto.SupplierAsnCount = purchaseReceiptJobDtos.Count();
}
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
if (DateTime.Now.Hour < DashboardConst.AsnReceiptTimeLimitHour)
private decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode)
{
startTime.AddDays(-1);
endTime.AddDays(-1);
return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty));
}
return await _supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime).ConfigureAwait(false);
}
private int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode)
{
return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode));
}
private async Task<List<SupplierDTO>> GetSuppliersAsync(IEnumerable<string> codes)
{
return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false);
}
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()
{
var startTime = DateTime.Today.AddHours(DashboardConst.AsnReceiptTimeLimitHour);
private async Task<List<PurchaseReceiptNoteDTO>> GetPurchaseReceiptNotesAsync(IEnumerable<string> asnNumbers)
{
return await _purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false);
}
var endTime = startTime.AddDays(1).AddSeconds(-1);
private async Task<List<PutawayNoteDTO>> GetPutawayNotesAsync(IEnumerable<string> asnNumbers)
{
return await _putawayNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false);
}
private async Task<List<ItemSafetyStockDTO>> GetItemSafetyStocksAsync(List<SupplierAsnDTO> supplierAsns)
{
var itemCodes = new List<string>();
if (DateTime.Now.Hour < DashboardConst.AsnReceiptTimeLimitHour)
{
startTime.AddDays(-1);
endTime.AddDays(-1);
}
supplierAsns.ForEach(t => { itemCodes.AddRange(t.Details.Select(t => t.ItemCode).ToList()); });
return await this._supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime);
}
var itemSafetyStorks = await _itemSafetyStockApp.GetByItemCodesAsync(itemCodes).ConfigureAwait(false);
return itemSafetyStorks;
private async Task<List<SupplierDTO>> GetSuppliersAsync(IEnumerable<string> codes)
{
return await this._supplierApp.GetByCodesAsync(codes);
}
private async Task<List<PurchaseReceiptNoteDTO>> GetPurchaseReceiptNotesAsync(IEnumerable<string> asnNumbers)
{
return await this._purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers);
}
private async Task<List<PutawayNoteDTO>> GetPutawayNotesAsync(IEnumerable<string> asnNumbers)
{
return await this._putawayNoteApp.GetListByAsnNumbers(asnNumbers);
}
private async Task<List<ItemSafetyStockDTO>> GetItemSafetyStocksAsync(List<SupplierAsnDTO> supplierAsns)
{
var itemCodes = new List<string>();
supplierAsns.ForEach(t => { itemCodes.AddRange(t.Details.Select(t => t.ItemCode).ToList()); });
var itemSafetyStorks = await this._itemSafetyStockApp.GetByItemCodesAsync(itemCodes);
return itemSafetyStorks;
}
}
}

352
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs

@ -5,233 +5,255 @@ using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.Dashboard.Host.Models;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers;
using System.Linq;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
using System;
using System.Linq;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Volo.Abp;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")]
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Label.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
public class PurchaseReceiptController : AbpController
{
private readonly IBalanceAppService _balanceApp;
private readonly IInventoryLabelAppService _labelService;
private readonly ISupplierAppService _supplierApp;
private readonly ISupplierAsnAppService _supplierAsnApp;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")]
public PurchaseReceiptController(IBalanceAppService balanceApp, IInventoryLabelAppService labelService, ISupplierAppService supplierApp, ISupplierAsnAppService supplierAsnApp)
public class PurchaseReceiptController : AbpController
{
this._balanceApp = balanceApp;
this._labelService = labelService;
this._supplierApp = supplierApp;
this._supplierAsnApp = supplierAsnApp;
}
private readonly IBalanceAppService _balanceApp;
private readonly IInventoryLabelAppService _labelService;
private readonly ISupplierAppService _supplierApp;
private readonly ISupplierAsnAppService _supplierAsnApp;
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService;
private readonly IInspectNoteAppService _inspectNoteAppService;
public PurchaseReceiptController(IBalanceAppService balanceApp, IInventoryLabelAppService labelService, ISupplierAppService supplierApp, ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, IInspectNoteAppService inspectNoteAppService)
{
this._balanceApp = balanceApp;
this._labelService = labelService;
this._supplierApp = supplierApp;
this._supplierAsnApp = supplierAsnApp;
_purchaseReceiptNoteAppService = purchaseReceiptNoteAppService;
_inspectNoteAppService = inspectNoteAppService;
}
[HttpGet("receipt-sum-qty")]
public virtual async Task<PurchaseReceiptSumQtyDashboardDto> GetReceiptSumQtyAsync()
{
var dto = new PurchaseReceiptSumQtyDashboardDto();
/// <summary>
/// 未上架数量
/// </summary>
/// <returns></returns>
[HttpGet("no-put-away-sum-qty")]
public virtual async Task<PurchaseReceiptSumQtyDashboardDto> GetNoPutAwaySumQtyAsync()
{
var dto = new PurchaseReceiptSumQtyDashboardDto();
var items = await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
var items = await GetPurchaseReceiptItemDashboardAsync();
dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) };
dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) };
return dto;
}
return dto;
}
[HttpGet("receipt-count-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetReceiptCountBySupplierQtyAsync()
{
var items = await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
/// <summary>
/// 未上架汇总
/// </summary>
/// <returns></returns>
[HttpGet("no-put-away-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetNoPutAwayBySupplierAsync()
{
var items = await GetPurchaseReceiptItemDashboardAsync();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
t => new PurchaseReceiptCountBySupplierDashboardDto
{
SupplierShortName = t.Key,
Qty = t.Sum(t1 => t1.Qty)
}).OrderBy(t => t.SupplierShortName).ToList();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
t => new PurchaseReceiptCountBySupplierDashboardDto
{
SupplierShortName = t.Key,
Qty = t.Sum(t1 => t1.Qty)
}).OrderBy(t => t.SupplierShortName).ToList();
return dtos;
}
return dtos;
}
[HttpGet("receipt-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetReceiptItemListAsync()
{
return await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
}
/// <summary>
/// 未上架明细
/// </summary>
/// <returns></returns>
[HttpGet("no-put-away-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetReceiptItemListAsync()
{
return await GetPurchaseReceiptItemDashboardAsync();
}
[HttpGet("un-receipt-sum-qty")]
public virtual async Task<PurchaseReceiptSumQtyDashboardDto> GetUnReceiptSumQtyAsync()
{
var dto = new PurchaseReceiptSumQtyDashboardDto();
[HttpGet("un-receipt-sum-qty")]
public virtual async Task<PurchaseReceiptSumQtyDashboardDto> GetUnReceiptSumQtyAsync()
{
var dto = new PurchaseReceiptSumQtyDashboardDto();
var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
var items = await this.GetUnPurchaseReceiptItemDashboardAsync();
dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) };
dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) };
return dto;
}
return dto;
}
[HttpGet("un-receipt-count-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetUnReceiptCountBySupplierQtyAsync()
{
var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
[HttpGet("un-receipt-count-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetUnReceiptCountBySupplierQtyAsync()
{
var items = await GetUnPurchaseReceiptItemDashboardAsync();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
t => new PurchaseReceiptCountBySupplierDashboardDto
{
SupplierShortName = t.Key,
Qty = t.Sum(t1 => t1.Qty)
}).OrderBy(t => t.SupplierShortName).ToList();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
t => new PurchaseReceiptCountBySupplierDashboardDto
{
SupplierShortName = t.Key,
Qty = t.Sum(t1 => t1.Qty)
}).OrderBy(t => t.SupplierShortName).ToList();
return dtos;
}
return dtos;
}
[HttpGet("un-receipt-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetUnReceiptItemListAsync()
{
return await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
}
[HttpGet("un-receipt-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetUnReceiptItemListAsync()
{
return await this.GetUnPurchaseReceiptItemDashboardAsync();
}
private async Task<List<PurchaseReceiptItemDashboardDto>> GetPurchaseReceiptItemDashboardAsync()
{
var balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK).ConfigureAwait(false);
private async Task<List<PurchaseReceiptItemDashboardDto>> GetPurchaseReceiptItemDashboardAsync()
{
var inspectNoteDetailDto = await _inspectNoteAppService.GetInspectNoteDetailByToDayTaskAsync();
var packingCodeList = inspectNoteDetailDto.Where(p => p.Status == EnumInventoryStatus.OK).Select(p => p.PackingCode).ToList();
var balances = await _balanceApp.GetListByPackingCodesAsync(packingCodeList);
balances = balances.Where(p => p.LocationCode == "INSPECT").ToList();
var packingcodes = balances.Select(t => t.PackingCode).Distinct();
//var balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK);
var labels = await GetLabelsAsync(packingcodes).ConfigureAwait(false);
var packingcodes = balances.Select(t => t.PackingCode).Distinct();
var supplierCodes = labels.Select(t => t.SupplierCode).Distinct();
var labels = await GetLabelsAsync(packingcodes);
var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false);
var supplierCodes = labels.Select(t => t.SupplierCode).Distinct();
return ConvertToPurchaseReceiptItemDashboard(balances, labels, suppliers);
}
var suppliers = await GetSuppliersAsync(supplierCodes);
private static List<PurchaseReceiptItemDashboardDto> ConvertToPurchaseReceiptItemDashboard(
List<BalanceDTO> balances,
List<InventoryLabelDto> labels,
List<SupplierDTO> suppliers)
{
var dtos = new List<PurchaseReceiptItemDashboardDto>();
return ConvertToPurchaseReceiptItemDashboard(balances, labels, suppliers);
}
foreach (var balance in balances)
private List<PurchaseReceiptItemDashboardDto> ConvertToPurchaseReceiptItemDashboard(
List<BalanceDTO> balances,
List<InventoryLabelDto> labels,
List<SupplierDTO> suppliers)
{
var supplierShortName = string.Empty;
var dtos = new List<PurchaseReceiptItemDashboardDto>();
var label = labels.FirstOrDefault(t => t.Code == balance.PackingCode);
if (label == null)
foreach (var balance in balances)
{
continue;
}
var supplierShortName = string.Empty;
var supplier = suppliers.FirstOrDefault(t => t != null && t.Code == label.SupplierCode);
var label = labels.FirstOrDefault(t => t.Code == balance.PackingCode);
if (supplier == null)
{
continue;
}
if (label == null)
continue;
supplierShortName = supplier.ShortName;
var supplier = suppliers.FirstOrDefault(t => t != null && t.Code == label.SupplierCode);
var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == balance.ItemCode);
if (supplier == null)
continue;
if (dto == null)
{
dto = new PurchaseReceiptItemDashboardDto();
supplierShortName = supplier.ShortName;
dto.SupplierShortName = supplierShortName;
dto.ItemCode = balance.ItemCode;
dto.ItemDesc1 = balance.ItemDesc1;
dto.Qty = 0;
var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == balance.ItemCode);
dtos.Add(dto);
}
if (dto == null)
{
dto = new PurchaseReceiptItemDashboardDto();
dto.Qty += balance.Qty;
}
dto.SupplierShortName = supplierShortName;
dto.ItemCode = balance.ItemCode;
dto.ItemDesc1 = balance.ItemDesc1;
dto.Qty = 0;
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
dtos.Add(dto);
}
private async Task<List<BalanceDTO>> GetBalancesAsync(string locationCode, EnumInventoryStatus status)
{
return await _balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status).ConfigureAwait(false);
}
private async Task<List<InventoryLabelDto>> GetLabelsAsync(IEnumerable<string> codes)
{
return await _labelService.GetByCodesAsync(codes).ConfigureAwait(false);
}
private async Task<List<SupplierDTO>> GetSuppliersAsync(IEnumerable<string> codes)
{
return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false);
}
dto.Qty += balance.Qty;
}
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()
{
return await _supplierAsnApp.GetForTodayUnReceivedListAsync().ConfigureAwait(false);
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
private static List<PurchaseReceiptItemDashboardDto> ConvertToUnPurchaseReceiptItemDashboard(
List<SupplierAsnDTO> supplierAsns,
List<SupplierDTO> suppliers)
{
var dtos = new List<PurchaseReceiptItemDashboardDto>();
private async Task<List<BalanceDTO>> GetBalancesAsync(string locationCode, EnumInventoryStatus status)
{
return await this._balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status);
}
private async Task<List<InventoryLabelDto>> GetLabelsAsync(IEnumerable<string> codes)
{
return await this._labelService.GetByCodesAsync(codes);
}
private async Task<List<SupplierDTO>> GetSuppliersAsync(IEnumerable<string> codes)
{
return await this._supplierApp.GetByCodesAsync(codes);
}
foreach (var supplierAsn in supplierAsns)
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()
{
var supplierShortName = string.Empty;
return await this._supplierAsnApp.GetForTodayUnReceivedListAsync();
}
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
private List<PurchaseReceiptItemDashboardDto> ConvertToUnPurchaseReceiptItemDashboard(
List<SupplierAsnDTO> supplierAsns,
List<SupplierDTO> suppliers)
{
var dtos = new List<PurchaseReceiptItemDashboardDto>();
if (supplier == null)
foreach (var supplierAsn in supplierAsns)
{
continue;
}
var supplierShortName = string.Empty;
supplierShortName = supplier.ShortName;
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
foreach (var detail in supplierAsn.Details)
{
var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode);
if (supplier == null)
continue;
if (dto == null)
supplierShortName = supplier.ShortName;
foreach (var detail in supplierAsn.Details)
{
dto = new PurchaseReceiptItemDashboardDto();
var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode);
dto.SupplierShortName = supplierShortName;
dto.ItemCode = detail.ItemCode;
dto.ItemDesc1 = detail.ItemDesc1;
dto.Qty = 0;
if (dto == null)
{
dto = new PurchaseReceiptItemDashboardDto();
dtos.Add(dto);
}
dto.SupplierShortName = supplierShortName;
dto.ItemCode = detail.ItemCode;
dto.ItemDesc1 = detail.ItemDesc1;
dto.Qty = 0;
dtos.Add(dto);
}
dto.Qty += detail.Qty;
dto.Qty += detail.Qty;
}
}
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
private async Task<List<PurchaseReceiptItemDashboardDto>> GetUnPurchaseReceiptItemDashboardAsync()
{
var dtos = new List<PurchaseReceiptItemDashboardDto>();
private async Task<List<PurchaseReceiptItemDashboardDto>> GetUnPurchaseReceiptItemDashboardAsync()
{
var dtos = new List<PurchaseReceiptItemDashboardDto>();
var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false);
var supplierAsns = await this.GetSupplierAsnsAsync();
var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct();
var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct();
var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false);
var suppliers = await GetSuppliersAsync(supplierCodes);
return ConvertToUnPurchaseReceiptItemDashboard(supplierAsns, suppliers);
return this.ConvertToUnPurchaseReceiptItemDashboard(supplierAsns, suppliers);
}
}
}

5
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -23,15 +24,17 @@ public class TransferLogAppService
{
private readonly ITransferLogManager _transferLogManager;
private readonly IInterfaceCalendarAclService _interfaceCalendarAclService;
private readonly ILocationAppService _locationAppService;
public TransferLogAppService(
ITransferLogRepository repository
, ITransferLogManager transferLogManager
, IInterfaceCalendarAclService interfaceCalendarAclService
) : base(repository)
, ILocationAppService locationAppService) : base(repository)
{
_transferLogManager = transferLogManager;
_interfaceCalendarAclService = interfaceCalendarAclService;
_locationAppService = locationAppService;
}
[HttpPost("add")]

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs

@ -48,4 +48,10 @@ public interface IPurchaseReceiptJobAppService
/// <param name="noCache"></param>
/// <returns></returns>
Task<PurchaseReceiptJobDTO> GetNoCacheAsync(Guid id);
/// <summary>
/// 根据收货编号获取收货任务
/// </summary>
/// <returns></returns>
Task<List<PurchaseReceiptJobDTO>> GetListBySupplierCodeOnTodayAsync(string supplierCode);
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs

@ -21,4 +21,6 @@ public interface IInspectNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase
/// </summary>
/// <returns></returns>
Task<List<InspectNoteDTO>> CreateSummaryDetailAndDetailByIdAsync(Guid id, InspectNoteEditInput input);
Task<List<InspectNoteDetailDTO>> GetInspectNoteDetailByToDayTaskAsync();
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs

@ -37,4 +37,6 @@ public interface IPurchaseOrderAppService
/// <param name="inputs"></param>
/// <returns></returns>
Task<List<PurchaseOrderDTO>> CreateManyAsync(List<PurchaseOrderEditInput> inputs);
Task<List<PurchaseOrderDTO>> GetListBySupplierCodeAsync(string supplierCode, string itemCode);
}

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs

@ -34,4 +34,6 @@ public interface ISupplierAsnAppService
Task<string> GenerateSupplierAsnNumberAsync(DateTime activeDate);
Task UpdateStatusAsync(string asnNumber, EnumSupplierAsnStatus status);
Task<List<SupplierAsnDTO>> GetForTodayListAsync();
}

15
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs

@ -191,6 +191,21 @@ public class PurchaseReceiptJobAppService :
return ObjectMapper.Map<PurchaseReceiptJob, PurchaseReceiptJobDTO>(entity);
}
/// <summary>
/// 根据供应商编号获取收货任务
/// </summary>
/// <returns></returns>
[HttpPost("get-by-supplier-code-on-today/{supplierCode}")]
public virtual async Task<List<PurchaseReceiptJobDTO>> GetListBySupplierCodeOnTodayAsync(string supplierCode)
{
var purchaseReceiptJobs = await _repository.GetListAsync(p =>
p.SupplierCode == supplierCode &&
p.PlanArriveDate.Year == DateTime.Now.Year &&
p.PlanArriveDate.Month == DateTime.Now.Month &&
p.PlanArriveDate.Day == DateTime.Now.Day);
var dto = ObjectMapper.Map<List<PurchaseReceiptJob>, List<PurchaseReceiptJobDTO>>(purchaseReceiptJobs);
return dto;
}
#endregion
/// <summary>

25
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs

@ -87,4 +87,29 @@ public class InspectNoteAppService : SfsStoreWithDetailsAppServiceBase<
return ObjectMapper.Map<List<InspectNote>, List<InspectNoteDTO>>(inspectNotes);
}
[HttpPost("detail-list/by-to-day")]
public virtual async Task<List<InspectNoteDetailDTO>> GetInspectNoteDetailByToDayTaskAsync()
{
var entitys = await _repository.GetListAsync(
p => p.Details.Any(
y => y.InspectDate.Year == DateTime.Now.Year
&& y.InspectDate.Month == DateTime.Now.Month
&& y.InspectDate.Day == DateTime.Now.Day), true
).ConfigureAwait(false);
List<InspectNoteDetail> list = new List<InspectNoteDetail>();
foreach (var entity in entitys)
{
list.AddRange(entity.Details.Where(y => y.InspectDate.Year == DateTime.Now.Year
&& y.InspectDate.Month == DateTime.Now.Month
&& y.InspectDate.Day == DateTime.Now.Day));
}
var detailDtos = ObjectMapper.Map<List<InspectNoteDetail>, List<InspectNoteDetailDTO>>(list);
return detailDtos;
}
}

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

@ -256,4 +256,22 @@ public class PurchaseOrderAppService :
return dtos;
}
[HttpGet("get-list-by-supplier-code-and-item-code")]
public virtual async Task<List<PurchaseOrderDTO>> GetListBySupplierCodeAsync(string supplierCode, string itemCode)
{
var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode);
List<PurchaseOrder> list = new List<PurchaseOrder>();
foreach (var entity in entitys)
{
var purchaseOrder = await _repository.GetAsync(entity.Id);
list.Add(purchaseOrder);
}
var dtos = ObjectMapper.Map<List<PurchaseOrder>, List<PurchaseOrderDTO>>(list);
return dtos;
}
}

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

@ -96,6 +96,15 @@ public class SupplierAsnAppService :
await _repository.UpdateAsync(supplierAsn).ConfigureAwait(false);
}
[HttpGet("list-for-today")]
public virtual async Task<List<SupplierAsnDTO>> GetForTodayListAsync()
{
var entities = await _repository.GetListAsync(
p => p.PlanArriveDate.Year == DateTime.Now.Year && p.PlanArriveDate.Month == DateTime.Now.Month &&
p.PlanArriveDate.Day == DateTime.Now.Day, true);
return ObjectMapper.Map<List<SupplierAsn>, List<SupplierAsnDTO>>(entities);
}
#endregion

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs

@ -1,3 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Win_in.Sfs.Shared.Domain;
@ -161,4 +162,9 @@ public class InspectNoteDetail : SfsStoreDetailWithLotPackingLocationStatusEntit
[Column(TypeName = "decimal(18,6)")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 质检时间
/// </summary>
[Display(Name = "质检时间")]
public DateTime InspectDate { get; set; }
}

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs

@ -56,37 +56,37 @@ public partial class StoreEventAutoMapperProfile : Profile
;
CreateMap<IssueJobDetail, ExpectOutEditInput>()
.MapExpectInOutFrom()
.MapExpectInOutFrom()
.Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties);
CreateMap<IssueJob, IssueNoteEditInput>()
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.MaterialRequestNumber))
.Ignore(x => x.Confirmed)
.Ignore(x => x.JobNumber)
.Ignore(x => x.RequestNumber)
.Ignore(x => x.ActiveDate)
;
CreateMap<IssueJobDetail, IssueNoteDetailInput>()
.Ignore(x => x.IssueTime)
.Ignore(x => x.FromPackingCode)
.Ignore(x => x.ToPackingCode)
.Ignore(x => x.FromContainerCode)
.Ignore(x => x.ToContainerCode)
.Ignore(x => x.FromLot)
.Ignore(x => x.ToLot)
.Ignore(x => x.SupplierBatch)
.Ignore(x => x.ArriveDate)
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.FromLocationCode)
.Ignore(x => x.FromLocationArea)
.Ignore(x => x.FromLocationGroup)
.Ignore(x => x.FromLocationErpCode)
.Ignore(x => x.FromWarehouseCode)
.Ignore(x => x.FromStatus)
.Ignore(x => x.ToStatus)
.Ignore(x => x.Qty)
.ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty))
.ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d =>d.HandledPackingCode))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot))
.ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode))
.ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status))
.ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status))
;
}
}

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs

@ -187,6 +187,7 @@ public class MaterialRequestEventHandler
job.WarehouseCode = fromLocation.WarehouseCode;
job.ProdLine = fromLocation.LocationGroupCode;
job.Worker = materialRequest.Worker;
job.MaterialRequestNumber = materialRequest.Number;
return job;
}

67
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -20,6 +21,13 @@ public class IssueNoteEventHandler
{
private const EnumTransType TransType = EnumTransType.Issue;
private readonly ILocationAppService _locationAppService;
public IssueNoteEventHandler(ILocationAppService locationAppService)
{
_locationAppService = locationAppService;
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueNote> eventData)
{
@ -68,7 +76,7 @@ public class IssueNoteEventHandler
private async Task AddTransferLogsAsync(List<TransferLogEditInput> inputList)
{
var transferLogs = new List<TransferLogEditInput>();
var transferLogs = new List<TransferLogEditInput>();
transferLogs.AddRange(inputList);
@ -83,42 +91,48 @@ public class IssueNoteEventHandler
{
var transferLog = ObjectMapper.Map<IssueNoteDetail, TransferLogEditInput>(detail);
LocationDTO fromLocationDTO = null;
LocationDTO toLocationDTO = null;
if (issueNote.UseOnTheWayLocation)
{
var location = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
switch (route)
{
case EnumTransferRoute.SourceToOnTheWay:
detail.ToLocationCode = detail.OnTheWayLocationCode;
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode;
detail.ToLocationArea = location.AreaCode;
fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
break;
case EnumTransferRoute.OnTheWayToDestination:
detail.FromLocationCode = detail.OnTheWayLocationCode;
detail.FromLocationErpCode = location.ErpLocationCode;
detail.FromWarehouseCode = location.WarehouseCode;
detail.FromLocationArea = location.AreaCode;
fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false);
break;
case EnumTransferRoute.SourceToDestination:
default:
throw new ArgumentOutOfRangeException(nameof(route), route, null);
}
}
if (issueNote.UseOnTheWayLocation)
else
{
transferLog.FromLocationCode = detail.OnTheWayLocationCode;
var location = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
transferLog.FromLocationGroup = location.LocationGroupCode;
transferLog.FromLocationArea = location.AreaCode;
transferLog.FromLocationErpCode = location.ErpLocationCode;
transferLog.FromWarehouseCode=location.WarehouseCode;
fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
}
transferLog.TransType = TransType;
transferLog.FromLocationCode = fromLocationDTO.Code;
transferLog.FromLocationArea = fromLocationDTO.AreaCode;
transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode;
transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode;
transferLog.ToLocationCode = toLocationDTO.Code;
transferLog.ToLocationArea = toLocationDTO.AreaCode;
transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode;
transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode;
transferLog.TransSubType = Enum.Parse<EnumTransSubType>(issueNote.RequestType);
transferLog.Worker = issueNote.Worker;
transferLog.TransType = TransType;
transferLog.DocNumber = issueNote.Number;
transferLog.JobNumber = issueNote.JobNumber;
@ -128,4 +142,17 @@ public class IssueNoteEventHandler
return transferLogs;
}
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput)
{
transferLogCreateInput.ToPackingCode = "";
transferLogCreateInput.ToLot = "";
transferLogCreateInput.ToContainerCode = "";
transferLogCreateInput.FromPackingCode = "";
transferLogCreateInput.FromLot = "";
transferLogCreateInput.FromContainerCode = "";
}
}

Loading…
Cancel
Save