diff --git a/API/TaskManager.Contracts/Dtos/Dtos.cs b/API/TaskManager.Contracts/Dtos/Dtos.cs index e26e00f..7035ebb 100644 --- a/API/TaskManager.Contracts/Dtos/Dtos.cs +++ b/API/TaskManager.Contracts/Dtos/Dtos.cs @@ -9,7 +9,9 @@ using System.Text.Json.Serialization; namespace TaskManager.Contracts.Dtos { - + /// + /// + /// public class PAGE_OUT_DTO { /// 数据总数 @@ -100,51 +102,141 @@ namespace TaskManager.Contracts.Dtos public class SUPPLIER_PRO_PLANING_DETIAL_DTO: CherryReadBaseEntityDto { - //public string models { get; set; } - //public decimal? quantity1 { get; set; } - //public decimal? quantity2 { get; set; } - //public string startMonth { get; set; } - //public int isDelete { get; set; } - //public string updateByUser { get; set; } - //public string pattern { get; set; } - //public string omterior { get; set; } - //public string salseDepartment { get; set; } - //public string materialCode { get; set; } - - //public DateTime? updateTime { get; set; } - //public string type { get; set; } - //public decimal? quantity3 { get; set; } - //public string releaseEdition { get; set; } - //public decimal? quantity4 { get; set; } - //public int? version { get; set; } - //public decimal? quantity5 { get; set; } - //public decimal? quantity6 { get; set; } - //public DateTime? createTime { get; set; } - //public string plant { get; set; } - //public string assembly { get; set; } - //public string id { get; set; } - //public string createByUser { get; set; } - - [JsonProperty("models")] - public string Models { get; set; } - [JsonProperty("quantity1")] - public decimal? Quantity1 { get; set; } + - [JsonProperty("quantity2")] - public decimal? Quantity2 { get; set; } + /// + /// 需求发布版次:唯一版次ID + /// + [JsonPropertyName("releaseEdition")] + [MaxLength(50)] + public string ReleaseEdition { get; set; } = string.Empty; + + /// + /// 车型 + /// + [JsonPropertyName("models")] + [MaxLength(50)] + public string Models { get; set; } = string.Empty; + + + /// + /// 类型 + /// + [JsonPropertyName("type")] + [MaxLength(50)] + public string Type { get; set; } = string.Empty; + + /// + /// 动力总成 + /// + [JsonPropertyName("assembly")] + [MaxLength(50)] + public string Assembly { get; set; } = string.Empty; + + /// + /// 版型 + /// + [JsonPropertyName("pattern")] + [MaxLength(50)] + public string Pattern { get; set; } = string.Empty; - [JsonProperty("startMonth")] - public string StartMonth { get; set; } + + /// + /// 物料号 + /// + [JsonPropertyName("materialCode")] + [MaxLength(50)] + public string MaterialCode { get; set; } = string.Empty; + + /// + /// 起始月份-格式:yyyy-MM + /// + [JsonPropertyName("startMonth")] + [MaxLength(50)] + public string StartMonth { get; set; } = string.Empty; + + /// + /// 数量1 + /// + [JsonPropertyName("quantity1")] + public int Quantity1 { get; set; } = 1; + + /// + /// 数量2 + /// + [JsonPropertyName("quantity2")] + public int Quantity2 { get; set; } = 1; + + /// + /// 数量3 + /// + [JsonPropertyName("quantity3")] + public int Quantity3 { get; set; } = 1; + + /// + /// 数量4 + /// + [JsonPropertyName("quantity4")] + public int Quantity4 { get; set; } = 1; + + /// + /// 数量5 + /// + [JsonPropertyName("quantity5")] + public int Quantity5 { get; set; } = 1; + + /// + /// 数量6 + /// + [JsonPropertyName("quantity6")] + public int Quantity6 { get; set; } = 1; + + /// + /// 工厂 + /// + [JsonPropertyName("plant")] + [MaxLength(50)] + public string Plant { get; set; } = string.Empty; + + /// + /// 创建人 + /// + [JsonPropertyName("createByUser")] + [MaxLength(50)] + public string CreateByUser { get; set; } = string.Empty; + + /// + /// 创建时间 + /// + [JsonPropertyName("createTime")] + public DateTime CreateTime { get; set; } - [JsonProperty("isDelete")] - public int IsDelete { get; set; } + /// + /// 修改人 + /// + [JsonPropertyName("updateByUser")] + [MaxLength(50)] + public string UpdateByUser { get; set; } = string.Empty; + + /// + /// 修改时间 + /// + [JsonPropertyName("updateTime")] + public DateTime UpdateTime { get; set; } - [JsonProperty("updateByUser")] - public string UpdateByUser { get; set; } + /// + /// 是否删除(0:否,1:是) + /// + [JsonPropertyName("isDelete")] + public int IsDelete { get; set; } = 0; + + /// + /// 版本号 + /// + [JsonPropertyName("version")] + public int Version { get; set; } = 1; - [JsonProperty("pattern")] - public string Pattern { get; set; } [JsonProperty("omterior")] // 可能是拼写错误,保留原始名称 public string Omterior { get; set; } @@ -152,46 +244,6 @@ namespace TaskManager.Contracts.Dtos [JsonProperty("salseDepartment")] // 可能是拼写错误,保留原始名称 public string SalseDepartment { get; set; } - [JsonProperty("materialCode")] - public string MaterialCode { get; set; } - - [JsonProperty("updateTime")] - public DateTime? UpdateTime { get; set; } - - [JsonProperty("type")] - public string Type { get; set; } - - [JsonProperty("quantity3")] - public decimal? Quantity3 { get; set; } - - [JsonProperty("releaseEdition")] - public string ReleaseEdition { get; set; } - - [JsonProperty("quantity4")] - public decimal? Quantity4 { get; set; } - - [JsonProperty("version")] - public int Version { get; set; } - - [JsonProperty("quantity5")] - public decimal? Quantity5 { get; set; } - - [JsonProperty("quantity6")] - public decimal? Quantity6 { get; set; } - - [JsonProperty("createTime")] - public DateTime? CreateTime { get; set; } - - [JsonProperty("plant")] - public string Plant { get; set; } - - [JsonProperty("assembly")] - public string Assembly { get; set; } - - - - [JsonProperty("createByUser")] - public string CreateByUser { get; set; } } @@ -790,6 +842,7 @@ public class SUPPLIER_MRP_WARNING_DETAIL_DTO : CherryReadBaseEntityDto public class SUPPLIER_MRP_DATE_DETAIL_DTO : CherryReadBaseEntityDto { + public string ReleaseEdition { get; set; } public string MaterialCode { get; set; } public string MaterialDescription { get; set; } diff --git a/API/TaskManager.Entity/Entity.cs b/API/TaskManager.Entity/Entity.cs index 4aecce3..b8b715c 100644 --- a/API/TaskManager.Entity/Entity.cs +++ b/API/TaskManager.Entity/Entity.cs @@ -6,6 +6,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace TaskManager.Entity @@ -66,30 +67,40 @@ namespace TaskManager.Entity } - public class TaskLog + public class TaskLog:BaseEntity { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UId { get; set; } + + /// /// 详细描述 /// + [ExporterHeader(DisplayName = "信息")] public string Info { get; set; } /// /// 日志类型 /// + [ExporterHeader(DisplayName = "日志类型")] public string Type { get; set; } /// /// 任务名称 /// + [ExporterHeader(DisplayName = "任务名")] public string TaskName { get; set; } + + /// + /// 任务名称 + /// + [ExporterHeader(DisplayName = "任务ID")] + public Guid TaskId { get; set; } /// /// 创建时间 /// + [ExporterHeader(DisplayName = "创建时间")] public DateTime CreationTime { set; get; } /// /// 备注 /// + [ExporterHeader(DisplayName = "备注")] public string Remark { get; set; } } @@ -115,7 +126,13 @@ namespace TaskManager.Entity public class CherryReadBaseEntity:BaseEntity { + /// + /// 请求发出日期 + /// public string RequestDate { get; set; } + /// + /// 同步ID + /// public string Id { get; set; } @@ -128,27 +145,27 @@ namespace TaskManager.Entity /// public class TaskSub:BaseEntity { - [ExporterHeader(DisplayName = "用户名")] + [ExporterHeader(DisplayName = "表名")] /// /// 关联的数据表名称(如:订单表、用户表等,可为空) /// public string? TableName { get; set; } - + [ExporterHeader(DisplayName = "任务名称")] /// /// 任务名称(用于业务层面标识任务,如:数据同步任务、报表生成任务) /// public string? TaskName { get; set; } - + [ExporterHeader(DisplayName = "同步总数量")] /// /// 数据总量(任务处理的数据条目数) /// public int DataCount { get; set; } - + [ExporterHeader(DisplayName = "发布客户")] /// /// 发布给那个客户 /// public string? Subscriber { get; set; } - + [ExporterHeader(DisplayName = "失败次数")] /// /// 失败次数(任务执行失败的累计次数) /// @@ -157,38 +174,41 @@ namespace TaskManager.Entity /// /// 失败详情(记录失败原因、异常堆栈等信息,支持长文本) /// + [ExporterHeader(DisplayName = "失败信息")] public string? FailedInfo { get; set; } /// /// 所属域(多租户场景下标识租户,如:租户A、租户B) /// + [ExporterHeader(DisplayName = "域名")] public string? Domain { get; set; } /// /// 站点标识(多站点部署时标识所属站点,如:Site1、Site2) /// + [ExporterHeader(DisplayName = "站点")] public string? Site { get; set; } - + [ExporterHeader(DisplayName = "创建用户")] /// /// 从那个内部系统创建系统 /// public string? CreateUser { get; set; } - + [ExporterHeader(DisplayName = "创建时间")] /// /// 创建时间(任务创建的时间戳) /// public DateTime CreateTime { get; set; } - + [ExporterHeader(DisplayName = "备注")] /// /// 备注信息(任务相关的补充说明,支持长文本) /// public string? Remark { get; set; } - + [ExporterHeader(DisplayName = "更新客户系统名")] /// /// 最后更新人(记录任务最后修改者) /// public string? UpdateUser { get; set; } - + [ExporterHeader(DisplayName = "更新完成时间")] /// /// 最后更新时间(任务最后修改的时间戳,可为空) /// @@ -196,86 +216,157 @@ namespace TaskManager.Entity } - - - - - - /// /// 整车月度生产计划-2 /// public class SUPPLIER_PRO_PLANING : CherryReadBaseEntity { + /// + /// 主键ID + /// + [JsonPropertyName("id")] + public string Id { get; set; } - [JsonProperty("models")] - public string Models { get; set; } + /// + /// 需求发布版次:唯一版次ID + /// + [JsonPropertyName("releaseEdition")] + [MaxLength(50)] + public string ReleaseEdition { get; set; } = string.Empty; - [JsonProperty("quantity1")] - public decimal? Quantity1 { get; set; } + /// + /// 车型 + /// + [JsonPropertyName("models")] + [MaxLength(50)] + public string Models { get; set; } = string.Empty; - [JsonProperty("quantity2")] - public decimal? Quantity2 { get; set; } - [JsonProperty("startMonth")] - public string StartMonth { get; set; } + /// + /// 类型 + /// + [JsonPropertyName("type")] + [MaxLength(50)] + public string Type { get; set; } = string.Empty; - [JsonProperty("isDelete")] - public int IsDelete { get; set; } + /// + /// 动力总成 + /// + [JsonPropertyName("assembly")] + [MaxLength(50)] + public string Assembly { get; set; } = string.Empty; - [JsonProperty("updateByUser")] - public string UpdateByUser { get; set; } + /// + /// 版型 + /// + [JsonPropertyName("pattern")] + [MaxLength(50)] + public string Pattern { get; set; } = string.Empty; - [JsonProperty("pattern")] - public string Pattern { get; set; } - [JsonProperty("omterior")] // 可能是拼写错误,保留原始名称 - public string Omterior { get; set; } + /// + /// 物料号 + /// + [JsonPropertyName("materialCode")] + [MaxLength(50)] + public string MaterialCode { get; set; } = string.Empty; - [JsonProperty("salseDepartment")] // 可能是拼写错误,保留原始名称 - public string SalseDepartment { get; set; } + /// + /// 起始月份-格式:yyyy-MM + /// + [JsonPropertyName("startMonth")] + [MaxLength(50)] + public string StartMonth { get; set; } = string.Empty; - [JsonProperty("materialCode")] - public string MaterialCode { get; set; } + /// + /// 数量1 + /// + [JsonPropertyName("quantity1")] + public decimal Quantity1 { get; set; } = 1; - [JsonProperty("updateTime")] - public DateTime? UpdateTime { get; set; } + /// + /// 数量2 + /// + [JsonPropertyName("quantity2")] + public decimal Quantity2 { get; set; } = 1; - [JsonProperty("type")] - public string Type { get; set; } + /// + /// 数量3 + /// + [JsonPropertyName("quantity3")] + public decimal Quantity3 { get; set; } = 1; - [JsonProperty("quantity3")] - public decimal? Quantity3 { get; set; } + /// + /// 数量4 + /// + [JsonPropertyName("quantity4")] + public decimal Quantity4 { get; set; } = 1; - [JsonProperty("releaseEdition")] - public string ReleaseEdition { get; set; } + /// + /// 数量5 + /// + [JsonPropertyName("quantity5")] + public decimal Quantity5 { get; set; } = 1; - [JsonProperty("quantity4")] - public decimal? Quantity4 { get; set; } + /// + /// 数量6 + /// + [JsonPropertyName("quantity6")] + public decimal Quantity6 { get; set; } = 1; - [JsonProperty("version")] - public int Version { get; set; } + /// + /// 工厂 + /// + [JsonPropertyName("plant")] + [MaxLength(50)] + public string Plant { get; set; } = string.Empty; - [JsonProperty("quantity5")] - public decimal? Quantity5 { get; set; } + /// + /// 创建人 + /// + [JsonPropertyName("createByUser")] + [MaxLength(50)] + public string CreateByUser { get; set; } = string.Empty; + + /// + /// 创建时间 + /// + [JsonPropertyName("createTime")] + public DateTime CreateTime { get; set; } - [JsonProperty("quantity6")] - public decimal? Quantity6 { get; set; } + /// + /// 修改人 + /// + [JsonPropertyName("updateByUser")] + [MaxLength(50)] + public string UpdateByUser { get; set; } = string.Empty; - [JsonProperty("createTime")] - public DateTime? CreateTime { get; set; } + /// + /// 修改时间 + /// + [JsonPropertyName("updateTime")] + public DateTime UpdateTime { get; set; } - [JsonProperty("plant")] - public string Plant { get; set; } + /// + /// 是否删除(0:否,1:是) + /// + [JsonPropertyName("isDelete")] + public int IsDelete { get; set; } = 0; - [JsonProperty("assembly")] - public string Assembly { get; set; } + /// + /// 版本号 + /// + [JsonPropertyName("version")] + public int Version { get; set; } = 1; - - [JsonProperty("createByUser")] - public string CreateByUser { get; set; } + [JsonProperty("omterior")] // 可能是拼写错误,保留原始名称 + public string Omterior { get; set; } + + [JsonProperty("salseDepartment")] // 可能是拼写错误,保留原始名称 + public string SalseDepartment { get; set; } + } /// @@ -283,37 +374,172 @@ namespace TaskManager.Entity /// public class SUPPLIER_MRP_MONTH : CherryReadBaseEntity { - - public string ReleaseEdition { get; set; } - public string MaterialCode { get; set; } - public string MaterialDescription { get; set; } - public string PlantId { get; set; } - public string PlantName { get; set; } - public string StartMonth { get; set; } - public decimal QuantityDemand1 { get; set; } - public decimal QuantityDemand2 { get; set; } - public decimal QuantityDemand3 { get; set; } - public decimal QuantityDemand4 { get; set; } - public decimal QuantityDemand5 { get; set; } - public decimal QuantityDemand6 { get; set; } - public decimal QuantityDemand7 { get; set; } - public decimal QuantityDemand8 { get; set; } - public decimal QuantityDemand9 { get; set; } - public decimal QuantityDemand10 { get; set; } - public decimal QuantityDemand11 { get; set; } - public decimal QuantityDemand12 { get; set; } - public string IsUpdate { get; set; } - public string CreateByUser { get; set; } - public DateTime CreateTime { get; set; } - public string UpdateByUser { get; set; } - public DateTime UpdateTime { get; set; } - public string IsDelete { get; set; } - public int Version { get; set; } + /// + /// 主键ID + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// 需求发布版次:M+6月物料需求计划风险确认接口对应需求版次,需求ID + /// + [JsonPropertyName("releaseEdition")] + [MaxLength(50)] + public string ReleaseEdition { get; set; } = string.Empty; + /// + /// 零件号:奇瑞零件号 + /// + [JsonPropertyName("materialCode")] + [MaxLength(50)] + public string MaterialCode { get; set; } = string.Empty; + /// + /// 零件名称 + /// + [JsonPropertyName("materialDescription")] + [MaxLength(50)] + public string MaterialDescription { get; set; } = string.Empty; + /// + /// 工厂代码 + /// + [JsonPropertyName("plantId")] + [MaxLength(50)] + public string PlantId { get; set; } = string.Empty; + + /// + /// 工厂名称 + /// + [JsonPropertyName("plantName")] + [MaxLength(50)] + public string PlantName { get; set; } = string.Empty; + + /// + /// 起始月份-格式:yyyy-MM + /// + [JsonPropertyName("startMonth")] + [MaxLength(50)] + public string StartMonth { get; set; } = string.Empty; + + /// + /// 需求数量1 + /// + [JsonPropertyName("quantityDemand1")] + public decimal QuantityDemand1 { get; set; } = 1; + + /// + /// 需求数量2 + /// + [JsonPropertyName("quantityDemand2")] + public decimal QuantityDemand2 { get; set; } = 1; + + /// + /// 需求数量3 + /// + [JsonPropertyName("quantityDemand3")] + public decimal QuantityDemand3 { get; set; } = 1; + + /// + /// 需求数量4 + /// + [JsonPropertyName("quantityDemand4")] + public decimal QuantityDemand4 { get; set; } = 1; + + /// + /// 需求数量5 + /// + [JsonPropertyName("quantityDemand5")] + public decimal QuantityDemand5 { get; set; } = 1; + + /// + /// 需求数量6 + /// + [JsonPropertyName("quantityDemand6")] + public decimal QuantityDemand6 { get; set; } = 1; + + /// + /// 需求数量7 + /// + [JsonPropertyName("quantityDemand7")] + public decimal QuantityDemand7 { get; set; } = 1; + + /// + /// 需求数量8 + /// + [JsonPropertyName("quantityDemand8")] + public decimal QuantityDemand8 { get; set; } = 1; + + /// + /// 需求数量9 + /// + [JsonPropertyName("quantityDemand9")] + public decimal QuantityDemand9 { get; set; } = 1; + + /// + /// 需求数量10 + /// + [JsonPropertyName("quantityDemand10")] + public decimal QuantityDemand10 { get; set; } = 1; + + /// + /// 需求数量11 + /// + [JsonPropertyName("quantityDemand11")] + public decimal QuantityDemand11 { get; set; } = 1; + + /// + /// 需求数量12 + /// + [JsonPropertyName("quantityDemand12")] + public int QuantityDemand12 { get; set; } = 1; + + /// + /// 当文件夹数据发生变更时(更新需求=1/否则=0) + /// + [JsonPropertyName("isUpdate")] + [MaxLength(50)] + public string IsUpdate { get; set; } = string.Empty; + + /// + /// 创建人 + /// + [JsonPropertyName("createByUser")] + [MaxLength(50)] + public string CreateByUser { get; set; } = string.Empty; + + /// + /// 创建时间 + /// + [JsonPropertyName("createTime")] + public DateTime CreateTime { get; set; } + + /// + /// 修改人 + /// + [JsonPropertyName("updateByUser")] + [MaxLength(50)] + public string UpdateByUser { get; set; } = string.Empty; + + /// + /// 修改时间 + /// + [JsonPropertyName("updateTime")] + public DateTime UpdateTime { get; set; } + + /// + /// 是否删除(0:否,1是) + /// + [JsonPropertyName("isDelete")] + public int IsDelete { get; set; } = 1; + + /// + /// 版本号 + /// + [JsonPropertyName("version")] + public int Version { get; set; } = 1; } @@ -351,53 +577,171 @@ namespace TaskManager.Entity /// public class SUPPLIER_MRP_DATE : CherryReadBaseEntity { - - public string ReleaseEdition { get; set; } - public string MaterialCode { get; set; } - public string MaterialDescription { get; set; } - public string PlantId { get; set; } - public string PlantName { get; set; } - public string StartDate { get; set; } - public int QuantityDemand1 { get; set; } - public int QuantityDemand2 { get; set; } - public int QuantityDemand3 { get; set; } - public int QuantityDemand4 { get; set; } - public int QuantityDemand5 { get; set; } - public int QuantityDemand6 { get; set; } - public int QuantityDemand7 { get; set; } - public int QuantityDemand8 { get; set; } - public int QuantityDemand9 { get; set; } - public int QuantityDemand10 { get; set; } - public int QuantityDemand11 { get; set; } - public int QuantityDemand12 { get; set; } - public int QuantityDemand13 { get; set; } - public int QuantityDemand14 { get; set; } - public int QuantityDemand15 { get; set; } - public int QuantityDemand16 { get; set; } - public int QuantityDemand17 { get; set; } - public int QuantityDemand18 { get; set; } - public int QuantityDemand19 { get; set; } - public int QuantityDemand20 { get; set; } - public int QuantityDemand21 { get; set; } - public int QuantityDemand22 { get; set; } - public int QuantityDemand23 { get; set; } - public int QuantityDemand24 { get; set; } - public int QuantityDemand25 { get; set; } - public int QuantityDemand26 { get; set; } - public int QuantityDemand27 { get; set; } - public int QuantityDemand28 { get; set; } - public int QuantityDemand29 { get; set; } - public int QuantityDemand30 { get; set; } - public int QuantityDemand31 { get; set; } - - public string IsUpdate { get; set; } - public string CreateByUser { get; set; } - public string CreateTime { get; set; } - public string UpdateByUser { get; set; } - public string UpdateTime { get; set; } - public int IsDelete { get; set; } - public int Version { get; set; } + // + /// 主键ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 需求发布版次:M+6月物料需求计划风险确认接口对应需求版次,需求ID + /// + [JsonPropertyName("releaseEdition")] + [MaxLength(50)] + public string ReleaseEdition { get; set; } = string.Empty; + + /// + /// 零件号:奇瑞零件号 + /// + [JsonPropertyName("materialCode")] + [MaxLength(50)] + public string MaterialCode { get; set; } = string.Empty; + + /// + /// 零件名称 + /// + [JsonPropertyName("materialDescription")] + [MaxLength(50)] + public string MaterialDescription { get; set; } = string.Empty; + + /// + /// 工厂代码 + /// + [JsonPropertyName("plantId")] + [MaxLength(50)] + public string PlantId { get; set; } = string.Empty; + + /// + /// 工厂名称 + /// + [JsonPropertyName("plantName")] + [MaxLength(50)] + public string PlantName { get; set; } = string.Empty; + + /// + /// 起始月份-格式:yyyy-MM + /// + [JsonPropertyName("startMonth")] + [MaxLength(50)] + public string StartMonth { get; set; } = string.Empty; + + /// + /// 需求数量1 + /// + [JsonPropertyName("quantityDemand1")] + public int QuantityDemand1 { get; set; } = 1; + + /// + /// 需求数量2 + /// + [JsonPropertyName("quantityDemand2")] + public int QuantityDemand2 { get; set; } = 1; + + /// + /// 需求数量3 + /// + [JsonPropertyName("quantityDemand3")] + public int QuantityDemand3 { get; set; } = 1; + + /// + /// 需求数量4 + /// + [JsonPropertyName("quantityDemand4")] + public int QuantityDemand4 { get; set; } = 1; + + /// + /// 需求数量5 + /// + [JsonPropertyName("quantityDemand5")] + public int QuantityDemand5 { get; set; } = 1; + + /// + /// 需求数量6 + /// + [JsonPropertyName("quantityDemand6")] + public int QuantityDemand6 { get; set; } = 1; + + /// + /// 需求数量7 + /// + [JsonPropertyName("quantityDemand7")] + public int QuantityDemand7 { get; set; } = 1; + + /// + /// 需求数量8 + /// + [JsonPropertyName("quantityDemand8")] + public int QuantityDemand8 { get; set; } = 1; + + /// + /// 需求数量9 + /// + [JsonPropertyName("quantityDemand9")] + public int QuantityDemand9 { get; set; } = 1; + + /// + /// 需求数量10 + /// + [JsonPropertyName("quantityDemand10")] + public int QuantityDemand10 { get; set; } = 1; + + /// + /// 需求数量11 + /// + [JsonPropertyName("quantityDemand11")] + public int QuantityDemand11 { get; set; } = 1; + + /// + /// 需求数量12 + /// + [JsonPropertyName("quantityDemand12")] + public int QuantityDemand12 { get; set; } = 1; + + /// + /// 当文件夹数据发生变更时(更新需求=1/否则=0) + /// + [JsonPropertyName("isUpdate")] + [MaxLength(50)] + public string IsUpdate { get; set; } = string.Empty; + + /// + /// 创建人 + /// + [JsonPropertyName("createByUser")] + [MaxLength(50)] + public string CreateByUser { get; set; } = string.Empty; + + /// + /// 创建时间 + /// + [JsonPropertyName("createTime")] + public DateTime CreateTime { get; set; } + + /// + /// 修改人 + /// + [JsonPropertyName("updateByUser")] + [MaxLength(50)] + public string UpdateByUser { get; set; } = string.Empty; + + /// + /// 修改时间 + /// + [JsonPropertyName("updateTime")] + public DateTime UpdateTime { get; set; } + + /// + /// 是否删除(0:否,1是) + /// + [JsonPropertyName("isDelete")] + public int IsDelete { get; set; } = 1; + + /// + /// 版本号 + /// + [JsonPropertyName("version")] + public int Version { get; set; } = 1; } diff --git a/API/Wood.Service/Controllers/LogController.cs b/API/Wood.Service/Controllers/LogController.cs index c37e785..9aea8d6 100644 --- a/API/Wood.Service/Controllers/LogController.cs +++ b/API/Wood.Service/Controllers/LogController.cs @@ -1,36 +1,41 @@  +using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using TaskManager.Controllers; using TaskManager.Entity; using TaskManager.EntityFramework; +using TaskManager.EntityFramework.Repository; +using Wood.Service.Controllers; namespace TaskManager.Controllers { - public class LogController:ControllerBase + public class LogController:NormalBaseController { - private readonly JobDbContext _dbContext; - public LogController(JobDbContext dbContext) + public LogController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository repository) : base(context, builder, configuration, repository) { - _dbContext = dbContext; } + public async Task> GetAll() { - var log = await _dbContext.TaskLogs.ToListAsync(); + var log = await _context.TaskLogs.ToListAsync(); return log; } [HttpGet("AddError")] public async Task AddError(string message,string taskname) { - _dbContext.TaskLogs.Add(new TaskLog() { Info = message, Type = "错误",TaskName=taskname ,CreationTime=DateTime.Now}); - var result =await _dbContext.SaveChangesAsync(); + _context.TaskLogs.Add(new TaskLog() { Info = message, Type = "错误",TaskName=taskname ,CreationTime=DateTime.Now}); + var result =await _context.SaveChangesAsync(); if (result > 0) { return true; @@ -40,16 +45,63 @@ namespace TaskManager.Controllers [HttpGet("AddInfo")] public async Task AddInfo(string message, string taskname) { - _dbContext.TaskLogs.Add(new TaskLog() { Info = message, Type = "记录", TaskName = taskname, CreationTime = DateTime.Now }); - var result = await _dbContext.SaveChangesAsync(); + _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; } - + + + public async Task Export([FromQuery] int pageNumber = 1, + [FromQuery] int pageSize = 10, + [FromQuery] string sortBy = "", + [FromQuery] bool isAscending = true, + [FromQuery] Dictionary filters = null) + { + var pagingParams = new PagingParams + { + PageNumber = pageNumber, + PageSize = pageSize, + SortBy = sortBy, + IsAscending = isAscending, + Filters = filters + }; + + // 可以在这里构建表达式树过滤条件 + Expression> filter = null; + + var pagedResult = await _repository.GetPagedAsync(null, pagingParams); + return await ExportFile(pagedResult.Data, Guid.NewGuid().ToString() + ".xlsx"); + + + } + protected async Task ExportFile(ICollection dtos, string fileName) where T : class, new() + { + var excelExporter = HttpContext.RequestServices.GetRequiredService(); + var res = await excelExporter.ExportAsByteArray(dtos); + return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "_" + fileName }; + } + + } + + /// 导出 + /// + /// 第几页 + /// 每页条数 + /// 排序列 + /// 是否升序 + /// 查询条件 + /// + + + + + + //private readonly IServiceProvider _serviceProvider; //public LogController(IServiceProvider serviceProvider) //{ @@ -63,5 +115,5 @@ namespace TaskManager.Controllers //} - -} + + } diff --git a/API/Wood.Service/Controllers/NormalBaseController.cs b/API/Wood.Service/Controllers/NormalBaseController.cs new file mode 100644 index 0000000..8a877f4 --- /dev/null +++ b/API/Wood.Service/Controllers/NormalBaseController.cs @@ -0,0 +1,110 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; +using TaskManager.Entity; +using TaskManager.EntityFramework; +using TaskManager.EntityFramework.Repository; + +namespace Wood.Service.Controllers +{ + public class NormalBaseController:ControllerBase where T:BaseEntity + { + + protected readonly JobDbContext _context; + protected readonly IServiceProvider _builder; + protected readonly IConfiguration _configuration; + protected readonly IRepository _repository; + public NormalBaseController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository repository) + { + _builder = builder; + _context = context; + _configuration = configuration; + _repository = repository; + } + + + /// + /// 通过UID获得实体 + /// + /// + /// + [HttpGet("{id}")] + public async Task> GetById(int id) + { + var entity = await _repository.GetByIdAsync(id); + if (entity == null) return NotFound(); + return entity; + } + + /// + /// 创建实体 + /// + /// + /// + [HttpPost] + public async Task> Create(T entity) + { + entity.CreationTime = DateTime.Now; + var createdEntity = await _repository.AddAsync(entity); + return new JsonResult(new { Code = 200, Message = "创建成功!" }); + } + /// + /// 更新实体UID + /// + /// + /// + [HttpPut("{id}")] + public async Task Update(T entity) + { + var _first = await _repository.GetByIdAsync(entity.UId); + if (_first == null) + { + return new JsonResult(new { Code = 400, Message = "修改失败!" }); + } + + + await _repository.UpdateAsync(entity); + return new JsonResult(new { Code = 200, Message = "修改成功!" }); + } + /// + /// 删除实体通过UID + /// + /// + /// + [HttpDelete("{id}")] + public async Task Delete(int id) + { + await _repository.DeleteAsync(id); + return new JsonResult(new { Code = 200, Message = "删除成功!" }); ; + } + [HttpGet] + public async Task>> GetPaged( + [FromQuery] int pageNumber = 1, + [FromQuery] int pageSize = 10, + [FromQuery] string sortBy = "", + [FromQuery] bool isAscending = true, + [FromQuery] Dictionary filters = null) + { + var pagingParams = new PagingParams + { + PageNumber = pageNumber, + PageSize = pageSize, + SortBy = sortBy, + IsAscending = isAscending, + Filters = filters + }; + + // 可以在这里构建表达式树过滤条件 + Expression> filter = null; + + var pagedResult = await _repository.GetPagedAsync(filter, pagingParams); + return Ok(pagedResult); + } + + } +} diff --git a/API/Wood.Service/Controllers/TaskConifgureController.cs b/API/Wood.Service/Controllers/TaskConifgureController.cs index 61d552c..e98d7d2 100644 --- a/API/Wood.Service/Controllers/TaskConifgureController.cs +++ b/API/Wood.Service/Controllers/TaskConifgureController.cs @@ -18,6 +18,7 @@ using TaskManager.Controllers; using TaskManager.Entity; using TaskManager.EntityFramework; using TaskManager.EntityFramework.Repository; +using Wood.Service.Controllers; namespace TaskManager.Controllers { @@ -25,20 +26,13 @@ namespace TaskManager.Controllers //[Route("[controller]")] [AllowAnonymous] - public class TaskConifgureController : ControllerBase + public class TaskConifgureController :NormalBaseController { - private readonly JobDbContext _context; - private readonly IServiceProvider _builder; - private readonly IConfiguration _configuration; - private readonly IRepository _repository; - public TaskConifgureController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository repository) + public TaskConifgureController(JobDbContext context, IServiceProvider builder, IConfiguration configuration, IRepository repository) : base(context, builder, configuration, repository) { - _builder = builder; - _context = context; - _configuration = configuration; - _repository = repository; } + protected async Task ExportFile(ICollection dtos, string fileName) where T : class, new() { var excelExporter = HttpContext.RequestServices.GetRequiredService(); @@ -85,38 +79,7 @@ namespace TaskManager.Controllers } /// - /// 导出 - /// - /// 第几页 - /// 每页条数 - /// 排序列 - /// 是否升序 - /// 查询条件 - /// - - public async Task Export([FromQuery] int pageNumber = 1, - [FromQuery] int pageSize = 10, - [FromQuery] string sortBy = "", - [FromQuery] bool isAscending = true, - [FromQuery] Dictionary filters = null) - { - var pagingParams = new PagingParams - { - PageNumber = pageNumber, - PageSize = pageSize, - SortBy = sortBy, - IsAscending = isAscending, - Filters = filters - }; - - // 可以在这里构建表达式树过滤条件 - Expression> filter = null; - - var pagedResult = await _repository.GetPagedAsync(null, pagingParams); - return await ExportFile(pagedResult.Data, Guid.NewGuid().ToString() + ".xlsx"); - - - } + @@ -618,82 +581,23 @@ namespace TaskManager.Controllers } } - - - - } - - /// - /// 获得所有揭露 - /// - /// - [HttpGet] - public async Task>> GetAll() - { - return await _repository.GetAllAsync() as List; - } - - /// - /// 通过UID获得实体 - /// - /// - /// - [HttpGet("{id}")] - public async Task> GetById(int id) - { - var entity = await _repository.GetByIdAsync(id); - if (entity == null) return NotFound(); - return entity; } - /// - /// 创建实体 - /// - /// - /// - [HttpPost] - public async Task> Create(TaskConifgure entity) - { - entity.CreationTime = DateTime.Now; - var createdEntity = await _repository.AddAsync(entity); - return new JsonResult(new { Code = 200, Message = "创建成功!" }); - } - /// - /// 更新实体UID + + /// 导出 /// - /// + /// 第几页 + /// 每页条数 + /// 排序列 + /// 是否升序 + /// 查询条件 /// - [HttpPut("{id}")] - public async Task Update(TaskConifgure entity) - { - var _first = await _repository.GetByIdAsync(entity.UId); - if (_first == null) - { - return new JsonResult(new { Code = 400, Message = "修改失败!" }); - } - - await _repository.UpdateAsync(entity); - return new JsonResult(new { Code = 200, Message = "修改成功!" }); - } - /// - /// 删除实体通过UID - /// - /// - /// - [HttpDelete("{id}")] - public async Task Delete(int id) - { - await _repository.DeleteAsync(id); - return new JsonResult(new { Code = 200, Message = "删除成功!" }); ; - } - [HttpGet] - public async Task>> GetPaged( - [FromQuery] int pageNumber = 1, - [FromQuery] int pageSize = 10, - [FromQuery] string sortBy = "", - [FromQuery] bool isAscending = true, - [FromQuery] Dictionary filters = null) + public async Task Export([FromQuery] int pageNumber = 1, + [FromQuery] int pageSize = 10, + [FromQuery] string sortBy = "", + [FromQuery] bool isAscending = true, + [FromQuery] Dictionary filters = null) { var pagingParams = new PagingParams { @@ -707,11 +611,12 @@ namespace TaskManager.Controllers // 可以在这里构建表达式树过滤条件 Expression> filter = null; - var pagedResult = await _repository.GetPagedAsync(filter, pagingParams); - return Ok(pagedResult); - } + var pagedResult = await _repository.GetPagedAsync(null, pagingParams); + return await ExportFile(pagedResult.Data, Guid.NewGuid().ToString() + ".xlsx"); + } + // 使用 Hangfire 注册定时任务