80 lines
3.4 KiB
C#
80 lines
3.4 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 PrdMaterialReceiptRecordDownServicecs : IDynamicApiController, ITransient, IOverideVisualDevService
|
|
{
|
|
private readonly ISqlSugarRepository<PrdKittingOutH> _repository;
|
|
private readonly IUserManager _userManager;
|
|
private readonly IOrganizeService _organizeService;
|
|
private const string ModuleId = "30371998404373";
|
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
|
|
|
public PrdMaterialReceiptRecordDownServicecs(
|
|
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 material_receipt_id = queryJson.ContainsKey("material_receipt_id") ? queryJson["material_receipt_id"].ToString() : "";
|
|
if (string.IsNullOrEmpty(material_receipt_id))
|
|
{
|
|
return new
|
|
{
|
|
pagination = new PageResult(),
|
|
list = Array.Empty<string>()
|
|
};
|
|
}
|
|
|
|
var result = await db.Queryable<PrdMaterialReceiptD>()
|
|
.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(material_receipt_id),a=>a.material_receipt_id==material_receipt_id)
|
|
.Select((a, b, c,d) => new PrdMaterialReceiptRecordUpListDownOutPut
|
|
{
|
|
id = a.id,
|
|
material_id = b.name,
|
|
unit_id = d.FullName,
|
|
batch = a.batch,
|
|
num = a.num.ToString(),
|
|
feeding_num = a.feeding_num.ToString(),
|
|
member_carry_code = a.member_carry_code
|
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return PageResult<PrdMaterialReceiptRecordUpListDownOutPut>.SqlSugarPageResult(result);
|
|
}
|
|
}
|
|
} |