104 lines
4.3 KiB
C#
104 lines
4.3 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 PrdKittingOutRecordDownService : IDynamicApiController, ITransient, IOverideVisualDevService
|
|
{
|
|
private readonly ISqlSugarRepository<PrdKittingOutH> _repository;
|
|
private readonly IUserManager _userManager;
|
|
private readonly IOrganizeService _organizeService;
|
|
private const string ModuleId = "30305671171605";
|
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
|
|
|
public PrdKittingOutRecordDownService(
|
|
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 kitting_out_id = queryJson.ContainsKey("kitting_out_id") ? queryJson["kitting_out_id"].ToString() : "";
|
|
string type = queryJson.ContainsKey("type") ? queryJson["type"].ToString() : "";
|
|
|
|
if (string.IsNullOrEmpty(kitting_out_id))
|
|
{
|
|
return new
|
|
{
|
|
pagination = new PageResult(),
|
|
list = Array.Empty<string>()
|
|
};
|
|
}
|
|
|
|
if (type == "1")
|
|
{
|
|
var result = await db.Queryable<PrdKittingOutD>()
|
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
|
.LeftJoin<DictionaryDataEntity>((a,b,c)=>a.unit_id==c.Id)
|
|
.WhereIF(!string.IsNullOrEmpty(kitting_out_id),a=>a.kitting_out_id==kitting_out_id)
|
|
.Select((a, b, c) => new OutstockRecordListDownOutput
|
|
{
|
|
id = a.id,
|
|
material_id = b.name,
|
|
material_id_id = a.material_id,
|
|
unit_id = c.FullName,
|
|
code_batch = a.code_batch,
|
|
pr_qty = a.pr_qty.ToString(),
|
|
box = a.box.ToString(),
|
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return PageResult<OutstockRecordListDownOutput>.SqlSugarPageResult(result);
|
|
}
|
|
else
|
|
{
|
|
var result = await db.Queryable<PrdOutstockD>()
|
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
|
.LeftJoin<DictionaryDataEntity>((a,b,c)=>a.unit_id==c.Id)
|
|
.WhereIF(!string.IsNullOrEmpty(kitting_out_id),a=>a.outstock_id==kitting_out_id)
|
|
.Select((a, b, c) => new OutstockRecordListDownOutput
|
|
{
|
|
id = a.id,
|
|
material_id = b.name,
|
|
material_id_id = a.material_id,
|
|
unit_id = c.FullName,
|
|
code_batch = a.code_batch,
|
|
pr_qty = "",
|
|
box = a.pr_qty.ToString(),
|
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return PageResult<OutstockRecordListDownOutput>.SqlSugarPageResult(result);
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
} |