diff --git a/src/CncModels/Constants/SensitiveConfigKey.cs b/src/CncModels/Constants/SensitiveConfigKey.cs new file mode 100644 index 0000000..64b09df --- /dev/null +++ b/src/CncModels/Constants/SensitiveConfigKey.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Constants +{ + /// + /// 敏感配置键(用于系统配置表中的敏感字段脱敏处理) + /// + public static class SensitiveConfigKey + { + /// API Token + public const string ApiToken = "api_token"; + + /// 采集器 API Key + public const string CollectorApiKey = "collector_api_key"; + + /// 管理员密码哈希 + public const string AdminPasswordHash = "admin_password_hash"; + } +} diff --git a/src/CncModels/Constants/TableName.cs b/src/CncModels/Constants/TableName.cs new file mode 100644 index 0000000..f84cf19 --- /dev/null +++ b/src/CncModels/Constants/TableName.cs @@ -0,0 +1,71 @@ +using System; + +namespace CncModels.Constants +{ + /// + /// 数据库表名常量 + /// + public static class TableName + { + /// 车间表 cnc_workshop + public const string Workshop = "cnc_workshop"; + + /// 品牌表 cnc_brand + public const string Brand = "cnc_brand"; + + /// 品牌字段映射表 cnc_brand_field_mapping + public const string BrandFieldMapping = "cnc_brand_field_mapping"; + + /// 采集地址表 cnc_collect_address + public const string CollectAddress = "cnc_collect_address"; + + /// 机床表 cnc_machine + public const string Machine = "cnc_machine"; + + /// 工人表 cnc_worker + public const string Worker = "cnc_worker"; + + /// 工人-机床绑定表 cnc_worker_machine + public const string WorkerMachine = "cnc_worker_machine"; + + /// 采集结构化记录表 cnc_collect_record + public const string CollectRecord = "cnc_collect_record"; + + /// 产量分段表 cnc_production_segment + public const string ProductionSegment = "cnc_production_segment"; + + /// 机床日状态 cnc_machine_daily_status + public const string MachineDailyStatus = "cnc_machine_daily_status"; + + /// 日产量 cnc_daily_production + public const string DailyProduction = "cnc_daily_production"; + + /// 工人日汇总 cnc_worker_daily_summary + public const string WorkerDailySummary = "cnc_worker_daily_summary"; + + /// 产量调整 cnc_production_adjustment + public const string ProductionAdjustment = "cnc_production_adjustment"; + + /// 告警 cnc_alert + public const string Alert = "cnc_alert"; + + /// 系统配置 cnc_sys_config + public const string SysConfig = "cnc_sys_config"; + + /// 大屏配置 cnc_screen_config + public const string ScreenConfig = "cnc_screen_config"; + + /// 大屏筛选配置 cnc_screen_filter + public const string ScreenFilter = "cnc_screen_filter"; + + // 日志库表 + /// 日志原始采集表 log_collect_raw + public const string LogCollectRaw = "log_collect_raw"; + + /// 日志系统表 log_system + public const string LogSystem = "log_system"; + + /// 日志心跳表 log_collector_heartbeat + public const string LogCollectorHeartbeat = "log_collector_heartbeat"; + } +} diff --git a/src/CncModels/Dto/Alert/AlertListItem.cs b/src/CncModels/Dto/Alert/AlertListItem.cs new file mode 100644 index 0000000..bf6acd7 --- /dev/null +++ b/src/CncModels/Dto/Alert/AlertListItem.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Dto.Alert +{ + /// + /// 告警列表项 + /// + public class AlertListItem + { + public int Id { get; set; } + public DateTime CreatedAt { get; set; } + public string AlertType { get; set; } + public string Title { get; set; } + public string MachineName { get; set; } + public string Detail { get; set; } + public int IsResolved { get; set; } + public DateTime? ResolvedAt { get; set; } + } +} diff --git a/src/CncModels/Dto/Alert/AlertQuery.cs b/src/CncModels/Dto/Alert/AlertQuery.cs new file mode 100644 index 0000000..6d36f65 --- /dev/null +++ b/src/CncModels/Dto/Alert/AlertQuery.cs @@ -0,0 +1,17 @@ +using System; +using CncModels.Dto; + +namespace CncModels.Dto.Alert +{ + /// + /// 告警查询(分页) + /// + public class AlertQuery : PagedQuery + { + public string AlertType { get; set; } + public int? IsResolved { get; set; } + public int? MachineId { get; set; } + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + } +} diff --git a/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs b/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs new file mode 100644 index 0000000..cdb4d37 --- /dev/null +++ b/src/CncModels/Dto/Alert/AlertStatisticsResponse.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Alert +{ + /// + /// 告警统计 + /// + public class AlertStatisticsResponse + { + public int Unresolved { get; set; } + public int CollectFail { get; set; } + public int DeviceOffline { get; set; } + public int ProductionAnomaly { get; set; } + public int UnknownDevice { get; set; } + public int ServiceError { get; set; } + } +} diff --git a/src/CncModels/Dto/Alert/BatchResolveRequest.cs b/src/CncModels/Dto/Alert/BatchResolveRequest.cs new file mode 100644 index 0000000..8e825cc --- /dev/null +++ b/src/CncModels/Dto/Alert/BatchResolveRequest.cs @@ -0,0 +1,10 @@ +namespace CncModels.Dto.Alert +{ + /// + /// 批量告警处理请求 + /// + public class BatchResolveRequest + { + public int[] Ids { get; set; } + } +} diff --git a/src/CncModels/Dto/Brand/BrandDetailResponse.cs b/src/CncModels/Dto/Brand/BrandDetailResponse.cs new file mode 100644 index 0000000..921b5c9 --- /dev/null +++ b/src/CncModels/Dto/Brand/BrandDetailResponse.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace CncModels.Dto.Brand +{ + /// + /// 品牌详情(含字段映射) + /// + public class BrandDetailResponse + { + public int Id { get; set; } + public string BrandName { get; set; } + public string DeviceField { get; set; } + public string TagsPath { get; set; } + public int IsEnabled { get; set; } + public int FieldCount { get; set; } + public List Mappings { get; set; } = new List(); + } +} diff --git a/src/CncModels/Dto/Brand/BrandFieldMappingDto.cs b/src/CncModels/Dto/Brand/BrandFieldMappingDto.cs new file mode 100644 index 0000000..1c91822 --- /dev/null +++ b/src/CncModels/Dto/Brand/BrandFieldMappingDto.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Brand +{ + /// + /// 品牌字段映射 + /// + public class BrandFieldMappingDto + { + public string StandardField { get; set; } + public string FieldName { get; set; } + public string MatchBy { get; set; } + public string DataType { get; set; } + public int IsRequired { get; set; } + } +} diff --git a/src/CncModels/Dto/Brand/BrandListItem.cs b/src/CncModels/Dto/Brand/BrandListItem.cs new file mode 100644 index 0000000..8b35bed --- /dev/null +++ b/src/CncModels/Dto/Brand/BrandListItem.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Brand +{ + /// + /// 品牌模板列表项 + /// + public class BrandListItem + { + public int Id { get; set; } + public string BrandName { get; set; } + public string DeviceField { get; set; } + public string TagsPath { get; set; } + public int IsEnabled { get; set; } + public int FieldCount { get; set; } + } +} diff --git a/src/CncModels/Dto/Brand/CreateBrandRequest.cs b/src/CncModels/Dto/Brand/CreateBrandRequest.cs new file mode 100644 index 0000000..421f0c1 --- /dev/null +++ b/src/CncModels/Dto/Brand/CreateBrandRequest.cs @@ -0,0 +1,12 @@ +namespace CncModels.Dto.Brand +{ + /// + /// 新增品牌模板请求 + /// + public class CreateBrandRequest + { + public string BrandName { get; set; } + public string DeviceField { get; set; } + public string TagsPath { get; set; } + } +} diff --git a/src/CncModels/Dto/Brand/StandardFieldResponse.cs b/src/CncModels/Dto/Brand/StandardFieldResponse.cs new file mode 100644 index 0000000..847d5ae --- /dev/null +++ b/src/CncModels/Dto/Brand/StandardFieldResponse.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Brand +{ + /// + /// 标准字段列表 + /// + public class StandardFieldResponse + { + public string StandardField { get; set; } + public string Description { get; set; } + } +} diff --git a/src/CncModels/Dto/Brand/UpdateBrandRequest.cs b/src/CncModels/Dto/Brand/UpdateBrandRequest.cs new file mode 100644 index 0000000..a527174 --- /dev/null +++ b/src/CncModels/Dto/Brand/UpdateBrandRequest.cs @@ -0,0 +1,12 @@ +namespace CncModels.Dto.Brand +{ + /// + /// 更新品牌模板请求 + /// + public class UpdateBrandRequest + { + public string BrandName { get; set; } + public string DeviceField { get; set; } + public string TagsPath { get; set; } + } +} diff --git a/src/CncModels/Dto/CollectAddress/CollectAddressDetailResponse.cs b/src/CncModels/Dto/CollectAddress/CollectAddressDetailResponse.cs new file mode 100644 index 0000000..63fed8f --- /dev/null +++ b/src/CncModels/Dto/CollectAddress/CollectAddressDetailResponse.cs @@ -0,0 +1,16 @@ +namespace CncModels.Dto.CollectAddress +{ + /// + /// 采集地址详情(扩展字段留待未来扩展) + /// + public class CollectAddressDetailResponse + { + public int Id { get; set; } + public string Name { get; set; } + public string Url { get; set; } + public int BrandId { get; set; } + public string BrandName { get; set; } + public int CollectInterval { get; set; } + public int IsEnabled { get; set; } + } +} diff --git a/src/CncModels/Dto/CollectAddress/CollectAddressListItem.cs b/src/CncModels/Dto/CollectAddress/CollectAddressListItem.cs new file mode 100644 index 0000000..8fd9692 --- /dev/null +++ b/src/CncModels/Dto/CollectAddress/CollectAddressListItem.cs @@ -0,0 +1,18 @@ +namespace CncModels.Dto.CollectAddress +{ + /// + /// 采集地址列表项 + /// + public class CollectAddressListItem + { + public int Id { get; set; } + public string Name { get; set; } + public string Url { get; set; } + public int BrandId { get; set; } + public string BrandName { get; set; } + public int CollectInterval { get; set; } + public int IsEnabled { get; set; } + public System.DateTime? LastCollectTime { get; set; } + public int MachineCount { get; set; } + } +} diff --git a/src/CncModels/Dto/CollectAddress/CollectAddressQuery.cs b/src/CncModels/Dto/CollectAddress/CollectAddressQuery.cs new file mode 100644 index 0000000..6360fcd --- /dev/null +++ b/src/CncModels/Dto/CollectAddress/CollectAddressQuery.cs @@ -0,0 +1,14 @@ +using CncModels.Dto; + +namespace CncModels.Dto.CollectAddress +{ + /// + /// 采集地址查询(分页) + /// + public class CollectAddressQuery : PagedQuery + { + public string Keyword { get; set; } + public int? BrandId { get; set; } + public int? IsEnabled { get; set; } + } +} diff --git a/src/CncModels/Dto/CollectAddress/CreateCollectAddressRequest.cs b/src/CncModels/Dto/CollectAddress/CreateCollectAddressRequest.cs new file mode 100644 index 0000000..702583f --- /dev/null +++ b/src/CncModels/Dto/CollectAddress/CreateCollectAddressRequest.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.CollectAddress +{ + /// + /// 新增采集地址请求 + /// + public class CreateCollectAddressRequest + { + public string Name { get; set; } + public string Url { get; set; } + public int BrandId { get; set; } + public int CollectInterval { get; set; } + } +} diff --git a/src/CncModels/Dto/CollectAddress/UpdateCollectAddressRequest.cs b/src/CncModels/Dto/CollectAddress/UpdateCollectAddressRequest.cs new file mode 100644 index 0000000..9001ed0 --- /dev/null +++ b/src/CncModels/Dto/CollectAddress/UpdateCollectAddressRequest.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.CollectAddress +{ + /// + /// 编辑采集地址请求 + /// + public class UpdateCollectAddressRequest + { + public string Name { get; set; } + public string Url { get; set; } + public int BrandId { get; set; } + public int CollectInterval { get; set; } + } +} diff --git a/src/CncModels/Dto/Common/SimpleOption.cs b/src/CncModels/Dto/Common/SimpleOption.cs new file mode 100644 index 0000000..198e506 --- /dev/null +++ b/src/CncModels/Dto/Common/SimpleOption.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Common +{ + /// + /// 通用下拉项 + /// + public class SimpleOption + { + public string Value { get; set; } + public string Label { get; set; } + } +} diff --git a/src/CncModels/Dto/Dashboard/DashboardQuery.cs b/src/CncModels/Dto/Dashboard/DashboardQuery.cs new file mode 100644 index 0000000..0152ee4 --- /dev/null +++ b/src/CncModels/Dto/Dashboard/DashboardQuery.cs @@ -0,0 +1,16 @@ +using System; + +namespace CncModels.Dto.Dashboard +{ + /// + /// 仪表盘查询参数(日期筛选,不带分页) + /// + public class DashboardQuery + { + /// 起始日期 + public DateTime? StartDate { get; set; } + + /// 结束日期 + public DateTime? EndDate { get; set; } + } +} diff --git a/src/CncModels/Dto/Dashboard/DashboardSummaryResponse.cs b/src/CncModels/Dto/Dashboard/DashboardSummaryResponse.cs new file mode 100644 index 0000000..504a695 --- /dev/null +++ b/src/CncModels/Dto/Dashboard/DashboardSummaryResponse.cs @@ -0,0 +1,34 @@ +using System; + +namespace CncModels.Dto.Dashboard +{ + /// + /// 仪表盘总览数据 + /// + public class DashboardSummaryResponse + { + /// 在线机床数量 + public int OnlineCount { get; set; } + + /// 总机床数量 + public int TotalMachines { get; set; } + + /// 今日产量(件) + public int TodayProduction { get; set; } + + /// 活跃告警数量 + public int ActiveAlerts { get; set; } + + /// 采集成功率(百分比,小数不放大) + public decimal CollectSuccessRate { get; set; } + + /// 今日总工作时长/产线运行时间,单位分钟 + public int TodayCuttingTime { get; set; } + + /// 正在运行的机床数量 + public int RunningMachines { get; set; } + + /// 数据缺失机床数量 + public int DataMissingMachines { get; set; } + } +} diff --git a/src/CncModels/Dto/Dashboard/MachineRankResponse.cs b/src/CncModels/Dto/Dashboard/MachineRankResponse.cs new file mode 100644 index 0000000..480904c --- /dev/null +++ b/src/CncModels/Dto/Dashboard/MachineRankResponse.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Dashboard +{ + /// + /// 机床产量排行项 + /// + public class MachineRankResponse + { + public int Rank { get; set; } + public int MachineId { get; set; } + public string MachineName { get; set; } + public string Program { get; set; } + public int Quantity { get; set; } + public int Status { get; set; } + } +} diff --git a/src/CncModels/Dto/Dashboard/WorkerRankResponse.cs b/src/CncModels/Dto/Dashboard/WorkerRankResponse.cs new file mode 100644 index 0000000..596c290 --- /dev/null +++ b/src/CncModels/Dto/Dashboard/WorkerRankResponse.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Dashboard +{ + /// + /// 工人产量排行项 + /// + public class WorkerRankResponse + { + public int Rank { get; set; } + public int WorkerId { get; set; } + public string WorkerName { get; set; } + public int MachineCount { get; set; } + public int TotalQuantity { get; set; } + } +} diff --git a/src/CncModels/Dto/Dashboard/WorkshopProductionResponse.cs b/src/CncModels/Dto/Dashboard/WorkshopProductionResponse.cs new file mode 100644 index 0000000..e93a15d --- /dev/null +++ b/src/CncModels/Dto/Dashboard/WorkshopProductionResponse.cs @@ -0,0 +1,22 @@ +using System; + +namespace CncModels.Dto.Dashboard +{ + /// + /// 各车间产量详情 + /// + public class WorkshopProductionResponse + { + /// 车间名称 + public string WorkshopName { get; set; } + + /// 产量 + public int Quantity { get; set; } + + /// 机床数量 + public int MachineCount { get; set; } + + /// 日均产量 + public decimal AvgQuantity { get; set; } + } +} diff --git a/src/CncModels/Dto/Log/AdjustmentLogListItem.cs b/src/CncModels/Dto/Log/AdjustmentLogListItem.cs new file mode 100644 index 0000000..641e747 --- /dev/null +++ b/src/CncModels/Dto/Log/AdjustmentLogListItem.cs @@ -0,0 +1,17 @@ +namespace CncModels.Dto.Log +{ + /// + /// 调整日志列表项 + /// + public class AdjustmentLogListItem + { + public int Id { get; set; } + public string CreatedAt { get; set; } + public string TargetTable { get; set; } + public int TargetId { get; set; } + public string OldValue { get; set; } + public string NewValue { get; set; } + public string Reason { get; set; } + public string OperatorIp { get; set; } + } +} diff --git a/src/CncModels/Dto/Log/AdjustmentLogQuery.cs b/src/CncModels/Dto/Log/AdjustmentLogQuery.cs new file mode 100644 index 0000000..7a18986 --- /dev/null +++ b/src/CncModels/Dto/Log/AdjustmentLogQuery.cs @@ -0,0 +1,15 @@ +using CncModels.Dto; + +namespace CncModels.Dto.Log +{ + /// + /// 调整日志查询(分页) + /// + public class AdjustmentLogQuery : PagedQuery + { + public string StartDate { get; set; } + public string EndDate { get; set; } + public string TargetTable { get; set; } + public string Keyword { get; set; } + } +} diff --git a/src/CncModels/Dto/Log/SystemLogListItem.cs b/src/CncModels/Dto/Log/SystemLogListItem.cs new file mode 100644 index 0000000..a2886d1 --- /dev/null +++ b/src/CncModels/Dto/Log/SystemLogListItem.cs @@ -0,0 +1,16 @@ +namespace CncModels.Dto.Log +{ + /// + /// 系统日志列表项 + /// + public class SystemLogListItem + { + public int Id { get; set; } + public string CreatedAt { get; set; } + public string LogLevel { get; set; } + public string Source { get; set; } + public string Message { get; set; } + public string StackTrace { get; set; } + public string ExtraData { get; set; } + } +} diff --git a/src/CncModels/Dto/Log/SystemLogQuery.cs b/src/CncModels/Dto/Log/SystemLogQuery.cs new file mode 100644 index 0000000..8a4ea7f --- /dev/null +++ b/src/CncModels/Dto/Log/SystemLogQuery.cs @@ -0,0 +1,16 @@ +using CncModels.Dto; + +namespace CncModels.Dto.Log +{ + /// + /// 系统日志查询(分页) + /// + public class SystemLogQuery : PagedQuery + { + public string StartDate { get; set; } + public string EndDate { get; set; } + public string LogLevel { get; set; } + public string Source { get; set; } + public string Keyword { get; set; } + } +} diff --git a/src/CncModels/Dto/Login/LoginRequest.cs b/src/CncModels/Dto/Login/LoginRequest.cs new file mode 100644 index 0000000..c170a73 --- /dev/null +++ b/src/CncModels/Dto/Login/LoginRequest.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Dto.Login +{ + /// + /// 登录请求 + /// + public class LoginRequest + { + /// 用户名 + public string Username { get; set; } + + /// 密码 + public string Password { get; set; } + + /// 是否记住密码/保持登录 + public bool? RememberMe { get; set; } + } +} diff --git a/src/CncModels/Dto/Login/LoginResponse.cs b/src/CncModels/Dto/Login/LoginResponse.cs new file mode 100644 index 0000000..88028e5 --- /dev/null +++ b/src/CncModels/Dto/Login/LoginResponse.cs @@ -0,0 +1,16 @@ +using System; + +namespace CncModels.Dto.Login +{ + /// + /// 登录响应 + /// + public class LoginResponse + { + /// JWT Token + public string Token { get; set; } + + /// Token 过期时间(秒) + public int ExpiresIn { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/CreateMachineRequest.cs b/src/CncModels/Dto/Machine/CreateMachineRequest.cs new file mode 100644 index 0000000..eaac76c --- /dev/null +++ b/src/CncModels/Dto/Machine/CreateMachineRequest.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Machine +{ + /// + /// 新增机床请求 + /// + public class CreateMachineRequest + { + public string DeviceCode { get; set; } + public string Name { get; set; } + public int WorkshopId { get; set; } + public int CollectAddressId { get; set; } + public string IpAddress { get; set; } + public int BrandId { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/MachineDetailResponse.cs b/src/CncModels/Dto/Machine/MachineDetailResponse.cs new file mode 100644 index 0000000..bb4a49a --- /dev/null +++ b/src/CncModels/Dto/Machine/MachineDetailResponse.cs @@ -0,0 +1,27 @@ +using System; + +namespace CncModels.Dto.Machine +{ + /// + /// 机床详情 + /// + public class MachineDetailResponse + { + public int Id { get; set; } + public string DeviceCode { get; set; } + public string Name { get; set; } + public int WorkshopId { get; set; } + public string WorkshopName { get; set; } + public int CollectAddressId { get; set; } + public int BrandId { get; set; } + public string BrandName { get; set; } + public string IpAddress { get; set; } + public int IsEnabled { get; set; } + public int IsOnline { get; set; } + public int? WorkerId { get; set; } + public string WorkerName { get; set; } + public string LastProgramName { get; set; } + public DateTime? LastCollectTime { get; set; } + // 其他扩展字段留作后续扩展 + } +} diff --git a/src/CncModels/Dto/Machine/MachineListItem.cs b/src/CncModels/Dto/Machine/MachineListItem.cs new file mode 100644 index 0000000..6766008 --- /dev/null +++ b/src/CncModels/Dto/Machine/MachineListItem.cs @@ -0,0 +1,26 @@ +using System; + +namespace CncModels.Dto.Machine +{ + /// + /// 机床列表项 + /// + public class MachineListItem + { + public int Id { get; set; } + public string DeviceCode { get; set; } + public string Name { get; set; } + public int WorkshopId { get; set; } + public string WorkshopName { get; set; } + public int CollectAddressId { get; set; } + public int BrandId { get; set; } + public string BrandName { get; set; } + public string IpAddress { get; set; } + public int IsEnabled { get; set; } + public int IsOnline { get; set; } + public int? WorkerId { get; set; } + public string WorkerName { get; set; } + public string LastProgramName { get; set; } + public DateTime? LastCollectTime { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/MachineProductionResponse.cs b/src/CncModels/Dto/Machine/MachineProductionResponse.cs new file mode 100644 index 0000000..420bf01 --- /dev/null +++ b/src/CncModels/Dto/Machine/MachineProductionResponse.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Machine +{ + /// + /// 今日产量与趋势(简化模型) + /// + public class MachineProductionResponse + { + /// 今日产量 + public int TodayQuantity { get; set; } + + /// 趋势数据(JSON 字符串) + public string Trend { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/MachineQuery.cs b/src/CncModels/Dto/Machine/MachineQuery.cs new file mode 100644 index 0000000..6990551 --- /dev/null +++ b/src/CncModels/Dto/Machine/MachineQuery.cs @@ -0,0 +1,22 @@ +using CncModels.Dto; + +namespace CncModels.Dto.Machine +{ + /// + /// 机床查询(分页) + /// + public class MachineQuery : PagedQuery + { + /// 搜索关键字(名称/编码) + public string Keyword { get; set; } + + /// 车间ID + public int? WorkshopId { get; set; } + + /// 是否在线(1在线 0离线) + public int? IsOnline { get; set; } + + /// 品牌ID + public int? BrandId { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/MachineStatusResponse.cs b/src/CncModels/Dto/Machine/MachineStatusResponse.cs new file mode 100644 index 0000000..99c9d2a --- /dev/null +++ b/src/CncModels/Dto/Machine/MachineStatusResponse.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.Machine +{ + /// + /// 实时采集状态 + /// + public class MachineStatusResponse + { + public int Status { get; set; } + public System.DateTime? LastUpdate { get; set; } + public string LastProgramName { get; set; } + public string Message { get; set; } + } +} diff --git a/src/CncModels/Dto/Machine/UpdateMachineRequest.cs b/src/CncModels/Dto/Machine/UpdateMachineRequest.cs new file mode 100644 index 0000000..0c17640 --- /dev/null +++ b/src/CncModels/Dto/Machine/UpdateMachineRequest.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Machine +{ + /// + /// 编辑机床请求 + /// + public class UpdateMachineRequest + { + public string Name { get; set; } + public int WorkshopId { get; set; } + public int CollectAddressId { get; set; } + public string IpAddress { get; set; } + public int BrandId { get; set; } + } +} diff --git a/src/CncModels/Dto/Production/DailyProductionListItem.cs b/src/CncModels/Dto/Production/DailyProductionListItem.cs new file mode 100644 index 0000000..aaa3f53 --- /dev/null +++ b/src/CncModels/Dto/Production/DailyProductionListItem.cs @@ -0,0 +1,19 @@ +namespace CncModels.Dto.Production +{ + /// + /// 日产量列表项 + /// + public class DailyProductionListItem + { + public int Id { get; set; } + public string Date { get; set; } + public string MachineName { get; set; } + public string ProgramName { get; set; } + public int Quantity { get; set; } + public string RunTime { get; set; } + public string CuttingTime { get; set; } + public string DataStatus { get; set; } + public int IsAdjusted { get; set; } + public int? AdjustedQuantity { get; set; } + } +} diff --git a/src/CncModels/Dto/Production/DailySummaryResponse.cs b/src/CncModels/Dto/Production/DailySummaryResponse.cs new file mode 100644 index 0000000..b12325a --- /dev/null +++ b/src/CncModels/Dto/Production/DailySummaryResponse.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.Production +{ + /// + /// 日汇总统计 + /// + public class DailySummaryResponse + { + public int TotalQuantity { get; set; } + public int MachineCount { get; set; } + public int NormalCount { get; set; } + public int OfflineCount { get; set; } + } +} diff --git a/src/CncModels/Dto/Production/ProductionAdjustRequest.cs b/src/CncModels/Dto/Production/ProductionAdjustRequest.cs new file mode 100644 index 0000000..3ed093a --- /dev/null +++ b/src/CncModels/Dto/Production/ProductionAdjustRequest.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Production +{ + /// + /// 调整产量请求 + /// + public class ProductionAdjustRequest + { + public string TargetTable { get; set; } + public int TargetId { get; set; } + public string FieldName { get; set; } + public string NewValue { get; set; } + public string Reason { get; set; } + } +} diff --git a/src/CncModels/Dto/Production/ProductionAdjustmentHistoryResponse.cs b/src/CncModels/Dto/Production/ProductionAdjustmentHistoryResponse.cs new file mode 100644 index 0000000..73102e7 --- /dev/null +++ b/src/CncModels/Dto/Production/ProductionAdjustmentHistoryResponse.cs @@ -0,0 +1,17 @@ +namespace CncModels.Dto.Production +{ + /// + /// 产量调整历史 + /// + public class ProductionAdjustmentHistoryResponse + { + public int Id { get; set; } + public string TargetTable { get; set; } + public int TargetId { get; set; } + public string OldValue { get; set; } + public string NewValue { get; set; } + public string Reason { get; set; } + public string OperatorIp { get; set; } + public System.DateTime? CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Dto/Production/ProductionQuery.cs b/src/CncModels/Dto/Production/ProductionQuery.cs new file mode 100644 index 0000000..6cc67fa --- /dev/null +++ b/src/CncModels/Dto/Production/ProductionQuery.cs @@ -0,0 +1,16 @@ +using CncModels.Dto; + +namespace CncModels.Dto.Production +{ + /// + /// 产量查询(分页) + /// + public class ProductionQuery : PagedQuery + { + public System.DateTime? Date { get; set; } + public int? WorkshopId { get; set; } + public int? MachineId { get; set; } + public int? WorkerId { get; set; } + public string DataStatus { get; set; } + } +} diff --git a/src/CncModels/Dto/Screen/ScreenFilterResponse.cs b/src/CncModels/Dto/Screen/ScreenFilterResponse.cs new file mode 100644 index 0000000..6b89893 --- /dev/null +++ b/src/CncModels/Dto/Screen/ScreenFilterResponse.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using CncModels.Dto.Common; + +namespace CncModels.Dto.Screen +{ + /// + /// 筛选条件集合(大屏用) + /// + public class ScreenFilterResponse + { + public List Filters { get; set; } = new List(); + } +} diff --git a/src/CncModels/Dto/Screen/ScreenMachineStatusResponse.cs b/src/CncModels/Dto/Screen/ScreenMachineStatusResponse.cs new file mode 100644 index 0000000..e176bfa --- /dev/null +++ b/src/CncModels/Dto/Screen/ScreenMachineStatusResponse.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.Screen +{ + /// + /// 机床状态总览 + /// + public class ScreenMachineStatusResponse + { + public string MachineName { get; set; } + public int Status { get; set; } + public string Program { get; set; } + public string RunTime { get; set; } + } +} diff --git a/src/CncModels/Dto/Screen/ScreenSummaryResponse.cs b/src/CncModels/Dto/Screen/ScreenSummaryResponse.cs new file mode 100644 index 0000000..247a16a --- /dev/null +++ b/src/CncModels/Dto/Screen/ScreenSummaryResponse.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.Screen +{ + /// + /// 大屏汇总数据(简化模型) + /// + public class ScreenSummaryResponse + { + public int MachineCount { get; set; } + public int ProductionToday { get; set; } + public int AlertCount { get; set; } + public int OnlineCount { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/CreateScreenConfigRequest.cs b/src/CncModels/Dto/ScreenConfig/CreateScreenConfigRequest.cs new file mode 100644 index 0000000..72c0db1 --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/CreateScreenConfigRequest.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 新增屏幕配置请求 + /// + public class CreateScreenConfigRequest + { + public string ConfigName { get; set; } + public string ConfigValue { get; set; } + public string Description { get; set; } + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/CreateScreenFilterRequest.cs b/src/CncModels/Dto/ScreenConfig/CreateScreenFilterRequest.cs new file mode 100644 index 0000000..5a35b62 --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/CreateScreenFilterRequest.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 新增屏幕筛选项请求 + /// + public class CreateScreenFilterRequest + { + public string Name { get; set; } + public string Value { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/ScreenConfigListItem.cs b/src/CncModels/Dto/ScreenConfig/ScreenConfigListItem.cs new file mode 100644 index 0000000..9010149 --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/ScreenConfigListItem.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 卡片配置列表项 + /// + public class ScreenConfigListItem + { + public int Id { get; set; } + public string ConfigName { get; set; } + public string ConfigValue { get; set; } + public string Description { get; set; } + public int IsEnabled { get; set; } + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/ScreenFilterListItem.cs b/src/CncModels/Dto/ScreenConfig/ScreenFilterListItem.cs new file mode 100644 index 0000000..e3d39c4 --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/ScreenFilterListItem.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 筛选项列表项 + /// + public class ScreenFilterListItem + { + public int Id { get; set; } + public string Name { get; set; } + public string Value { get; set; } + public int IsEnabled { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/UpdateScreenConfigRequest.cs b/src/CncModels/Dto/ScreenConfig/UpdateScreenConfigRequest.cs new file mode 100644 index 0000000..23e8cef --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/UpdateScreenConfigRequest.cs @@ -0,0 +1,13 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 更新屏幕配置请求 + /// + public class UpdateScreenConfigRequest + { + public int Id { get; set; } + public string ConfigValue { get; set; } + public string Description { get; set; } + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Dto/ScreenConfig/UpdateScreenFilterRequest.cs b/src/CncModels/Dto/ScreenConfig/UpdateScreenFilterRequest.cs new file mode 100644 index 0000000..6a2d856 --- /dev/null +++ b/src/CncModels/Dto/ScreenConfig/UpdateScreenFilterRequest.cs @@ -0,0 +1,12 @@ +namespace CncModels.Dto.ScreenConfig +{ + /// + /// 更新屏幕筛选项请求 + /// + public class UpdateScreenFilterRequest + { + public int Id { get; set; } + public string Name { get; set; } + public string Value { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/ChangePasswordRequest.cs b/src/CncModels/Dto/Settings/ChangePasswordRequest.cs new file mode 100644 index 0000000..ffa2ecd --- /dev/null +++ b/src/CncModels/Dto/Settings/ChangePasswordRequest.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 修改密码请求 + /// + public class ChangePasswordRequest + { + public string OldPassword { get; set; } + public string NewPassword { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/CreateWorkshopRequest.cs b/src/CncModels/Dto/Settings/CreateWorkshopRequest.cs new file mode 100644 index 0000000..a1fb58d --- /dev/null +++ b/src/CncModels/Dto/Settings/CreateWorkshopRequest.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 新增车间请求 + /// + public class CreateWorkshopRequest + { + public string Name { get; set; } + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/SysConfigListItem.cs b/src/CncModels/Dto/Settings/SysConfigListItem.cs new file mode 100644 index 0000000..068bf81 --- /dev/null +++ b/src/CncModels/Dto/Settings/SysConfigListItem.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 系统配置项 + /// + public class SysConfigListItem + { + public int Id { get; set; } + public string ConfigKey { get; set; } + public string ConfigValue { get; set; } + public string ValueType { get; set; } + public string Description { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/UpdateSysConfigRequest.cs b/src/CncModels/Dto/Settings/UpdateSysConfigRequest.cs new file mode 100644 index 0000000..5c70a7f --- /dev/null +++ b/src/CncModels/Dto/Settings/UpdateSysConfigRequest.cs @@ -0,0 +1,10 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 更新系统配置请求 + /// + public class UpdateSysConfigRequest + { + public string ConfigValue { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/UpdateWorkshopRequest.cs b/src/CncModels/Dto/Settings/UpdateWorkshopRequest.cs new file mode 100644 index 0000000..6ff3421 --- /dev/null +++ b/src/CncModels/Dto/Settings/UpdateWorkshopRequest.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 编辑车间请求 + /// + public class UpdateWorkshopRequest + { + public string Name { get; set; } + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Dto/Settings/WorkshopListItem.cs b/src/CncModels/Dto/Settings/WorkshopListItem.cs new file mode 100644 index 0000000..d45db02 --- /dev/null +++ b/src/CncModels/Dto/Settings/WorkshopListItem.cs @@ -0,0 +1,14 @@ +namespace CncModels.Dto.Settings +{ + /// + /// 车间列表项 + /// + public class WorkshopListItem + { + public int Id { get; set; } + public string Name { get; set; } + public int SortOrder { get; set; } + public int IsEnabled { get; set; } + public int MachineCount { get; set; } + } +} diff --git a/src/CncModels/Dto/Worker/CreateWorkerRequest.cs b/src/CncModels/Dto/Worker/CreateWorkerRequest.cs new file mode 100644 index 0000000..915909e --- /dev/null +++ b/src/CncModels/Dto/Worker/CreateWorkerRequest.cs @@ -0,0 +1,11 @@ +namespace CncModels.Dto.Worker +{ + /// + /// 新增工人请求 + /// + public class CreateWorkerRequest + { + public string Name { get; set; } + public string Code { get; set; } + } +} diff --git a/src/CncModels/Dto/Worker/UpdateWorkerRequest.cs b/src/CncModels/Dto/Worker/UpdateWorkerRequest.cs new file mode 100644 index 0000000..2a41165 --- /dev/null +++ b/src/CncModels/Dto/Worker/UpdateWorkerRequest.cs @@ -0,0 +1,10 @@ +namespace CncModels.Dto.Worker +{ + /// + /// 更新工人请求 + /// + public class UpdateWorkerRequest + { + public string Name { get; set; } + } +} diff --git a/src/CncModels/Dto/Worker/WorkerDetailResponse.cs b/src/CncModels/Dto/Worker/WorkerDetailResponse.cs new file mode 100644 index 0000000..f3c8272 --- /dev/null +++ b/src/CncModels/Dto/Worker/WorkerDetailResponse.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Worker +{ + /// + /// 工人详情 + /// + public class WorkerDetailResponse + { + public int Id { get; set; } + public string Code { get; set; } + public string Name { get; set; } + public int IsEnabled { get; set; } + public int MachineCount { get; set; } + public string MachineNames { get; set; } + } +} diff --git a/src/CncModels/Dto/Worker/WorkerListItem.cs b/src/CncModels/Dto/Worker/WorkerListItem.cs new file mode 100644 index 0000000..723f18a --- /dev/null +++ b/src/CncModels/Dto/Worker/WorkerListItem.cs @@ -0,0 +1,15 @@ +namespace CncModels.Dto.Worker +{ + /// + /// 工人列表项 + /// + public class WorkerListItem + { + public int Id { get; set; } + public string Code { get; set; } + public string Name { get; set; } + public int IsEnabled { get; set; } + public int MachineCount { get; set; } + public string MachineNames { get; set; } + } +} diff --git a/src/CncModels/Dto/Worker/WorkerQuery.cs b/src/CncModels/Dto/Worker/WorkerQuery.cs new file mode 100644 index 0000000..114dfdb --- /dev/null +++ b/src/CncModels/Dto/Worker/WorkerQuery.cs @@ -0,0 +1,13 @@ +using CncModels.Dto; + +namespace CncModels.Dto.Worker +{ + /// + /// 工人查询(分页) + /// + public class WorkerQuery : PagedQuery + { + public string Keyword { get; set; } + public int? IsEnabled { get; set; } + } +} diff --git a/src/CncModels/Entity/Alert.cs b/src/CncModels/Entity/Alert.cs new file mode 100644 index 0000000..c4e54e9 --- /dev/null +++ b/src/CncModels/Entity/Alert.cs @@ -0,0 +1,37 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_alert 告警表 + /// + public class Alert + { + /// 主键ID + public long Id { get; set; } + + /// 告警类型 + public string AlertType { get; set; } + + /// 机床ID + public int? MachineId { get; set; } + + /// 采集地址ID + public int? CollectAddressId { get; set; } + + /// 标题 + public string Title { get; set; } + + /// 详情 + public string Detail { get; set; } + + /// 是否已解决 + public int IsResolved { get; set; } + + /// 解决时间 + public DateTime? ResolvedAt { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/Brand.cs b/src/CncModels/Entity/Brand.cs new file mode 100644 index 0000000..011fed4 --- /dev/null +++ b/src/CncModels/Entity/Brand.cs @@ -0,0 +1,31 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_brand CNC品牌模板表 + /// + public class Brand + { + /// 主键ID + public int Id { get; set; } + + /// 品牌名称 + public string BrandName { get; set; } + + /// 设备字段名 + public string DeviceField { get; set; } + + /// 标签路径 + public string TagsPath { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/BrandFieldMapping.cs b/src/CncModels/Entity/BrandFieldMapping.cs new file mode 100644 index 0000000..6fc2858 --- /dev/null +++ b/src/CncModels/Entity/BrandFieldMapping.cs @@ -0,0 +1,34 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_brand_field_mapping 品牌字段映射表 + /// + public class BrandFieldMapping + { + /// 主键ID + public int Id { get; set; } + + /// 品牌ID + public int BrandId { get; set; } + + /// 标准字段 + public string StandardField { get; set; } + + /// 字段名 + public string FieldName { get; set; } + + /// 匹配规则 + public string MatchBy { get; set; } + + /// 数据类型 + public string DataType { get; set; } + + /// 是否必填 + public int IsRequired { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/CollectAddress.cs b/src/CncModels/Entity/CollectAddress.cs new file mode 100644 index 0000000..d5d1081 --- /dev/null +++ b/src/CncModels/Entity/CollectAddress.cs @@ -0,0 +1,43 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_collect_address 采集地址表 + /// + public class CollectAddress + { + /// 主键ID + public int Id { get; set; } + + /// 名称 + public string Name { get; set; } + + /// 地址URL + public string Url { get; set; } + + /// 品牌ID + public int BrandId { get; set; } + + /// 采集间隔(秒/单位未约定以整型表示) + public int CollectInterval { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 最近采集时间 + public DateTime? LastCollectTime { get; set; } + + /// 最近采集状态 + public string LastCollectStatus { get; set; } + + /// 失败次数 + public int FailCount { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/CollectRaw.cs b/src/CncModels/Entity/CollectRaw.cs new file mode 100644 index 0000000..46b88d3 --- /dev/null +++ b/src/CncModels/Entity/CollectRaw.cs @@ -0,0 +1,40 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// log_collect_raw 原始采集JSON表 + /// + public class CollectRaw + { + /// 主键ID + public long Id { get; set; } + + /// 采集地址ID + public int CollectAddressId { get; set; } + + /// 请求时间 + public DateTime RequestTime { get; set; } + + /// 响应时间 + public DateTime ResponseTime { get; set; } + + /// 响应时长 + public int? ResponseDuration { get; set; } + + /// 是否成功 + public int IsSuccess { get; set; } + + /// 状态码 + public int? StatusCode { get; set; } + + /// 原始JSON + public string RawJson { get; set; } + + /// 错误信息 + public string ErrorMessage { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/CollectRecord.cs b/src/CncModels/Entity/CollectRecord.cs new file mode 100644 index 0000000..430299b --- /dev/null +++ b/src/CncModels/Entity/CollectRecord.cs @@ -0,0 +1,76 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_collect_record 采集结构化记录表 + /// + public class CollectRecord + { + /// 主键ID + public long Id { get; set; } + + /// 机床ID + public int MachineId { get; set; } + + /// 采集时间 + public DateTime CollectTime { get; set; } + + /// 设备时间 + public DateTime? DeviceTime { get; set; } + + /// NC程序名 + public string ProgramName { get; set; } + + /// 零件计数 + public decimal? PartCount { get; set; } + + /// 设备状态 + public string DeviceStatus { get; set; } + + /// 运行状态 + public string RunStatus { get; set; } + + /// 操作模式 + public string OperateMode { get; set; } + + /// 主轴设定速度 + public decimal? SpindleSpeedSet { get; set; } + + /// 进给设定速度 + public decimal? FeedSpeedSet { get; set; } + + /// 主轴实际速度 + public decimal? SpindleSpeedActual { get; set; } + + /// 进给实际速度 + public decimal? FeedSpeedActual { get; set; } + + /// 主轴负载 + public decimal? SpindleLoad { get; set; } + + /// 主轴倍率 + public decimal? SpindleOverride { get; set; } + + /// 开机时间 + public decimal? PowerOnTime { get; set; } + + /// 运行时间 + public decimal? RunTime { get; set; } + + /// 切削时间 + public decimal? CuttingTime { get; set; } + + /// 循环时间 + public decimal? CycleTime { get; set; } + + /// 加工状态 + public string MachiningStatus { get; set; } + + /// 扩展数据(JSON 字符串) + public string ExtraData { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/CollectorHeartbeat.cs b/src/CncModels/Entity/CollectorHeartbeat.cs new file mode 100644 index 0000000..72a6aa8 --- /dev/null +++ b/src/CncModels/Entity/CollectorHeartbeat.cs @@ -0,0 +1,40 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// log_collector_heartbeat 采集服务心跳表 + /// + public class CollectorHeartbeat + { + /// 主键ID + public long Id { get; set; } + + /// 服务ID + public string ServiceId { get; set; } + + /// 状态 + public string Status { get; set; } + + /// 采集地址ID + public int? CollectAddressId { get; set; } + + /// 最近采集时间 + public DateTime? LastCollectTime { get; set; } + + /// 成功次数 + public int SuccessCount { get; set; } + + /// 失败次数 + public int FailCount { get; set; } + + /// 运行时长(秒) + public long? UptimeSeconds { get; set; } + + /// 详情(JSON 字符串) + public string Detail { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/DailyProduction.cs b/src/CncModels/Entity/DailyProduction.cs new file mode 100644 index 0000000..59176d9 --- /dev/null +++ b/src/CncModels/Entity/DailyProduction.cs @@ -0,0 +1,49 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_daily_production 日汇总表 + /// + public class DailyProduction + { + /// 主键ID + public int Id { get; set; } + + /// 机床ID + public int MachineId { get; set; } + + /// 生产日期 + public DateTime ProductionDate { get; set; } + + /// 程序名 + public string ProgramName { get; set; } + + /// 总产量 + public decimal TotalQuantity { get; set; } + + /// 段数 + public int SegmentCount { get; set; } + + /// 总运行时间 + public decimal? TotalRunTime { get; set; } + + /// 总切削时间 + public decimal? TotalCuttingTime { get; set; } + + /// 总循环时间 + public decimal? TotalCycleTime { get; set; } + + /// 是否已调整 + public int IsAdjusted { get; set; } + + /// 调整后的数量 + public decimal? AdjustedQuantity { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/Machine.cs b/src/CncModels/Entity/Machine.cs new file mode 100644 index 0000000..35b6fb0 --- /dev/null +++ b/src/CncModels/Entity/Machine.cs @@ -0,0 +1,67 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_machine 机床表 + /// + public class Machine + { + /// 主键ID + public int Id { get; set; } + + /// 设备编码 + public string DeviceCode { get; set; } + + /// 名称 + public string Name { get; set; } + + /// 车间ID + public int WorkshopId { get; set; } + + /// 采集地址ID + public int CollectAddressId { get; set; } + + /// IP地址 + public string IpAddress { get; set; } + + /// 品牌ID + public int BrandId { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 是否在线 + public int IsOnline { get; set; } + + /// 最近Ping时间 + public DateTime? LastPingTime { get; set; } + + /// 最近采集时间 + public DateTime? LastCollectTime { get; set; } + + /// 最近设备状态 + public string LastDeviceStatus { get; set; } + + /// 最近运行状态 + public string LastRunStatus { get; set; } + + /// 最近程序名 + public string LastProgramName { get; set; } + + /// 最近零件数 + public decimal? LastPartCount { get; set; } + + /// 最近操作模式 + public string LastOperateMode { get; set; } + + /// 最近加工状态 + public string LastMachiningStatus { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/MachineDailyStatus.cs b/src/CncModels/Entity/MachineDailyStatus.cs new file mode 100644 index 0000000..6dd126a --- /dev/null +++ b/src/CncModels/Entity/MachineDailyStatus.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_machine_daily_status 机床日状态表 + /// + public class MachineDailyStatus + { + /// 主键ID + public int Id { get; set; } + + /// 机床ID + public int MachineId { get; set; } + + /// 生产日期 + public DateTime ProductionDate { get; set; } + + /// 数据状态 + public string DataStatus { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/ProductionAdjustment.cs b/src/CncModels/Entity/ProductionAdjustment.cs new file mode 100644 index 0000000..2109be0 --- /dev/null +++ b/src/CncModels/Entity/ProductionAdjustment.cs @@ -0,0 +1,37 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_production_adjustment 产量修正审计表 + /// + public class ProductionAdjustment + { + /// 主键ID + public long Id { get; set; } + + /// 目标表 + public string TargetTable { get; set; } + + /// 目标ID + public int TargetId { get; set; } + + /// 字段名 + public string FieldName { get; set; } + + /// 旧值 + public decimal? OldValue { get; set; } + + /// 新值 + public decimal NewValue { get; set; } + + /// 原因 + public string Reason { get; set; } + + /// 操作IP + public string OperatorIp { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/ProductionSegment.cs b/src/CncModels/Entity/ProductionSegment.cs new file mode 100644 index 0000000..65b5cb2 --- /dev/null +++ b/src/CncModels/Entity/ProductionSegment.cs @@ -0,0 +1,49 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_production_segment 产量分段记录表 + /// + public class ProductionSegment + { + /// 主键ID + public long Id { get; set; } + + /// 机床ID + public int MachineId { get; set; } + + /// 程序名 + public string ProgramName { get; set; } + + /// 生产日期 + public DateTime ProductionDate { get; set; } + + /// 开始时间 + public DateTime StartTime { get; set; } + + /// 结束时间 + public DateTime? EndTime { get; set; } + + /// 起始零件数 + public decimal StartPartCount { get; set; } + + /// 结束零件数 + public decimal? EndPartCount { get; set; } + + /// 产量 + public decimal? Quantity { get; set; } + + /// 是否已结算 + public int IsSettled { get; set; } + + /// 结束原因 + public string CloseReason { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/ScreenConfig.cs b/src/CncModels/Entity/ScreenConfig.cs new file mode 100644 index 0000000..8bea0e5 --- /dev/null +++ b/src/CncModels/Entity/ScreenConfig.cs @@ -0,0 +1,43 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_screen_config 大屏卡片配置表 + /// + public class ScreenConfig + { + /// 主键ID + public int Id { get; set; } + + /// 卡片键 + public string CardKey { get; set; } + + /// 卡片类型 + public string CardType { get; set; } + + /// 标题 + public string Title { get; set; } + + /// 指标 + public string Metric { get; set; } + + /// 维度 + public string Dimension { get; set; } + + /// 排序 + public int SortOrder { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 图表配置(JSON 字符串) + public string ChartConfig { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/ScreenFilter.cs b/src/CncModels/Entity/ScreenFilter.cs new file mode 100644 index 0000000..8761ab6 --- /dev/null +++ b/src/CncModels/Entity/ScreenFilter.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_screen_filter 大屏筛选配置表 + /// + public class ScreenFilter + { + /// 主键ID + public int Id { get; set; } + + /// 屏幕Key + public string ScreenKey { get; set; } + + /// 筛选类型 + public string FilterType { get; set; } + + /// 筛选值 + public string FilterValue { get; set; } + + /// 是否为默认 + public int IsDefault { get; set; } + + /// 排序 + public int SortOrder { get; set; } + } +} diff --git a/src/CncModels/Entity/SysConfig.cs b/src/CncModels/Entity/SysConfig.cs new file mode 100644 index 0000000..0d5e201 --- /dev/null +++ b/src/CncModels/Entity/SysConfig.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_sys_config 系统配置表 + /// + public class SysConfig + { + /// 主键ID + public int Id { get; set; } + + /// 配置键 + public string ConfigKey { get; set; } + + /// 配置值 + public string ConfigValue { get; set; } + + /// 值类型 + public string ValueType { get; set; } + + /// 描述 + public string Description { get; set; } + + /// 最后修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/SystemLog.cs b/src/CncModels/Entity/SystemLog.cs new file mode 100644 index 0000000..00ef806 --- /dev/null +++ b/src/CncModels/Entity/SystemLog.cs @@ -0,0 +1,31 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// log_system 系统日志表 + /// + public class SystemLog + { + /// 主键ID + public long Id { get; set; } + + /// 日志等级 + public string LogLevel { get; set; } + + /// 来源 + public string Source { get; set; } + + /// 消息 + public string Message { get; set; } + + /// 堆栈信息 + public string StackTrace { get; set; } + + /// 扩展数据(JSON 字符串) + public string ExtraData { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/Worker.cs b/src/CncModels/Entity/Worker.cs new file mode 100644 index 0000000..022b2f7 --- /dev/null +++ b/src/CncModels/Entity/Worker.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_worker 工人表 + /// + public class Worker + { + /// 主键ID + public int Id { get; set; } + + /// 姓名 + public string Name { get; set; } + + /// 工号 + public string Code { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/WorkerDailySummary.cs b/src/CncModels/Entity/WorkerDailySummary.cs new file mode 100644 index 0000000..f3c8f75 --- /dev/null +++ b/src/CncModels/Entity/WorkerDailySummary.cs @@ -0,0 +1,40 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_worker_daily_summary 工人日汇总表 + /// + public class WorkerDailySummary + { + /// 主键ID + public int Id { get; set; } + + /// 工人ID + public int WorkerId { get; set; } + + /// 生产日期 + public DateTime ProductionDate { get; set; } + + /// 总产量 + public decimal TotalQuantity { get; set; } + + /// 机床数量 + public int MachineCount { get; set; } + + /// 程序数量 + public int ProgramCount { get; set; } + + /// 是否已调整 + public int IsAdjusted { get; set; } + + /// 调整后的数量 + public decimal? AdjustedQuantity { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/WorkerMachine.cs b/src/CncModels/Entity/WorkerMachine.cs new file mode 100644 index 0000000..18f8242 --- /dev/null +++ b/src/CncModels/Entity/WorkerMachine.cs @@ -0,0 +1,22 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_worker_machine 工人-机床绑定表 + /// + public class WorkerMachine + { + /// 主键ID + public int Id { get; set; } + + /// 工人ID + public int WorkerId { get; set; } + + /// 机床ID + public int MachineId { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + } +} diff --git a/src/CncModels/Entity/Workshop.cs b/src/CncModels/Entity/Workshop.cs new file mode 100644 index 0000000..b4e49e9 --- /dev/null +++ b/src/CncModels/Entity/Workshop.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Entity +{ + /// + /// cnc_workshop 车间表 + /// + public class Workshop + { + /// 主键ID + public int Id { get; set; } + + /// 车间名称 + public string Name { get; set; } + + /// 排序序号 + public int SortOrder { get; set; } + + /// 是否启用 + public int IsEnabled { get; set; } + + /// 创建时间 + public DateTime CreatedAt { get; set; } + + /// 修改时间 + public DateTime UpdatedAt { get; set; } + } +} diff --git a/src/CncModels/Enum/AlertType.cs b/src/CncModels/Enum/AlertType.cs new file mode 100644 index 0000000..b63d7a5 --- /dev/null +++ b/src/CncModels/Enum/AlertType.cs @@ -0,0 +1,25 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 告警类型常量集合(数据库以字符串存储) + /// + public static class AlertType + { + /// 采集失败 + public const string CollectFail = "collect_fail"; + + /// 设备离线 + public const string DeviceOffline = "device_offline"; + + /// 产量异常 + public const string ProductionAnomaly = "production_anomaly"; + + /// 未知设备 + public const string UnknownDevice = "unknown_device"; + + /// 服务错误 + public const string ServiceError = "service_error"; + } +} diff --git a/src/CncModels/Enum/CardType.cs b/src/CncModels/Enum/CardType.cs new file mode 100644 index 0000000..70b3136 --- /dev/null +++ b/src/CncModels/Enum/CardType.cs @@ -0,0 +1,28 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 大屏卡片类型常量(存储为字符串) + /// + public static class CardType + { + /// 统计数字 + public const string StatNumber = "stat_number"; + + /// 柱状图 + public const string BarChart = "bar_chart"; + + /// 折线图 + public const string LineChart = "line_chart"; + + /// 饼图 + public const string PieChart = "pie_chart"; + + /// 状态网格 + public const string StatusGrid = "status_grid"; + + /// 排名列表 + public const string RankList = "rank_list"; + } +} diff --git a/src/CncModels/Enum/CollectStatus.cs b/src/CncModels/Enum/CollectStatus.cs new file mode 100644 index 0000000..ed03648 --- /dev/null +++ b/src/CncModels/Enum/CollectStatus.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 采集结果状态常量 + /// + public static class CollectStatus + { + /// 成功 + public const string Success = "success"; + + /// 失败 + public const string Fail = "fail"; + + /// 超时 + public const string Timeout = "timeout"; + } +} diff --git a/src/CncModels/Enum/CollectorServiceStatus.cs b/src/CncModels/Enum/CollectorServiceStatus.cs new file mode 100644 index 0000000..42dec24 --- /dev/null +++ b/src/CncModels/Enum/CollectorServiceStatus.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 采集服务状态(字符串存储) + /// + public static class CollectorServiceStatus + { + /// 运行中 + public const string Running = "running"; + + /// 已停止 + public const string Stopped = "stopped"; + + /// 错误 + public const string Error = "error"; + } +} diff --git a/src/CncModels/Enum/DataStatus.cs b/src/CncModels/Enum/DataStatus.cs new file mode 100644 index 0000000..eec418c --- /dev/null +++ b/src/CncModels/Enum/DataStatus.cs @@ -0,0 +1,19 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 数据状态枚举(字符串存储版本) + /// + public static class DataStatus + { + /// 正常 + public const string Normal = "normal"; + + /// 离线 + public const string Offline = "offline"; + + /// 数据缺失 + public const string DataMissing = "data_missing"; + } +} diff --git a/src/CncModels/Enum/DataType.cs b/src/CncModels/Enum/DataType.cs new file mode 100644 index 0000000..25df193 --- /dev/null +++ b/src/CncModels/Enum/DataType.cs @@ -0,0 +1,16 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 数据类型枚举(字符串存储版本) + /// + public static class DataType + { + /// 字符串 + public const string String = "string"; + + /// 数字 + public const string Number = "number"; + } +} diff --git a/src/CncModels/Enum/LogLevel.cs b/src/CncModels/Enum/LogLevel.cs new file mode 100644 index 0000000..6f4ef13 --- /dev/null +++ b/src/CncModels/Enum/LogLevel.cs @@ -0,0 +1,22 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 日志等级常量(字符串表示) + /// + public static class LogLevel + { + /// 调试 + public const string Debug = "DEBUG"; + + /// 信息 + public const string Info = "INFO"; + + /// 警告 + public const string Warn = "WARN"; + + /// 错误 + public const string Error = "ERROR"; + } +} diff --git a/src/CncModels/Enum/MatchBy.cs b/src/CncModels/Enum/MatchBy.cs new file mode 100644 index 0000000..cfba3fa --- /dev/null +++ b/src/CncModels/Enum/MatchBy.cs @@ -0,0 +1,16 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 字段匹配方式(字符串存储) + /// + public static class MatchBy + { + /// 按ID匹配 + public const string Id = "id"; + + /// 按名称匹配 + public const string Name = "name"; + } +} diff --git a/src/CncModels/Enum/SegmentCloseReason.cs b/src/CncModels/Enum/SegmentCloseReason.cs new file mode 100644 index 0000000..895b0f9 --- /dev/null +++ b/src/CncModels/Enum/SegmentCloseReason.cs @@ -0,0 +1,22 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 产量段关闭原因(字符串存储) + /// + public static class SegmentCloseReason + { + /// 程序切换 + public const string ProgramChange = "program_change"; + + /// 手动复位 + public const string ManualReset = "manual_reset"; + + /// 日终结束 + public const string EndOfDay = "end_of_day"; + + /// 服务停止 + public const string ServiceStop = "service_stop"; + } +} diff --git a/src/CncModels/Enum/ValueType.cs b/src/CncModels/Enum/ValueType.cs new file mode 100644 index 0000000..2a16cd6 --- /dev/null +++ b/src/CncModels/Enum/ValueType.cs @@ -0,0 +1,16 @@ +using System; + +namespace CncModels.Enum +{ + /// + /// 值类型枚举(字符串存储) + /// + public static class ValueType + { + /// 字符串 + public const string String = "string"; + + /// 数字 + public const string Number = "number"; + } +}