diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/PurchaseReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/PurchaseReceiptNoteController.cs index cf0ecabc6..686f72267 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/PurchaseReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/PurchaseReceiptNoteController.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; @@ -47,4 +49,21 @@ public class PurchaseReceiptNoteController : AbpController { return await _purchaseReceiptNoteAppService.GetDetailByItemAndPackingAsync(itemCode, packingCode).ConfigureAwait(false); } + + /// + /// 获取收货记录下所有箱码 + /// + /// + [HttpPost("get-packing-by-purchase-recepit-note")] + public virtual async Task> GetPackingCodeByPurchaseRecepitNote(string poNumber) + { + var dtos = await _purchaseReceiptNoteAppService.GetListByPoNumberAsync(poNumber).ConfigureAwait(false); + var packingCodes=new List(); + foreach (var dto in dtos) + { + packingCodes.AddRange(dto.Details.Select(p=>p.PackingCode)); + } + + return packingCodes.Distinct().ToList(); + } } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/SupplierAsnController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/SupplierAsnController.cs index f102b70ee..08e2711c0 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/SupplierAsnController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/SupplierAsnController.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json index 10fb7993c..386a6d7ee 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json @@ -2,9 +2,9 @@ //"RemoteServices": { // "Default": { "BaseUrl": "http://dev.ccwin-in.com:21293/" }, // "BaseData": { "BaseUrl": "http://dev.ccwin-in.com:21294/" }, - // "Store": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, - // "Job": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, - // "Inventory": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, + "Store": { "BaseUrl": "http://localhost:59095/" }, + "Job": { "BaseUrl": "http://localhost:59095/" }, + "Inventory": { "BaseUrl": "http://localhost:59095/" } // "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, // "Message": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, // "Label": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs index cf79d0628..a9c62ad15 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs @@ -157,4 +157,11 @@ public interface IBalanceAppService /// Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto); + /// + /// 获取【库存】根据 库位代码 和 物品代码 + /// + /// + /// + /// + Task> GetListByErpLocationCodeAndItemCodeAsync(string erplocationCode, string itemCode); } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs index 6a96bbdd2..4668b56a8 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs @@ -426,6 +426,20 @@ public class BalanceAppService return dtos; } + /// + /// 获取【库存】根据 库位代码 和 物品代码 + /// + /// + /// + /// + [HttpGet("list/by-erplocation-and-item")] + public virtual async Task> GetListByErpLocationCodeAndItemCodeAsync(string erplocationCode, string itemCode) + { + var entitys = await _repository.GetListAsync(p => p.LocationErpCode == erplocationCode && p.ItemCode == itemCode).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entitys); + return dtos; + } + /// /// 根据发料任务需求,算出推荐的库存 (在获取时 已经添加预占用) /// diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs index e54d7b221..b87c87bc3 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs @@ -133,22 +133,31 @@ public class TransactionAppService public virtual async Task> GetItemSerialList(List itemCodes,string erpLocationCode,DateTime startDateTime,DateTime endDateTime) { var itemSerialDtos = new List(); + var allItemBasicDtos = new List(); + var allTransactions = new List(); + var locationDtos = await _locationAppService.GetAllAsync().ConfigureAwait(false); + var balanceDtos = await _balanceAppService + .GetAllListByFilterAsync(new SfsInventoryRequestInputBase()).ConfigureAwait(false); if (!itemCodes.Any()) { var itemBasicDtos_i= await _itemBasicAppService.GetAllListByFilterAsync(new SfsBaseDataRequestInputBase()).ConfigureAwait(false); var itemBasicDtos_t = await _repository.GetListAsync().ConfigureAwait(false); + allItemBasicDtos = itemBasicDtos_i; + allTransactions = itemBasicDtos_t; + itemCodes.AddRange(itemBasicDtos_i.Select(p => p.Code)); itemCodes.AddRange(itemBasicDtos_t.Select(p => p.ItemCode)); itemCodes=itemCodes.Distinct().ToList(); + } foreach (var itemCode in itemCodes) { var itemSerialDto = new ReportItemSerialDto(); - var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(itemCode).ConfigureAwait(false); + var itemBasicDto = allItemBasicDtos.FirstOrDefault(p=>p.Code== itemCode); if (itemBasicDto==null) { throw new UserFriendlyException($"物品代码{itemCode}不存在"); @@ -161,13 +170,12 @@ public class TransactionAppService itemSerialDto.ItemName = itemBasicDto.Name; //所有这个零件的事务 - var transactions=await _repository.GetListAsync(p => p.ItemCode == itemCode).ConfigureAwait(false); + var transactions = allTransactions.Where(p => p.ItemCode == itemCode); if (!string.IsNullOrEmpty(erpLocationCode)) { transactions = transactions.Where(p => p.LocationErpCode == erpLocationCode).ToList(); } - var locationDtos=await _locationAppService.GetAllAsync().ConfigureAwait(false); if (!string.IsNullOrEmpty(erpLocationCode)) { locationDtos = locationDtos.Where(p => p.ErpLocationCode == erpLocationCode).ToList(); @@ -219,10 +227,8 @@ public class TransactionAppService decimal tempNowSum = 0; try { - var balanceDtos = await _balanceAppService - .GetListByLocationCodeAndItemCodeAsync(locationDto.Code, itemSerialDto.ItemCode) - .ConfigureAwait(false); - tempNowSum = balanceDtos.Sum(p => p.Qty); + var balanceDtosWithLocation = balanceDtos.Where(p =>p.ItemCode== itemCode && p.LocationCode == locationDto.Code); + tempNowSum = balanceDtosWithLocation.Sum(p => p.Qty); } catch { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/IPurchaseReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/IPurchaseReceiptNoteAppService.cs index 1d9936c35..bc3f32af9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/IPurchaseReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/PurchaseReceiptNotes/IPurchaseReceiptNoteAppService.cs @@ -56,4 +56,5 @@ public interface IPurchaseReceiptNoteAppService : string packingCode); Task> GetListByAsnNumbers(IEnumerable asnNumbers); + Task> GetListByPoNumberAsync(string poNumber); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteAppService.cs index 282d1ec8e..ea0259e7a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PurchaseReceiptNotes/PurchaseReceiptNoteAppService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -29,6 +30,14 @@ public class PurchaseReceiptNoteAppService : _purchaseReceiptNoteManager = purchaseReceiptNoteManager; } + [HttpPost("get-list-by-po/{poNumber}")] + public async Task> GetListByPoNumberAsync(string poNumber) + { + var entitys= await _repository.GetListAsync(p => p.PoNumber == poNumber,string.Empty,true).ConfigureAwait(false); + var dtos=ObjectMapper.Map,List< PurchaseReceiptNoteDTO>>(entitys); + return dtos; + } + [HttpPost("{id}/set-po-number/{poNumber}")] public async Task SetPoNumber(string poNumber) {