me 2 days ago
parent
commit
5c7de35677
  1. 2
      API/TaskManager.Contracts/Dtos/Dtos.cs
  2. 60
      API/TaskManager.Entity/Entity.cs
  3. 5323
      API/TaskManager.EntityFramework/Migrations/20250610061746_z2025061000024.Designer.cs
  4. 49
      API/TaskManager.EntityFramework/Migrations/20250610061746_z2025061000024.cs
  5. 5330
      API/TaskManager.EntityFramework/Migrations/20250610062047_z20250610000240002.Designer.cs
  6. 158
      API/TaskManager.EntityFramework/Migrations/20250610062047_z20250610000240002.cs
  7. 5342
      API/TaskManager.EntityFramework/Migrations/20250610064324_z20250610000240003.Designer.cs
  8. 69
      API/TaskManager.EntityFramework/Migrations/20250610064324_z20250610000240003.cs
  9. 5444
      API/TaskManager.EntityFramework/Migrations/20250611063901_z2025061100001.Designer.cs
  10. 741
      API/TaskManager.EntityFramework/Migrations/20250611063901_z2025061100001.cs
  11. 192
      API/TaskManager.EntityFramework/Migrations/JobDbContextModelSnapshot.cs
  12. 44
      API/Wood.Admin.WebApi/Other/ServiceCollectionExtensions.cs
  13. 99
      API/Wood.Admin.WebApi/Startup.cs
  14. 8
      API/Wood.Admin.WebApi/Wood.Admin.WebApi.csproj
  15. 86
      API/Wood.Service/Controllers/CheryDataMaintenanceService.cs
  16. 24
      API/Wood.Service/Controllers/CheryRecurringJobInputPageController.cs
  17. 320
      API/Wood.Service/Controllers/CheryRecurringJobOutPageController.cs
  18. 16
      API/Wood.Service/Controllers/CherySupplierConMmrpService.cs
  19. 8
      API/Wood.Service/Controllers/CherySupplierMrpDataService.cs
  20. 27
      API/Wood.Service/Controllers/CherySupplierMrpMonthService.cs
  21. 7
      API/Wood.Service/Controllers/CherySupplierPoService.cs
  22. 21
      API/Wood.Service/Controllers/CustomLogService.cs
  23. 286
      API/Wood.Service/Controllers/LogConsumerService.cs
  24. 188
      API/Wood.Service/Controllers/LogController.cs
  25. 162
      API/Wood.Service/Controllers/LogService.cs
  26. 13
      API/Wood.Service/Controllers/RecurringJobBaseController.cs
  27. 268
      API/Wood.Service/Controllers/TaskConifgureController.cs

2
API/TaskManager.Contracts/Dtos/Dtos.cs

@ -1096,7 +1096,7 @@ namespace TaskManager.Contracts.Dtos
public string MaterialDescription { get; set; }
public string SummarySign { get; set; }
public string DateRequired { get; set; }
public int QuantityDemand { get; set; }
public decimal? QuantityDemand { get; set; }
public string ConfirmTime { get; set; }
public decimal? CreatQuantity { get; set; }
public decimal? QuantityDelivery { get; set; }

60
API/TaskManager.Entity/Entity.cs

@ -19,7 +19,7 @@ namespace TaskManager.Entity
public interface IDoExecute
{
Task ExecuteAsync(string url, string path, string takName,string client);
Task ExecuteAsync(string url, string path, string takName,string client, int pageSize);
}
public class TaskConifgure:BaseEntity
{
@ -29,10 +29,12 @@ namespace TaskManager.Entity
/// </summary>
[ExporterHeader(DisplayName = "API路径")]
[ImporterHeader(Name = "API路径")]
[MaxLength(400)]
public string? Api { get; set; }
/// <summary>
/// 任务周期设置
/// </summary>
[MaxLength(400)]
[ExporterHeader(DisplayName = "任务周期设置")]
[ImporterHeader(Name = "任务周期设置")]
public string? Corn { get; set; }
@ -41,6 +43,7 @@ namespace TaskManager.Entity
/// </summary>
[ExporterHeader(IsIgnore = true)]
[ImporterHeader(IsIgnore = true)]
[MaxLength(400)]
public string? Module { get; set; }
/// <summary>
@ -48,6 +51,7 @@ namespace TaskManager.Entity
/// </summary>
[ExporterHeader(DisplayName = "客户")]
[ImporterHeader(Name = "客户")]
[MaxLength(50)]
public string? Client { get; set; }
@ -56,10 +60,12 @@ namespace TaskManager.Entity
/// </summary>
[ExporterHeader(DisplayName = "备注")]
[ImporterHeader(Name = "备注")]
public string? Remark { get; set; }
/// <summary>
/// 表名
/// </summary>
[MaxLength(100)]
[ExporterHeader(DisplayName = "表名")]
[ImporterHeader(Name = "表名")]
@ -67,11 +73,13 @@ namespace TaskManager.Entity
/// <summary>
/// 任务名称
/// </summary>
[MaxLength(200)]
[ExporterHeader(DisplayName = "任务名称")]
public string? TaskName { get; set; }
/// <summary>
/// 全路径
/// </summary>
[MaxLength(500)]
[ExporterHeader(DisplayName = "调用全路径")]
[ImporterHeader(Name = "调用全路径")]
public string? Url { get; set; }
@ -81,6 +89,17 @@ namespace TaskManager.Entity
[ExporterHeader(DisplayName = "是否自动执行")]
[ImporterHeader(Name = "是否自动执行")]
public bool IsAuto { get; set; }
/// <summary>
/// 是否自动执行
/// </summary>
[ExporterHeader(DisplayName = "分页大小")]
[ImporterHeader(Name = "分页大小")]
public int PageSize { get; set; } = 500;
public TaskConifgure()
{ }
@ -181,6 +200,10 @@ namespace TaskManager.Entity
public string? Remark { get; set; }
}
public class BaseEntity
{
public BaseEntity()
@ -223,6 +246,10 @@ namespace TaskManager.Entity
[Index(nameof(Id), IsUnique = true)]
[Index(nameof(TaskId), IsUnique = false)]
[Index(nameof(WriteState), IsUnique = false)]
[Index(nameof(ReadState), IsUnique = false)]
public class CherryReadBaseEntity:BaseEntity
{
@ -240,6 +267,13 @@ namespace TaskManager.Entity
public string? Id { get; set; }
}
[Index(nameof(Id), IsUnique = true)]
[Index(nameof(TaskId), IsUnique = false)]
[Index(nameof(WriteState), IsUnique = false)]
[Index(nameof(ReadState), IsUnique = false)]
public class CherryConReadBaseEntity : BaseEntity
{
@ -548,7 +582,7 @@ namespace TaskManager.Entity
/// 零件名称
/// </summary>
[JsonPropertyName("materialDescription")]
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; } = string.Empty;
@ -745,7 +779,7 @@ namespace TaskManager.Entity
/// 字符串长度限制:50 字节
/// </summary>
[ExporterHeader(DisplayName = "零件名称")]
[StringLength(50)]
[StringLength(100)]
public string? MaterialDescription { get; set; } = string.Empty;
/// <summary>
@ -1007,7 +1041,7 @@ namespace TaskManager.Entity
/// 零件名称
/// </summary>
[ExporterHeader(DisplayName = "零件名称")]
[MaxLength(50)]
[MaxLength(100)]
public string? MaterialDescription { get; set; } = "";
/// <summary>
@ -1144,7 +1178,7 @@ namespace TaskManager.Entity
/// <summary>
/// 物料描述
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "物料描述")]
public string? MaterialDescription { get; set; }
@ -1320,7 +1354,7 @@ namespace TaskManager.Entity
/// <summary>
/// 物料描述
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "物料描述")]
public string? MaterialDescription { get; set; }
@ -1425,7 +1459,7 @@ namespace TaskManager.Entity
/// <summary>
/// 物料描述
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "物料描述")]
public string? MaterialDescription { get; set; }
@ -1537,7 +1571,7 @@ namespace TaskManager.Entity
/// <summary>
/// 物料描述
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "物料描述")]
public string? MaterialDescription { get; set; }
@ -1673,7 +1707,7 @@ namespace TaskManager.Entity
/// <summary>
/// 零件名称
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; }
@ -1836,7 +1870,7 @@ namespace TaskManager.Entity
/// <summary>
/// 零件名称
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; }
@ -1949,7 +1983,7 @@ namespace TaskManager.Entity
/// <summary>
/// 零件名称
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; }
@ -2076,7 +2110,7 @@ namespace TaskManager.Entity
/// <summary>
/// 零件名称
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; }
@ -2228,7 +2262,7 @@ namespace TaskManager.Entity
/// <summary>
/// 零件名称
/// </summary>
[MaxLength(50)]
[MaxLength(100)]
[ExporterHeader(DisplayName = "零件名称")]
public string? MaterialDescription { get; set; }

5323
API/TaskManager.EntityFramework/Migrations/20250610061746_z2025061000024.Designer.cs

File diff suppressed because it is too large

49
API/TaskManager.EntityFramework/Migrations/20250610061746_z2025061000024.cs

@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskManager.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class z2025061000024 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "PageSize",
table: "TaskConifgure",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "SUPPLIER_PRO_PLANING",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PageSize",
table: "TaskConifgure");
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "SUPPLIER_PRO_PLANING",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
}
}
}

5330
API/TaskManager.EntityFramework/Migrations/20250610062047_z20250610000240002.Designer.cs

File diff suppressed because it is too large

158
API/TaskManager.EntityFramework/Migrations/20250610062047_z20250610000240002.cs

@ -0,0 +1,158 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskManager.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class z20250610000240002 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Url",
table: "TaskConifgure",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "TaskName",
table: "TaskConifgure",
type: "nvarchar(200)",
maxLength: 200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "TableName",
table: "TaskConifgure",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Module",
table: "TaskConifgure",
type: "nvarchar(400)",
maxLength: 400,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Corn",
table: "TaskConifgure",
type: "nvarchar(400)",
maxLength: 400,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Client",
table: "TaskConifgure",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Api",
table: "TaskConifgure",
type: "nvarchar(400)",
maxLength: 400,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Url",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "TaskName",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "TableName",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Module",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(400)",
oldMaxLength: 400,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Corn",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(400)",
oldMaxLength: 400,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Client",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Api",
table: "TaskConifgure",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(400)",
oldMaxLength: 400,
oldNullable: true);
}
}
}

5342
API/TaskManager.EntityFramework/Migrations/20250610064324_z20250610000240003.Designer.cs

File diff suppressed because it is too large

69
API/TaskManager.EntityFramework/Migrations/20250610064324_z20250610000240003.cs

@ -0,0 +1,69 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskManager.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class z20250610000240003 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "SUPPLIER_CON_MMRP",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_PO_Id",
table: "SUPPLIER_CON_PO",
column: "Id",
unique: true,
filter: "[Id] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_MMRP_Id",
table: "SUPPLIER_CON_MMRP",
column: "Id",
unique: true,
filter: "[Id] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_DATE_Id",
table: "SUPPLIER_CON_DATE",
column: "Id",
unique: true,
filter: "[Id] IS NOT NULL");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_PO_Id",
table: "SUPPLIER_CON_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_MMRP_Id",
table: "SUPPLIER_CON_MMRP");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_DATE_Id",
table: "SUPPLIER_CON_DATE");
migrationBuilder.AlterColumn<string>(
name: "Id",
table: "SUPPLIER_CON_MMRP",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
}
}
}

5444
API/TaskManager.EntityFramework/Migrations/20250611063901_z2025061100001.Designer.cs

File diff suppressed because it is too large

741
API/TaskManager.EntityFramework/Migrations/20250611063901_z2025061100001.cs

@ -0,0 +1,741 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TaskManager.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class z2025061100001 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_SA_WEEK",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_RETURN",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_TSCHEDUL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_HSCHEDUL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_CSCHEDUL",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PO",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_WARNING",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_STATE",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_MONTH",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_DATE",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_INV_DATA",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_DEL_STATE",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SINV_DATA_ReadState",
table: "SUPPLIER_SINV_DATA",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SINV_DATA_TaskId",
table: "SUPPLIER_SINV_DATA",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SINV_DATA_WriteState",
table: "SUPPLIER_SINV_DATA",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SA_WEEK_ReadState",
table: "SUPPLIER_SA_WEEK",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SA_WEEK_TaskId",
table: "SUPPLIER_SA_WEEK",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_SA_WEEK_WriteState",
table: "SUPPLIER_SA_WEEK",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_RETURN_ReadState",
table: "SUPPLIER_RETURN",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_RETURN_TaskId",
table: "SUPPLIER_RETURN",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_RETURN_WriteState",
table: "SUPPLIER_RETURN",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_ReadState",
table: "SUPPLIER_PRO_TSCHEDUL",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_TaskId",
table: "SUPPLIER_PRO_TSCHEDUL",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_WriteState",
table: "SUPPLIER_PRO_TSCHEDUL",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_PLANING_ReadState",
table: "SUPPLIER_PRO_PLANING",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_PLANING_TaskId",
table: "SUPPLIER_PRO_PLANING",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_PLANING_WriteState",
table: "SUPPLIER_PRO_PLANING",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_ReadState",
table: "SUPPLIER_PRO_HSCHEDUL",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_TaskId",
table: "SUPPLIER_PRO_HSCHEDUL",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_WriteState",
table: "SUPPLIER_PRO_HSCHEDUL",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_ReadState",
table: "SUPPLIER_PRO_CSCHEDUL",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_TaskId",
table: "SUPPLIER_PRO_CSCHEDUL",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_WriteState",
table: "SUPPLIER_PRO_CSCHEDUL",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PO_ReadState",
table: "SUPPLIER_PO",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PO_TaskId",
table: "SUPPLIER_PO",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_PO_WriteState",
table: "SUPPLIER_PO",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_WARNING_ReadState",
table: "SUPPLIER_MRP_WARNING",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_WARNING_TaskId",
table: "SUPPLIER_MRP_WARNING",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_WARNING_WriteState",
table: "SUPPLIER_MRP_WARNING",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_STATE_ReadState",
table: "SUPPLIER_MRP_STATE",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_STATE_TaskId",
table: "SUPPLIER_MRP_STATE",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_STATE_WriteState",
table: "SUPPLIER_MRP_STATE",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_MONTH_ReadState",
table: "SUPPLIER_MRP_MONTH",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_MONTH_TaskId",
table: "SUPPLIER_MRP_MONTH",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_MONTH_WriteState",
table: "SUPPLIER_MRP_MONTH",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_DATE_ReadState",
table: "SUPPLIER_MRP_DATE",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_DATE_TaskId",
table: "SUPPLIER_MRP_DATE",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_MRP_DATE_WriteState",
table: "SUPPLIER_MRP_DATE",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_INV_DATA_ReadState",
table: "SUPPLIER_INV_DATA",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_INV_DATA_TaskId",
table: "SUPPLIER_INV_DATA",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_INV_DATA_WriteState",
table: "SUPPLIER_INV_DATA",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_DEL_STATE_ReadState",
table: "SUPPLIER_DEL_STATE",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_DEL_STATE_TaskId",
table: "SUPPLIER_DEL_STATE",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_DEL_STATE_WriteState",
table: "SUPPLIER_DEL_STATE",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_PO_ReadState",
table: "SUPPLIER_CON_PO",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_PO_TaskId",
table: "SUPPLIER_CON_PO",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_PO_WriteState",
table: "SUPPLIER_CON_PO",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_MMRP_ReadState",
table: "SUPPLIER_CON_MMRP",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_MMRP_TaskId",
table: "SUPPLIER_CON_MMRP",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_MMRP_WriteState",
table: "SUPPLIER_CON_MMRP",
column: "WriteState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_DATE_ReadState",
table: "SUPPLIER_CON_DATE",
column: "ReadState");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_DATE_TaskId",
table: "SUPPLIER_CON_DATE",
column: "TaskId");
migrationBuilder.CreateIndex(
name: "IX_SUPPLIER_CON_DATE_WriteState",
table: "SUPPLIER_CON_DATE",
column: "WriteState");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SINV_DATA_ReadState",
table: "SUPPLIER_SINV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SINV_DATA_TaskId",
table: "SUPPLIER_SINV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SINV_DATA_WriteState",
table: "SUPPLIER_SINV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SA_WEEK_ReadState",
table: "SUPPLIER_SA_WEEK");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SA_WEEK_TaskId",
table: "SUPPLIER_SA_WEEK");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_SA_WEEK_WriteState",
table: "SUPPLIER_SA_WEEK");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_RETURN_ReadState",
table: "SUPPLIER_RETURN");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_RETURN_TaskId",
table: "SUPPLIER_RETURN");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_RETURN_WriteState",
table: "SUPPLIER_RETURN");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_ReadState",
table: "SUPPLIER_PRO_TSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_TaskId",
table: "SUPPLIER_PRO_TSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_TSCHEDUL_WriteState",
table: "SUPPLIER_PRO_TSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_PLANING_ReadState",
table: "SUPPLIER_PRO_PLANING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_PLANING_TaskId",
table: "SUPPLIER_PRO_PLANING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_PLANING_WriteState",
table: "SUPPLIER_PRO_PLANING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_ReadState",
table: "SUPPLIER_PRO_HSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_TaskId",
table: "SUPPLIER_PRO_HSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_HSCHEDUL_WriteState",
table: "SUPPLIER_PRO_HSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_ReadState",
table: "SUPPLIER_PRO_CSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_TaskId",
table: "SUPPLIER_PRO_CSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PRO_CSCHEDUL_WriteState",
table: "SUPPLIER_PRO_CSCHEDUL");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PO_ReadState",
table: "SUPPLIER_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PO_TaskId",
table: "SUPPLIER_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_PO_WriteState",
table: "SUPPLIER_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_WARNING_ReadState",
table: "SUPPLIER_MRP_WARNING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_WARNING_TaskId",
table: "SUPPLIER_MRP_WARNING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_WARNING_WriteState",
table: "SUPPLIER_MRP_WARNING");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_STATE_ReadState",
table: "SUPPLIER_MRP_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_STATE_TaskId",
table: "SUPPLIER_MRP_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_STATE_WriteState",
table: "SUPPLIER_MRP_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_MONTH_ReadState",
table: "SUPPLIER_MRP_MONTH");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_MONTH_TaskId",
table: "SUPPLIER_MRP_MONTH");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_MONTH_WriteState",
table: "SUPPLIER_MRP_MONTH");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_DATE_ReadState",
table: "SUPPLIER_MRP_DATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_DATE_TaskId",
table: "SUPPLIER_MRP_DATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_MRP_DATE_WriteState",
table: "SUPPLIER_MRP_DATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_INV_DATA_ReadState",
table: "SUPPLIER_INV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_INV_DATA_TaskId",
table: "SUPPLIER_INV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_INV_DATA_WriteState",
table: "SUPPLIER_INV_DATA");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_DEL_STATE_ReadState",
table: "SUPPLIER_DEL_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_DEL_STATE_TaskId",
table: "SUPPLIER_DEL_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_DEL_STATE_WriteState",
table: "SUPPLIER_DEL_STATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_PO_ReadState",
table: "SUPPLIER_CON_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_PO_TaskId",
table: "SUPPLIER_CON_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_PO_WriteState",
table: "SUPPLIER_CON_PO");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_MMRP_ReadState",
table: "SUPPLIER_CON_MMRP");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_MMRP_TaskId",
table: "SUPPLIER_CON_MMRP");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_MMRP_WriteState",
table: "SUPPLIER_CON_MMRP");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_DATE_ReadState",
table: "SUPPLIER_CON_DATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_DATE_TaskId",
table: "SUPPLIER_CON_DATE");
migrationBuilder.DropIndex(
name: "IX_SUPPLIER_CON_DATE_WriteState",
table: "SUPPLIER_CON_DATE");
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_SA_WEEK",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_RETURN",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_TSCHEDUL",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_HSCHEDUL",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PRO_CSCHEDUL",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_PO",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_WARNING",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_STATE",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_MONTH",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_MRP_DATE",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_INV_DATA",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "MaterialDescription",
table: "SUPPLIER_DEL_STATE",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
}
}
}

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

@ -215,6 +215,16 @@ namespace TaskManager.EntityFramework.Migrations
b.HasKey("UId");
b.HasIndex("Id")
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_CON_DATE", (string)null);
});
@ -234,7 +244,7 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("NVARCHAR");
b.Property<string>("Id")
.HasColumnType("nvarchar(max)");
.HasColumnType("nvarchar(450)");
b.Property<string>("MaterialCode")
.HasMaxLength(50)
@ -335,6 +345,16 @@ namespace TaskManager.EntityFramework.Migrations
b.HasKey("UId");
b.HasIndex("Id")
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_CON_MMRP", (string)null);
});
@ -404,6 +424,16 @@ namespace TaskManager.EntityFramework.Migrations
b.HasKey("UId");
b.HasIndex("Id")
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_CON_PO", (string)null);
});
@ -1938,8 +1968,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PlantId")
.HasMaxLength(50)
@ -2001,6 +2031,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_DEL_STATE");
});
@ -2530,8 +2566,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PlantId")
.HasMaxLength(50)
@ -2580,6 +2616,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_INV_DATA");
});
@ -2616,8 +2658,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PlantId")
.HasMaxLength(50)
@ -2759,6 +2801,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_MRP_DATE");
});
@ -2801,8 +2849,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasAnnotation("Relational:JsonPropertyName", "materialCode");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)")
.HasAnnotation("Relational:JsonPropertyName", "materialDescription");
b.Property<string>("PlantId")
@ -2908,6 +2956,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_MRP_MONTH");
});
@ -2958,8 +3012,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<decimal?>("OnTimePercentage")
.HasColumnType("decimal(18,2)");
@ -3032,6 +3086,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_MRP_STATE");
});
@ -3071,8 +3131,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PlantId")
.HasMaxLength(50)
@ -3125,6 +3185,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_MRP_WARNING");
});
@ -3177,8 +3243,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("MaterialUnit")
.HasMaxLength(50)
@ -3256,6 +3322,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_PO");
});
@ -3554,8 +3626,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ModelCategory")
.HasMaxLength(50)
@ -3631,6 +3703,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_PRO_CSCHEDUL");
});
@ -4040,8 +4118,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Models")
.HasMaxLength(50)
@ -4098,6 +4176,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_PRO_HSCHEDUL");
});
@ -4303,8 +4387,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("datetime2");
b.Property<string>("Id")
.HasColumnType("nvarchar(450)")
.HasAnnotation("Relational:JsonPropertyName", "id");
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("IsDelete")
.HasColumnType("int")
@ -4410,6 +4494,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_PRO_PLANING");
});
@ -4719,8 +4809,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Models")
.HasMaxLength(50)
@ -4773,6 +4863,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_PRO_TSCHEDUL");
});
@ -4821,8 +4917,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PickUpCrossings")
.HasMaxLength(50)
@ -4891,6 +4987,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_RETURN");
});
@ -4927,8 +5029,8 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDescription")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("PlantId")
.HasMaxLength(50)
@ -4981,6 +5083,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_SA_WEEK");
});
@ -5086,6 +5194,12 @@ namespace TaskManager.EntityFramework.Migrations
.IsUnique()
.HasFilter("[Id] IS NOT NULL");
b.HasIndex("ReadState");
b.HasIndex("TaskId");
b.HasIndex("WriteState");
b.ToTable("SUPPLIER_SINV_DATA", (string)null);
});
@ -5146,13 +5260,16 @@ namespace TaskManager.EntityFramework.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("UId"));
b.Property<string>("Api")
.HasColumnType("nvarchar(max)");
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<string>("Client")
.HasColumnType("nvarchar(max)");
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Corn")
.HasColumnType("nvarchar(max)");
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
@ -5161,7 +5278,11 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("bit");
b.Property<string>("Module")
.HasColumnType("nvarchar(max)");
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<int>("PageSize")
.HasColumnType("int");
b.Property<bool>("ReadState")
.HasColumnType("bit");
@ -5170,16 +5291,19 @@ namespace TaskManager.EntityFramework.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("TableName")
.HasColumnType("nvarchar(max)");
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<Guid>("TaskId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TaskName")
.HasColumnType("nvarchar(max)");
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Url")
.HasColumnType("nvarchar(max)");
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("WriteState")
.HasColumnType("bit");

44
API/Wood.Admin.WebApi/Other/ServiceCollectionExtensions.cs

@ -105,28 +105,28 @@ namespace Wood.Admin.WebApi
#endregion
#region autoJob 初始化
public static void UseAutoJob(this IApplicationBuilder app)
{
Task.Run(async () =>
{
if (GlobalContext.SystemConfig!.RunAutoJob)
{
//延迟 5s
await Task.Delay(5 * 1000);
try
{
AutoJobCenter jobCenter = new AutoJobCenter();
jobCenter.ScanJob();
await jobCenter.AddScheduleJob();
}
catch (Exception ex)
{
Log.Error(ex, "初始化自动job失败!");
}
}
});
}
//public static void UseAutoJob(this IApplicationBuilder app)
//{
// Task.Run(async () =>
// {
// if (GlobalContext.SystemConfig!.RunAutoJob)
// {
// //延迟 5s
// await Task.Delay(5 * 1000);
// try
// {
// AutoJobCenter jobCenter = new AutoJobCenter();
// jobCenter.ScanJob();
// await jobCenter.AddScheduleJob();
// }
// catch (Exception ex)
// {
// Log.Error(ex, "初始化自动job失败!");
// }
// }
// });
//}
#endregion
#region sqlsugar初始化

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

@ -11,15 +11,20 @@ using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Numeric;
using Quartz;
using SixLabors.ImageSharp.Drawing;
using Swashbuckle.AspNetCore.Filters;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using TaskManager.Controllers;
using TaskManager.Entity;
using TaskManager.EntityFramework;
@ -28,7 +33,9 @@ using TaskManager.EntityFramework.Repository;
using Wood.Admin.WebApi.Filter;
using Wood.Admin.WebApi.Middleware;
using Wood.Data.Repository;
using Wood.Service.Controllers;
using Wood.Service.Controllers.RegistService;
using Wood.Service.SystemManage;
using Wood.Util;
namespace Wood.Admin.WebApi
@ -67,26 +74,8 @@ namespace Wood.Admin.WebApi
GlobalContext.JwtConfig = Configuration.GetSection("JwtConfig").Get<JwtConfig>()!;
GlobalContext.Services = services;
GlobalContext.Configuration = Configuration;
//// 扫描当前程序集
//var assembly = Assembly.GetExecutingAssembly();
//// 方法1:按约定注册服务
//services.AddServicesByConvention(assembly);
//// 方法2:注册所有实现了IRepository接口的类
//services.AddImplementationsOf<IRepository>(assembly);
//// 方法3:注册特定命名空间下的所有服务
//services.Scan(scan => scan
// .FromAssemblyOf<Startup>()
// .AddClasses(classes => classes.InNamespace("YourProject.Services"))
// .AsImplementedInterfaces()
// .WithScopedLifetime());
@ -97,51 +86,7 @@ namespace Wood.Admin.WebApi
services.AddSqlSugar(Configuration);
services.AddHttpClient();
//services.AddScoped<LogController>();
//services.AddScoped<TaskConifgureController>();
//// 注册所有需要通过 GetRequiredService 获取的服务
//// 1. 整车月度生产计划相关
//services.AddScoped<SupplierProPlaningService>();
//// 2. M+6月物料需求计划相关
//services.AddScoped<CherySupplierMrpMonthService>();
//// 3. 日物料需求计划相关
//services.AddScoped<CherySupplierMrpDataService>();
//// 4. 计划协议相关
//services.AddScoped<CherySupplierSaWeekService>();
//// 5. 采购订单相关
//services.AddScoped<CherySupplierPoService>();
//// 6. 过焊装未过总装相关
//services.AddScoped<CherySupplierPorHSCHEDULService>();
//// 7. 过涂装未过总装相关
//services.AddScoped<CherySupplierProTSCHEDULService>(); // 注意类型名是否包含大小写问题(如驼峰命名)
//// 8. 排序供货相关
//services.AddScoped<CherySupplierProCSCHEDULService>();
//// 9. 看板配送单相关
//services.AddScoped<CherySupplierDelStateService>();
//// 10. 退货单相关
//services.AddScoped<CherySupplierReturnService>();
//// 11. 奇瑞RDC共享库存相关
//services.AddScoped<SupplierInvDataService>();
//// 12. 日MRP预警推移相关
//services.AddScoped<CherySupplierMrpWarningService>();
//// 13. 供应商共享库存相关
//services.AddScoped<CherySupplierSinvDataService>();
// 14. 风险确认相关服务(如果类型名正确)
@ -296,7 +241,7 @@ namespace Wood.Admin.WebApi
{
foreach (var item in assembly)
{
var xmlPath = Path.Combine(AppContext.BaseDirectory, $"{item.GetName().Name}.xml");
var xmlPath = System.IO.Path.Combine(AppContext.BaseDirectory, $"{item.GetName().Name}.xml");
if (File.Exists(xmlPath))
options.IncludeXmlComments(xmlPath, true);
@ -352,22 +297,26 @@ namespace Wood.Admin.WebApi
#endregion
});
//services.AddControllers();
//var s = services.BuildServiceProvider().GetRequiredService<TaskConifgureController>();
//services.AddSingleton<BackgroundService>();
//services.AddHostedService<BackgroundService>();
services.AddSingleton<LogController>();
services.AddHostedService<LogConsumerService>();
//s.TaskAllAsync("2025-05-29");
}
/// <summary>
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
/// <summary>
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{

8
API/Wood.Admin.WebApi/Wood.Admin.WebApi.csproj

@ -20,6 +20,14 @@
<ItemGroup>
<Content Remove="wwwroot\DataSeed.sql" />
<Content Remove="奇瑞RDC共享库存.json" />
<Content Remove="整车月度生产计划1.json" />
<Content Remove="日MRP状态监控.json" />
<Content Remove="日物料需求计划.json" />
<Content Remove="计划协议.json" />
<Content Remove="过涂装未过总装.json" />
<Content Remove="过焊装未过总装.json" />
<Content Remove="采购订单.json" />
</ItemGroup>
<ItemGroup>

86
API/Wood.Service/Controllers/CheryDataMaintenanceService.cs

@ -0,0 +1,86 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskManager.Entity;
using TaskManager.EntityFramework;
using Wood.Entity;
namespace Wood.Service.Controllers
{
public class CheryDataMaintenanceService:IScoped,IDoExecute
{
private readonly IServiceProvider _serviceProvider;
private readonly IConfiguration _configuration;
public CheryDataMaintenanceService(IServiceProvider serviceProvider, IConfiguration configuration)
{
_serviceProvider = serviceProvider;
_configuration = configuration;
}
public async Task ExecuteAsync(string url, string path, string takName, string client, int pageSize)
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<JobDbContext>();
var tasklist=db.TaskConifgure.Where(p=>p.Client=="Chery").Select(x => x.TaskName);
//DateTime.Now.AddDays(-1).ToString("yyyyMMdd")
foreach (var task in tasklist)
{
}
}
public async Task SyncDataAsync(string version,string taskName)
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<JobDbContext>();
var list = db.TaskLogs.Where(x => x.TaskName == taskName && x.Version == version
&& !string.IsNullOrEmpty(x.Path) && x.Type == "应答");
if (list.Any())
{
}
}
}
}

24
API/Wood.Service/Controllers/CheryRecurringJobInputPageController.cs

@ -64,16 +64,18 @@ namespace TaskManager.Controllers
Path = first.Api;
TaskName = first.TaskName;
Client = client;
CPageSize = first.PageSize;
await SyncTaskSubTable(TaskName, Client);
}
protected override async Task DoExecutingAsync(string url, string path, string takName, string client)
protected override async Task DoExecutingAsync(string url, string path, string takName, string client, int pagesize)
{
Url = url;
Path = path;
TaskName = takName;
Client = client;
CPageSize = pagesize;
await SyncTaskSubTable(TaskName,Client);
}
@ -166,7 +168,7 @@ namespace TaskManager.Controllers
return;
}
var sublist = _jobDbContext.TaskSub.Where(p => taskName.Contains(p.TaskName) && p.WriteState == false && p.Subscriber == client ).ToList();
int pageSize = 10;
int pageSize = CPageSize;
if (sublist.Any())
{
foreach (var sub in sublist)
@ -206,7 +208,7 @@ namespace TaskManager.Controllers
itm.WriteState = true;
}
var result = await PostPageAsync(pagedRequest,sub.TaskId, DateTime.Now.ToString("yyyyMMdd"));
if (result.code == "200")
if(result.code == "200")
{
_jobDbContext.BulkUpdate(records);
sub.SyncedPageCount = i;
@ -497,7 +499,7 @@ namespace TaskManager.Controllers
}
catch (Exception ex)
{
await _logger.AddError(ex.Message, TaskName);
//await _logger.AddError(ex.Message, TaskName);
return new JsonResult(new { Code = 400, Message = "导入失败:" + ex.Message });
}
}
@ -529,10 +531,18 @@ namespace TaskManager.Controllers
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)
public class DecimalTrimConverter : JsonConverter<decimal>
{
// 关键步骤:使用 TrimTrailingZeros() 去掉末尾的 0
writer.WriteStringValue(value.ToString("0.########################", CultureInfo.InvariantCulture));
public override decimal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.GetDecimal();
}
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)
{
// 关键步骤:使用 TrimTrailingZeros() 去掉末尾的 0
writer.WriteStringValue(value.ToString("0.########################", CultureInfo.InvariantCulture));
}
}
}
}

320
API/Wood.Service/Controllers/CheryRecurringJobOutPageController.cs

@ -86,7 +86,7 @@ namespace TaskManager.Controllers
var readedcount = _jobDbContext.Set<T>().Where(p => p.RequestDate == inputdate).Count();
if (readedcount == 0)//第一次请求用false,接口人胡启名要求
{
PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date,PageSize=100, IsForce = false},taskId,version);
PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date,PageSize=CPageSize, IsForce = false},taskId,version);
if (firstResponse == null || firstResponse.Code != 200)
{
@ -110,17 +110,12 @@ namespace TaskManager.Controllers
// firstResponse.Data.Rows.Select(p=>p.Id)
foreach (var itm in firstResponse.Data.Rows)
{
T entity = new T();
entity.InjectFrom(itm);
entity.CreationTime = DateTime.Now;
entity.RequestDate = date;
pagefirstList.Add(entity);
allData.Add(itm);
}
@ -163,7 +158,7 @@ namespace TaskManager.Controllers
// 循环请求剩余页面
for (currentPage = 2; currentPage <= totalPages; currentPage++)
{
PAGE_DTO pageinput = new PAGE_DTO() { Date = date, PageNum = currentPage, PageSize = 100, IsForce = false };
PAGE_DTO pageinput = new PAGE_DTO() { Date = date, PageNum = currentPage, PageSize = CPageSize, IsForce = false };
Console.WriteLine($"正在请求第 {currentPage} 页...");
PagedResponse<ToutputDetial> pageResponse = await GetPageAsync(pageinput, taskId, version);
@ -177,6 +172,7 @@ namespace TaskManager.Controllers
T entity = new T();
entity.InjectFrom(itm);
entity.CreationTime = DateTime.Now;
entity.RequestDate = date;
pageList.Add(entity);
allData.Add(itm);
}
@ -225,7 +221,7 @@ namespace TaskManager.Controllers
else
{
PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date, PageSize = 100, IsForce = true },taskId,version);
PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date, PageSize = CPageSize, IsForce = true },taskId,version);
if (firstResponse == null || firstResponse.Code != 200)
{
await _logger.AddInfo("首次请求失败,无法获取分页信息。", TaskName, taskId, version);
@ -250,6 +246,7 @@ namespace TaskManager.Controllers
entity.InjectFrom(itm);
entity.CreationTime = DateTime.Now;
pagefirstList.Add(entity);
entity.RequestDate = date;
allData.Add(itm);
}
@ -289,7 +286,7 @@ namespace TaskManager.Controllers
// 循环请求剩余页面
for (currentPage = 2; currentPage <= totalPages; currentPage++)
{
PAGE_DTO pageinput = new PAGE_DTO() { Date = date, PageNum = currentPage, PageSize = 100, IsForce = true };
PAGE_DTO pageinput = new PAGE_DTO() { Date = date, PageNum = currentPage, PageSize = CPageSize, IsForce = true };
//Console.WriteLine($"正在请求第 {currentPage} 页...");
PagedResponse<ToutputDetial> pageResponse = await GetPageAsync(pageinput,taskId,version);
if (pageResponse?.Data.Rows != null && pageResponse.Data.Rows.Count > 0)
@ -300,6 +297,7 @@ namespace TaskManager.Controllers
T entity = new T();
entity.InjectFrom(itm);
entity.CreationTime = DateTime.Now;
entity.RequestDate = date;
pageList.Add(entity);
allData.Add(itm);
}
@ -413,14 +411,16 @@ namespace TaskManager.Controllers
Url =first.Url;
Path = first.Api;
TaskName = taskName;
CPageSize = first.PageSize;
await FetchAllDataAsync(inputdate);
}
protected override async Task DoExecutingAsync(string url, string path, string takName, string client)
protected override async Task DoExecutingAsync(string url, string path, string takName, string client, int pagesize)
{
Url = url;
Path = path;
TaskName = takName;
Client = client;
CPageSize = pagesize;
await FetchAllDataAsync(string.Empty);
}
@ -488,41 +488,9 @@ namespace TaskManager.Controllers
await _repository.DeleteAsync(id);
return new JsonResult(new { Code = 200, Message = "删除成功!" }); ;
}
/// <summary>
/// 分页
/// </summary>
/// <param name="pageNumber">第几页</param>
/// <param name="pageSize">每页条数</param>
/// <param name="sortBy">排序字段</param>
/// <param name="isAscending">正序还是倒序</param>
/// <param name="filters">过滤条件</param>
/// <returns></returns>
//[HttpGet]
//public async Task<ActionResult> GetPaged(
//[FromQuery] int pageNumber = 1,
//[FromQuery] int pageSize = 10,
//[FromQuery] string sortBy = "",
//[FromQuery] bool isAscending = true,
//[FromQuery] Dictionary<string, string> filters = null)
//{
// var pagingParams = new PagingParams
// {
// PageNumber = pageNumber,
// PageSize = pageSize,
// SortBy = sortBy,
// IsAscending = isAscending,
// Filters = filters
// };
// // 可以在这里构建表达式树过滤条件
// Expression<Func<T, bool>> filter = null;
// var pagedResult = await _repository.GetPagedAsync(filter, pagingParams);
// return Ok(pagedResult);
//}
/// <summary>
/// 分页New
/// 分页
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
@ -553,34 +521,7 @@ namespace TaskManager.Controllers
/// <param name="sortBy">排序字段</param>
/// <param name="isAscending">正序还是倒序</param>
/// <param name="filters">过滤条件</param>
/// <returns></returns>
// [HttpGet]
// public async Task<FileStreamResult> Export([FromQuery] int pageNumber = 1,
//[FromQuery] int pageSize = 10,
//[FromQuery] string sortBy = "",
//[FromQuery] bool isAscending = true,
//[FromQuery] Dictionary<string, string> filters = null)
// {
// var pagingParams = new PagingParams
// {
// PageNumber = pageNumber,
// PageSize = pageSize,
// SortBy = sortBy,
// IsAscending = isAscending,
// Filters = filters
// };
// // 可以在这里构建表达式树过滤条件
// //Expression<Func<T, bool>> filter = null;
// var pagedResult = await _repository.GetPagedAsync(null, pagingParams);
// return await ExportFile(pagedResult.Data, Guid.NewGuid().ToString() + ".xlsx");
// }
/// <summary>
/// 导出New
/// </summary>
@ -713,7 +654,7 @@ namespace TaskManager.Controllers
}
catch (Exception ex)
{
await _logger.AddError(ex.Message, TaskName);
//await _logger.AddError(ex.Message, TaskName);
return new JsonResult(new { Code = 400, Message = "导入失败:" + ex.Message });
}
}
@ -777,3 +718,238 @@ namespace TaskManager.Controllers
}
/*并发修改*/
//public class CheryRecurringJobOutPageController<T, ToutputDetial> : RecurringJobBaseController
// where T : CherryReadBaseEntity, new()
// where ToutputDetial : CherryReadBaseEntityDto
//{
// // 其他成员保持不变...
// // 并发控制参数
// private readonly int _maxConcurrency;
// private readonly SemaphoreSlim _semaphore;
// public CheryRecurringJobOutPageController(
// HttpClient httpClient,
// JobDbContext jobDbContext,
// LogController log,
// IRepository<T> repository,
// int maxConcurrency = 5) : base(httpClient, jobDbContext, log)
// {
// _repository = repository;
// _maxConcurrency = maxConcurrency;
// _semaphore = new SemaphoreSlim(maxConcurrency);
// }
// [NonAction]
// public async Task<List<ToutputDetial>> FetchAllDataAsync(string inputdate)
// {
// var allData = new List<ToutputDetial>();
// int totalItems = 0;
// int pageSize = 0;
// int currentPage = 1;
// string date = !string.IsNullOrEmpty(inputdate) ? inputdate : DateTime.Now.ToString("yyyy-MM-dd");
// var taskId = Guid.NewGuid();
// var version = date.Replace("-", "");
// var readedcount = _jobDbContext.Set<T>().Where(p => p.RequestDate == inputdate).Count();
// if (readedcount == 0)
// {
// PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date, PageSize = CPageSize, IsForce = false }, taskId, version);
// if (firstResponse == null || firstResponse.Code != 200)
// {
// await _logger.AddError("首次请求失败,无法获取分页信息。", TaskName, taskId, version);
// return allData;
// }
// if (firstResponse.Data.Total == "0")
// {
// await _logger.AddInfo("首次请求失败,Total为0是否已经全部读取过。", TaskName, taskId, version);
// return allData;
// }
// if (readedcount != int.Parse(firstResponse.Data.Total))
// {
// var ids = _jobDbContext.Set<T>().Where(p => p.RequestDate == inputdate).Select(p => p.Id).ToList();
// totalItems = int.Parse(firstResponse.Data.Total);
// pageSize = int.Parse(firstResponse.Data.PageSize);
// List<T> pagefirstList = new List<T>();
// foreach (var itm in firstResponse.Data.Rows)
// {
// T entity = new T();
// entity.InjectFrom(itm);
// entity.CreationTime = DateTime.Now;
// entity.RequestDate = date;
// pagefirstList.Add(entity);
// allData.Add(itm);
// }
// if (pagefirstList.Any())
// {
// await InsertDataAsync(pagefirstList);
// }
// // 计算总页数
// int totalPages = (int)Math.Ceiling((double)totalItems / pageSize);
// // 并发请求剩余页面
// await FetchPagesConcurrently(2, totalPages, date, taskId, version, ids, allData);
// await _logger.AddInfo($"所有数据获取完成,总共获取了 {allData.Count} 条记录", TaskName, taskId, version);
// }
// }
// else
// {
// // 类似的逻辑,修改为并发请求
// PagedResponse<ToutputDetial> firstResponse = await GetPageAsync(new PAGE_DTO() { Date = date, PageSize = CPageSize, IsForce = true }, taskId, version);
// if (firstResponse == null || firstResponse.Code != 200)
// {
// await _logger.AddInfo("首次请求失败,无法获取分页信息。", TaskName, taskId, version);
// return allData;
// }
// if (firstResponse.Data.Total == "0")
// {
// await _logger.AddInfo("首次请求失败,Total为0是否已经全部读取过。", TaskName, taskId, version);
// return allData;
// }
// if (readedcount != int.Parse(firstResponse.Data.Total))
// {
// var ids = _jobDbContext.Set<T>().Where(p => p.RequestDate == inputdate).Select(p => p.Id).ToList();
// totalItems = int.Parse(firstResponse.Data.Total);
// pageSize = int.Parse(firstResponse.Data.PageSize);
// List<T> pagefirstList = new List<T>();
// foreach (var itm in firstResponse.Data.Rows)
// {
// T entity = new T();
// entity.InjectFrom(itm);
// entity.CreationTime = DateTime.Now;
// entity.RequestDate = date;
// pagefirstList.Add(entity);
// allData.Add(itm);
// }
// if (pagefirstList.Any())
// {
// await InsertDataAsync(pagefirstList);
// }
// int totalPages = (int)Math.Ceiling((double)totalItems / pageSize);
// // 并发请求剩余页面
// await FetchPagesConcurrently(2, totalPages, date, taskId, version, ids, allData);
// await _logger.AddInfo($"所有数据获取完成,总共获取了 {allData.Count} 条记录", TaskName, taskId, version);
// }
// }
// return allData;
// }
// private async Task FetchPagesConcurrently(int startPage, int totalPages, string date, Guid taskId, string version, List<int> existingIds, List<ToutputDetial> allData)
// {
// var tasks = new List<Task>();
// // 为每个页面创建一个任务
// for (int page = startPage; page <= totalPages; page++)
// {
// int currentPage = page; // 避免闭包问题
// tasks.Add(ProcessPageAsync(currentPage, date, taskId, version, existingIds, allData));
// }
// // 分批执行任务,控制并发量
// for (int i = 0; i < tasks.Count; i += _maxConcurrency)
// {
// int batchSize = Math.Min(_maxConcurrency, tasks.Count - i);
// var batch = tasks.GetRange(i, batchSize);
// await Task.WhenAll(batch);
// }
// }
// private async Task ProcessPageAsync(int page, string date, Guid taskId, string version, List<int> existingIds, List<ToutputDetial> allData)
// {
// await _semaphore.WaitAsync(); // 限制并发量
// try
// {
// PAGE_DTO pageinput = new PAGE_DTO() { Date = date, PageNum = page, PageSize = CPageSize, IsForce = existingIds.Count == 0 ? false : true };
// //Console.WriteLine($"正在请求第 {page} 页...");
// PagedResponse<ToutputDetial> pageResponse = await GetPageAsync(pageinput, taskId, version);
// if (pageResponse?.Data.Rows != null && pageResponse.Data.Rows.Count > 0)
// {
// List<T> pageList = new List<T>();
// foreach (var itm in pageResponse.Data.Rows)
// {
// T entity = new T();
// entity.InjectFrom(itm);
// entity.CreationTime = DateTime.Now;
// entity.RequestDate = date;
// pageList.Add(entity);
// allData.Add(itm);
// }
// if (pageList.Any())
// {
// await InsertDataAsync(pageList);
// }
// }
// else
// {
// await _logger.AddInfo($"第 {page} 页未返回数据", TaskName, taskId, version);
// }
// }
// catch (Exception ex)
// {
// await _logger.AddError($"第 {page} 页请求出错: {ex.Message}", TaskName, taskId, version);
// }
// finally
// {
// _semaphore.Release(); // 释放信号量
// }
// }
// // 优化数据库插入方法,支持批量处理
// private async Task InsertDataAsync(List<T> list)
// {
// if (list.Any())
// {
// // 使用分块处理大列表,避免内存压力
// int batchSize = 500;
// for (int i = 0; i < list.Count; i += batchSize)
// {
// int end = Math.Min(i + batchSize, list.Count);
// var batch = list.GetRange(i, end - i);
// using (var transaction = await _jobDbContext.Database.BeginTransactionAsync())
// {
// try
// {
// await _jobDbContext.BulkMergeAsync(batch, options => { options.ColumnPrimaryKeyExpression = p => p.Id; });
// await ConfirmDataInsertAsync(batch, _jobDbContext, transaction.GetDbTransaction());
// await transaction.CommitAsync();
// }
// catch (Exception ex)
// {
// await transaction.RollbackAsync();
// await _logger.AddError($"数据插入失败: {ex.Message}", TaskName, Guid.NewGuid(), "1.0");
// }
// }
// // 短暂延迟,避免数据库过载
// await Task.Delay(100);
// }
// }
// }
// // 其他方法保持不变...
//}

16
API/Wood.Service/Controllers/CherySupplierConMmrpService.cs

@ -19,6 +19,22 @@ namespace TaskManager.Controllers
public CherySupplierConMmrpService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_CON_MMRP> repository) : base(httpClient, jobDbContext, log, repository)
{
}
[HttpGet]
public async Task<SUPPLIER_MRP_MONTH> GetDetialByID(String id)
{
SUPPLIER_MRP_MONTH first = new SUPPLIER_MRP_MONTH();
var m = await _jobDbContext.SUPPLIER_MRP_MONTH.FirstOrDefaultAsync(p => p.Id == id);
if (m != null)
{
return m;
}
return first;
}
/// <summary>
/// 审批通过
/// </summary>

8
API/Wood.Service/Controllers/CherySupplierMrpDataService.cs

@ -70,7 +70,13 @@ namespace TaskManager.Controllers
list.Add(con);
});
await dbContext.BulkInsertAsync(list, options => { options.Transaction = dbTransaction; options.UseTableLock = false; });
await dbContext.BulkMergeAsync(list, options => { options.Transaction = dbTransaction; options.UseTableLock = false;
options.ColumnPrimaryKeyExpression = p => p.Id ;
});
}
return;
}

27
API/Wood.Service/Controllers/CherySupplierMrpMonthService.cs

@ -1,11 +1,15 @@
using Magicodes.ExporterAndImporter.Core;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Data.Common;
using System.Linq.Dynamic.Core;
using TaskManager.Contracts.Dtos;
using TaskManager.Controllers;
using TaskManager.Entity;
using TaskManager.Entity.Entitys;
using TaskManager.EntityFramework;
using Z.BulkOperations;
using Z.EntityFramework.Extensions;
namespace TaskManager.Controllers
@ -21,6 +25,22 @@ namespace TaskManager.Controllers
}
[HttpGet]
public async Task<SUPPLIER_MRP_MONTH> GetDetialByID(String id)
{
SUPPLIER_MRP_MONTH first = new SUPPLIER_MRP_MONTH();
var m = await _jobDbContext.SUPPLIER_MRP_MONTH.FirstOrDefaultAsync(p => p.Id == id);
if (m != null)
{
return m;
}
return first;
}
protected override async Task ConfirmDataInsertAsync(List<SUPPLIER_MRP_MONTH> plist, JobDbContext dbContext, DbTransaction dbTransaction)
{
if (plist.Count > 0)
@ -54,7 +74,12 @@ namespace TaskManager.Controllers
list.Add(con);
});
await dbContext.BulkInsertAsync(list, options=> { options.Transaction = dbTransaction; options.UseTableLock = false; });
await dbContext.BulkMergeAsync(list, options=> { options.Transaction = dbTransaction; options.UseTableLock = false;
options.ColumnPrimaryKeyExpression = p => p.Id;
});
}
return;
}

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

@ -41,7 +41,12 @@ namespace TaskManager.Controllers
list.Add(con);
});
await dbContext.BulkInsertAsync(list, options => { options.Transaction = dbTransaction; options.UseTableLock = false; });
await dbContext.BulkMergeAsync(list, options => { options.Transaction = dbTransaction; options.UseTableLock = false;
options.ColumnPrimaryKeyExpression = p => p.Id;
});
}
return;
}

21
API/Wood.Service/Controllers/CustomLogService.cs

@ -0,0 +1,21 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskManager.Entity;
using TaskManager.EntityFramework;
namespace Wood.Service.Controllers
{
/// <summary>
/// 读取日志服务
/// </summary>
public class CustomLogService : NormalBaseController<TaskLog>
{
public CustomLogService(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository<TaskLog> repository) : base(context, builder, configuration, repository)
{
}
}
}

286
API/Wood.Service/Controllers/LogConsumerService.cs

@ -0,0 +1,286 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity.Data;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Json;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Threading.Channels;
using System.Threading.Tasks;
using TaskManager.Entity;
using TaskManager.EntityFramework;
using Wood.Entity;
using Wood.Service.SystemManage;
namespace TaskManager.Controllers
{
public class LogConsumerService : BackgroundService
{
private readonly ChannelReader<TaskLog> _logReader;
private readonly ILogger<LogConsumerService> _logger;
private const int BatchSize = 100; // 批量写入大小
private readonly string _logDirectory;
private readonly IServiceProvider _serviceProvider;
public LogConsumerService(
LogController logService,
ILogger<LogConsumerService> logger, IServiceProvider serviceProvider)
{
_logReader = logService.GetLogReader();
_logger = logger;
_serviceProvider = serviceProvider; ;
_logDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CustomLogs"); // 使用更安全的路径获取方式
EnsureDirectoryExists(_logDirectory);
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("日志消费服务已启动");
// 批量处理日志,减少数据库写入次数
while (!stoppingToken.IsCancellationRequested &&
await _logReader.WaitToReadAsync(stoppingToken))
{
try
{
var logs = new List<TaskLog>();
int count = 0;
// 读取一批日志
while (_logReader.TryRead(out var log) && count < BatchSize)
{
logs.Add(log);
count++;
}
if (logs.Any())
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<JobDbContext>();
List<TaskLog> logsToSave = new List<TaskLog>();
foreach (var log in logs)
{
if (!string.IsNullOrEmpty(log.Remark))
{
log.Path = WriteLogToFile(log.Remark);
}
log.Remark = string.Empty;
logsToSave.Add(log);
}
await db.TaskLogs.AddRangeAsync(logsToSave, stoppingToken);
await db.SaveChangesAsync(stoppingToken);
_logger.LogInformation($"已写入 {logs.Count} 条日志");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "日志写入数据库失败");
// 错误处理:可记录到临时文件或重试
await Task.Delay(1000, stoppingToken); // 短暂延迟后重试
}
}
}
public override async Task StopAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("日志消费服务正在停止");
// 处理剩余日志
await base.StopAsync(stoppingToken);
}
private void EnsureDirectoryExists(string directoryPath)
{
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
}
// 修改后的日志写入方法
private string WriteLogToFile(string jsonContent)
{
//if string.IsNullOrEmpty(logMessage.RawRemark)) return null; // 必须提供JSON数据
// 创建日期目录
string dateDirectory = DateTime.Now.ToString("yyyy-MM-dd");
string fullDatePath = Path.Combine(_logDirectory, dateDirectory);
EnsureDirectoryExists(fullDatePath);
// 生成唯一文件名(时间戳+随机数)
string fileName = $"log_{DateTime.Now.Ticks}_{Random.Shared.Next(1000, 9999)}.json";
string fullPath = Path.Combine(fullDatePath, fileName);
try
{
// 写入文件(使用UTF-8无BOM格式)
File.WriteAllText(fullPath, jsonContent, new UTF8Encoding(false));
// 存储相对路径(从日志根目录开始,使用正斜杠兼容API)
return Path.Combine(dateDirectory, fileName).Replace('\\', '/');
}
catch (Exception ex)
{
Console.WriteLine($"JSON文件写入失败:{ex.Message}");
return null;
}
}
}
// 后台服务
//public class LogBackgroundService : BackgroundService
//{
// private readonly Channel<TaskLog> _logChannel;
// private readonly IServiceProvider _serviceProvider;
// private readonly string _logDirectory;
// public LogBackgroundService(IServiceProvider serviceProvider, IConfiguration configuration)
// {
// Console.WriteLine("LogService 初始化");
// _serviceProvider = serviceProvider;
// _logDirectory = configuration["Logging:Directory"] ??
// Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CustomLogs"); // 使用更安全的路径获取方式
// EnsureDirectoryExists(_logDirectory);
// _logChannel = Channel.CreateUnbounded<TaskLog>();
// }
// public void EnqueueLog(TaskLog log)
// {
// _logChannel.Writer.TryWrite(log);
// }
// public override async Task StartAsync(CancellationToken cancellationToken)
// {
// // 服务启动前的准备工作
// // _logger.LogInformation("Worker starting up...");
// // 调用基类方法
// await base.StartAsync(cancellationToken);
// }
// public override async Task StopAsync(CancellationToken cancellationToken)
// {
// // 服务停止前的清理工作
// //_logger.LogInformation("Worker shutting down...");
// // 调用基类方法
// await base.StopAsync(cancellationToken);
// }
// public override void Dispose()
// {
// // 资源释放
// // _logger.LogInformation("Worker disposing resources");
// base.Dispose();
// }
// protected override async Task ExecuteAsync(CancellationToken stoppingToken)
// {
// Console.WriteLine("LogService 开始执行后台任务");
// using PeriodicTimer timer = new(TimeSpan.FromSeconds(10));
// // 主循环 - 使用 PeriodicTimer 等待下一个触发时间
// while (await timer.WaitForNextTickAsync(stoppingToken))
// {
// await foreach (var log in _logChannel.Reader.ReadAllAsync(stoppingToken))
// {
// try
// {
// if (!string.IsNullOrEmpty(log.Remark))
// {
// log.Path = WriteLogToFile(log.Remark);
// }
// log.Remark = string.Empty;
// using var scope = _serviceProvider.CreateScope();
// var db = scope.ServiceProvider.GetRequiredService<JobDbContext>();
// await db.TaskLogs.AddAsync(log, stoppingToken);
// await db.SaveChangesAsync(stoppingToken);
// Console.WriteLine($"日志已保存: {log.Info}");
// }
// catch (Exception ex)
// {
// Console.WriteLine($"日志处理失败: {ex.Message}");
// }
// }
// }
// Console.WriteLine("LogService 后台任务已停止");
// }
// private void EnsureDirectoryExists(string directoryPath)
// {
// if (!Directory.Exists(directoryPath))
// {
// Directory.CreateDirectory(directoryPath);
// }
// }
// // 修改后的日志写入方法
// private string WriteLogToFile(string jsonContent)
// {
// //if string.IsNullOrEmpty(logMessage.RawRemark)) return null; // 必须提供JSON数据
// // 创建日期目录
// string dateDirectory = DateTime.Now.ToString("yyyy-MM-dd");
// string fullDatePath = Path.Combine(_logDirectory, dateDirectory);
// EnsureDirectoryExists(fullDatePath);
// // 生成唯一文件名(时间戳+随机数)
// string fileName = $"log_{DateTime.Now.Ticks}_{Random.Shared.Next(1000, 9999)}.json";
// string fullPath = Path.Combine(fullDatePath, fileName);
// try
// {
// // 写入文件(使用UTF-8无BOM格式)
// File.WriteAllText(fullPath, jsonContent, new UTF8Encoding(false));
// // 存储相对路径(从日志根目录开始,使用正斜杠兼容API)
// return Path.Combine(dateDirectory, fileName).Replace('\\', '/');
// }
// catch (Exception ex)
// {
// Console.WriteLine($"JSON文件写入失败:{ex.Message}");
// return null;
// }
// }
//}
}

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

@ -17,47 +17,60 @@ using TaskManager.Entity;
using TaskManager.EntityFramework;
using TaskManager.EntityFramework.Repository;
using Wood.Service.Controllers;
using System;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace TaskManager.Controllers
{
public class LogController:NormalBaseController<TaskLog>
public class LogController
{
public LogController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository<TaskLog> repository) : base(context, builder, configuration, repository)
private readonly Channel<TaskLog> _logChannel;
public LogController(int bufferSize = 1000)
{
// 创建有界通道,设置缓冲区大小
var options = new BoundedChannelOptions(bufferSize)
{
FullMode = BoundedChannelFullMode.Wait
};
_logChannel = Channel.CreateBounded<TaskLog>(options);
}
public async Task<List<TaskLog>> GetAll()
public void EnqueueLog(TaskLog log)
{
var log = await _context.TaskLogs.ToListAsync();
return log;
_logChannel.Writer.TryWrite(log);
}
//[HttpGet("AddError")]
//public async Task<bool> AddError(string message,string taskname)
//private readonly LogBackgroundService _logService;
//public LogController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository<TaskLog> repository, LogBackgroundService logService) : base(context, builder, configuration, repository)
//{
// _context.TaskLogs.Add(new TaskLog() { Info = message, Type = "错误",TaskName=taskname ,CreationTime=DateTime.Now});
// var result =await _context.SaveChangesAsync();
// if (result > 0)
// {
// return true;
// }
// return false;
// _logService = logService;
//}
//[HttpGet("AddInfo")]
//public async Task<bool> AddInfo(string message, string taskname)
//[HttpGet]
//public async Task<List<TaskLog>> GetAll()
//{
// _context.TaskLogs.Add(new TaskLog() { Info = message, Type = "记录", TaskName = taskname, CreationTime = DateTime.Now });
// var result = await _context.SaveChangesAsync();
// if (result > 0)
// {
// return true;
// }
// return false;
// var log = await _context.TaskLogs.ToListAsync();
// return log;
//}
public ChannelReader<TaskLog> GetLogReader()
{
return _logChannel.Reader;
}
[HttpGet("AddError")]
[NonAction]
//[HttpGet("AddError")]
public async Task<bool> AddError(string message, string taskname, Guid taskid, string version)
{
var log = new TaskLog
@ -69,14 +82,14 @@ namespace TaskManager.Controllers
TaskId = taskid,
Version = version?.ToString()
};
_context.TaskLogs.Add(log);
var result = await _context.SaveChangesAsync();
EnqueueLog(log);
//_context.TaskLogs.Add(log);
//var result = await _context.SaveChangesAsync();
return true; // 日志已入队,视为成功
}
[HttpGet("AddInfo")]
[NonAction]
//[HttpGet("AddInfo")]
public async Task<bool> AddInfo(string message, string taskname, Guid taskid, string version)
{
var log = new TaskLog
@ -88,14 +101,15 @@ namespace TaskManager.Controllers
TaskId = taskid,
Version = version?.ToString()
};
_context.TaskLogs.Add(log);
var result = await _context.SaveChangesAsync();
EnqueueLog(log);
//_context.TaskLogs.Add(log);
//var result = await _context.SaveChangesAsync();
return true;
}
[HttpGet("AddPostRequest")]
public async Task<bool> AddPostRequest(string message, string taskname, Guid taskid, string version,string remark)
[NonAction]
//[HttpGet("AddPostRequest")]
public async Task<bool> AddPostRequest(string message, string taskname, Guid taskid, string version, string remark)
{
var log = new TaskLog
{
@ -105,14 +119,16 @@ namespace TaskManager.Controllers
CreationTime = DateTime.Now,
TaskId = taskid,
Version = version?.ToString(),
Remark = remark
Remark = remark
};
_context.TaskLogs.Add(log);
var result = await _context.SaveChangesAsync();
EnqueueLog(log);
//_context.TaskLogs.Add(log);
//var result = await _context.SaveChangesAsync();
return true;
}
[HttpGet("AddPostResponse")]
public async Task<bool> AddPostResponse(string message, string taskname, Guid taskid, string version,string remaek)
[NonAction]
//[HttpGet("AddPostResponse")]
public async Task<bool> AddPostResponse(string message, string taskname, Guid taskid, string version, string remaek)
{
var log = new TaskLog
{
@ -122,99 +138,15 @@ namespace TaskManager.Controllers
CreationTime = DateTime.Now,
TaskId = taskid,
Version = version?.ToString(),
Remark = remaek
Remark = remaek
};
_context.TaskLogs.Add(log);
var result = await _context.SaveChangesAsync();
EnqueueLog(log);
return true;
}
[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,
[FromQuery] int pageSize = 10,
[FromQuery] string sortBy = "",
[FromQuery] bool isAscending = true,
[FromQuery] Dictionary<string, string> filters = null)
{
var pagingParams = new PagingParams
{
PageNumber = pageNumber,
PageSize = pageSize,
SortBy = sortBy,
IsAscending = isAscending,
Filters = filters
};
// 可以在这里构建表达式树过滤条件
Expression<Func<T, bool>> filter = null;
var pagedResult = await _repository.GetPagedAsync(null, pagingParams);
return await ExportFile<TaskLog>(pagedResult.Data, Guid.NewGuid().ToString() + ".xlsx");
}
protected async Task<FileStreamResult> ExportFile<T>(ICollection<T> dtos, string fileName) where T : class, new()
{
var excelExporter = HttpContext.RequestServices.GetRequiredService<IExcelExporter>();
var res = await excelExporter.ExportAsByteArray(dtos);
return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_" + fileName };
}
}
/// 导出
/// </summary>
/// <param name="pageNumber">第几页</param>
/// <param name="pageSize">每页条数</param>
/// <param name="sortBy">排序列</param>
/// <param name="isAscending">是否升序</param>
/// <param name="filters">查询条件</param>
/// <returns></returns>
//private readonly IServiceProvider _serviceProvider;
//public LogController(IServiceProvider serviceProvider)
//{
// _serviceProvider = serviceProvider;
//}
//public async Task<IEnumerable<Logs>> GetLogs()
//{
// var dbcontext= _serviceProvider.GetRequiredService<JobDbContext>();
// var connection=dbcontext.Database.GetDbConnection();
// connection.Query<Logs>("select top 10 * from logs");
//}
}
}

162
API/Wood.Service/Controllers/LogService.cs

@ -1,162 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
using TaskManager.Entity;
using TaskManager.EntityFramework;
namespace Wood.Service.Controllers
{
public class LogController1 : BackgroundService
{
private readonly IServiceProvider _serviceProvider;
private readonly Channel<TaskLog> _logChannel;
private readonly string _logDirectory;
public LogController1(
IServiceProvider serviceProvider,
IConfiguration configuration)
{
_serviceProvider = serviceProvider;
_logDirectory = configuration["Logging:Directory"] ??
Path.Combine(Directory.GetCurrentDirectory(), "Logs");
EnsureDirectoryExists(_logDirectory);
_logChannel = Channel.CreateUnbounded<TaskLog>();
}
public void EnqueueLog(TaskLog logMessage)
{
// 设置日志路径并写入文件
logMessage.Path= WriteLogToFile(logMessage);
// 将日志加入处理队列
_logChannel.Writer.TryWrite(logMessage);
}
private string WriteLogToFile(TaskLog logMessage)
{
// 获取今天的日期目录
string todayDirectory = Path.Combine(_logDirectory, DateTime.Now.ToString("yyyy-MM-dd"));
// 确保目录存在
EnsureDirectoryExists(todayDirectory);
// 创建或追加到日志文件
string logFilePath = Path.Combine(todayDirectory, "application.log");
try
{
// 写入日志内容到文件
File.AppendAllText(logFilePath,
$"[{logMessage.CreationTime:yyyy-MM-dd HH:mm:ss}] [{logMessage.Type}] {logMessage.Info}{Environment.NewLine}");
// 返回相对路径(从日志根目录开始)
return Path.GetRelativePath(_logDirectory, logFilePath);
}
catch (Exception ex)
{
// 记录日志写入失败的错误
Console.WriteLine($"Error writing log to file: {ex.Message}");
return null;
}
}
private void EnsureDirectoryExists(string directoryPath)
{
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
}
}
[HttpGet("AddError")]
public async Task<bool> AddError(string message, string taskname, Guid taskid, Version version)
{
var log = new TaskLog
{
Info = message,
Type = "错误",
TaskName = taskname,
CreationTime = DateTime.Now,
TaskId = taskid,
Version = version?.ToString()
};
EnqueueLog(log);
return true; // 日志已入队,视为成功
}
[HttpGet("AddInfo")]
public async Task<bool> AddInfo(string message, string taskname, Guid taskid, Version version)
{
var log = new TaskLog
{
Info = message,
Type = "错误",
TaskName = taskname,
CreationTime = DateTime.Now,
TaskId = taskid,
Version = version?.ToString()
};
EnqueueLog(log);
return true;
}
[HttpGet("AddInfoRemark")]
public async Task<bool> AddInfoRemark(string message, string taskname, string remark)
{
var log = new TaskLog
{
Info = message,
Type = "记录",
TaskName = taskname,
CreationTime = DateTime.Now,
Remark = remark
};
EnqueueLog(log);
return true;
}
// 其他方法保持不变...
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await foreach (var logMessage in _logChannel.Reader.ReadAllAsync(stoppingToken))
{
// 使用IServiceScopeFactory创建独立的作用域
using var scope = _serviceProvider.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<JobDbContext>();
try
{
dbContext.TaskLogs.Add(logMessage);
await dbContext.SaveChangesAsync(stoppingToken);
}
catch (Exception ex)
{
Console.WriteLine($"Error saving log: {ex.Message}");
}
}
}
}
}

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

@ -33,6 +33,9 @@ namespace TaskManager.Controllers
protected string Client { set; get; } = "Wood";
protected string Path { set; get; } = "/v2/get/supplierProPlaning";
protected string Url { set; get; } = "/v2/get/supplierProPlaning";
protected int CPageSize { set; get; } = 1000;
protected virtual string TaskName { set; get; } = "SupplierProPlaning";
protected readonly LogController _logger;
@ -95,7 +98,7 @@ namespace TaskManager.Controllers
////string jsonContent = System.IO.File.ReadAllText("采购订单.json");
//string jsonContent = System.IO.File.ReadAllText("采购订单.json");
//// string jsonContent = System.IO.File.ReadAllText("过焊装未过总装.json");
//// string jsonContent = System.IO.File.ReadAllText("计划协议.json");
////string jsonContent = System.IO.File.ReadAllText("奇瑞RDC共享库存.json");
@ -103,7 +106,7 @@ namespace TaskManager.Controllers
//string jsonContent = System.IO.File.ReadAllText("日物料需求计划.json");
////string jsonContent = System.IO.File.ReadAllText("整车月度生产计划1.json");
///string jsonContent = System.IO.File.ReadAllText("M+6月物料需求计划1.json");
//string jsonContent = System.IO.File.ReadAllText("M+6月物料需求计划1.json");
//string jsonContent = System.IO.File.ReadAllText("过涂装未过总装.json");
//return jsonContent;
@ -158,17 +161,17 @@ namespace TaskManager.Controllers
//await _logger.AddInfo($"{TaskName}结束执行作业{uid}", TaskName);
}
[NonAction]
public async Task ExecuteAsync(string url, string path, string taskName,string client)
public async Task ExecuteAsync(string url, string path, string taskName,string client,int pageSize)
{
var str = DateTime.Now.ToLongTimeString();
await BeforeExecuteAsync(str);
await DoExecutingAsync(url, path, taskName,client);
await DoExecutingAsync(url, path, taskName,client,pageSize);
await AfterExecuteAsync(str);
}
protected async virtual Task DoExecutingAsync(string url, string path, string takName,string client)
protected async virtual Task DoExecutingAsync(string url, string path, string takName,string client,int pageSize)
{

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

@ -61,191 +61,14 @@ namespace TaskManager.Controllers
var url = first.Url;
var path = first.Api;
var client = first.Client;
var pagesize = first.PageSize;
var controller = _builder.GetRequiredService<SupplierProPlaningService>();
await controller.ExecuteAsync(url, path, taskName,client);
await controller.ExecuteAsync(url, path, taskName,client,pagesize);
}
/// <summary>
///// <summary>
///// 执行铁定任务
///// </summary>
///// <param name="taskName"></param>
///// <returns></returns>
//[NonAction]
//public async Task testTask(string taskName)
//{
// var first = await _context.TaskConifgure.FirstOrDefaultAsync(p => p.TaskName == taskName);
// 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<CherySupplierMrpMonthService>();
// 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<CherySupplierMrpMonthService>();
// await controller4.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "日物料需求计划":
// // 添加的代码块
// var controller5 = _builder.GetRequiredService<CherySupplierMrpDataService>();
// await controller5.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "计划协议":
// // 添加的代码块
// var controller6 = _builder.GetRequiredService<CherySupplierSaWeekService>();
// await controller6.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "采购订单":
// // 添加的代码块
// var controller7 = _builder.GetRequiredService<CherySupplierPoService>();
// await controller7.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "过焊装未过总装":
// // 添加的代码块
// var controller8 = _builder.GetRequiredService<CherySupplierPorHSCHEDULService>();
// await controller8.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "过涂装未过总装":
// // 添加的代码块
// var controller9 = _builder.GetRequiredService<CherySupplierProTSCHEDULService>();
// await controller9.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "排序供货":
// // 添加的代码块
// var controller10 = _builder.GetRequiredService<CherySupplierProCSCHEDULService>();
// await controller10.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "看板配送单":
// // 添加的代码块
// var controller11 = _builder.GetRequiredService<CherySupplierDelStateService>();
// await controller11.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "退货单":
// // 添加的代码块
// var controller12 = _builder.GetRequiredService<CherySupplierReturnService>();
// 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<CherySupplierMrpDataService>();
// await controller14.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "日MRP预警推移":
// // 添加的代码块
// var controller15 = _builder.GetRequiredService<CherySupplierMrpWarningService>();
// await controller15.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "供应商共享库存-上午":
// // 添加的代码块
// var controller19 = _builder.GetRequiredService<CherySupplierSinvDataService>();
// await controller19.TestAsync(url, path, taskname, "2025-05-29");
// break;
// case "供应商共享库存-晚上":
// // 添加的代码块
// var controller20 = _builder.GetRequiredService<CherySupplierSinvDataService>();
// await controller20.TestAsync(url, path, taskname, "2025-05-29");
// break;
// }
// }
// catch
// {
// }
// }
//}
/// <summary>
/// 设置任务是否自动执行
@ -305,6 +128,16 @@ namespace TaskManager.Controllers
public async Task RefreshTaskConfig()
{
//RecurringJob.AddOrUpdate<LogBackgroundService>(
// "日志定时任务",
// x => x.ExecuteAsync(),
// "*/10 * * * * *",
// TimeZoneInfo.Local
// );
// 从数据库加载所有任务配置
var tasks = _context.TaskConifgure.Where(p => p.IsAuto == true && !string.IsNullOrEmpty(p.Corn)
@ -333,13 +166,14 @@ namespace TaskManager.Controllers
var url = task.Url;
var path = task.Api;
var client = task.Client;
var pagesize = task.PageSize;
switch (task.TaskName)
{
case "来料检验数据":
RecurringJob.AddOrUpdate<SupplierProMaterialStockService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -347,7 +181,7 @@ namespace TaskManager.Controllers
case "排产数据":
RecurringJob.AddOrUpdate<CherySupplierProSchedulingService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -355,7 +189,7 @@ namespace TaskManager.Controllers
case "供应商基础信息":
RecurringJob.AddOrUpdate<CherySupplierInfoService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -363,7 +197,7 @@ namespace TaskManager.Controllers
case "人员资质信息":
RecurringJob.AddOrUpdate<CherySupplierEmployeeService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -371,7 +205,7 @@ namespace TaskManager.Controllers
case "BOM主数据":
RecurringJob.AddOrUpdate<CherySupplierBomService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -379,7 +213,7 @@ namespace TaskManager.Controllers
case "过程控制项质量数据":
RecurringJob.AddOrUpdate<CherySupplierProCpsService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -387,7 +221,7 @@ namespace TaskManager.Controllers
case "生产过程数据":
RecurringJob.AddOrUpdate<CherySupplierProDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -395,7 +229,7 @@ namespace TaskManager.Controllers
case "产品一次合格率":
RecurringJob.AddOrUpdate<CherySupplierProFirstPassyieldService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -403,7 +237,7 @@ namespace TaskManager.Controllers
case "工位一次合格率":
RecurringJob.AddOrUpdate<CherySupplierProStationFirstPassyieldService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -411,7 +245,7 @@ namespace TaskManager.Controllers
case "缺陷业务数据":
RecurringJob.AddOrUpdate<CherySupplierProFlawService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -419,7 +253,7 @@ namespace TaskManager.Controllers
case "环境业务数据":
RecurringJob.AddOrUpdate<CherySupplierProEnvironmentService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -427,7 +261,7 @@ namespace TaskManager.Controllers
case "设备OEE达成率":
RecurringJob.AddOrUpdate<CherySupplierProOeeAchievementRateService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -435,7 +269,7 @@ namespace TaskManager.Controllers
case "OEE时间明细":
RecurringJob.AddOrUpdate<CherySupplierProOeeTimeDetailsService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -443,7 +277,7 @@ namespace TaskManager.Controllers
case "物料主数据":
RecurringJob.AddOrUpdate<CherySupplierProMaterialDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -451,7 +285,7 @@ namespace TaskManager.Controllers
case "附件类数据":
RecurringJob.AddOrUpdate<CherySupplierProAttachmentDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -459,7 +293,7 @@ namespace TaskManager.Controllers
case "工艺装备":
RecurringJob.AddOrUpdate<CherySupplierProProcessEquipmentService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -467,7 +301,7 @@ namespace TaskManager.Controllers
case "工艺":
RecurringJob.AddOrUpdate<CherySupplierProProcessService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -476,7 +310,7 @@ namespace TaskManager.Controllers
case "整车月度生产计划1":
RecurringJob.AddOrUpdate<SupplierProPlaningService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -484,7 +318,7 @@ namespace TaskManager.Controllers
case "M+6月物料需求计划1":
RecurringJob.AddOrUpdate<CherySupplierMrpMonthService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -492,7 +326,7 @@ namespace TaskManager.Controllers
case "整车月度生产计划2":
RecurringJob.AddOrUpdate<SupplierProPlaningService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -500,7 +334,7 @@ namespace TaskManager.Controllers
case "M+6月物料需求计划2":
RecurringJob.AddOrUpdate<CherySupplierMrpMonthService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -508,7 +342,7 @@ namespace TaskManager.Controllers
case "日物料需求计划":
RecurringJob.AddOrUpdate<CherySupplierMrpDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -516,7 +350,7 @@ namespace TaskManager.Controllers
case "计划协议":
RecurringJob.AddOrUpdate<CherySupplierSaWeekService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -524,7 +358,7 @@ namespace TaskManager.Controllers
case "采购订单":
RecurringJob.AddOrUpdate<CherySupplierPoService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -532,7 +366,7 @@ namespace TaskManager.Controllers
case "过焊装未过总装":
RecurringJob.AddOrUpdate<CherySupplierPorHSCHEDULService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -540,7 +374,7 @@ namespace TaskManager.Controllers
case "过涂装未过总装":
RecurringJob.AddOrUpdate<CherySupplierProTSCHEDULService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -548,7 +382,7 @@ namespace TaskManager.Controllers
case "排序供货":
RecurringJob.AddOrUpdate<CherySupplierProCSCHEDULService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -556,7 +390,7 @@ namespace TaskManager.Controllers
case "看板配送单":
RecurringJob.AddOrUpdate<CherySupplierDelStateService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -564,7 +398,7 @@ namespace TaskManager.Controllers
case "退货单":
RecurringJob.AddOrUpdate<CherySupplierReturnService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -572,7 +406,7 @@ namespace TaskManager.Controllers
case "奇瑞RDC共享库存":
RecurringJob.AddOrUpdate<SupplierInvDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -580,7 +414,7 @@ namespace TaskManager.Controllers
case "日MRP状态监控":
RecurringJob.AddOrUpdate<CherySupplierMrpDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -588,7 +422,7 @@ namespace TaskManager.Controllers
case "日MRP预警推移":
RecurringJob.AddOrUpdate<CherySupplierMrpWarningService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -596,7 +430,7 @@ namespace TaskManager.Controllers
case "M+6月物料需求计划风险确认":
RecurringJob.AddOrUpdate<CherySupplierConMmrpService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -604,7 +438,7 @@ namespace TaskManager.Controllers
case "日物料需求计划风险确认":
RecurringJob.AddOrUpdate<CherySupplierConDateService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -612,7 +446,7 @@ namespace TaskManager.Controllers
case "采购订单风险确认":
RecurringJob.AddOrUpdate<CherySupplierConPoService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -621,7 +455,7 @@ namespace TaskManager.Controllers
RecurringJob.AddOrUpdate<CherySupplierSinvDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);
@ -629,7 +463,7 @@ namespace TaskManager.Controllers
case "供应商共享库存-晚上":
RecurringJob.AddOrUpdate<CherySupplierSinvDataService>(
task.TaskName,
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client),
x => ((IDoExecute)x).ExecuteAsync(url, path, task.TaskName, client,pagesize),
task.Corn,
TimeZoneInfo.Local
);

Loading…
Cancel
Save