This commit is contained in:
2026-03-29 23:17:20 +08:00
commit 7dc5e73af7
36 changed files with 1480 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

363
.gitignore vendored Normal file
View File

@@ -0,0 +1,363 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

View File

@@ -0,0 +1,22 @@
namespace OrpaonVision.ConfigApp.Annotation.Options;
/// <summary>
/// CVAT 连接配置。
/// </summary>
public sealed class CvatOptions
{
/// <summary>
/// CVAT 服务地址。
/// </summary>
public string ServerEndpoint { get; set; } = "http://127.0.0.1:8080";
/// <summary>
/// API Token预留
/// </summary>
public string? ApiToken { get; set; }
/// <summary>
/// 同步超时时间(秒)。
/// </summary>
public int SyncTimeoutSeconds { get; set; } = 60;
}

View File

@@ -0,0 +1,82 @@
using OrpaonVision.ConfigApp.Annotation.Options;
using OrpaonVision.Core.Annotation;
using OrpaonVision.Core.Annotation.Contracts;
using OrpaonVision.Core.Enums;
using OrpaonVision.Core.Results;
namespace OrpaonVision.ConfigApp.Annotation.Services;
/// <summary>
/// CVAT 标注同步应用服务(骨架实现)。
///
/// 说明:
/// - 当前阶段先提供参数校验与返回契约,便于前后链路先跑通;
/// - 实际 HTTP 调用、认证、重试策略将在后续迭代补齐。
/// </summary>
public sealed class CvatAnnotationSyncAppService : IAnnotationSyncAppService
{
private readonly CvatOptions _options;
/// <summary>
/// 构造函数。
/// </summary>
/// <param name="options">CVAT 配置。</param>
public CvatAnnotationSyncAppService(CvatOptions options)
{
_options = options;
}
/// <inheritdoc />
public Task<Result> SyncProjectAsync(SyncAnnotationProjectCommand command, CancellationToken cancellationToken = default)
{
if (command.Platform != AnnotationPlatformEnum.Cvat)
{
return Task.FromResult(Result.Fail("ANNOTATION_PLATFORM_NOT_SUPPORTED", "当前版本仅支持 CVAT 平台同步。"));
}
if (command.ProjectId == Guid.Empty || command.AnnotationTaskId == Guid.Empty)
{
return Task.FromResult(Result.Fail("ANNOTATION_ARGUMENT_INVALID", "项目标识或标注任务标识无效。"));
}
if (string.IsNullOrWhiteSpace(command.CvatServerEndpoint))
{
return Task.FromResult(Result.Fail("ANNOTATION_ENDPOINT_REQUIRED", "CVAT 服务地址不能为空。"));
}
if (!Uri.TryCreate(command.CvatServerEndpoint, UriKind.Absolute, out _))
{
return Task.FromResult(Result.Fail("ANNOTATION_ENDPOINT_INVALID", "CVAT 服务地址格式不合法。"));
}
if (command.CvatTaskId <= 0 || command.CvatProjectId <= 0)
{
return Task.FromResult(Result.Fail("ANNOTATION_CVAT_ID_INVALID", "CVAT 项目 ID 或任务 ID 必须大于 0。"));
}
// 当前为骨架实现:预留后续与 CVAT API 的双向同步逻辑。
return Task.FromResult(Result.Success(message: "CVAT 同步请求已受理。"));
}
/// <inheritdoc />
public Task<Result<AnnotationSyncStatusDto>> GetSyncStatusAsync(Guid projectId, CancellationToken cancellationToken = default)
{
if (projectId == Guid.Empty)
{
return Task.FromResult(Result<AnnotationSyncStatusDto>.Fail("ANNOTATION_PROJECT_ID_INVALID", "项目标识不能为空。"));
}
var status = new AnnotationSyncStatusDto
{
ProjectId = projectId,
AnnotationTaskId = Guid.Empty,
Platform = AnnotationPlatformEnum.Cvat,
SyncStatus = AnnotationSyncStatusEnum.None,
ProgressPercent = 0,
LastSyncedAtUtc = null,
LastErrorMessage = null
};
return Task.FromResult(Result<AnnotationSyncStatusDto>.Success(status, message: $"CVAT 状态查询完成({_options.ServerEndpoint})。"));
}
}

View File

@@ -0,0 +1,8 @@
<Application x:Class="OrpaonVision.ConfigApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:OrpaonVision.ConfigApp">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,37 @@
using Microsoft.Extensions.DependencyInjection;
using OrpaonVision.ConfigApp.DependencyInjection;
using System.Windows;
namespace OrpaonVision.ConfigApp
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private ServiceProvider? _serviceProvider;
/// <inheritdoc />
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var services = new ServiceCollection();
services.AddConfigAppServices();
services.AddSingleton<MainWindow>();
_serviceProvider = services.BuildServiceProvider();
var mainWindow = _serviceProvider.GetRequiredService<MainWindow>();
mainWindow.Show();
}
/// <inheritdoc />
protected override void OnExit(ExitEventArgs e)
{
_serviceProvider?.Dispose();
base.OnExit(e);
}
}
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,24 @@
using Microsoft.Extensions.DependencyInjection;
using OrpaonVision.ConfigApp.Annotation.Options;
using OrpaonVision.ConfigApp.Annotation.Services;
using OrpaonVision.Core.Annotation;
namespace OrpaonVision.ConfigApp.DependencyInjection;
/// <summary>
/// ConfigApp 服务注册扩展。
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// 注册 ConfigApp 应用服务。
/// </summary>
/// <param name="services">服务集合。</param>
/// <returns>服务集合。</returns>
public static IServiceCollection AddConfigAppServices(this IServiceCollection services)
{
services.AddSingleton(new CvatOptions());
services.AddSingleton<IAnnotationSyncAppService, CvatAnnotationSyncAppService>();
return services;
}
}

View File

@@ -0,0 +1,12 @@
<Window x:Class="OrpaonVision.ConfigApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OrpaonVision.ConfigApp"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@@ -0,0 +1,25 @@
using OrpaonVision.Core.Annotation;
using System.Windows;
namespace OrpaonVision.ConfigApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private readonly IAnnotationSyncAppService _annotationSyncAppService;
/// <summary>
/// 主窗口构造函数。
/// </summary>
/// <param name="annotationSyncAppService">标注同步应用服务。</param>
public MainWindow(IAnnotationSyncAppService annotationSyncAppService)
{
_annotationSyncAppService = annotationSyncAppService;
InitializeComponent();
Title = "OrpaonVision ConfigApp (CVAT)";
}
}
}

View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OrpaonVision.Core\OrpaonVision.Core.csproj" />
<ProjectReference Include="..\OrpaonVision.Model\OrpaonVision.Model.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,21 @@
namespace OrpaonVision.Core.Abstractions;
/// <summary>
/// 时间服务抽象。
///
/// 用途:
/// - 消除业务代码对 DateTime.Now 的直接依赖;
/// - 提升可测试性,便于通过替身时间源复现时序问题。
/// </summary>
public interface IClock
{
/// <summary>
/// 获取当前本地时间。
/// </summary>
DateTime Now { get; }
/// <summary>
/// 获取当前 UTC 时间。
/// </summary>
DateTime UtcNow { get; }
}

View File

@@ -0,0 +1,26 @@
namespace OrpaonVision.Core.Abstractions;
/// <summary>
/// 当前用户上下文抽象。
///
/// 用途:
/// - 为审计字段CreatedBy/UpdatedBy提供统一来源
/// - 在应用服务中统一获取当前登录人信息。
/// </summary>
public interface IUserContext
{
/// <summary>
/// 当前用户 ID。
/// </summary>
string UserId { get; }
/// <summary>
/// 当前用户名或工号。
/// </summary>
string UserName { get; }
/// <summary>
/// 当前用户角色集合。
/// </summary>
IReadOnlyCollection<string> Roles { get; }
}

View File

@@ -0,0 +1,44 @@
using OrpaonVision.Core.Enums;
namespace OrpaonVision.Core.Annotation.Contracts;
/// <summary>
/// 标注同步状态 DTO。
/// </summary>
public sealed class AnnotationSyncStatusDto
{
/// <summary>
/// 本地项目标识。
/// </summary>
public Guid ProjectId { get; init; }
/// <summary>
/// 本地标注任务标识。
/// </summary>
public Guid AnnotationTaskId { get; init; }
/// <summary>
/// 平台类型(当前固定为 Cvat
/// </summary>
public AnnotationPlatformEnum Platform { get; init; } = AnnotationPlatformEnum.Cvat;
/// <summary>
/// 同步状态。
/// </summary>
public AnnotationSyncStatusEnum SyncStatus { get; init; }
/// <summary>
/// 同步进度0~100
/// </summary>
public decimal ProgressPercent { get; init; }
/// <summary>
/// 最近一次同步时间UTC
/// </summary>
public DateTime? LastSyncedAtUtc { get; init; }
/// <summary>
/// 最近错误信息。
/// </summary>
public string? LastErrorMessage { get; init; }
}

View File

@@ -0,0 +1,46 @@
using OrpaonVision.Core.Enums;
namespace OrpaonVision.Core.Annotation.Contracts;
/// <summary>
/// 同步标注项目命令。
///
/// 当前版本约束:仅支持 CVAT。
/// </summary>
public sealed class SyncAnnotationProjectCommand
{
/// <summary>
/// 平台类型(当前固定为 Cvat
/// </summary>
public AnnotationPlatformEnum Platform { get; init; } = AnnotationPlatformEnum.Cvat;
/// <summary>
/// 本地项目标识。
/// </summary>
public Guid ProjectId { get; init; }
/// <summary>
/// 本地标注任务标识。
/// </summary>
public Guid AnnotationTaskId { get; init; }
/// <summary>
/// CVAT 服务地址,例如 http://127.0.0.1:8080。
/// </summary>
public string CvatServerEndpoint { get; init; } = string.Empty;
/// <summary>
/// CVAT 项目 ID。
/// </summary>
public long CvatProjectId { get; init; }
/// <summary>
/// CVAT 任务 ID。
/// </summary>
public long CvatTaskId { get; init; }
/// <summary>
/// 发起同步的用户。
/// </summary>
public string RequestedBy { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,24 @@
using OrpaonVision.Core.Annotation.Contracts;
using OrpaonVision.Core.Results;
namespace OrpaonVision.Core.Annotation;
/// <summary>
/// 标注同步应用服务接口。
///
/// 职责:
/// - 发起本地标注任务与 CVAT 任务的同步;
/// - 查询任务同步状态,供配置端界面展示。
/// </summary>
public interface IAnnotationSyncAppService
{
/// <summary>
/// 发起同步。
/// </summary>
Task<Result> SyncProjectAsync(SyncAnnotationProjectCommand command, CancellationToken cancellationToken = default);
/// <summary>
/// 查询同步状态。
/// </summary>
Task<Result<AnnotationSyncStatusDto>> GetSyncStatusAsync(Guid projectId, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,12 @@
namespace OrpaonVision.Core;
/// <summary>
/// Core 模块标记类型。
///
/// 该类型用于:
/// 1) 提供统一的程序集锚点(反射扫描、依赖注入装配);
/// 2) 替代模板生成的占位类,避免语义不明确的 Class1 命名。
/// </summary>
public sealed class CoreModuleMarker
{
}

View File

@@ -0,0 +1,16 @@
namespace OrpaonVision.Core.Enums;
/// <summary>
/// 标注平台类型。
///
/// 说明:
/// - 根据当前需求文档,系统当前版本仅支持 CVAT
/// - 后续若扩展其他平台,可在本枚举中追加,并由适配层实现差异化处理。
/// </summary>
public enum AnnotationPlatformEnum
{
/// <summary>
/// CVAT 平台。
/// </summary>
Cvat = 1
}

View File

@@ -0,0 +1,27 @@
namespace OrpaonVision.Core.Enums;
/// <summary>
/// 标注任务同步状态。
/// </summary>
public enum AnnotationSyncStatusEnum
{
/// <summary>
/// 未同步。
/// </summary>
None = 0,
/// <summary>
/// 同步中。
/// </summary>
Syncing = 1,
/// <summary>
/// 同步成功。
/// </summary>
Succeeded = 2,
/// <summary>
/// 同步失败。
/// </summary>
Failed = 3
}

View File

@@ -0,0 +1,32 @@
namespace OrpaonVision.Core.Enums;
/// <summary>
/// 标注任务状态。
/// </summary>
public enum AnnotationTaskStatusEnum
{
/// <summary>
/// 待开始。
/// </summary>
Pending = 1,
/// <summary>
/// 进行中。
/// </summary>
InProgress = 2,
/// <summary>
/// 已完成(外部平台已提交)。
/// </summary>
Completed = 3,
/// <summary>
/// 已回收(业务系统已成功回收标注结果)。
/// </summary>
Recovered = 4,
/// <summary>
/// 失败。
/// </summary>
Failed = 5
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,102 @@
namespace OrpaonVision.Core.Results;
/// <summary>
/// 非泛型统一返回结果。
///
/// 约束:
/// - 普通业务失败使用 Result 返回,不建议抛异常;
/// - 异常场景请由上层捕获后转换为统一错误码与消息。
/// </summary>
public class Result
{
/// <summary>
/// 是否成功。
/// </summary>
public bool Succeeded { get; init; }
/// <summary>
/// 业务编码(成功或失败编码)。
/// </summary>
public string Code { get; init; } = string.Empty;
/// <summary>
/// 业务消息。
/// </summary>
public string Message { get; init; } = string.Empty;
/// <summary>
/// 错误明细。
/// </summary>
public IReadOnlyCollection<string> Errors { get; init; } = Array.Empty<string>();
/// <summary>
/// 跟踪 ID用于日志链路关联。
/// </summary>
public string? TraceId { get; init; }
/// <summary>
/// 创建成功结果。
/// </summary>
public static Result Success(string code = "OK", string message = "Success")
{
return new Result
{
Succeeded = true,
Code = code,
Message = message
};
}
/// <summary>
/// 创建失败结果。
/// </summary>
public static Result Fail(string code, string message, params string[] errors)
{
return new Result
{
Succeeded = false,
Code = code,
Message = message,
Errors = errors
};
}
}
/// <summary>
/// 泛型统一返回结果。
/// </summary>
public sealed class Result<T> : Result
{
/// <summary>
/// 业务数据。
/// </summary>
public T? Data { get; init; }
/// <summary>
/// 创建成功结果。
/// </summary>
public static Result<T> Success(T data, string code = "OK", string message = "Success")
{
return new Result<T>
{
Succeeded = true,
Code = code,
Message = message,
Data = data
};
}
/// <summary>
/// 创建失败结果。
/// </summary>
public static new Result<T> Fail(string code, string message, params string[] errors)
{
return new Result<T>
{
Succeeded = false,
Code = code,
Message = message,
Errors = errors
};
}
}

View File

@@ -0,0 +1,57 @@
namespace OrpaonVision.Model.Annotation;
/// <summary>
/// 标注任务项模型(对应需求文档中的 mdl_annotation_task_item
/// </summary>
public sealed class AnnotationTaskItemModel
{
/// <summary>
/// 主键。
/// </summary>
public long Id { get; set; }
/// <summary>
/// 所属标注任务 ID。
/// </summary>
public long AnnotationTaskId { get; set; }
/// <summary>
/// 数据集项 ID。
/// </summary>
public long DatasetItemId { get; set; }
/// <summary>
/// 处理状态。
/// </summary>
public int Status { get; set; }
/// <summary>
/// 审核人。
/// </summary>
public string? ReviewedBy { get; set; }
/// <summary>
/// 审核时间。
/// </summary>
public DateTime? ReviewedAt { get; set; }
/// <summary>
/// 创建时间。
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// 创建人。
/// </summary>
public string? CreatedBy { get; set; }
/// <summary>
/// 更新时间。
/// </summary>
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// 更新人。
/// </summary>
public string? UpdatedBy { get; set; }
}

View File

@@ -0,0 +1,89 @@
namespace OrpaonVision.Model.Annotation;
/// <summary>
/// 标注任务模型(对应需求文档中的 mdl_annotation_task
///
/// 说明:
/// - 为保持 Model 层轻量与独立,枚举字段暂以 int 存储;
/// - 业务层可在 Core 中将其映射为强类型枚举。
/// </summary>
public sealed class AnnotationTaskModel
{
/// <summary>
/// 主键。
/// </summary>
public long Id { get; set; }
/// <summary>
/// 任务编码(唯一)。
/// </summary>
public string TaskCode { get; set; } = string.Empty;
/// <summary>
/// 任务名称。
/// </summary>
public string TaskName { get; set; } = string.Empty;
/// <summary>
/// 平台类型。
/// 当前版本仅支持 CVAT建议固定为 1。
/// </summary>
public int PlatformType { get; set; } = 1;
/// <summary>
/// 外部平台任务 IDCVAT TaskId
/// </summary>
public string? ExternalTaskId { get; set; }
/// <summary>
/// 数据集 ID。
/// </summary>
public long DatasetId { get; set; }
/// <summary>
/// 标签集 ID。
/// </summary>
public long LabelSetId { get; set; }
/// <summary>
/// 指派标注人员。
/// </summary>
public string? AssignedTo { get; set; }
/// <summary>
/// 标注任务状态。
/// 参考Pending/InProgress/Completed/Recovered/Failed。
/// </summary>
public int Status { get; set; }
/// <summary>
/// 进度百分比0~100
/// </summary>
public decimal? ProgressPercent { get; set; }
/// <summary>
/// 同步状态。
/// 参考None/Syncing/Succeeded/Failed。
/// </summary>
public int SyncStatus { get; set; }
/// <summary>
/// 创建时间。
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// 创建人。
/// </summary>
public string? CreatedBy { get; set; }
/// <summary>
/// 更新时间。
/// </summary>
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// 更新人。
/// </summary>
public string? UpdatedBy { get; set; }
}

View File

@@ -0,0 +1,77 @@
namespace OrpaonVision.Model.Annotation;
/// <summary>
/// 数据集项模型(对应需求文档中的 mdl_dataset_item 关键字段)。
/// </summary>
public sealed class DatasetItemModel
{
/// <summary>
/// 主键。
/// </summary>
public long Id { get; set; }
/// <summary>
/// 数据集 ID。
/// </summary>
public long DatasetId { get; set; }
/// <summary>
/// 文件路径(图片或视频帧存储路径)。
/// </summary>
public string FilePath { get; set; } = string.Empty;
/// <summary>
/// 文件名。
/// </summary>
public string FileName { get; set; } = string.Empty;
/// <summary>
/// 宽度。
/// </summary>
public int? Width { get; set; }
/// <summary>
/// 高度。
/// </summary>
public int? Height { get; set; }
/// <summary>
/// 标注状态。
/// </summary>
public int AnnotationStatus { get; set; }
/// <summary>
/// 质量状态。
/// </summary>
public int QualityStatus { get; set; }
/// <summary>
/// 文件哈希。
/// </summary>
public string? HashValue { get; set; }
/// <summary>
/// 扩展字段JSON
/// </summary>
public string? ExtraJson { get; set; }
/// <summary>
/// 创建时间。
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// 创建人。
/// </summary>
public string? CreatedBy { get; set; }
/// <summary>
/// 更新时间。
/// </summary>
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// 更新人。
/// </summary>
public string? UpdatedBy { get; set; }
}

View File

@@ -0,0 +1,82 @@
namespace OrpaonVision.Model.Annotation;
/// <summary>
/// 数据集版本模型(对应需求文档中的 mdl_dataset_version 关键字段)。
/// </summary>
public sealed class DatasetVersionModel
{
/// <summary>
/// 主键。
/// </summary>
public long Id { get; set; }
/// <summary>
/// 数据集 ID。
/// </summary>
public long DatasetId { get; set; }
/// <summary>
/// 版本号。
/// </summary>
public string VersionNo { get; set; } = string.Empty;
/// <summary>
/// 标签集 ID。
/// </summary>
public long LabelSetId { get; set; }
/// <summary>
/// 条目数量。
/// </summary>
public int ItemCount { get; set; }
/// <summary>
/// 训练集数量。
/// </summary>
public int? TrainCount { get; set; }
/// <summary>
/// 验证集数量。
/// </summary>
public int? ValCount { get; set; }
/// <summary>
/// 测试集数量。
/// </summary>
public int? TestCount { get; set; }
/// <summary>
/// 导出路径。
/// </summary>
public string? ExportPath { get; set; }
/// <summary>
/// 快照 JSON。
/// </summary>
public string SnapshotJson { get; set; } = string.Empty;
/// <summary>
/// 状态。
/// </summary>
public int Status { get; set; }
/// <summary>
/// 创建时间。
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// 创建人。
/// </summary>
public string? CreatedBy { get; set; }
/// <summary>
/// 更新时间。
/// </summary>
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// 更新人。
/// </summary>
public string? UpdatedBy { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace OrpaonVision.Model;
/// <summary>
/// Model 模块标记类型。
/// </summary>
public sealed class ModelModuleMarker
{
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<Application x:Class="OrpaonVision.SiteApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:OrpaonVision.SiteApp"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace OrpaonVision.SiteApp
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@@ -0,0 +1,12 @@
<Window x:Class="OrpaonVision.SiteApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OrpaonVision.SiteApp"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
</Grid>
</Window>

View File

@@ -0,0 +1,15 @@
using System.Windows;
namespace OrpaonVision.SiteApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OrpaonVision.Core\OrpaonVision.Core.csproj" />
<ProjectReference Include="..\OrpaonVision.Model\OrpaonVision.Model.csproj" />
</ItemGroup>
</Project>

46
OrpaonVision.sln Normal file
View File

@@ -0,0 +1,46 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrpaonVision.SiteApp", "OrpaonVision.SiteApp\OrpaonVision.SiteApp.csproj", "{B73678CE-709E-4D54-B973-088E7D8FDFA9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrpaonVision.ConfigApp", "OrpaonVision.ConfigApp\OrpaonVision.ConfigApp.csproj", "{3548E93A-5613-4F21-ACFB-F7A4C732EE75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrpaonVision.Model", "OrpaonVision.Model\OrpaonVision.Model.csproj", "{3BB30820-DD9F-40D0-8DDA-8A8F8C7B4F07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrpaonVision.Core", "OrpaonVision.Core\OrpaonVision.Core.csproj", "{50CC1F6C-D21E-45B2-B288-9F6FBC98AD33}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrpaonVision.Shared", "OrpaonVision.Shared\OrpaonVision.Shared.csproj", "{4B9F801C-8F51-4E6A-9B84-8BDA2BB41BBD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B73678CE-709E-4D54-B973-088E7D8FDFA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B73678CE-709E-4D54-B973-088E7D8FDFA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B73678CE-709E-4D54-B973-088E7D8FDFA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B73678CE-709E-4D54-B973-088E7D8FDFA9}.Release|Any CPU.Build.0 = Release|Any CPU
{3548E93A-5613-4F21-ACFB-F7A4C732EE75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3548E93A-5613-4F21-ACFB-F7A4C732EE75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3548E93A-5613-4F21-ACFB-F7A4C732EE75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3548E93A-5613-4F21-ACFB-F7A4C732EE75}.Release|Any CPU.Build.0 = Release|Any CPU
{3BB30820-DD9F-40D0-8DDA-8A8F8C7B4F07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BB30820-DD9F-40D0-8DDA-8A8F8C7B4F07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BB30820-DD9F-40D0-8DDA-8A8F8C7B4F07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BB30820-DD9F-40D0-8DDA-8A8F8C7B4F07}.Release|Any CPU.Build.0 = Release|Any CPU
{50CC1F6C-D21E-45B2-B288-9F6FBC98AD33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50CC1F6C-D21E-45B2-B288-9F6FBC98AD33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50CC1F6C-D21E-45B2-B288-9F6FBC98AD33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50CC1F6C-D21E-45B2-B288-9F6FBC98AD33}.Release|Any CPU.Build.0 = Release|Any CPU
{4B9F801C-8F51-4E6A-9B84-8BDA2BB41BBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B9F801C-8F51-4E6A-9B84-8BDA2BB41BBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B9F801C-8F51-4E6A-9B84-8BDA2BB41BBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B9F801C-8F51-4E6A-9B84-8BDA2BB41BBD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal