diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
index d54bb4b54..3c91b8ddf 100644
--- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
+++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
@@ -36,7 +36,10 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
_purchaseReceiptJobApp = purchaseReceiptJobApp;
}
-
+ ///
+ /// 纳入计划与实际
+ ///
+ ///
[HttpGet("plan-actual-list")]
public virtual async Task> GetPlanAndActualListAsync()
{
@@ -76,23 +79,28 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number);
+ var supplierName = string.Empty;
var supplierShortName = string.Empty;
var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode);
if (supplier == null)
+ {
continue;
+ }
+ supplierName = supplier.Name;
supplierShortName = supplier.ShortName;
foreach (var detail in supplierAsn.Details)
{
- var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode);
+ var dto = dtos.FirstOrDefault(t => t.SupplierName == supplierName && t.ItemCode == detail.ItemCode);
if (dto == null)
{
dto = new PlanAndActualDashboardDto();
+ dto.SupplierName = supplier.Name;
dto.SupplierShortName = supplierShortName;
dto.ItemCode = detail.ItemCode;
dto.ItemDesc1 = detail.ItemDesc1;
@@ -112,21 +120,24 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
purchaseOrderDtos = purchaseOrderDtos.Where(p => poNumberList.Contains(p.Number)).ToList();
-
decimal allPutawayQty = 0;
decimal allReceiptQty = 0;
decimal allPlanArriveQty = 0;
+ decimal allArriveQty = 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);
+ allReceiptQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.PutAwayQty);
+ allPlanArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.Qty);
+ allArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ShippedQty);
}
dto.PutawayQty = allPutawayQty;
dto.PlanArriveQty = allPlanArriveQty;
dto.ReceiptQty = allReceiptQty;
+ dto.ArriveQty = allArriveQty;
+ dto.DifferQty = dto.PlanArriveQty - dto.ReceiptQty;
dtos.Add(dto);
}
@@ -139,7 +150,7 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers
}
}
- return dtos.OrderBy(t => t.SupplierShortName).ToList();
+ return dtos.OrderBy(t => t.SupplierName).ToList();
}
private decimal CountReceiptQty(List purchaseReceipts, string itemCode)
diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs
index 9af8b2d40..26fba190d 100644
--- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs
+++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Models/PlanAndActualDashboardDto.cs
@@ -4,6 +4,12 @@ namespace Win_in.Sfs.Wms.Dashboard.Host.Models;
public class PlanAndActualDashboardDto
{
+ ///
+ /// 供应商名称
+ ///
+ [Display(Name = "供应商名称")]
+ public string SupplierName { get; set; }
+
///
/// 供应商简称
///
@@ -17,9 +23,9 @@ public class PlanAndActualDashboardDto
public string ItemCode { get; set; }
///
- /// 零件号
+ /// 物料名称
///
- [Display(Name = "零件号")]
+ [Display(Name = "物料名称")]
public string ItemName { get; set; }
///
@@ -41,17 +47,29 @@ public class PlanAndActualDashboardDto
public decimal SupplierAsnCount { get; set; }
///
- /// 发货物料数量
+ /// 计划发货物料数量
///
[Display(Name = "发货物料数量")]
public decimal PlanArriveQty { get; set; }
+ ///
+ /// 发货物料数量
+ ///
+ [Display(Name = "发货物料数量")]
+ public decimal ArriveQty { get; set; }
+
///
/// 收货物料数量
///
[Display(Name = "收货物料数量")]
public decimal ReceiptQty { get; set; }
+ ///
+ /// 差异数 PlanArriveQty-ReceiptQty
+ ///
+ [Display(Name = "差异数")]
+ public decimal DifferQty { get; set; }
+
///
/// 上架物料数量
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
index 90f9f8fd1..07e300af2 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
@@ -1,14 +1,15 @@
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
-using System.Collections.Generic;
-
[Authorize]
[Route($"{StoreConsts.RootPath}backFlush-note")]
public class BackFlushNoteAppService :
@@ -17,17 +18,22 @@ public class BackFlushNoteAppService :
IBackFlushNoteAppService
{
private readonly IBackFlushNoteManager _backFlushNoteManager;
+ private readonly IItemBasicAppService _itemBasicAppService;
- public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager) :
+ public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager, IItemBasicAppService itemBasicAppService) :
base(repository)
{
_backFlushNoteManager = backFlushNoteManager;
+ _itemBasicAppService = itemBasicAppService;
}
+
[HttpPost("create-many")]
public virtual async Task> CreateManyAsync(List inputs)
{
var entities = ObjectMapper.Map, List>(inputs);
+ entities = await ProcessingBackFlushNoteData(entities).ConfigureAwait(false);
+
entities = await _backFlushNoteManager.CreateManyAsync(entities).ConfigureAwait(false);
var dtos = ObjectMapper.Map, List>(entities);
@@ -43,4 +49,33 @@ public class BackFlushNoteAppService :
return ObjectMapper.Map, List>(entities);
}
+
+ ///
+ /// 处理数据
+ ///
+ ///
+ private async Task> ProcessingBackFlushNoteData(List backFlushNotes)
+ {
+ if (backFlushNotes != null && backFlushNotes.Count > 0)
+ {
+ var itemCodes = backFlushNotes.Select(t => t.ItemCode);
+ List itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
+
+ backFlushNotes.ForEach(t =>
+ {
+ var itemBasicDto = itemBasicDtos.FirstOrDefault(w => w.Code == t.ItemCode);
+ if (itemBasicDto != null)
+ {
+ t.ItemDesc1 = itemBasicDto.Desc1;
+ t.ItemDesc2 = itemBasicDto.Desc2;
+ t.Details.ForEach(tDetail =>
+ {
+ tDetail.ItemDesc1 = itemBasicDto.Desc1;
+ tDetail.ItemDesc2 = itemBasicDto.Desc2;
+ });
+ }
+ });
+ }
+ return backFlushNotes;
+ }
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
index abffc111b..d1d5c3dd4 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
@@ -64,8 +64,15 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
{
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode,
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false);
- var toLocationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
+ var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
+ var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
+
CheckLocation(toLocationDto, detail);
+ CheckFromLocation(fromLocationDto, detail);
+ if (toLocationDto.Type != fromLocationDto.Type)
+ {
+ throw new UserFriendlyException($"来源库位与目标库位类型不一致");
+ }
detail.OnTheWayLocationCode = bool.FalseString;
detail.ItemCode=balanceDto.ItemCode;
@@ -91,7 +98,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
detail.FromLot = balanceDto.Lot;
detail.ToLocationArea = toLocationDto.AreaCode;
- detail.ToLocationErpCode = toLocationDto.LocationGroupCode;
+ detail.ToLocationErpCode = toLocationDto.ErpLocationCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode = toLocationDto.WarehouseCode;
detail.ToContainerCode = balanceDto.ContainerCode;
@@ -126,6 +133,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在");
}
}
+ private void CheckFromLocation(LocationDTO locationDto, TransferNoteDetail detail)
+ {
+ if (locationDto == null)
+ {
+ throw new UserFriendlyException($"库位代码为【{detail.FromLocationCode}】不存在");
+ }
+ }
#endregion
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
index 11e682df0..6053d58d7 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
@@ -91,7 +91,7 @@ public class PurchaseOrderAppService :
detail.ItemName = itemBasicDto.Name;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
- detail.StdPackQty=itemBasicDto.StdPackQty;
+ detail.StdPackQty = itemBasicDto.StdPackQty;
}
}
@@ -297,7 +297,7 @@ public class PurchaseOrderAppService :
public virtual async Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode)
{
var entitys = await _repository
- .GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode)
+ .GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode, true)
.ConfigureAwait(false);
var dtos = ObjectMapper.Map, List>(entitys);
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
index 950a6768b..6e8c9edc4 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
@@ -110,7 +110,15 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false);
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode)
.ConfigureAwait(false);
+ var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode)
+ .ConfigureAwait(false);
+
CheckLocation(toLocationDto, detail.ToLocationCode);
+ CheckLocation(fromLocationDto, detail.FromLocationCode);
+ if (toLocationDto.Type != fromLocationDto.Type)
+ {
+ throw new UserFriendlyException($"来源库位与目标库位类型不一致");
+ }
detail.ItemCode = balanceDto.ItemCode;
detail.ArriveDate = balanceDto.ArriveDate;
@@ -135,7 +143,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
detail.FromLot = balanceDto.Lot;
detail.ToLocationArea = toLocationDto.AreaCode;
- detail.ToLocationErpCode = toLocationDto.LocationGroupCode;
+ detail.ToLocationErpCode = toLocationDto.ErpLocationCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode = toLocationDto.WarehouseCode;
detail.ToContainerCode = balanceDto.ContainerCode;