Files
tnb.server/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs
DEVICE8\12494 c6522831b4 1
2023-05-28 21:17:49 +08:00

81 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Interfaces;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Interfaces;
using JNPF.Systems.Interfaces.System;
using Tnb.BasicData;
using JNPF.Common.Extension;
namespace Tnb.ProductionMgr
{
/// <summary>
/// 生产提报记录
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
[OverideVisualDev(ModuleId)]
public class ProductionReportRecordService : IOverideVisualDevService, IProductionReportRecordService, IDynamicApiController, ITransient
{
private const string ModuleId = "25568191969061";
private readonly ISqlSugarRepository<PrdMoTask> _repository;
private readonly ISqlSugarClient _db;
private readonly IRunService _runService;
private readonly IVisualDevService _visualDevService;
private readonly IDictionaryDataService _dictionaryDataService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
public ProductionReportRecordService(ISqlSugarRepository<PrdMoTask> repository, IRunService runService, IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
_runService = runService;
_visualDevService = visualDevService;
OverideFuncs.GetListAsync = GetList;
_dictionaryDataService = dictionaryDataService;
}
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
{
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
var data = await _runService.GetListResult(templateEntity, input);
//if (data?.list?.Count > 0)
//{
// var dicMoTaskStatus = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
// foreach (var row in data.list)
// {
// var dic = row.ToDictionary(x => x.Key, x => x.Value);
// //if (dic.ContainsKey(nameof(PrdReportRecord.status)))
// //{
// // var statusCode = dic[nameof(PrdReportRecord.status)].ToString();
// // row[nameof(PrdReportRecord.status)] = dicMoTaskStatus[statusCode];
// //}
// if (dic.ContainsKey(nameof(PrdReportRecord.mo_task_type)))
// {
// var moTypeId = dic[nameof(PrdReportRecord.mo_task_type)].ToString();
// if (moTypeId.IsNotEmptyOrNull())
// {
// row[nameof(PrdReportRecord.mo_task_type)] = (await _dictionaryDataService.GetInfo(moTypeId)).FullName;
// }
// }
// }
//}
return data!;
}
}
}