78 lines
3.2 KiB
C#
78 lines
3.2 KiB
C#
using JNPF.Common.Core.Manager;
|
|
using JNPF.Common.Filter;
|
|
using JNPF.DependencyInjection;
|
|
using JNPF.DynamicApiController;
|
|
using JNPF.Systems.Entitys.Permission;
|
|
using JNPF.Systems.Entitys.System;
|
|
using JNPF.Systems.Interfaces.Permission;
|
|
using JNPF.VisualDev;
|
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json;
|
|
using SqlSugar;
|
|
using Tnb.BasicData;
|
|
using Tnb.BasicData.Entities;
|
|
using Tnb.EquipMgr.Entities;
|
|
using Tnb.ProductionMgr.Entities;
|
|
using Tnb.ProductionMgr.Entities.Dto;
|
|
using Tnb.WarehouseMgr.Entities;
|
|
|
|
namespace Tnb.ProductionMgr
|
|
{
|
|
/// <summary>
|
|
/// 物料签收记录pc端
|
|
/// </summary>
|
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
|
[Route("api/[area]/[controller]/[action]")]
|
|
[OverideVisualDev(ModuleId)]
|
|
public class PrdFeedingRecordDownServicecs : IDynamicApiController, ITransient, IOverideVisualDevService
|
|
{
|
|
private readonly ISqlSugarRepository<PrdKittingOutH> _repository;
|
|
private readonly IUserManager _userManager;
|
|
private readonly IOrganizeService _organizeService;
|
|
private const string ModuleId = "30373784928789";
|
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
|
|
|
public PrdFeedingRecordDownServicecs(
|
|
ISqlSugarRepository<PrdKittingOutH> repository,
|
|
IOrganizeService organizeService,
|
|
IUserManager userManager
|
|
)
|
|
{
|
|
_repository = repository;
|
|
_organizeService = organizeService;
|
|
_userManager = userManager;
|
|
OverideFuncs.GetListAsync = GetList;
|
|
}
|
|
|
|
private async Task<object> GetList(VisualDevModelListQueryInput input)
|
|
{
|
|
var db = _repository.AsSugarClient();
|
|
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
|
string feeding_id = queryJson.ContainsKey("feeding_id") ? queryJson["feeding_id"].ToString() : "";
|
|
if (string.IsNullOrEmpty(feeding_id))
|
|
{
|
|
return new
|
|
{
|
|
pagination = new PageResult(),
|
|
list = Array.Empty<string>()
|
|
};
|
|
}
|
|
|
|
var result = await db.Queryable<PrdFeedingD>()
|
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
|
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.MeasurementUnit)
|
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>a.unit_id==d.EnCode && c.Id==d.DictionaryTypeId)
|
|
.WhereIF(!string.IsNullOrEmpty(feeding_id),a=>a.feeding_id==feeding_id)
|
|
.Select((a, b, c,d) => new PrdFeedingRecordUpListDownOutPut
|
|
{
|
|
id = a.id,
|
|
material_id = b.name,
|
|
unit_id = d.FullName,
|
|
batch = a.batch,
|
|
num = a.num.ToString(),
|
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return PageResult<PrdFeedingRecordUpListDownOutPut>.SqlSugarPageResult(result);
|
|
}
|
|
}
|
|
} |