齐套搭配方案,查询接口代码调整

This commit is contained in:
alex
2023-07-21 10:31:19 +08:00
parent 7bb60e3018
commit cba5adf5f3
6 changed files with 21 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ using Aop.Api.Domain;
using Aspose.Cells.Drawing;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
@@ -15,6 +16,7 @@ using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Interfaces;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
@@ -89,25 +91,25 @@ namespace Tnb.WarehouseMgr
/// <returns></returns>
[HttpPost]
//[NonUnify]
public async Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
public async Task<dynamic?> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
{
if (input.IsNull()) throw new ArgumentNullException("input");
var data = new List<CollocationSchemeOutput>();
SqlSugarPagedList<CollocationSchemeOutput> pageData = new();
try
{
data = await _db.Queryable<WmsCollocationSchemeH>()
pageData = await _db.Queryable<WmsCollocationSchemeH>()
.Where(a => a.material_id == input.material_id)
.Select(a => new CollocationSchemeOutput
{
list = SqlFunc.Subqueryable<WmsCollocationSchemeD>().Where(b => b.bill_id == a.id).ToList(),
}, true)
.Mapper(it => it.CollocationSchemeDs = it.list?.Adapt<List<CollocationSchemeDOutput>>())
.ToListAsync();
.Mapper(it => it.CollocationSchemeDsJson = JsonConvert.SerializeObject(it.list))
.ToPagedListAsync(input.currentPage, input.pageSize);
}
catch (Exception)
{
}
return data;
return pageData == null ? Enumerable.Empty<dynamic>() : PageResult<CollocationSchemeOutput>.SqlSugarPageResult(pageData);
}
}
}