增加箱差出库单信息
This commit is contained in:
@@ -37,10 +37,11 @@ namespace WMS.Web.Api.Controllers
|
|||||||
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
|
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||||
|
private readonly IOutStockRepositories _outStockRepositories;
|
||||||
public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories,
|
public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories,
|
||||||
IBoxRepositories boxRepositories, IErpService erpService, ISingleDataService singleDataService,
|
IBoxRepositories boxRepositories, IErpService erpService, ISingleDataService singleDataService,
|
||||||
ISerialNumbersRepositories serialNumbersRepositories, IBoxInventoryRepositories boxInventoryRepositories,
|
ISerialNumbersRepositories serialNumbersRepositories, IBoxInventoryRepositories boxInventoryRepositories,
|
||||||
IMapper mapper, IErpBasicDataExtendService erpBasicDataExtendService)
|
IMapper mapper, IErpBasicDataExtendService erpBasicDataExtendService, IOutStockRepositories outStockRepositories)
|
||||||
{
|
{
|
||||||
_loginService = loginService;
|
_loginService = loginService;
|
||||||
_basicsRepositories = basicsRepositories;
|
_basicsRepositories = basicsRepositories;
|
||||||
@@ -51,6 +52,7 @@ namespace WMS.Web.Api.Controllers
|
|||||||
_boxInventoryRepositories = boxInventoryRepositories;
|
_boxInventoryRepositories = boxInventoryRepositories;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||||
|
_outStockRepositories = outStockRepositories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -357,6 +359,26 @@ namespace WMS.Web.Api.Controllers
|
|||||||
return Result<BoxResponse>.ReSuccess(res.First());
|
return Result<BoxResponse>.ReSuccess(res.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据箱号获取箱对应出库单信息 最新一条
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="boxBillNo">必填</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("GetBox_OutStock")]
|
||||||
|
public async Task<Result<BoxResponse>> GetBox_OutStock([FromQuery] string boxBillNo)
|
||||||
|
{
|
||||||
|
var res = await _boxRepositories.GetBox(new List<string>() { boxBillNo });
|
||||||
|
if (res.Count() <= 0)
|
||||||
|
return Result<BoxResponse>.ReFailure("箱号" + boxBillNo + "不存在", 800000);
|
||||||
|
var response = res[0];
|
||||||
|
var detail = await _outStockRepositories.GetDetailsByBoxId(response.Id);
|
||||||
|
response.Details = detail;
|
||||||
|
response.TotalQty = detail.Sum(s => s.Qty);
|
||||||
|
return Result<BoxResponse>.ReSuccess(response);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据序列号或规格型号,物料编码搜索物料信息-PDA
|
/// 根据序列号或规格型号,物料编码搜索物料信息-PDA
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
using WMS.Web.Core.Dto.OutStock;
|
using WMS.Web.Core.Dto.OutStock;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
|
|
||||||
@@ -23,5 +24,7 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
Task<bool> EditEntityList(List<OutStock> entitys, bool isTransaction = true);
|
Task<bool> EditEntityList(List<OutStock> entitys, bool isTransaction = true);
|
||||||
//获取详情
|
//获取详情
|
||||||
Task<OutStockInfoResponse> GetInfo(int id);
|
Task<OutStockInfoResponse> GetInfo(int id);
|
||||||
|
//获取出库单明细
|
||||||
|
Task<List<BoxDetailResponse>> GetDetailsByBoxId(int boxId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WMS.Web.Core;
|
using WMS.Web.Core;
|
||||||
|
using WMS.Web.Core.Dto;
|
||||||
using WMS.Web.Core.Dto.Erp;
|
using WMS.Web.Core.Dto.Erp;
|
||||||
using WMS.Web.Core.Dto.OutStock;
|
using WMS.Web.Core.Dto.OutStock;
|
||||||
using WMS.Web.Core.Help;
|
using WMS.Web.Core.Help;
|
||||||
@@ -320,5 +321,34 @@ namespace WMS.Web.Repositories
|
|||||||
{
|
{
|
||||||
return await GetListAsync(dto);
|
return await GetListAsync(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<BoxDetailResponse>> GetDetailsByBoxId(int boxId)
|
||||||
|
{
|
||||||
|
var res = await _context.OutStock
|
||||||
|
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
|
||||||
|
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails.Where(w => w.BoxId == boxId))
|
||||||
|
.Where(f => f.Details.SelectMany(s => s.BoxsDetails).Where(w => w.BoxId == boxId).Any())
|
||||||
|
.OrderByDescending(o => o.Id)
|
||||||
|
.FirstAsync();
|
||||||
|
List<BoxDetailResponse> details = new List<BoxDetailResponse>();
|
||||||
|
|
||||||
|
var materials_result = await _erpService.BillQueryForMaterial();
|
||||||
|
if (!materials_result.IsSuccess)
|
||||||
|
return new List<BoxDetailResponse>();
|
||||||
|
var materials = materials_result.Data.ToList();
|
||||||
|
|
||||||
|
foreach (var d in res.Details)
|
||||||
|
{
|
||||||
|
BoxDetailResponse detail = new BoxDetailResponse();
|
||||||
|
detail.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, detail.MaterialId);
|
||||||
|
detail.MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, detail.MaterialId);
|
||||||
|
detail.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, detail.MaterialId);
|
||||||
|
detail.SerialNumbers = d.SerialNumbers;
|
||||||
|
detail.MaterialId = d.MaterialId;
|
||||||
|
detail.Qty = d.BoxsDetails.FirstOrDefault(f => f.BoxId == boxId)?.Qty ?? 0;
|
||||||
|
details.Add(detail);
|
||||||
|
}
|
||||||
|
return details;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user