非采购上架接口

This commit is contained in:
tongfei
2023-11-11 10:25:42 +08:00
parent f2edf1ea4c
commit 4ff41e1ded
12 changed files with 580 additions and 123 deletions

View File

@@ -259,7 +259,7 @@ namespace WMS.Web.Repositories
/// </summary>
/// <param name="sourceBillNo"></param>
/// <returns></returns>
public async Task<List<InStockTaskBillNoQueryResponse>> GetListBy(InStockTaskBillNoQueryRequest dto)
public async Task<List<SourceBillNoQueryResponse>> GetListBy(InStockTaskBillNoQueryRequest dto)
{
//1.获取物料集合
var materials_result = await _erpService.BillQueryForMaterial();
@@ -276,7 +276,7 @@ namespace WMS.Web.Repositories
if(dto.InstockType.HasValue)
query = query.Where(w => (int)w.order.Type == dto.InstockType.Value);
var list = await query.Select(s => new InStockTaskBillNoQueryResponse()
var list = await query.Select(s => new SourceBillNoQueryResponse()
{
Id=s.order.Id,
DetailsId=s.detail.Id,
@@ -297,7 +297,72 @@ namespace WMS.Web.Repositories
}
/// <summary>
/// 列表-根据来源单模糊查询-非采购上架使用
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<List<SourceBillNoNoPurchaseQueryResponse>> GetListInfoBy(InStockTaskBillNoQueryRequest dto)
{
//1.获取物料集合
var materials_result = await _erpService.BillQueryForMaterial();
var materials = new List<ErpMaterialDto>();
if (materials_result.IsSuccess)
materials = materials_result.Data.ToList();
//这里只查状态为:部分入库和等待收货
var task_query = _context.InStockTask
.Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait));
if (dto.InstockType.HasValue)
task_query = task_query.Where(w => (int)w.Type == dto.InstockType.Value);
//找到头列表
var taskList = await task_query
.Select(x=>new SourceBillNoNoPurchaseQueryResponse()
{
Id=x.Id,
SourceBillNo=x.SourceBillNo
}).ToListAsync();
if (taskList != null && taskList.Count != 0)
{
var ids = taskList.Select(x => x.Id).ToList();
//找明细
var task_details = await _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid))
.Select(s=>new SourceBillNoNoPurchaseDetailsQueryResponse()
{
TaskId=s.Fid,
SupplierId = s.SupplierId,
OrgId = s.OrgId,
MaterialId = s.MaterialId,
StockCode = s.StockCode,
StockName = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId),
Qty = s.AccruedQty,
DeliveredQty = s.DeliveredQty,
Remark = s.Remark
}).ToListAsync();
//找箱
var task_box = await _context.InstockTaskBox.Where(x => ids.Contains(x.TaskId))
.Select(s => new SourceBillNoNoPurchaseBoxQueryResponse()
{
Id = s.Id,
TaskId=s.TaskId,
BoxId = s.BoxId,
BoxBillNo = s.BoxBillNo
}).ToListAsync();
//对应头赋值:明细和箱
foreach (var item in taskList)
{
item.Details = task_details.Where(x => x.TaskId == item.Id).ToList();
item.Boxs = task_box.Where(x => x.TaskId == item.Id).ToList();
}
}
return taskList;
}
/// <summary>
/// 批量添加