You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
296 lines
19 KiB
296 lines
19 KiB
using Hangfire;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Numeric;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing.Printing;
|
|
using System.Linq;
|
|
using System.Security.Policy;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using TaskManager.Controllers;
|
|
using TaskManager.Entity;
|
|
using TaskManager.EntityFramework;
|
|
using Wood.Util.Filters;
|
|
|
|
namespace Wood.Service.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 读取日志服务
|
|
/// </summary>
|
|
public class CustomLogService : NormalBaseController<TaskLog>
|
|
{
|
|
private readonly string _logDirectory;
|
|
public CustomLogService(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository<TaskLog> repository) : base(context, builder, configuration, repository)
|
|
{
|
|
_logDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CustomLogs");
|
|
|
|
}
|
|
/// <summary>
|
|
/// 获取请求文件
|
|
/// </summary>
|
|
/// <param name="uId"></param>
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetLogRequestJsonList(int uId)
|
|
{
|
|
var first = _context.TaskLogs.FirstOrDefault(x => x.UId == uId);
|
|
if (!string.IsNullOrEmpty(first.Path))
|
|
{
|
|
string fullDatePath = Path.Combine(_logDirectory, first.Path);
|
|
string jsonContent = await System.IO.File.ReadAllTextAsync(fullDatePath);
|
|
return new JsonResult(new { Code = 200, Message = jsonContent });
|
|
|
|
|
|
}
|
|
return new JsonResult(new { Code = 400, Message = "没找到文件!" });
|
|
}
|
|
[HttpPost]
|
|
public async Task<IActionResult> GetLogReponseList([FromBody] RequestInputBase requestInputBase)
|
|
{
|
|
var uid = requestInputBase.Condition.Filters.FirstOrDefault(p => p.Column == "Uid").Value;
|
|
|
|
var first = _context.TaskLogs.FirstOrDefault(x => x.UId == long.Parse(uid));
|
|
|
|
var flawtask = requestInputBase.Condition.Filters.FirstOrDefault(p => p.Column == "Uid");
|
|
requestInputBase.Condition.Filters.Remove(flawtask);
|
|
|
|
switch (first.TaskName)
|
|
{
|
|
case "来料检验数据":
|
|
var stockService = _builder.GetRequiredService<SupplierProMaterialStockService>();
|
|
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic="and" });
|
|
var stockResult = await stockService.GetTaskDataPaged(requestInputBase);
|
|
return Ok(stockResult);
|
|
case "排产数据":
|
|
var schedulingService = _builder.GetRequiredService<CherySupplierProSchedulingService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var schedulingResult = await schedulingService.GetLogDataPaged(requestInputBase);
|
|
return Ok(schedulingResult);
|
|
|
|
case "供应商基础信息":
|
|
var supplierInfoService = _builder.GetRequiredService<CherySupplierInfoService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var supplierInfoResult = await supplierInfoService.GetLogDataPaged(requestInputBase);
|
|
return Ok(supplierInfoResult);
|
|
|
|
case "人员资质信息":
|
|
var employeeService = _builder.GetRequiredService<CherySupplierEmployeeService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var employeeResult = await employeeService.GetLogDataPaged(requestInputBase);
|
|
return Ok(employeeResult);
|
|
|
|
case "BOM主数据":
|
|
var bomService = _builder.GetRequiredService<CherySupplierBomService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var bomResult = await bomService.GetLogDataPaged(requestInputBase);
|
|
return Ok(bomResult);
|
|
|
|
case "过程控制项质量数据":
|
|
var cpsService = _builder.GetRequiredService<CherySupplierProCpsService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var cpsResult = await cpsService.GetLogDataPaged(requestInputBase);
|
|
return Ok(cpsResult);
|
|
|
|
case "生产过程数据":
|
|
var proDataService = _builder.GetRequiredService<CherySupplierProDataService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var proDataResult = await proDataService.GetLogDataPaged(requestInputBase);
|
|
return Ok(proDataResult);
|
|
|
|
case "产品一次合格率":
|
|
var firstPassYieldService = _builder.GetRequiredService<CherySupplierProFirstPassyieldService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var firstPassYieldResult = await firstPassYieldService.GetLogDataPaged(requestInputBase);
|
|
return Ok(firstPassYieldResult);
|
|
|
|
case "工位一次合格率":
|
|
var stationFirstPassYieldService = _builder.GetRequiredService<CherySupplierProStationFirstPassyieldService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var stationFirstPassYieldResult = await stationFirstPassYieldService.GetLogDataPaged(requestInputBase);
|
|
return Ok(stationFirstPassYieldResult);
|
|
|
|
case "缺陷业务数据":
|
|
var flawService = _builder.GetRequiredService<CherySupplierProFlawService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var flawResult = await flawService.GetLogDataPaged(requestInputBase);
|
|
return Ok(flawResult);
|
|
|
|
case "环境业务数据":
|
|
var environmentService = _builder.GetRequiredService<CherySupplierProEnvironmentService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var environmentResult = await environmentService.GetLogDataPaged(requestInputBase);
|
|
return Ok(environmentResult);
|
|
|
|
case "设备OEE达成率":
|
|
var oeeAchievementRateService = _builder.GetRequiredService<CherySupplierProOeeAchievementRateService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var oeeAchievementRateResult = await oeeAchievementRateService.GetLogDataPaged(requestInputBase);
|
|
return Ok(oeeAchievementRateResult);
|
|
|
|
case "OEE时间明细":
|
|
var oeeTimeDetailsService = _builder.GetRequiredService<CherySupplierProOeeTimeDetailsService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var oeeTimeDetailsResult = await oeeTimeDetailsService.GetLogDataPaged(requestInputBase);
|
|
return Ok(oeeTimeDetailsResult);
|
|
|
|
case "物料主数据":
|
|
var materialDataService = _builder.GetRequiredService<CherySupplierProMaterialDataService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var materialDataResult = await materialDataService.GetLogDataPaged(requestInputBase);
|
|
return Ok(materialDataResult);
|
|
|
|
case "附件类数据":
|
|
var attachmentDataService = _builder.GetRequiredService<CherySupplierProAttachmentDataService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var attachmentDataResult = await attachmentDataService.GetLogDataPaged(requestInputBase);
|
|
return Ok(attachmentDataResult);
|
|
|
|
case "工艺装备":
|
|
var processEquipmentService = _builder.GetRequiredService<CherySupplierProProcessEquipmentService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var processEquipmentResult = await processEquipmentService.GetLogDataPaged(requestInputBase);
|
|
return Ok(processEquipmentResult);
|
|
|
|
case "工艺":
|
|
var processService = _builder.GetRequiredService<CherySupplierProProcessService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var processResult = await processService.GetLogDataPaged(requestInputBase);
|
|
return Ok(processResult);
|
|
|
|
case "M+6月物料需求计划风险确认":
|
|
var m6RiskService = _builder.GetRequiredService<CherySupplierProSchedulingService>(); // 假设此业务仍使用排产服务
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var m6RiskResult = await m6RiskService.GetLogDataPaged(requestInputBase);
|
|
return Ok(m6RiskResult);
|
|
|
|
case "日物料需求计划风险确认":
|
|
var dailyRiskService = _builder.GetRequiredService<CherySupplierProSchedulingService>(); // 假设此业务仍使用排产服务
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var dailyRiskResult = await dailyRiskService.GetLogDataPaged(requestInputBase);
|
|
return Ok(dailyRiskResult);
|
|
|
|
case "采购订单风险确认":
|
|
var purchaseOrderRiskService = _builder.GetRequiredService<CherySupplierProSchedulingService>(); // 假设此业务仍使用排产服务
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var purchaseOrderRiskResult = await purchaseOrderRiskService.GetLogDataPaged(requestInputBase);
|
|
return Ok(purchaseOrderRiskResult);
|
|
|
|
case "供应商共享库存-上午":
|
|
var morningStockService = _builder.GetRequiredService<CherySupplierProSchedulingService>(); // 假设此业务仍使用排产服务
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var morningStockResult = await morningStockService.GetLogDataPaged(requestInputBase);
|
|
return Ok(morningStockResult);
|
|
|
|
case "供应商共享库存-晚上":
|
|
var eveningStockService = _builder.GetRequiredService<CherySupplierProSchedulingService>(); // 假设此业务仍使用排产服务
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var eveningStockResult = await eveningStockService.GetLogDataPaged(requestInputBase);
|
|
return Ok(eveningStockResult);
|
|
|
|
|
|
case "整车月度生产计划1":
|
|
var service1 = _builder.GetRequiredService<SupplierProPlaningLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result1 = await service1.GetLogDataPaged(requestInputBase);
|
|
return Ok(result1);
|
|
|
|
case "M+6月物料需求计划1":
|
|
var service2 = _builder.GetRequiredService<CherySupplierMrpMonthLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result2 = await service2.GetLogDataPaged(requestInputBase);
|
|
return Ok(result2);
|
|
|
|
case "整车月度生产计划2":
|
|
var service3 = _builder.GetRequiredService<SupplierProPlaningLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result3= await service3.GetLogDataPaged(requestInputBase);
|
|
return Ok(result3);
|
|
|
|
case "M+6月物料需求计划2":
|
|
var service4 = _builder.GetRequiredService<CherySupplierMrpMonthLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result4= await service4.GetLogDataPaged(requestInputBase);
|
|
return Ok(result4);
|
|
|
|
case "日物料需求计划":
|
|
var service5 = _builder.GetRequiredService<CherySupplierMrpDatalogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result5 = await service5.GetLogDataPaged(requestInputBase);
|
|
return Ok(result5);
|
|
|
|
case "计划协议":
|
|
var service6 = _builder.GetRequiredService<CherySupplierSaWeekLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result6 = await service6.GetLogDataPaged(requestInputBase);
|
|
return Ok(result6);
|
|
|
|
case "采购订单":
|
|
var service7 = _builder.GetRequiredService<CherySupplierPoLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result7 = await service7.GetLogDataPaged(requestInputBase);
|
|
return Ok(result7);
|
|
|
|
case "过焊装未过总装":
|
|
var service8 = _builder.GetRequiredService<CherySupplierPorHSCHEDULLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result8 = await service8.GetLogDataPaged(requestInputBase);
|
|
return Ok(result8);
|
|
|
|
case "过涂装未过总装":
|
|
var service9 = _builder.GetRequiredService<CherySupplierProTSCHEDULLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result9 = await service9.GetLogDataPaged(requestInputBase);
|
|
return Ok(result9);
|
|
|
|
case "排序供货":
|
|
var service10 = _builder.GetRequiredService<CherySupplierProCSCHEDULLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result10 = await service10.GetLogDataPaged(requestInputBase);
|
|
return Ok(result10);
|
|
|
|
case "看板配送单":
|
|
var service11 = _builder.GetRequiredService<CherySupplierDelStateLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result11 = await service11.GetLogDataPaged(requestInputBase);
|
|
return Ok(result11);
|
|
|
|
case "退货单":
|
|
var service12 = _builder.GetRequiredService<CherySupplierReturnLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result12 = await service12.GetLogDataPaged(requestInputBase);
|
|
return Ok(result12);
|
|
|
|
case "奇瑞RDC共享库存":
|
|
var service13 = _builder.GetRequiredService<SupplierInvDataLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result13 = await service13.GetLogDataPaged(requestInputBase);
|
|
return Ok(result13);
|
|
|
|
|
|
case "日MRP状态监控":
|
|
var service14 = _builder.GetRequiredService<CherySupplierMrpLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result14 = await service14.GetLogDataPaged(requestInputBase);
|
|
return Ok(result14);
|
|
|
|
case "日MRP预警推移":
|
|
var service15 = _builder.GetRequiredService<CherySupplierMrpWarningLogService>();
|
|
requestInputBase.Condition.Filters.Add(new Filter() { Action = "==", Column = "TaskId", Value = first.TaskId.ToString(), Logic = "and" });
|
|
var result15 = await service15.GetLogDataPaged(requestInputBase);
|
|
return Ok(result15);
|
|
|
|
|
|
|
|
}
|
|
return Ok();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|