Browse Source

解决冲突

集成Redis
郑勃旭 2 years ago
parent
commit
de8c2a9d11
  1. 139
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs
  2. 4
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs
  3. 1
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj
  4. 1
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs
  5. 32
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs
  6. 199
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs
  7. 262
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
  8. 352
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs
  9. 1
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  10. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs
  11. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs
  12. 45
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs
  13. 30
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs
  14. 26
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs
  15. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs
  16. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs
  17. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs
  18. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs
  19. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs
  20. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs
  21. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs
  22. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs
  23. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
  24. 25
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs
  25. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs
  26. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs
  27. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs
  28. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs
  29. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs
  30. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs
  31. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs
  32. 6
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs
  33. 7
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs
  34. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs
  35. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

139
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Auth.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing;
public class ItemTransformNoteConverter : IOutgoingConverter
{
private readonly IOutgoingFromWmsManager _outgoingFromWmsManager;
private readonly IOutgoingToExternalManager _outgoingToExternalManager;
private readonly ISupplierAsnAppService _supplierAsnAppService;
private readonly IDepartmentAppService _departmentAppService;
private readonly IObjectMapper _objectMapper;
public ItemTransformNoteConverter(
IOutgoingFromWmsManager outgoingFromWmsManager
, IOutgoingToExternalManager outgoingToExternalManager
, ISupplierAsnAppService supplierAsnAppService
, IDepartmentAppService departmentAppService
, IObjectMapper objectMapper
)
{
_outgoingFromWmsManager = outgoingFromWmsManager;
_outgoingToExternalManager = outgoingToExternalManager;
_supplierAsnAppService = supplierAsnAppService;
_departmentAppService = departmentAppService;
_objectMapper = objectMapper;
}
public virtual async Task<List<OutgoingToExternal>> ConvertAsync()
{
var outgoingToExternalList = new List<OutgoingToExternal>();
var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Item_Transform, EnumSystemType.ERP).ConfigureAwait(false);
foreach (var outgoingFromWms in outgoingFromWmsList)
{
var wmsCountAdjust = JsonSerializer.Deserialize<ItemTransformNoteDTO>(outgoingFromWms.DataContent);
if (Enum.Parse<EnumTransSubType>(wmsCountAdjust.Type) == EnumTransSubType.Item_Transform)
{
var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false);
var departmentCode = department == null ? "" : department.Code;
var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.ToItemCode, r.LocationErpCode, r.ToLocationCode }).Select(p => new ItemTransformNoteDetailExchangeDto { ToQty = p.Sum(itm => itm.ToQty), FromQty = p.Sum(itm => itm.FromQty), ItemCode = p.Key.ItemCode, ToItemCode = p.Key.ToItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) });
foreach (var detail in details)
{
List<ItemTransformNoteDetailExchangeDto> ItemTransform = new List<ItemTransformNoteDetailExchangeDto>();
ItemTransformNoteDetailExchangeDto ItemTrans = new ItemTransformNoteDetailExchangeDto();
ItemTrans.ItemCode = detail.ItemCode;
ItemTrans.LocationErpCode = detail.LocationErpCode;
ItemTrans.FromQty = detail.FromQty - detail.FromQty - detail.FromQty;
ItemTrans.ReasonCode = detail.ReasonCode;
ItemTransform.Add(ItemTrans);
ItemTransformNoteDetailExchangeDto ItemTranss = new ItemTransformNoteDetailExchangeDto();
ItemTranss.ItemCode = detail.ToItemCode;
ItemTranss.LocationErpCode = detail.LocationErpCode;
ItemTranss.FromQty = detail.ToQty;
ItemTranss.ReasonCode = detail.ReasonCode;
ItemTransform.Add(ItemTranss);
foreach (var Item in ItemTransform)
{
var outgoingToExternal = new OutgoingToExternal()
{
DataType = outgoingFromWms.DataType,
DataAction = outgoingFromWms.DataAction,
SourceSystem = EnumSystemType.WMS.ToString(),
SourceDataId = wmsCountAdjust.Number,
SourceDataGroupCode = wmsCountAdjust.Number,
SourceDataDetailCode = Item.ItemCode,
Writer = nameof(TyrpOutgoingBackgroundWorker),
DestinationSystem = EnumSystemType.ERP.ToString(),
DestinationDataId = "",
};
outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate);
var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, Item).ConfigureAwait(false);
outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue);
var arrive = BuildIssue(exchangeIssue, departmentCode);
outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive);
outgoingToExternalList.Add(outgoingToExternal);
}
}
}
}
await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); ;
//将outgoingFromWms数据归档
await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); ;
return outgoingToExternalList;
//插入到中间表OutgoingToExternal
}
private CountAdjust BuildIssue(ItemTransformNoteExchangeDto exchangeCountAdjust, string departmentCode)
{
var detail = exchangeCountAdjust.Detail;
string asdtype = "";
if (Enum.Parse<EnumTransSubType>(exchangeCountAdjust.Type) == EnumTransSubType.Item_Transform)
{
asdtype = "4003";
}
var counta = new CountAdjust()
{
mesout_asd_refc = departmentCode,
mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"),
mesout_asd_type = asdtype,
mesout_asd_part = detail.ItemCode,
mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"),
mesout_asd_loc = detail.LocationErpCode,
mesout_asd_code = detail.ReasonCode,
mesout_asd_qty = detail.FromQty,
mesout_asd_user = exchangeCountAdjust.Worker,
mesout_asd_k = string.Empty,
mesout_asd_stat = "Y"
};
return counta;
}
private async Task<ItemTransformNoteExchangeDto> BuildPurchaseReceiptExchangeDtoAsync(
ItemTransformNoteDTO wmsCountAdjust, ItemTransformNoteDetailExchangeDto wmsCountAdjustDetail)
{
var exchangeCountAdjust = _objectMapper.Map<ItemTransformNoteDTO, ItemTransformNoteExchangeDto>(wmsCountAdjust);
exchangeCountAdjust.Detail = wmsCountAdjustDetail;
return exchangeCountAdjust;
}
}

4
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs

@ -120,6 +120,10 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false);
await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false);
Logger.LogInformation($"Write ItemTransformNote");//回收料调整单
var ItemTransformNoteConvert = workerContext.ServiceProvider.GetRequiredService<ItemTransformNoteConverter>();
var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false);
await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Outgoing}");
}

1
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj

@ -31,6 +31,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\Hosts\Auth.Host\src\Win_in.Sfs.Auth.Application.Contracts\Win_in.Sfs.Auth.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\Modules\BaseData\src\Win_in.Sfs.Basedata.Application\Win_in.Sfs.Basedata.Application.csproj" />
<ProjectReference Include="..\..\..\Modules\Label\src\Win_in.Sfs.Label.Application.Contracts\Win_in.Sfs.Label.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\Modules\Shared\src\Win_in.Sfs.Shared.Host\Win_in.Sfs.Shared.Host.csproj" />
<ProjectReference Include="..\..\..\Modules\Store\src\Win_in.Sfs.Wms.Store.Application.Contracts\Win_in.Sfs.Wms.Store.Application.Contracts.csproj" />

1
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs

@ -30,6 +30,7 @@ public enum EnumOutgoingDataType
RecycledMaterialReceipt = 22,
ScrapNote = 23,
ProductRecycle = 24,
Item_Transform = 25
}
public enum EnumExchangeTableType
{

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);
}
}
}

1
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql

@ -3069,6 +3069,7 @@ CREATE TABLE [Store_InspectNoteDetail] (
[Weight] nvarchar(max) NULL,
[OtherPropertyJson] nvarchar(max) NULL,
[StdPackQty] decimal(18,6) NOT NULL,
[InspectDate] datetime2 NOT NULL,
[CreationTime] datetime2 NOT NULL,
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs

@ -54,7 +54,7 @@ public class L7Controller : AbpController
[HttpPost("create-product-recycle-note-with-l7")]
public virtual async Task<ProductRecycleNoteDTO> CreateProductRecycleNoteWithL7Async(ProductRecycleNoteEditInput input)
{
return await _productRecycleNoteAppService.CreateWithL7Async(input).ConfigureAwait(false);
return await _productRecycleNoteAppService.CreateAsync(input).ConfigureAwait(false);
}
/// <summary>

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs

@ -19,6 +19,7 @@ public class UomImportInput : SfsBaseDataImportInputBase
/// 名称
/// </summary>
[Display(Name = "名称")]
[Required(ErrorMessage = "{0}是必填项")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Name { get; set; }

45
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
public class ItemTransformNoteDetailExchangeDto
{
/// <summary>
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
public string ItemCode { get; set; }
/// <summary>
/// ERP库位
/// </summary>
[Display(Name = "ERP库位")]
public string LocationErpCode { get; set; }
/// <summary>
/// 原因代码
/// </summary>
[Display(Name = "原因代码")]
public string ReasonCode { get; set; }
/// <summary>
/// 调整数量
/// </summary>
[Display(Name = "来源数量")]
public decimal FromQty { get; set; }
/// <summary>
/// 目标数量
/// </summary>
[Display(Name = "目标数量")]
public decimal ToQty { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string ToLocationCode { get; set; }
/// <summary>
/// 目标物品代码
/// </summary>
[Display(Name = "目标物品代码")]
public string ToItemCode { get; set; }
}

30
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs

@ -0,0 +1,30 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote;
public class ItemTransformNoteExchangeDto
{
/// <summary>
/// 单据号
/// </summary>
public string Number { get; set; }
/// <summary>
/// 生效日期
/// </summary>
public DateTime ActiveDate { get; set; } = DateTime.Now.Date;
/// <summary>
/// 操作员
/// </summary>
public string Worker { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 明细
/// </summary>
[Display(Name = "明细")]
public ItemTransformNoteDetailExchangeDto Detail { get; set; } = new();
}

26
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs

@ -1,4 +1,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -9,4 +14,25 @@ public interface IDeliverNoteAppService :
Task<DeliverNoteDTO> CreateWithL7Async(DeliverNoteEditInput input);
Task<PagedResultDto<DeliverNoteDTO>> GetForFisListAsync(
SfsStoreRequestInputBase sfsRequestDTO,
bool includeDetails = false,
CancellationToken cancellationToken = default);
Task<PagedResultDto<DeliverNoteDTO>> GetForNormalListAsync(
SfsStoreRequestInputBase sfsRequestDTO,
bool includeDetails = false,
CancellationToken cancellationToken = default);
Task<PagedResultDto<DeliverNoteDTO>> GetForRAWListAsync(
SfsStoreRequestInputBase sfsRequestDTO,
bool includeDetails = false,
CancellationToken cancellationToken = default);
Task<IActionResult> ExportForNormalAsync(SfsStoreRequestInputBase requestInput);
Task<IActionResult> ExportForRAWAsync(SfsExportRequestInput requestInput);
Task SumPrintAsync(string number);
}

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();
}

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs

@ -19,5 +19,8 @@ public class ItemTransformNoteDTO : SfsStoreDTOBase<ItemTransformNoteDetailDTO>,
[Display(Name = "任务单号")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string JobNumber { get; set; }
/// <summary>
/// 调整类型
/// </summary>
public string Type { get; set; }
}

6
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs

@ -214,7 +214,11 @@ public class ItemTransformNoteDetailDTO : SfsStoreDetailDTOBase
/// </summary>
[Display(Name = "目标ERP储位")]
public string ToLocationErpCode { get; set; }
/// <summary>
/// ERP库位
/// </summary>
[Display(Name = "ERP库位")]
public string LocationErpCode { get; set; }
/// <summary>
/// 目标仓库
/// </summary>

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs

@ -7,5 +7,4 @@ public interface IProductRecycleNoteAppService :
{
Task<ProductRecycleNoteDTO> CreateAsync(ProductRecycleNoteEditInput input);
Task<ProductRecycleNoteDTO> CreateWithL7Async(ProductRecycleNoteEditInput input);
}

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();
}

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -70,7 +71,7 @@ public class ProductReceiptRequestEditInput : SfsStoreRequestCreateOrUpdateInput
/// 类型
/// </summary>
[Display(Name = "类型")]
public string EnumProductReceiptType { get; set; }
public EnumProductReceiptType Type { get; set; }
/// <summary>
/// 明细列表

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs

@ -157,7 +157,8 @@ public abstract class SfsStoreRequestAppServiceBase<TEntity, TEntityDto, TReques
public virtual async Task<TEntityDto> CompleteByNumberAsync(string number)
{
var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
Check.NotNull(entity, typeof(TEntity).Name);
if (entity == null) return null;
// Check.NotNull(entity, typeof(TEntity).Name);
var result = await _requestManager.CompleteAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<TEntity, TEntityDto>(result);
return dto;

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

@ -168,6 +168,19 @@ public class PurchaseReceiptJobAppService :
entity.Details.Find(p => p.Id == input.DetailId));
}
/// <summary>
/// 按Id获取实体 不走缓存
/// </summary>
/// <param name="id">实体Id</param>
/// <param name="noCache"></param>
/// <returns></returns>
[HttpGet("no-cache/{id}")]
public virtual async Task<PurchaseReceiptJobDTO> GetNoCacheAsync(Guid id)
{
var entity= await _repository.GetAsync(id).ConfigureAwait(false);
return ObjectMapper.Map<PurchaseReceiptJob, PurchaseReceiptJobDTO>(entity);
}
#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;
}
}

17
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs

@ -54,23 +54,6 @@ public class ProductRecycleNoteAppService :
return dto;
}
/// <summary>
/// 新增退货接口
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-with-l7")]
public virtual async Task<ProductRecycleNoteDTO> CreateWithL7Async(ProductRecycleNoteEditInput input)
{
var entity = ObjectMapper.Map<ProductRecycleNoteEditInput, ProductRecycleNote>(input);
await _productRecycleNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<ProductRecycleNote, ProductRecycleNoteDTO>(entity);
return dto;
}
[HttpGet("note-and-back-flush/{id}")]
public virtual async Task<ProductRecycleNoteDTO> GetNoteAndBackFlushAsync(Guid id)
{

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs

@ -28,7 +28,7 @@ public class ProductionReturnNoteAppService :
}
/// <summary>
/// 新增接口
/// 新增实体
/// </summary>
/// <param name="input"></param>
/// <returns></returns>

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

@ -243,8 +243,24 @@ public class PurchaseOrderAppService :
// await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
//}
//protected override Func<PurchaseOrderImportInput, object> GetEntityExpression()
//{
// return t => t.Number;
//}
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

24
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs

@ -35,14 +35,14 @@ public class DeliverRequestFisAppService :
public DeliverRequestFisAppService(
IDeliverRequestRepository repository,
IDeliverRequestManager DeliverRequestManager,
IDeliverRequestManager deliverRequestManager,
IAreaAppService areaApp,
ICustomerAppService customerApp,
ICustomerAddressAppService customerAddressApp
)
: base(repository, DeliverRequestManager)
: base(repository, deliverRequestManager)
{
_deliverRequestManager = DeliverRequestManager;
_deliverRequestManager = deliverRequestManager;
_areaApp = areaApp;
_customerApp = customerApp;
_customerAddressApp = customerAddressApp;
@ -60,6 +60,24 @@ public class DeliverRequestFisAppService :
return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken);
}
/// <summary>
/// 【创建】发货申请
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
//[Authorize(DeliverRequestPermissions.Create)]
public override async Task<DeliverRequestDTO> CreateAsync(DeliverRequestEditInput input)
{
var entity = ObjectMapper.Map<DeliverRequestEditInput, DeliverRequest>(input);
await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<DeliverRequest, DeliverRequestDTO>(entity);
return dto;
}
#region import
protected virtual async Task CheckImportInputBusinessAsync(

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs

@ -6,12 +6,14 @@ using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Office.CustomUI;
using FluentValidation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Validation;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
@ -176,7 +178,12 @@ public class ProductReceiptRequestAppService :
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
Expression<Func<ProductReceiptRequest, bool>> expression = p => p.Type.ToString() == type;
if (!EnumProductReceiptType.TryParse(type, true, out EnumProductReceiptType enumType))
{
throw new AbpValidationException($"type {type} is not valid");
}
Expression<Func<ProductReceiptRequest, bool>> expression = p => p.Type == enumType;
if (requestInput.Condition.Filters?.Count > 0)
{
expression = expression.And(requestInput.Condition.Filters.ToLambda<ProductReceiptRequest>());

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs

@ -20,7 +20,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<ProductionReturnRequestDetailInput, ProductionReturnRequestDetail>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId)
.Ignore(x => x.Number)

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; }
}

7
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs

@ -52,9 +52,6 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<ProductionReturnJobDetail, ExpectOutEditInput>()
.MapExpectInOutTo()
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.ExtraProperties)
@ -63,10 +60,10 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<ProductionReturnJobDetail, ExpectInEditInput>()
.MapExpectInOutTo()
.ForMember(x => x.LocationCode, y => y.MapFrom(d => d.FromLocationCode))
.ForMember(x => x.LocationArea, y => y.MapFrom(d => d.FromLocationArea))
.ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.FromLocationGroup))
.ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode))
.ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode))
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.SerialNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.ExtraProperties);

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs

@ -9,7 +9,7 @@ using Win_in.Sfs.Wms.Store.Event.Inventories;
namespace Win_in.Sfs.Wms.Store.Event.ExpectInOuts;
public class ProductionReturnStoreEventHandler :
public class ProductionReturnJobEventHandler :
StoreExpectInOutEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<ProductionReturnJob>>
, ILocalEventHandler<SfsCompletedEntityEventData<ProductionReturnJob>>

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs

@ -7,7 +7,6 @@ using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared;
using Win_in.Sfs.Wms.Store.Event.Transaction;

Loading…
Cancel
Save