Browse Source

更新

master
赵新宇 2 weeks ago
parent
commit
0c08b50ead
  1. 2
      API/TaskManager.EntityFramework/JobDbContext.cs
  2. 4650
      API/TaskManager.EntityFramework/Migrations/20250529065559_z20250529.Designer.cs
  3. 8729
      API/TaskManager.EntityFramework/Migrations/20250529065559_z20250529.cs
  4. 4134
      API/TaskManager.EntityFramework/Migrations/JobDbContextModelSnapshot.cs
  5. 11
      API/Wood.Admin.WebApi/Startup.cs
  6. 12
      API/Wood.Service/Controllers/LogController.cs
  7. 4
      API/Wood.Service/Controllers/NormalBaseController.cs
  8. 7
      API/Wood.Service/Controllers/RecurringJobBaseController.cs
  9. 2
      API/Wood.Service/Controllers/RecurringJobOutPageController.cs
  10. 158
      API/Wood.Service/Controllers/TaskConifgureController.cs

2
API/TaskManager.EntityFramework/JobDbContext.cs

@ -1,4 +1,5 @@

using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -18,6 +19,7 @@ using Wood.Util;
namespace TaskManager.EntityFramework
{
public class JobDbContext:DbContext
{

4650
API/TaskManager.EntityFramework/Migrations/20250529065559_z20250529.Designer.cs

File diff suppressed because it is too large

8729
API/TaskManager.EntityFramework/Migrations/20250529065559_z20250529.cs

File diff suppressed because it is too large

4134
API/TaskManager.EntityFramework/Migrations/JobDbContextModelSnapshot.cs

File diff suppressed because it is too large

11
API/Wood.Admin.WebApi/Startup.cs

@ -19,10 +19,11 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TaskManager.Controllers;
using TaskManager.EntityFramework;
using TaskManager.EntityFramework.Repository;
using TaskManager.EntityFramework.Repository;
using Wood.Admin.WebApi.Filter;
using Wood.Admin.WebApi.Middleware;
using Wood.Data.Repository;
@ -55,7 +56,7 @@ namespace Wood.Admin.WebApi
/// This method gets called by the runtime. Use this method to add services to the container.
/// </summary>
/// <param name="services"></param>
public void ConfigureServices(IServiceCollection services)
public async Task ConfigureServices(IServiceCollection services)
{
services.AddHttpContextAccessor();
@ -109,7 +110,7 @@ namespace Wood.Admin.WebApi
services.AddScoped(typeof(TaskManager.EntityFramework.IRepository<>), typeof(Repository<>));
//注册控制器
services.AddControllers(options =>
@ -267,7 +268,9 @@ namespace Wood.Admin.WebApi
options.OperationFilter<SecurityRequirementsOperationFilter>();
#endregion
});
//services.BuildServiceProvider().GetRequiredService()
//var s = services.BuildServiceProvider().GetRequiredService<TaskConifgureController>();
// s.TaskAllAsync("2025-05-29");

12
API/Wood.Service/Controllers/LogController.cs

@ -20,6 +20,7 @@ using Wood.Service.Controllers;
namespace TaskManager.Controllers
{
public class LogController:NormalBaseController<TaskLog>
{
public LogController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository<TaskLog> repository) : base(context, builder, configuration, repository)
@ -53,6 +54,17 @@ namespace TaskManager.Controllers
}
return false;
}
[HttpGet("AddInfoRemark")]
public async Task<bool> AddInfoRemark(string message, string taskname,string remark)
{
_context.TaskLogs.Add(new TaskLog() { Info = message, Type = "记录", TaskName = taskname, CreationTime = DateTime.Now,Remark=remark });
var result = await _context.SaveChangesAsync();
if (result > 0)
{
return true;
}
return false;
}
public async Task<FileStreamResult> Export([FromQuery] int pageNumber = 1,

4
API/Wood.Service/Controllers/NormalBaseController.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
@ -12,6 +13,7 @@ using TaskManager.EntityFramework.Repository;
namespace Wood.Service.Controllers
{
[AllowAnonymous]
public class NormalBaseController<T>:ControllerBase where T:BaseEntity
{

7
API/Wood.Service/Controllers/RecurringJobBaseController.cs

@ -57,6 +57,8 @@ namespace TaskManager.Controllers
/// <returns>返回DTOJson</returns>
protected async Task<string> Post(string url, string path, string jsonData)
{
try
{
// 生成签名参数
@ -75,7 +77,10 @@ namespace TaskManager.Controllers
// 发送请求
var response = await _httpClient.SendAsync(request);
response.EnsureSuccessStatusCode(); // 抛出异常处理状态码
return await response.Content.ReadAsStringAsync();
var str = await response.Content.ReadAsStringAsync();
await _logger.AddInfoRemark("test", TaskName,str);
return str;
}
catch (HttpRequestException ex)
{

2
API/Wood.Service/Controllers/RecurringJobOutPageController.cs

@ -78,7 +78,7 @@ namespace TaskManager.Controllers
// 首次请求获取总条数和分页信息
PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date, IsForce = true });
if (firstResponse == null || firstResponse.Code != 200)
{

158
API/Wood.Service/Controllers/TaskConifgureController.cs

@ -13,6 +13,7 @@ using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
using System.Linq.Expressions;
using System.Security.Policy;
using System.Threading.Tasks;
using TaskManager.Controllers;
using TaskManager.Entity;
@ -72,11 +73,6 @@ namespace TaskManager.Controllers
await controller.ExecuteAsync(url, path, taskName);
}
/// <summary>
@ -97,15 +93,165 @@ namespace TaskManager.Controllers
var url = first.Url;
var path = first.Api;
var controller = _builder.GetRequiredService<SupplierProPlaningService>();
await controller.TestAsync(url, path, taskName, "2025-04-21");
}
[NonAction]
public async Task TaskAllAsync(string date)
{
var tasks = _context.TaskConifgure.Where(p => p.IsAuto == true && !string.IsNullOrEmpty(p.Corn)
&& !string.IsNullOrEmpty(p.Api) && !string.IsNullOrEmpty(p.Url)).ToList();
foreach (var task in tasks)
{
try
{
var url = task.Url;
var path = task.Api;
var taskname = task.TaskName;
switch (task.TaskName)
{
case "整车月度生产计划1":
// 添加的代码块
var controller1 = _builder.GetRequiredService<SupplierProPlaningService>();
await controller1.TestAsync(url, path, taskname, "2025-05-29");
break;
case "M+6月物料需求计划1":
// 添加的代码块
var controller2 = _builder.GetRequiredService<SupplierMrpMonthService>();
await controller2.TestAsync(url, path, taskname, "2025-05-29");
break;
case "整车月度生产计划2":
// 添加的代码块
var controller3 = _builder.GetRequiredService<SupplierProPlaningService>();
await controller3.TestAsync(url, path, taskname, "2025-05-29");
break;
case "M+6月物料需求计划2":
// 添加的代码块
var controller4 = _builder.GetRequiredService<SupplierMrpMonthService>();
await controller4.TestAsync(url, path, taskname, "2025-05-29");
break;
case "日物料需求计划":
// 添加的代码块
var controller5 = _builder.GetRequiredService<SupplierMrpDataService>();
await controller5.TestAsync(url, path, taskname, "2025-05-29");
break;
case "计划协议":
// 添加的代码块
var controller6 = _builder.GetRequiredService<SupplierSaWeekService>();
await controller6.TestAsync(url, path, taskname, "2025-05-29");
break;
case "采购订单":
// 添加的代码块
var controller7 = _builder.GetRequiredService<SupplierPoService>();
await controller7.TestAsync(url, path, taskname, "2025-05-29");
break;
case "过焊装未过总装":
// 添加的代码块
var controller8 = _builder.GetRequiredService<SupplierPorHSCHEDULService>();
await controller8.TestAsync(url, path, taskname, "2025-05-29");
break;
case "过涂装未过总装":
// 添加的代码块
var controller9 = _builder.GetRequiredService<supplierProTSCHEDULService>();
await controller9.TestAsync(url, path, taskname, "2025-05-29");
break;
case "排序供货":
// 添加的代码块
var controller10 = _builder.GetRequiredService<SupplierProCSCHEDULService>();
await controller10.TestAsync(url, path, taskname, "2025-05-29");
break;
case "看板配送单":
// 添加的代码块
var controller11 = _builder.GetRequiredService<SupplierDelStateService>();
await controller11.TestAsync(url, path, taskname, "2025-05-29");
break;
case "退货单":
// 添加的代码块
var controller12 = _builder.GetRequiredService<SupplierReturnService>();
await controller12.TestAsync(url, path, taskname, "2025-05-29");
break;
case "奇瑞RDC共享库存":
// 添加的代码块
var controller13 = _builder.GetRequiredService<SupplierInvDataService>();
await controller13.TestAsync(url, path, taskname, "2025-05-29");
break;
case "日MRP状态监控":
// 添加的代码块
var controller14 = _builder.GetRequiredService<SupplierMrpDataService>();
await controller14.TestAsync(url, path, taskname, "2025-05-29");
break;
case "日MRP预警推移":
// 添加的代码块
var controller15 = _builder.GetRequiredService<SupplierMrpWarningService>();
await controller15.TestAsync(url, path, taskname, "2025-05-29");
break;
case "供应商共享库存-上午":
// 添加的代码块
var controller19 = _builder.GetRequiredService<SupplierSinvDataService>();
await controller19.TestAsync(url, path, taskname, "2025-05-29");
break;
case "供应商共享库存-晚上":
// 添加的代码块
var controller20 = _builder.GetRequiredService<SupplierSinvDataService>();
await controller20.TestAsync(url, path, taskname, "2025-05-29");
break;
}
}
catch
{
}
}
}

Loading…
Cancel
Save