添加了手动更新标识
This commit is contained in:
parent
4967df927a
commit
4af38a021c
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://cdivd7qml4dvu"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://cdivd7qml4dvu"]
|
||||
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXPanel.cs" id="1_im3hi"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0f2b032lufnb" path="res://Mods/教育平台/Arts/Textures/ee680086375133.5d97558385c71.jpg" id="2_n24po"]
|
||||
|
@ -10,6 +10,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://bx4v3ofh4on5e" path="res://Mods/工业数据采集与分析应用分享/标识注册.tscn" id="6_nuph1"]
|
||||
[ext_resource type="PackedScene" uid="uid://yxubv8dgqnpa" path="res://Mods/工业数据采集与分析应用分享/标识解析.tscn" id="7_fapjq"]
|
||||
[ext_resource type="Script" path="res://Mods/教育平台/Scripts/SearchEngine.cs" id="12_m0fjq"]
|
||||
[ext_resource type="Script" path="res://Mods/教育平台/Scripts/SearchRegister.cs" id="13_p3ia1"]
|
||||
[ext_resource type="Script" path="res://BITKit/Scripts/UX/UXServiceProxy.cs" id="16_qcre0"]
|
||||
[ext_resource type="Texture2D" uid="uid://c38luts5hc5fj" path="res://Artists/Art/Icons/Arrows/icon_chevron-left-rounded.png" id="16_s70sy"]
|
||||
|
||||
|
@ -118,7 +119,24 @@ quickSearchButton = NodePath("../TabContainer/标识解析/MarginContainer/VBoxC
|
|||
searchProgressBar = NodePath("../TabContainer/标识解析/MarginContainer/VBoxContainer/SearchProgressBar")
|
||||
searchLogLabel = NodePath("../TabContainer/标识解析/SearchLogLabel")
|
||||
|
||||
[node name="SearchRegister" type="Node" parent="." node_paths=PackedStringArray("keyLine", "valueLine", "nameLine", "idLine", "registryRecordLine", "registryButton")]
|
||||
script = ExtResource("13_p3ia1")
|
||||
keyLine = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer/keyLine")
|
||||
valueLine = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer2/valueLine")
|
||||
nameLine = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer3/nameLine")
|
||||
idLine = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer4/idLine")
|
||||
registryRecordLine = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer5/registryRecordLine")
|
||||
registryButton = NodePath("../TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/register-button")
|
||||
|
||||
[connection signal="pressed" from="Return-Button" to="Return-Button" method="Return"]
|
||||
|
||||
[editable path="教程Header"]
|
||||
[editable path="TabContainer/标识注册"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement2"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement5"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement3"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement4"]
|
||||
[editable path="TabContainer/标识注册/VBoxContainer/ScrollContainer/HFlowContainer/StepElement6"]
|
||||
[editable path="TabContainer/标识解析"]
|
||||
|
|
|
@ -206,6 +206,103 @@ text = "注册标识"
|
|||
icon = ExtResource("2_1ml36")
|
||||
expand_icon = true
|
||||
|
||||
[node name="StepElement9" parent="VBoxContainer/ScrollContainer/HFlowContainer" instance=ExtResource("1_6n8rk")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/BaseComponent" index="0"]
|
||||
text = "手动注册与更新标识"
|
||||
|
||||
[node name="Label2" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/BaseComponent" index="2"]
|
||||
text = "你需要手动注册一些标识数据"
|
||||
|
||||
[node name="RichTextLabel" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/BaseComponent" index="4"]
|
||||
text = "在这里手动添加数据"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "标识码:"
|
||||
|
||||
[node name="keyLine" type="LineEdit" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "88.123.99/02020220225008"
|
||||
placeholder_text = "88.123.99/XXXXXXX"
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "标识值:"
|
||||
|
||||
[node name="valueLine" type="LineEdit" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "myProduct"
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "标识名:"
|
||||
|
||||
[node name="nameLine" type="LineEdit" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "我的产品"
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "标识Id:"
|
||||
|
||||
[node name="idLine" type="LineEdit" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "my.device"
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer5"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "注册记录:"
|
||||
|
||||
[node name="registryRecordLine" type="LineEdit" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9/HBoxContainer5"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "registry.my.device.record-001"
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="register-button" type="Button" parent="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
layout_mode = 2
|
||||
text = "手动注册"
|
||||
icon = ExtResource("2_1ml36")
|
||||
expand_icon = true
|
||||
|
||||
[node name="StepElement" parent="VBoxContainer/ScrollContainer/HFlowContainer" instance=ExtResource("1_6n8rk")]
|
||||
layout_mode = 2
|
||||
|
||||
|
@ -420,6 +517,7 @@ layout_mode = 2
|
|||
[connection signal="ready" from="VBoxContainer/ScrollContainer" to="VBoxContainer/ScrollContainer" method="set_horizontal_scroll_mode" binds= [1]]
|
||||
|
||||
[editable path="VBoxContainer/ScrollContainer/HFlowContainer/StepElement2"]
|
||||
[editable path="VBoxContainer/ScrollContainer/HFlowContainer/StepElement9"]
|
||||
[editable path="VBoxContainer/ScrollContainer/HFlowContainer/StepElement"]
|
||||
[editable path="VBoxContainer/ScrollContainer/HFlowContainer/StepElement5"]
|
||||
[editable path="VBoxContainer/ScrollContainer/HFlowContainer/StepElement3"]
|
||||
|
|
|
@ -8,6 +8,7 @@ using BITKit;
|
|||
using Godot;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
@ -19,9 +20,10 @@ public interface ISearchEntry
|
|||
string Value { get; }
|
||||
}
|
||||
[Serializable]
|
||||
[Keyless]
|
||||
public class SearchResult:ISearchEntry
|
||||
{
|
||||
[Key]
|
||||
public Guid Guid { get; set; }= Guid.NewGuid();
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string Display { get; set; }
|
||||
|
@ -31,7 +33,13 @@ public class SearchResult:ISearchEntry
|
|||
public DateTime CreateDate { get; set; }=DateTime.Now;
|
||||
}
|
||||
|
||||
public partial class SearchEngine:Node
|
||||
public interface ISearchEngine
|
||||
{
|
||||
SearchResult[] GetSearchResults(string key);
|
||||
void Add(SearchResult result);
|
||||
void Remove(string key, string id);
|
||||
}
|
||||
public partial class SearchEngine:Node,ISearchEngine
|
||||
{
|
||||
private static SqlLiteContext<SearchResult> Context;
|
||||
[Export] private Node nodeContainer;
|
||||
|
@ -44,8 +52,11 @@ public partial class SearchEngine:Node
|
|||
|
||||
private readonly StringBuilder _logBuilder=new StringBuilder();
|
||||
private SearchResult[] _currentSearchResults;
|
||||
|
||||
public override async void _Ready()
|
||||
{
|
||||
BITApp.ServiceCollection.AddSingleton<ISearchEngine>(this);
|
||||
DI.Register<ISearchEngine>(this);
|
||||
try
|
||||
{
|
||||
QueueContainerFree();
|
||||
|
@ -132,4 +143,17 @@ public partial class SearchEngine:Node
|
|||
x.QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
public SearchResult[] GetSearchResults(string key)=>Context.context.Where(x=>x.Key.Contains(key)).ToArray();
|
||||
|
||||
public void Add(SearchResult result)
|
||||
{
|
||||
Context.context.Add(result);
|
||||
Context.SaveChanges();
|
||||
}
|
||||
|
||||
public void Remove(string key, string id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using BITKit;
|
||||
using Godot;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BITFactory;
|
||||
|
||||
public partial class SearchRegister:Node
|
||||
{
|
||||
[Export] private LineEdit keyLine;
|
||||
[Export] private LineEdit valueLine;
|
||||
[Export] private LineEdit nameLine;
|
||||
[Export] private LineEdit idLine;
|
||||
[Export] private LineEdit registryRecordLine;
|
||||
[Export] private Button registryButton;
|
||||
public override void _Ready()
|
||||
{
|
||||
registryButton.Pressed += Create;
|
||||
}
|
||||
|
||||
private void Create()
|
||||
{
|
||||
var result = new SearchResult()
|
||||
{
|
||||
Key = keyLine.Text,
|
||||
Value = valueLine.Text,
|
||||
Display = nameLine.Text,
|
||||
Id = idLine.Text,
|
||||
RegistryRecord = registryRecordLine.Text,
|
||||
CreateDate = DateTime.Now,
|
||||
UpdateDate = DateTime.Now,
|
||||
};
|
||||
DI.Get<ISearchEngine>().Add(result);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue