100 lines
5.3 KiB
C#
100 lines
5.3 KiB
C#
using JNPF.Common.Core.Manager;
|
|
using JNPF.Common.Filter;
|
|
using JNPF.DependencyInjection;
|
|
using JNPF.DynamicApiController;
|
|
using JNPF.Systems.Entitys.System;
|
|
using JNPF.Systems.Interfaces.System;
|
|
using JNPF.VisualDev;
|
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
|
using JNPF.VisualDev.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SqlSugar;
|
|
using Tnb.BasicData;
|
|
using Tnb.BasicData.Entities;
|
|
using Tnb.EquipMgr.Entities;
|
|
using Tnb.ProductionMgr.Entities;
|
|
|
|
namespace Tnb.ProductionMgr.APP
|
|
{
|
|
/// <summary>
|
|
/// 移动端组装包装任务管理
|
|
/// </summary>
|
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
|
[Route("api/[area]/[controller]/[action]")]
|
|
[OverideVisualDev(ModuleId)]
|
|
public class AppPrdMoTaskTwoService : IOverideVisualDevService, IDynamicApiController, ITransient
|
|
{
|
|
private const string ModuleId = "28486997557781";
|
|
private readonly ISqlSugarRepository<PrdMoTask> _repository;
|
|
private readonly IUserManager _userManager;
|
|
private readonly IRunService _runService;
|
|
private readonly IVisualDevService _visualDevService;
|
|
private readonly ISqlSugarClient _db;
|
|
private readonly IBillRullService _billRuleService;
|
|
|
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
|
public AppPrdMoTaskTwoService(
|
|
ISqlSugarRepository<PrdMoTask> repository,
|
|
IUserManager userManager,
|
|
IRunService runService,
|
|
IBillRullService billRullService,
|
|
IVisualDevService visualDevService
|
|
)
|
|
{
|
|
_repository = repository;
|
|
_userManager = userManager;
|
|
_runService = runService;
|
|
_visualDevService = visualDevService;
|
|
_db = _repository.AsSugarClient();
|
|
OverideFuncs.GetListAsync = GetList;
|
|
_billRuleService = billRullService;
|
|
}
|
|
|
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
|
{
|
|
ISqlSugarClient db = _repository.AsSugarClient();
|
|
Dictionary<string, string>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
|
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
|
string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : "";
|
|
string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : "";
|
|
SqlSugarPagedList<AppPrdMoTaskOneListOutput> result = await db.Queryable<PrdMoTask>()
|
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId)
|
|
.LeftJoin<BasProcess>((a, b, c, d, e, f) => a.process_id == f.id)
|
|
.WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code))
|
|
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code))
|
|
.WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code))
|
|
.Where(a => a.schedule_type == 2)
|
|
.Where(a => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)
|
|
.OrderByDescending(a => a.create_time)
|
|
.Select((a, b, c, d, e, f) => new AppPrdMoTaskOneListOutput
|
|
{
|
|
id = a.id,
|
|
mo_task_code = a.mo_task_code,
|
|
mo_task_status = e.FullName,
|
|
material_id_id = a.material_id,
|
|
material_id = b.code + "/" + b.name,
|
|
material_code = b.code,
|
|
material_name = b.name,
|
|
mold_id_id = a.mold_id,
|
|
mold_id = c.mold_code,
|
|
mold_code = c.mold_code,
|
|
eqp_id_id = a.eqp_id,
|
|
eqp_id = d.code,
|
|
equip_code = d.code,
|
|
process_id_id = a.process_id,
|
|
process_id = f.process_name,
|
|
process_code = f.process_code,
|
|
mbom_process_id = a.mbom_process_id,
|
|
scheduled_qty = a.scheduled_qty,
|
|
reported_work_qty = a.reported_work_qty,
|
|
scrap_qty = a.scrap_qty,
|
|
plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
|
plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return PageResult<AppPrdMoTaskOneListOutput>.SqlSugarPageResult(result);
|
|
}
|
|
}
|
|
} |