唐明亮 2 years ago
parent
commit
790fbd5a8a
  1. 32
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs
  2. 39
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs
  3. 98
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
  4. 102
      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. 40
      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. 65
      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");
}
}

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

@ -2,22 +2,25 @@ 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;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
using System.Linq;
using NUglify.Helpers;
using NUglify.Helpers;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Store.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 static IdentityServer4.Models.IdentityResources;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}material-request")]
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}material-request")]
public class MaterialRequestController : AbpController
{
public class MaterialRequestController : AbpController
{
private readonly IMaterialRequestAppService _materialRequestApp;
private readonly IIssueNoteAppService _issueNoteApp;
@ -32,7 +35,7 @@ public class MaterialRequestController : AbpController
{
var dto = new MaterialRequestUnHandledOrderSumDto();
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
var list = await GetMaterialRequestAsync();
dto.Sum = list.Where(t => t.RequestStatus == EnumRequestStatus.New).Count();
@ -44,7 +47,7 @@ public class MaterialRequestController : AbpController
{
var dto = new MaterialRequestUnIssuedItemQtySumDto();
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
var list = await GetMaterialRequestAsync();
dto.Sum = list.Where(t => t.RequestStatus != EnumRequestStatus.New)
.Sum(t => t.Details.Sum(t1 => t1.Qty - t1.IssuedQty));
@ -58,7 +61,7 @@ public class MaterialRequestController : AbpController
{
var dtos = new List<MaterialRequestUnReceivedItemQtyByItemDto>();
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
var list = await GetMaterialRequestAsync();
var details = new List<MaterialRequestDetailDTO>();
@ -96,7 +99,7 @@ public class MaterialRequestController : AbpController
var Received = 0.0M;
var list = await GetMaterialRequestAsync().ConfigureAwait(false);
var list = await GetMaterialRequestAsync();
list.ForEach(
item =>
@ -106,6 +109,7 @@ public class MaterialRequestController : AbpController
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 });
@ -118,7 +122,7 @@ public class MaterialRequestController : AbpController
{
var dtos = new List<MaterialRequestUnReceivedItemDto>();
var notes = await GetIssueNotesAsync().ConfigureAwait(false);
var notes = await this.GetIssueNotesAsync();
foreach (var note in notes)
{
@ -142,11 +146,12 @@ public class MaterialRequestController : AbpController
private async Task<List<IssueNoteDTO>> GetIssueNotesAsync()
{
return await _issueNoteApp.GetListUnConfirmedByTypeAsync(EnumTransSubType.Issue_WIP.ToString()).ConfigureAwait(false);
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);
return await this._materialRequestApp.GetListByTypeAsync(EnumTransSubType.Issue_WIP.ToString());
}
}
}

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

@ -1,59 +1,65 @@
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;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")]
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")]
public class PlanAndActualController : AbpController
{
public class PlanAndActualController : AbpController
{
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)
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;
}
[HttpGet("plan-actual-list")]
public virtual async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualListAsync()
{
return await GetPlanAndActualDashboardsAsync().ConfigureAwait(false);
return await GetPlanAndActualDashboardsAsync();
}
private async Task<List<PlanAndActualDashboardDto>> GetPlanAndActualDashboardsAsync()
{
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);
var putawayNotes = await GetPutawayNotesAsync(asnNumbers).ConfigureAwait(false);
var putawayNotes = await this.GetPutawayNotesAsync(asnNumbers);
var itemSafetyStorks = await GetItemSafetyStocksAsync(supplierAsns).ConfigureAwait(false);
var itemSafetyStorks = await this.GetItemSafetyStocksAsync(supplierAsns);
return ConvertToPlanAndActualDashboards(
return await this.ConvertToPlanAndActualDashboards(
supplierAsns,
suppliers,
purchaseReceiptNotes,
@ -61,7 +67,7 @@ public class PlanAndActualController : AbpController
itemSafetyStorks);
}
private static List<PlanAndActualDashboardDto> ConvertToPlanAndActualDashboards(List<SupplierAsnDTO> supplierAsns, List<SupplierDTO> suppliers, List<PurchaseReceiptNoteDTO> purchaseReceiptNotes, List<PutawayNoteDTO> putawayNotes, List<ItemSafetyStockDTO> itemSafetyStorks)
private async Task<List<PlanAndActualDashboardDto>> ConvertToPlanAndActualDashboards(List<SupplierAsnDTO> supplierAsns, List<SupplierDTO> suppliers, List<PurchaseReceiptNoteDTO> purchaseReceiptNotes, List<PutawayNoteDTO> putawayNotes, List<ItemSafetyStockDTO> itemSafetyStorks)
{
var dtos = new List<PlanAndActualDashboardDto>();
@ -75,9 +81,7 @@ public class PlanAndActualController : AbpController
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
if (supplier == null)
{
continue;
}
supplierShortName = supplier.ShortName;
@ -102,35 +106,50 @@ public class PlanAndActualController : AbpController
dto.MinQty = itemSafetyStork.MinStock;
}
dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode, detail.Lot);
var purchaseOrderDtos = await _purchaseOrderApp.GetListBySupplierCodeAsync(supplierAsn.SupplierCode, detail.ItemCode);
var supllierAsn = await _supplierAsnApp.GetForTodayListAsync();
var poNumberList = supllierAsn.Select(p => p.PoNumber).ToList();
purchaseOrderDtos = purchaseOrderDtos.Where(p => poNumberList.Contains(p.Number)).ToList();
decimal allPutawayQty = 0;
decimal allReceiptQty = 0;
decimal allPlanArriveQty = 0;
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);
}
dto.PutawayQty = allPutawayQty;
dto.PlanArriveQty = allPlanArriveQty;
dto.ReceiptQty = allReceiptQty;
dtos.Add(dto);
}
dto.SupplierAsnCount += 1;
var purchaseReceiptJobDtos = await _purchaseReceiptJobApp.GetListBySupplierCodeOnTodayAsync(supplierAsn.SupplierCode);
dto.ReceiptNoteCount = purchaseReceiptJobDtos.Count(p => p.JobStatus == EnumJobStatus.Done);
dto.PlanArriveQty += detail.Qty;
dto.SupplierAsnCount = purchaseReceiptJobDtos.Count();
}
}
return dtos.OrderBy(t => t.SupplierShortName).ToList();
}
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));
}
private static decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
private decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode)
{
return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.HandledLot == lot).Sum(t => t.Qty));
return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty));
}
private static int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
private int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode)
{
return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode && t.Lot == lot));
return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode));
}
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()
@ -145,22 +164,22 @@ public class PlanAndActualController : 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);
}
private async Task<List<PutawayNoteDTO>> GetPutawayNotesAsync(IEnumerable<string> asnNumbers)
{
return await _putawayNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false);
return await this._putawayNoteApp.GetListByAsnNumbers(asnNumbers);
}
private async Task<List<ItemSafetyStockDTO>> GetItemSafetyStocksAsync(List<SupplierAsnDTO> supplierAsns)
{
@ -168,7 +187,8 @@ public class PlanAndActualController : AbpController
supplierAsns.ForEach(t => { itemCodes.AddRange(t.Details.Select(t => t.ItemCode).ToList()); });
var itemSafetyStorks = await _itemSafetyStockApp.GetByItemCodesAsync(itemCodes).ConfigureAwait(false);
var itemSafetyStorks = await this._itemSafetyStockApp.GetByItemCodesAsync(itemCodes);
return itemSafetyStorks;
}
}
}

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

@ -5,49 +5,65 @@ 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;
namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
{
using System;
using System.Linq;
using System.Linq;
using Volo.Abp;
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 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;
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")]
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")]
public class PurchaseReceiptController : AbpController
{
public class PurchaseReceiptController : AbpController
{
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)
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()
/// <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) };
return dto;
}
[HttpGet("receipt-count-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetReceiptCountBySupplierQtyAsync()
/// <summary>
/// 未上架汇总
/// </summary>
/// <returns></returns>
[HttpGet("no-put-away-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetNoPutAwayBySupplierAsync()
{
var items = await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
var items = await GetPurchaseReceiptItemDashboardAsync();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
@ -60,10 +76,14 @@ public class PurchaseReceiptController : AbpController
return dtos;
}
[HttpGet("receipt-item-list")]
/// <summary>
/// 未上架明细
/// </summary>
/// <returns></returns>
[HttpGet("no-put-away-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetReceiptItemListAsync()
{
return await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
return await GetPurchaseReceiptItemDashboardAsync();
}
[HttpGet("un-receipt-sum-qty")]
@ -71,7 +91,7 @@ public class PurchaseReceiptController : AbpController
{
var dto = new PurchaseReceiptSumQtyDashboardDto();
var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
var items = await this.GetUnPurchaseReceiptItemDashboardAsync();
dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) };
@ -81,7 +101,7 @@ public class PurchaseReceiptController : AbpController
[HttpGet("un-receipt-count-by-supplier")]
public virtual async Task<List<PurchaseReceiptCountBySupplierDashboardDto>> GetUnReceiptCountBySupplierQtyAsync()
{
var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
var items = await GetUnPurchaseReceiptItemDashboardAsync();
var dtos = items.GroupBy(t => t.SupplierShortName)
.Select(
@ -97,25 +117,30 @@ public class PurchaseReceiptController : AbpController
[HttpGet("un-receipt-item-list")]
public virtual async Task<List<PurchaseReceiptItemDashboardDto>> GetUnReceiptItemListAsync()
{
return await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false);
return await this.GetUnPurchaseReceiptItemDashboardAsync();
}
private async Task<List<PurchaseReceiptItemDashboardDto>> GetPurchaseReceiptItemDashboardAsync()
{
var balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK).ConfigureAwait(false);
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 balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK);
var packingcodes = balances.Select(t => t.PackingCode).Distinct();
var labels = await GetLabelsAsync(packingcodes).ConfigureAwait(false);
var labels = await GetLabelsAsync(packingcodes);
var supplierCodes = labels.Select(t => t.SupplierCode).Distinct();
var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false);
var suppliers = await GetSuppliersAsync(supplierCodes);
return ConvertToPurchaseReceiptItemDashboard(balances, labels, suppliers);
}
private static List<PurchaseReceiptItemDashboardDto> ConvertToPurchaseReceiptItemDashboard(
private List<PurchaseReceiptItemDashboardDto> ConvertToPurchaseReceiptItemDashboard(
List<BalanceDTO> balances,
List<InventoryLabelDto> labels,
List<SupplierDTO> suppliers)
@ -129,16 +154,12 @@ public class PurchaseReceiptController : AbpController
var label = labels.FirstOrDefault(t => t.Code == balance.PackingCode);
if (label == null)
{
continue;
}
var supplier = suppliers.FirstOrDefault(t => t != null && t.Code == label.SupplierCode);
if (supplier == null)
{
continue;
}
supplierShortName = supplier.ShortName;
@ -164,23 +185,23 @@ public class PurchaseReceiptController : AbpController
private async Task<List<BalanceDTO>> GetBalancesAsync(string locationCode, EnumInventoryStatus status)
{
return await _balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status).ConfigureAwait(false);
return await this._balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status);
}
private async Task<List<InventoryLabelDto>> GetLabelsAsync(IEnumerable<string> codes)
{
return await _labelService.GetByCodesAsync(codes).ConfigureAwait(false);
return await this._labelService.GetByCodesAsync(codes);
}
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<SupplierAsnDTO>> GetSupplierAsnsAsync()
{
return await _supplierAsnApp.GetForTodayUnReceivedListAsync().ConfigureAwait(false);
return await this._supplierAsnApp.GetForTodayUnReceivedListAsync();
}
private static List<PurchaseReceiptItemDashboardDto> ConvertToUnPurchaseReceiptItemDashboard(
private List<PurchaseReceiptItemDashboardDto> ConvertToUnPurchaseReceiptItemDashboard(
List<SupplierAsnDTO> supplierAsns,
List<SupplierDTO> suppliers)
{
@ -193,9 +214,7 @@ public class PurchaseReceiptController : AbpController
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
if (supplier == null)
{
continue;
}
supplierShortName = supplier.ShortName;
@ -226,12 +245,15 @@ public class PurchaseReceiptController : AbpController
{
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 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; }
}

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

@ -62,31 +62,31 @@ public partial class StoreEventAutoMapperProfile : Profile
.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;
}

65
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)
{
@ -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