Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aee8ae1b8 | ||
|
|
dfa9a53ab1 | ||
|
|
781155370f | ||
|
|
dd7bf1b4d1 | ||
|
|
b3fe0f2dd1 | ||
|
|
42d728b2ca | ||
|
|
37723963ce | ||
|
|
bcca150aea | ||
|
|
2abd80567a | ||
|
|
104bec5de6 | ||
|
|
9e391cd291 | ||
|
|
3b936a37cb | ||
|
|
9c00cb8176 | ||
|
|
41990092c4 | ||
|
|
a1ec2f84a6 | ||
|
|
7c31cab283 | ||
|
|
7edfcec844 | ||
|
|
339d4cfde5 | ||
|
|
26a7faebe7 | ||
|
|
2b93e8141e | ||
|
|
b64e35a100 | ||
|
|
62cd3c6e33 | ||
|
|
bb334e76cf | ||
|
|
650f89b7cb | ||
|
|
9e5e1415a9 | ||
|
|
55ee496d51 | ||
|
|
f3b17df9c2 | ||
|
|
003037f94a | ||
|
|
b7b4729805 | ||
|
|
e5ce1bd9ca | ||
|
|
eb6ea78c50 | ||
|
|
ec4aa3a9a2 | ||
|
|
a1d566b2e0 | ||
|
|
355d942c6e | ||
|
|
2cfd88d7a1 | ||
|
|
7bd4fca576 | ||
|
|
508b07acc5 | ||
|
|
7d1c20b414 | ||
|
|
f3e377cc2b | ||
|
|
b53c596d0d | ||
|
|
05c1185c2d | ||
|
|
0c24c679ce | ||
|
|
e5a7d89219 | ||
|
|
ec8bd91c8b | ||
|
|
370936c484 | ||
|
|
70a9133f5e | ||
|
|
66d40d94aa | ||
|
|
79625bf08c | ||
|
|
24e7dff82f | ||
|
|
3e3a04cb36 | ||
|
|
c7ccd8277c | ||
|
|
9df14365ef | ||
|
|
a4cf2ffd00 | ||
|
|
c4b3cbb469 | ||
|
|
34af5b755e | ||
|
|
f0597387d5 | ||
|
|
8bcdc19eb9 | ||
|
|
026a3f4f2b | ||
|
|
f2d5e795b0 | ||
|
|
9205894999 | ||
|
|
105155b737 | ||
|
|
d9e5f4e2dc | ||
|
|
53b28c8319 | ||
|
|
6c6fa42544 | ||
|
|
c768489b69 | ||
|
|
65a738d238 | ||
|
|
eff04b74cd | ||
|
|
da1d79f073 | ||
|
|
4206dda9aa | ||
|
|
0af96ea30b | ||
|
|
8cb58fc6fa | ||
|
|
8db7de1d3c | ||
|
|
f08fde6dad | ||
|
|
df21f7f4cf | ||
|
|
6b26763320 | ||
|
|
683c7b03f3 | ||
|
|
6a1d6c5cf8 | ||
|
|
f7e051baec | ||
|
|
5da57efb29 | ||
|
|
37192378b0 | ||
|
|
06b948dd92 | ||
|
|
aaee65200a | ||
|
|
af6b3c0796 | ||
|
|
c4f98eda2a | ||
|
|
eae0bbeed3 | ||
|
|
bec56c1206 | ||
|
|
f6f3bd5607 | ||
|
|
7d259c5b51 | ||
|
|
6119bfe857 | ||
|
|
6ddb1f0a86 | ||
|
|
e4deb1e52c | ||
|
|
56bb9e0fd7 | ||
|
|
ba1fe7ef95 | ||
|
|
a689ff0ad0 | ||
|
|
8a9cb1b05e | ||
|
|
53eb3be876 | ||
|
|
e570ba713a | ||
|
|
27a9b87387 | ||
|
|
d2d1f1a741 | ||
|
|
5750ff7ce1 | ||
|
|
2d83da7916 | ||
|
|
227f2c9967 | ||
|
|
59706005cd | ||
|
|
b3e33b2f27 | ||
|
|
6af357c0d0 | ||
|
|
469d76f9b0 | ||
|
|
0402261175 | ||
|
|
ad64084638 |
No files matched your search
@@ -0,0 +1,247 @@
|
|||||||
|
# 如果要从更高级别的目录继承 .editorconfig 设置,请删除以下行
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# c# 文件
|
||||||
|
[*.cs]
|
||||||
|
|
||||||
|
#### Core EditorConfig 选项 ####
|
||||||
|
|
||||||
|
# 缩进和间距
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
end_of_line = crlf
|
||||||
|
insert_final_newline = false
|
||||||
|
|
||||||
|
#### .NET 代码操作 ####
|
||||||
|
|
||||||
|
# 类型成员
|
||||||
|
dotnet_hide_advanced_members = false
|
||||||
|
dotnet_member_insertion_location = with_other_members_of_the_same_kind
|
||||||
|
dotnet_property_generation_behavior = prefer_throwing_properties
|
||||||
|
|
||||||
|
# 符号搜索
|
||||||
|
dotnet_search_reference_assemblies = true
|
||||||
|
|
||||||
|
#### .NET 编码约定 ####
|
||||||
|
|
||||||
|
# 组织 Using
|
||||||
|
dotnet_separate_import_directive_groups = false
|
||||||
|
dotnet_sort_system_directives_first = false
|
||||||
|
file_header_template = unset
|
||||||
|
|
||||||
|
# this. 和 Me. 首选项
|
||||||
|
dotnet_style_qualification_for_event = false
|
||||||
|
dotnet_style_qualification_for_field = false
|
||||||
|
dotnet_style_qualification_for_method = false
|
||||||
|
dotnet_style_qualification_for_property = false
|
||||||
|
|
||||||
|
# 语言关键字与 bcl 类型首选项
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||||
|
dotnet_style_predefined_type_for_member_access = true
|
||||||
|
|
||||||
|
# 括号首选项
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||||
|
|
||||||
|
# 修饰符首选项
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||||
|
|
||||||
|
# 表达式级首选项
|
||||||
|
dotnet_prefer_system_hash_code = true
|
||||||
|
dotnet_style_coalesce_expression = true
|
||||||
|
dotnet_style_collection_initializer = true
|
||||||
|
dotnet_style_explicit_tuple_names = true
|
||||||
|
dotnet_style_namespace_match_folder = true
|
||||||
|
dotnet_style_null_propagation = true
|
||||||
|
dotnet_style_object_initializer = true
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
dotnet_style_prefer_auto_properties = true
|
||||||
|
dotnet_style_prefer_collection_expression = when_types_loosely_match
|
||||||
|
dotnet_style_prefer_compound_assignment = true
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true
|
||||||
|
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true
|
||||||
|
dotnet_style_prefer_simplified_interpolation = true
|
||||||
|
|
||||||
|
# 字段首选项
|
||||||
|
dotnet_style_readonly_field = true
|
||||||
|
|
||||||
|
# 参数首选项
|
||||||
|
dotnet_code_quality_unused_parameters = all
|
||||||
|
|
||||||
|
# 禁止显示首选项
|
||||||
|
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
dotnet_style_allow_multiple_blank_lines_experimental = true
|
||||||
|
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||||
|
|
||||||
|
#### c# 编码约定 ####
|
||||||
|
|
||||||
|
# var 首选项
|
||||||
|
csharp_style_var_elsewhere = false
|
||||||
|
csharp_style_var_for_built_in_types = false
|
||||||
|
csharp_style_var_when_type_is_apparent = false
|
||||||
|
|
||||||
|
# Expression-bodied 成员
|
||||||
|
csharp_style_expression_bodied_accessors = true
|
||||||
|
csharp_style_expression_bodied_constructors = false
|
||||||
|
csharp_style_expression_bodied_indexers = true
|
||||||
|
csharp_style_expression_bodied_lambdas = true
|
||||||
|
csharp_style_expression_bodied_local_functions = false
|
||||||
|
csharp_style_expression_bodied_methods = false
|
||||||
|
csharp_style_expression_bodied_operators = false
|
||||||
|
csharp_style_expression_bodied_properties = true
|
||||||
|
|
||||||
|
# 模式匹配首选项
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||||
|
csharp_style_prefer_extended_property_pattern = true
|
||||||
|
csharp_style_prefer_not_pattern = true
|
||||||
|
csharp_style_prefer_pattern_matching = true
|
||||||
|
csharp_style_prefer_switch_expression = true
|
||||||
|
|
||||||
|
# Null 检查首选项
|
||||||
|
csharp_style_conditional_delegate_call = true
|
||||||
|
|
||||||
|
# 修饰符首选项
|
||||||
|
csharp_prefer_static_anonymous_function = true
|
||||||
|
csharp_prefer_static_local_function = true
|
||||||
|
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
|
||||||
|
csharp_style_prefer_readonly_struct = true
|
||||||
|
csharp_style_prefer_readonly_struct_member = true
|
||||||
|
|
||||||
|
# 代码块首选项
|
||||||
|
csharp_prefer_braces = true
|
||||||
|
csharp_prefer_simple_using_statement = true
|
||||||
|
csharp_prefer_system_threading_lock = true
|
||||||
|
csharp_style_namespace_declarations = block_scoped
|
||||||
|
csharp_style_prefer_method_group_conversion = true
|
||||||
|
csharp_style_prefer_primary_constructors = true
|
||||||
|
csharp_style_prefer_simple_property_accessors = true
|
||||||
|
csharp_style_prefer_top_level_statements = true
|
||||||
|
|
||||||
|
# 表达式级首选项
|
||||||
|
csharp_prefer_simple_default_expression = true
|
||||||
|
csharp_style_deconstructed_variable_declaration = true
|
||||||
|
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
||||||
|
csharp_style_inlined_variable_declaration = true
|
||||||
|
csharp_style_prefer_implicitly_typed_lambda_expression = true
|
||||||
|
csharp_style_prefer_index_operator = true
|
||||||
|
csharp_style_prefer_local_over_anonymous_function = true
|
||||||
|
csharp_style_prefer_null_check_over_type_check = true
|
||||||
|
csharp_style_prefer_range_operator = true
|
||||||
|
csharp_style_prefer_tuple_swap = true
|
||||||
|
csharp_style_prefer_unbound_generic_type_in_nameof = true
|
||||||
|
csharp_style_prefer_utf8_string_literals = true
|
||||||
|
csharp_style_throw_expression = true
|
||||||
|
csharp_style_unused_value_assignment_preference = discard_variable
|
||||||
|
csharp_style_unused_value_expression_statement_preference = discard_variable
|
||||||
|
|
||||||
|
# "using" 指令首选项
|
||||||
|
csharp_using_directive_placement = outside_namespace
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||||
|
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
|
||||||
|
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
|
||||||
|
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||||
|
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||||
|
|
||||||
|
#### C# 格式规则 ####
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_anonymous_types = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
|
||||||
|
# 缩进首选项
|
||||||
|
csharp_indent_block_contents = true
|
||||||
|
csharp_indent_braces = false
|
||||||
|
csharp_indent_case_contents = true
|
||||||
|
csharp_indent_case_contents_when_block = true
|
||||||
|
csharp_indent_labels = one_less_than_current
|
||||||
|
csharp_indent_switch_labels = true
|
||||||
|
|
||||||
|
# 空格键首选项
|
||||||
|
csharp_space_after_cast = false
|
||||||
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_after_comma = true
|
||||||
|
csharp_space_after_dot = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_after_semicolon_in_for_statement = true
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_space_around_declaration_statements = false
|
||||||
|
csharp_space_before_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_before_comma = false
|
||||||
|
csharp_space_before_dot = false
|
||||||
|
csharp_space_before_open_square_brackets = false
|
||||||
|
csharp_space_before_semicolon_in_for_statement = false
|
||||||
|
csharp_space_between_empty_square_brackets = false
|
||||||
|
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_parentheses = false
|
||||||
|
csharp_space_between_square_brackets = false
|
||||||
|
|
||||||
|
# 包装首选项
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
csharp_preserve_single_line_statements = true
|
||||||
|
|
||||||
|
#### 命名样式 ####
|
||||||
|
|
||||||
|
# 命名规则
|
||||||
|
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||||
|
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
# 符号规范
|
||||||
|
|
||||||
|
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interface.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.types.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||||
|
|
||||||
|
# 命名样式
|
||||||
|
|
||||||
|
dotnet_naming_style.pascal_case.required_prefix =
|
||||||
|
dotnet_naming_style.pascal_case.required_suffix =
|
||||||
|
dotnet_naming_style.pascal_case.word_separator =
|
||||||
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||||
|
dotnet_naming_style.begins_with_i.required_suffix =
|
||||||
|
dotnet_naming_style.begins_with_i.word_separator =
|
||||||
|
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[SYS]
|
||||||
|
COM=COM7
|
||||||
|
Language=zh-CN
|
||||||
|
Protocols=SUNLIGHT_R
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
@@ -80,6 +80,11 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup />
|
||||||
|
<PropertyGroup />
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
@@ -137,6 +142,7 @@
|
|||||||
<Compile Include="UserClass\HardwareSN.cs" />
|
<Compile Include="UserClass\HardwareSN.cs" />
|
||||||
<Compile Include="UserClass\IniFile.cs" />
|
<Compile Include="UserClass\IniFile.cs" />
|
||||||
<Compile Include="UserClass\Json.cs" />
|
<Compile Include="UserClass\Json.cs" />
|
||||||
|
<Compile Include="UserClass\LiquidDosingSystem.cs" />
|
||||||
<Compile Include="UserClass\LogDataRead.cs" />
|
<Compile Include="UserClass\LogDataRead.cs" />
|
||||||
<Compile Include="UserClass\ERRinf.cs" />
|
<Compile Include="UserClass\ERRinf.cs" />
|
||||||
<Compile Include="UserClass\LogGing.cs" />
|
<Compile Include="UserClass\LogGing.cs" />
|
||||||
@@ -201,6 +207,15 @@
|
|||||||
<Compile Include="Windows\Sampling.xaml.cs">
|
<Compile Include="Windows\Sampling.xaml.cs">
|
||||||
<DependentUpon>Sampling.xaml</DependentUpon>
|
<DependentUpon>Sampling.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="KEY\TouchKeyboardNumeral.xaml.cs">
|
||||||
|
<DependentUpon>TouchKeyboardNumeral.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="KEY\TouchKeyboard.xaml.cs">
|
||||||
|
<DependentUpon>TouchKeyboard.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Windows\UserInf.xaml.cs">
|
||||||
|
<DependentUpon>UserInf.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\UserCall.xaml.cs">
|
<Compile Include="Windows\UserCall.xaml.cs">
|
||||||
<DependentUpon>UserCall.xaml</DependentUpon>
|
<DependentUpon>UserCall.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -282,6 +297,18 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="KEY\TouchKeyboardNumeral.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="KEY\TouchKeyboard.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Windows\UserInf.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\UserCall.xaml">
|
<Page Include="Windows\UserCall.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -327,8 +354,11 @@
|
|||||||
<LastGenOutput>Resources.zh-TW.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.zh-TW.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<Resource Include="Fonts\FontAwesome.otf" />
|
<Resource Include="Fonts\FontAwesome.otf" />
|
||||||
|
<None Include=".editorconfig" />
|
||||||
|
<None Include="app.manifest" />
|
||||||
<None Include="DATA\800COMPUTER.db" />
|
<None Include="DATA\800COMPUTER.db" />
|
||||||
<None Include="DATA\Chart.db" />
|
<None Include="DATA\Chart.db" />
|
||||||
|
<None Include="DATA\LOG.db" />
|
||||||
<None Include="Fonts\font-awesome-4.7.0.zip" />
|
<None Include="Fonts\font-awesome-4.7.0.zip" />
|
||||||
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
|
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
|
||||||
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
|
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
|
||||||
@@ -363,6 +393,7 @@
|
|||||||
<None Include="Fonts\font-awesome-4.7.0\scss\_screen-reader.scss" />
|
<None Include="Fonts\font-awesome-4.7.0\scss\_screen-reader.scss" />
|
||||||
<None Include="Fonts\font-awesome-4.7.0\scss\_stacked.scss" />
|
<None Include="Fonts\font-awesome-4.7.0\scss\_stacked.scss" />
|
||||||
<None Include="Fonts\font-awesome-4.7.0\scss\_variables.scss" />
|
<None Include="Fonts\font-awesome-4.7.0\scss\_variables.scss" />
|
||||||
|
<None Include="Properties\.editorconfig" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@@ -372,6 +403,7 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="DLL\" />
|
||||||
<Folder Include="Model\" />
|
<Folder Include="Model\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -425,6 +457,30 @@
|
|||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
||||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||||
|
<Resource Include="Lmage\00001-1.png" />
|
||||||
|
<Resource Include="Lmage\00002-1.png" />
|
||||||
|
<Resource Include="Lmage\00001.png" />
|
||||||
|
<Resource Include="Lmage\19002.png" />
|
||||||
|
<Resource Include="Lmage\19001.png" />
|
||||||
|
<Resource Include="Lmage\19000.png" />
|
||||||
|
<Resource Include="Lmage\10009-0.png" />
|
||||||
|
<Resource Include="Lmage\10009-1.png" />
|
||||||
|
<Resource Include="Lmage\12500-1.png" />
|
||||||
|
<Resource Include="Lmage\12000-1.png" />
|
||||||
|
<Resource Include="Lmage\12000.png" />
|
||||||
|
<Resource Include="Lmage\10002-1.png" />
|
||||||
|
<Resource Include="Lmage\10002-2.png" />
|
||||||
|
<Resource Include="Lmage\10002-3.png" />
|
||||||
|
<Resource Include="Lmage\10002-4.png" />
|
||||||
|
<Resource Include="Lmage\10002-5.png" />
|
||||||
|
<Resource Include="Lmage\10002-6.png" />
|
||||||
|
<Resource Include="Lmage\11000.png" />
|
||||||
|
<Resource Include="Lmage\15000.png" />
|
||||||
|
<Resource Include="Lmage\IconParkExtendY.png" />
|
||||||
|
<Resource Include="Lmage\IconParkExtendR.png" />
|
||||||
|
<Resource Include="Lmage\MdiPh.png" />
|
||||||
|
<Resource Include="Lmage\IconParkExtend.png" />
|
||||||
|
<Resource Include="Lmage\IconParkInfo.png" />
|
||||||
<Resource Include="Lmage\ID051.png" />
|
<Resource Include="Lmage\ID051.png" />
|
||||||
<Resource Include="Lmage\ID050.png" />
|
<Resource Include="Lmage\ID050.png" />
|
||||||
<Resource Include="Lmage\ADD.jpg" />
|
<Resource Include="Lmage\ADD.jpg" />
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
<Window x:Class="DyeingComputer.KEY.TouchKeyboard"
|
||||||
|
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:DyeingComputer.Windows"
|
||||||
|
mc:Ignorable="d" WindowStyle="None" ResizeMode="NoResize" Topmost="True"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="TouchKeyboard" Height="500" Width="750">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style x:Key="KeyButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="FontSize" Value="20"/>
|
||||||
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
|
<Setter Property="Margin" Value="2"/>
|
||||||
|
<Setter Property="MinWidth" Value="60"/>
|
||||||
|
<Setter Property="MinHeight" Value="40"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFDDDDDD"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#FFE0E0E0"/>
|
||||||
|
<Setter Property="FontSize" Value="16"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 预览区域 -->
|
||||||
|
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
|
||||||
|
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
|
||||||
|
|
||||||
|
<!-- 键盘主体区域 -->
|
||||||
|
<Grid Grid.Row="1" Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 数字行 -->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
|
||||||
|
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 第一行字母 -->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
|
||||||
|
<Button Content="Q" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="W" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="E" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="R" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="T" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="Y" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="U" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="I" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="O" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="P" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 第二行字母 -->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
|
||||||
|
<Button Content="A" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="S" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="D" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="F" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="G" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="H" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="J" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="K" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="L" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="/" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 第三行字母 -->
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center">
|
||||||
|
<Button x:Name="ShiftButton" Content="⇧" Style="{StaticResource SpecialKeyButtonStyle}" Click="Shift_Click" Width="60"/>
|
||||||
|
<Button Content="Z" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="X" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="C" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="V" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="B" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="N" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="M" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="120"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- 状态栏 -->
|
||||||
|
<StatusBar Grid.Row="2">
|
||||||
|
<StatusBarItem>
|
||||||
|
<TextBlock x:Name="StatusTextBlock" Text="就绪"/>
|
||||||
|
</StatusBarItem>
|
||||||
|
</StatusBar>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using static DyeingComputer.KEY.TouchKeyboardNumeral;
|
||||||
|
|
||||||
|
namespace DyeingComputer.KEY
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TouchKeyboard.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class TouchKeyboard : Window
|
||||||
|
{
|
||||||
|
private bool isShiftActive = false;
|
||||||
|
public string KeyValue;
|
||||||
|
public event EventHandler<KeyPressedEventArgs> KeyPressed;
|
||||||
|
|
||||||
|
public TouchKeyboard()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void KeyButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Button button = sender as Button;
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
string key = button.Content.ToString();
|
||||||
|
|
||||||
|
if (key.Length == 1 && char.IsLetter(key[0]))
|
||||||
|
{
|
||||||
|
key = isShiftActive ? key.ToUpper() : key.ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
PreviewTextBox.Text += key;
|
||||||
|
|
||||||
|
// 输入后关闭Shift状态
|
||||||
|
if (isShiftActive)
|
||||||
|
{
|
||||||
|
isShiftActive = false;
|
||||||
|
UpdateButtonAppearance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Shift_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
isShiftActive = !isShiftActive;
|
||||||
|
UpdateButtonAppearance();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Backspace_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(PreviewTextBox.Text))
|
||||||
|
{
|
||||||
|
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Enter_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 触发回车事件
|
||||||
|
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
|
||||||
|
|
||||||
|
this.Close();
|
||||||
|
// PreviewTextBox.Text += Environment.NewLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Hide_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateButtonAppearance()
|
||||||
|
{
|
||||||
|
// 更新Shift按钮的外观以反映当前状态
|
||||||
|
if (isShiftActive)
|
||||||
|
{
|
||||||
|
ShiftButton.Background = new SolidColorBrush(Colors.LightBlue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShiftButton.Background = new SolidColorBrush(Color.FromRgb(224, 224, 224));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class KeyPressedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public KeyType KeyType { get; }
|
||||||
|
public string KeyValue { get; }
|
||||||
|
|
||||||
|
public KeyPressedEventArgs(KeyType keyType, string keyValue)
|
||||||
|
{
|
||||||
|
KeyType = keyType;
|
||||||
|
KeyValue = keyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 初始化为默认模式
|
||||||
|
// SetKeyboardMode(KeyboardMode.Default);
|
||||||
|
PreviewTextBox.Text = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
<Window x:Class="DyeingComputer.KEY.TouchKeyboardNumeral"
|
||||||
|
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:DyeingComputer.Windows"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
WindowStyle="None"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
Topmost="True"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="TouchKeyboardNumeral"
|
||||||
|
Loaded="Window_Loaded"
|
||||||
|
Height="500" Width="550">
|
||||||
|
<Window.Resources>
|
||||||
|
<Style x:Key="KeyButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFCCCCCC"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="FontSize" Value="20"/>
|
||||||
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
|
<Setter Property="Margin" Value="2"/>
|
||||||
|
<Setter Property="MinWidth" Value="100"/>
|
||||||
|
<Setter Property="MinHeight" Value="40"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border x:Name="border"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="4">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFDDDDDD"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="#FFBBBBBB"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="SpecialKeyButtonStyle" BasedOn="{StaticResource KeyButtonStyle}" TargetType="Button">
|
||||||
|
<Setter Property="Background" Value="#FFE0E0E0"/>
|
||||||
|
<Setter Property="FontSize" Value="16"/>
|
||||||
|
</Style>
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 预览区域 -->
|
||||||
|
<TextBox x:Name="PreviewTextBox" Grid.Row="0" Height="60" Margin="10"
|
||||||
|
FontSize="24" VerticalContentAlignment="Center" IsReadOnly="False"/>
|
||||||
|
|
||||||
|
<!-- 键盘主体区域 -->
|
||||||
|
<Grid Grid.Row="1" Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- 数字行 -->
|
||||||
|
<StackPanel x:Name="FirstRow" Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Center">
|
||||||
|
<Button Content="7" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="8" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="9" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="0" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="DEL" Style="{StaticResource SpecialKeyButtonStyle}" Click="Backspace_Click" Width="60"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 数字行 -->
|
||||||
|
<StackPanel x:Name="SecondRow" Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
|
||||||
|
<Button Content="4" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="5" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="6" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="." Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="HIDE" Style="{StaticResource SpecialKeyButtonStyle}" Click="Hide_Click" Width="60"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- 数字行 -->
|
||||||
|
<StackPanel x:Name="ThirdRow" Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center">
|
||||||
|
<Button Content="1" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="2" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="3" Style="{StaticResource KeyButtonStyle}" Click="KeyButton_Click"/>
|
||||||
|
<Button Content="ENTER" Style="{StaticResource SpecialKeyButtonStyle}" Click="Enter_Click" Width="200"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace DyeingComputer.KEY
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TouchKeyboard.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class TouchKeyboardNumeral : Window
|
||||||
|
{
|
||||||
|
private bool mode = false;
|
||||||
|
public string KeyValue;
|
||||||
|
public event EventHandler<KeyPressedEventArgs> KeyPressed;
|
||||||
|
private KeyboardMode currentMode = KeyboardMode.Default;
|
||||||
|
private int minValue = 0;
|
||||||
|
private int maxValue = 9;
|
||||||
|
private TextBox targetTextBox;
|
||||||
|
// 定义键盘模式枚举
|
||||||
|
public enum KeyboardMode
|
||||||
|
{
|
||||||
|
Default, // 默认模式,所有键可用
|
||||||
|
NumericOnly, // 只允许数字
|
||||||
|
DecimalOnly, // 允许数字和小数点
|
||||||
|
LimitedRange // 限制数字范围
|
||||||
|
}
|
||||||
|
|
||||||
|
public TouchKeyboardNumeral()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public void SetKeyboardMode(KeyboardMode mode, TextBox target = null, int min = 0, int max = 9)
|
||||||
|
{
|
||||||
|
currentMode = mode;
|
||||||
|
targetTextBox = target;
|
||||||
|
minValue = min;
|
||||||
|
maxValue = max;
|
||||||
|
|
||||||
|
UpdateKeyboardLayout();
|
||||||
|
}
|
||||||
|
private void UpdateKeyboardLayout()
|
||||||
|
{
|
||||||
|
switch (currentMode)
|
||||||
|
{
|
||||||
|
case KeyboardMode.NumericOnly:
|
||||||
|
// 只允许数字,禁用小数点
|
||||||
|
SetButtonEnabled(".", false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KeyboardMode.DecimalOnly:
|
||||||
|
// 允许数字和小数点
|
||||||
|
SetButtonEnabled(".", true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KeyboardMode.LimitedRange:
|
||||||
|
// 根据范围启用/禁用数字键
|
||||||
|
for (int i = 0; i <= 9; i++)
|
||||||
|
{
|
||||||
|
SetButtonEnabled(i.ToString(), i >= minValue && i <= maxValue);
|
||||||
|
}
|
||||||
|
mode = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KeyboardMode.Default:
|
||||||
|
default:
|
||||||
|
// 启用所有键
|
||||||
|
foreach (var element in FirstRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
|
||||||
|
button.IsEnabled = true;
|
||||||
|
}
|
||||||
|
foreach (var element in SecondRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && (char.IsDigit(button.Content.ToString()[0]) || button.Content.ToString() == "."))
|
||||||
|
button.IsEnabled = true;
|
||||||
|
}
|
||||||
|
foreach (var element in ThirdRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && char.IsDigit(button.Content.ToString()[0]))
|
||||||
|
button.IsEnabled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置按钮启用状态
|
||||||
|
private void SetButtonEnabled(string content, bool enabled)
|
||||||
|
{
|
||||||
|
// 在第一行查找
|
||||||
|
foreach (var element in FirstRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && button.Content.ToString() == content)
|
||||||
|
{
|
||||||
|
button.IsEnabled = enabled;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在第二行查找
|
||||||
|
foreach (var element in SecondRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && button.Content.ToString() == content)
|
||||||
|
{
|
||||||
|
button.IsEnabled = enabled;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在第三行查找
|
||||||
|
foreach (var element in ThirdRow.Children)
|
||||||
|
{
|
||||||
|
if (element is Button button && button.Content.ToString() == content)
|
||||||
|
{
|
||||||
|
button.IsEnabled = enabled;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字键点击事件
|
||||||
|
private void KeyButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (mode && PreviewTextBox.Text.Length > 0) return;
|
||||||
|
Button button = sender as Button;
|
||||||
|
if (button != null && button.IsEnabled)
|
||||||
|
{
|
||||||
|
string keyValue = button.Content.ToString();
|
||||||
|
PreviewTextBox.Text += keyValue;
|
||||||
|
|
||||||
|
// 触发按键事件
|
||||||
|
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Character, keyValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退格键点击事件
|
||||||
|
private void Backspace_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (PreviewTextBox.Text.Length > 0)
|
||||||
|
{
|
||||||
|
PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1);
|
||||||
|
|
||||||
|
// 触发退格事件
|
||||||
|
// KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Backspace, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 回车键点击事件
|
||||||
|
private void Enter_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 触发回车事件
|
||||||
|
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Enter, PreviewTextBox.Text));
|
||||||
|
|
||||||
|
// 隐藏键盘
|
||||||
|
this.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 隐藏键点击事件
|
||||||
|
private void Hide_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
KeyPressed?.Invoke(this, new KeyPressedEventArgs(KeyType.Hide, ""));
|
||||||
|
// 隐藏键盘
|
||||||
|
this.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class KeyPressedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public KeyType KeyType { get; }
|
||||||
|
public string KeyValue { get; }
|
||||||
|
|
||||||
|
public KeyPressedEventArgs(KeyType keyType, string keyValue)
|
||||||
|
{
|
||||||
|
KeyType = keyType;
|
||||||
|
KeyValue = keyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 初始化为默认模式
|
||||||
|
// SetKeyboardMode(KeyboardMode.Default);
|
||||||
|
PreviewTextBox.Text = null;
|
||||||
|
mode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 按键类型枚举
|
||||||
|
public enum KeyType
|
||||||
|
{
|
||||||
|
Character,
|
||||||
|
Backspace,
|
||||||
|
Enter,
|
||||||
|
Hide
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按键事件参数
|
||||||
|
public class KeyPressedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public KeyType KeyType { get; }
|
||||||
|
public string KeyValue { get; }
|
||||||
|
|
||||||
|
public KeyPressedEventArgs(KeyType keyType, string keyValue)
|
||||||
|
{
|
||||||
|
KeyType = keyType;
|
||||||
|
KeyValue = keyValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 447 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -8,7 +8,7 @@
|
|||||||
xmlns:viewmodel="clr-namespace:DyeingComputer.ViewModel"
|
xmlns:viewmodel="clr-namespace:DyeingComputer.ViewModel"
|
||||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="SUNLIGHT 838 b0.0.1 (2024/08/10)"
|
Title="SUNLIGHT838"
|
||||||
Height="720" Width="1280"
|
Height="720" Width="1280"
|
||||||
WindowState ="Maximized"
|
WindowState ="Maximized"
|
||||||
WindowStyle="None">
|
WindowStyle="None">
|
||||||
@@ -181,11 +181,26 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Image.Style>
|
</Image.Style>
|
||||||
</Image>
|
</Image>
|
||||||
|
<Image Height="40" VerticalAlignment="Center" Width="40" Visibility="{Binding EX_bool}">
|
||||||
|
<Image.Style>
|
||||||
|
<Style TargetType="Image">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtend.png"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding EX_str}" Value="309">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtendR.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding EX_str}" Value="308">
|
||||||
|
<Setter Property="Source" Value="/Lmage/IconParkExtendY.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Image.Style>
|
||||||
|
</Image>
|
||||||
|
<Image Height="40" VerticalAlignment="Center" Width="40" Source="/Lmage/link.png"
|
||||||
|
Visibility="{Binding Link_bool}"/>
|
||||||
<Image Height="40" Width="40" Source="/Lmage/IconParkLock.png"
|
<Image Height="40" Width="40" Source="/Lmage/IconParkLock.png"
|
||||||
Visibility="{Binding Lock_bool}" MouseLeftButtonDown="Image_MouseLeftButtonDown"
|
Visibility="{Binding Lock_bool}" MouseLeftButtonDown="Image_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="Image_MouseLeftButtonUp" VerticalAlignment="Center"/>
|
MouseLeftButtonUp="Image_MouseLeftButtonUp" VerticalAlignment="Center"/>
|
||||||
<Image Height="40" VerticalAlignment="Center" Width="40" Source="/Lmage/link.png"
|
|
||||||
Visibility="{Binding Link_bool}"/>
|
|
||||||
<Image Height="40" Width="40" VerticalAlignment="Center" FlowDirection="LeftToRight"
|
<Image Height="40" Width="40" VerticalAlignment="Center" FlowDirection="LeftToRight"
|
||||||
MouseLeftButtonDown="Image_MouseLeftButtonDown_1"
|
MouseLeftButtonDown="Image_MouseLeftButtonDown_1"
|
||||||
MouseLeftButtonUp="Image_MouseLeftButtonUp_1">
|
MouseLeftButtonUp="Image_MouseLeftButtonUp_1">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using DyeingComputer.UserClass;
|
using DyeingComputer.UserClass;
|
||||||
using DyeingComputer.View;
|
using DyeingComputer.View;
|
||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.ViewModel;
|
||||||
|
using DyeingComputer.Windows;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -35,7 +36,9 @@ namespace DyeingComputer
|
|||||||
MainWindowViewModel.ViewID = 1;
|
MainWindowViewModel.ViewID = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SQLiteHelper SQLiteChartAdress = null; //定义数据库
|
||||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
|
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -47,6 +50,9 @@ namespace DyeingComputer
|
|||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
|
SQLiteChartAdress = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
|
SQLiteChartAdress.Open(); //打开数据库
|
||||||
|
|
||||||
bool result_System = SQLiteHelpers.TableExists("System"); //检查表格是否存在(存在返回true)
|
bool result_System = SQLiteHelpers.TableExists("System"); //检查表格是否存在(存在返回true)
|
||||||
bool result_IOName = SQLiteHelpers.TableExists("IOName");
|
bool result_IOName = SQLiteHelpers.TableExists("IOName");
|
||||||
bool result_ProgramName = SQLiteHelpers.TableExists("ProgramName");
|
bool result_ProgramName = SQLiteHelpers.TableExists("ProgramName");
|
||||||
@@ -68,13 +74,13 @@ namespace DyeingComputer
|
|||||||
if (!result_WorkorderSteps) LogGing.LogGingDATA("Master_WorkorderSteps_Table_Loss");
|
if (!result_WorkorderSteps) LogGing.LogGingDATA("Master_WorkorderSteps_Table_Loss");
|
||||||
if (!result_System || !result_IOName || !result_ProgramName || !result_ProgramSteps || !result_RUN || !result_Dyelot || !result_Parameters || !result_WorkOrder || !result_WorkorderSteps)
|
if (!result_System || !result_IOName || !result_ProgramName || !result_ProgramSteps || !result_RUN || !result_Dyelot || !result_Parameters || !result_WorkOrder || !result_WorkorderSteps)
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
MessageBox.Show(Properties.Resources.SysDatLoss);
|
MessageBox.Show(Properties.Resources.SysDatLoss);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,247 @@
|
|||||||
|
# 如果要从更高级别的目录继承 .editorconfig 设置,请删除以下行
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# c# 文件
|
||||||
|
[*.cs]
|
||||||
|
|
||||||
|
#### Core EditorConfig 选项 ####
|
||||||
|
|
||||||
|
# 缩进和间距
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
end_of_line = crlf
|
||||||
|
insert_final_newline = false
|
||||||
|
|
||||||
|
#### .NET 代码操作 ####
|
||||||
|
|
||||||
|
# 类型成员
|
||||||
|
dotnet_hide_advanced_members = false
|
||||||
|
dotnet_member_insertion_location = with_other_members_of_the_same_kind
|
||||||
|
dotnet_property_generation_behavior = prefer_throwing_properties
|
||||||
|
|
||||||
|
# 符号搜索
|
||||||
|
dotnet_search_reference_assemblies = true
|
||||||
|
|
||||||
|
#### .NET 编码约定 ####
|
||||||
|
|
||||||
|
# 组织 Using
|
||||||
|
dotnet_separate_import_directive_groups = false
|
||||||
|
dotnet_sort_system_directives_first = false
|
||||||
|
file_header_template = unset
|
||||||
|
|
||||||
|
# this. 和 Me. 首选项
|
||||||
|
dotnet_style_qualification_for_event = false
|
||||||
|
dotnet_style_qualification_for_field = false
|
||||||
|
dotnet_style_qualification_for_method = false
|
||||||
|
dotnet_style_qualification_for_property = false
|
||||||
|
|
||||||
|
# 语言关键字与 bcl 类型首选项
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||||
|
dotnet_style_predefined_type_for_member_access = true
|
||||||
|
|
||||||
|
# 括号首选项
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||||
|
|
||||||
|
# 修饰符首选项
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members
|
||||||
|
|
||||||
|
# 表达式级首选项
|
||||||
|
dotnet_prefer_system_hash_code = true
|
||||||
|
dotnet_style_coalesce_expression = true
|
||||||
|
dotnet_style_collection_initializer = true
|
||||||
|
dotnet_style_explicit_tuple_names = true
|
||||||
|
dotnet_style_namespace_match_folder = true
|
||||||
|
dotnet_style_null_propagation = true
|
||||||
|
dotnet_style_object_initializer = true
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
dotnet_style_prefer_auto_properties = true
|
||||||
|
dotnet_style_prefer_collection_expression = when_types_loosely_match
|
||||||
|
dotnet_style_prefer_compound_assignment = true
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true
|
||||||
|
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true
|
||||||
|
dotnet_style_prefer_simplified_interpolation = true
|
||||||
|
|
||||||
|
# 字段首选项
|
||||||
|
dotnet_style_readonly_field = true
|
||||||
|
|
||||||
|
# 参数首选项
|
||||||
|
dotnet_code_quality_unused_parameters = all
|
||||||
|
|
||||||
|
# 禁止显示首选项
|
||||||
|
dotnet_remove_unnecessary_suppression_exclusions = none
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
dotnet_style_allow_multiple_blank_lines_experimental = true
|
||||||
|
dotnet_style_allow_statement_immediately_after_block_experimental = true
|
||||||
|
|
||||||
|
#### c# 编码约定 ####
|
||||||
|
|
||||||
|
# var 首选项
|
||||||
|
csharp_style_var_elsewhere = false
|
||||||
|
csharp_style_var_for_built_in_types = false
|
||||||
|
csharp_style_var_when_type_is_apparent = false
|
||||||
|
|
||||||
|
# Expression-bodied 成员
|
||||||
|
csharp_style_expression_bodied_accessors = true
|
||||||
|
csharp_style_expression_bodied_constructors = false
|
||||||
|
csharp_style_expression_bodied_indexers = true
|
||||||
|
csharp_style_expression_bodied_lambdas = true
|
||||||
|
csharp_style_expression_bodied_local_functions = false
|
||||||
|
csharp_style_expression_bodied_methods = false
|
||||||
|
csharp_style_expression_bodied_operators = false
|
||||||
|
csharp_style_expression_bodied_properties = true
|
||||||
|
|
||||||
|
# 模式匹配首选项
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||||
|
csharp_style_prefer_extended_property_pattern = true
|
||||||
|
csharp_style_prefer_not_pattern = true
|
||||||
|
csharp_style_prefer_pattern_matching = true
|
||||||
|
csharp_style_prefer_switch_expression = true
|
||||||
|
|
||||||
|
# Null 检查首选项
|
||||||
|
csharp_style_conditional_delegate_call = true
|
||||||
|
|
||||||
|
# 修饰符首选项
|
||||||
|
csharp_prefer_static_anonymous_function = true
|
||||||
|
csharp_prefer_static_local_function = true
|
||||||
|
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
|
||||||
|
csharp_style_prefer_readonly_struct = true
|
||||||
|
csharp_style_prefer_readonly_struct_member = true
|
||||||
|
|
||||||
|
# 代码块首选项
|
||||||
|
csharp_prefer_braces = true
|
||||||
|
csharp_prefer_simple_using_statement = true
|
||||||
|
csharp_prefer_system_threading_lock = true
|
||||||
|
csharp_style_namespace_declarations = block_scoped
|
||||||
|
csharp_style_prefer_method_group_conversion = true
|
||||||
|
csharp_style_prefer_primary_constructors = true
|
||||||
|
csharp_style_prefer_simple_property_accessors = true
|
||||||
|
csharp_style_prefer_top_level_statements = true
|
||||||
|
|
||||||
|
# 表达式级首选项
|
||||||
|
csharp_prefer_simple_default_expression = true
|
||||||
|
csharp_style_deconstructed_variable_declaration = true
|
||||||
|
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
||||||
|
csharp_style_inlined_variable_declaration = true
|
||||||
|
csharp_style_prefer_implicitly_typed_lambda_expression = true
|
||||||
|
csharp_style_prefer_index_operator = true
|
||||||
|
csharp_style_prefer_local_over_anonymous_function = true
|
||||||
|
csharp_style_prefer_null_check_over_type_check = true
|
||||||
|
csharp_style_prefer_range_operator = true
|
||||||
|
csharp_style_prefer_tuple_swap = true
|
||||||
|
csharp_style_prefer_unbound_generic_type_in_nameof = true
|
||||||
|
csharp_style_prefer_utf8_string_literals = true
|
||||||
|
csharp_style_throw_expression = true
|
||||||
|
csharp_style_unused_value_assignment_preference = discard_variable
|
||||||
|
csharp_style_unused_value_expression_statement_preference = discard_variable
|
||||||
|
|
||||||
|
# "using" 指令首选项
|
||||||
|
csharp_using_directive_placement = outside_namespace
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
|
||||||
|
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
|
||||||
|
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
|
||||||
|
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
|
||||||
|
csharp_style_allow_embedded_statements_on_same_line_experimental = true
|
||||||
|
|
||||||
|
#### C# 格式规则 ####
|
||||||
|
|
||||||
|
# 新行首选项
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_anonymous_types = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
|
||||||
|
# 缩进首选项
|
||||||
|
csharp_indent_block_contents = true
|
||||||
|
csharp_indent_braces = false
|
||||||
|
csharp_indent_case_contents = true
|
||||||
|
csharp_indent_case_contents_when_block = true
|
||||||
|
csharp_indent_labels = one_less_than_current
|
||||||
|
csharp_indent_switch_labels = true
|
||||||
|
|
||||||
|
# 空格键首选项
|
||||||
|
csharp_space_after_cast = false
|
||||||
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_after_comma = true
|
||||||
|
csharp_space_after_dot = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_after_semicolon_in_for_statement = true
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_space_around_declaration_statements = false
|
||||||
|
csharp_space_before_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_before_comma = false
|
||||||
|
csharp_space_before_dot = false
|
||||||
|
csharp_space_before_open_square_brackets = false
|
||||||
|
csharp_space_before_semicolon_in_for_statement = false
|
||||||
|
csharp_space_between_empty_square_brackets = false
|
||||||
|
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_parentheses = false
|
||||||
|
csharp_space_between_square_brackets = false
|
||||||
|
|
||||||
|
# 包装首选项
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
csharp_preserve_single_line_statements = true
|
||||||
|
|
||||||
|
#### 命名样式 ####
|
||||||
|
|
||||||
|
# 命名规则
|
||||||
|
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||||
|
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||||
|
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||||
|
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||||
|
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||||
|
|
||||||
|
# 符号规范
|
||||||
|
|
||||||
|
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interface.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.types.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||||
|
|
||||||
|
# 命名样式
|
||||||
|
|
||||||
|
dotnet_naming_style.pascal_case.required_prefix =
|
||||||
|
dotnet_naming_style.pascal_case.required_suffix =
|
||||||
|
dotnet_naming_style.pascal_case.word_separator =
|
||||||
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||||
|
dotnet_naming_style.begins_with_i.required_suffix =
|
||||||
|
dotnet_naming_style.begins_with_i.word_separator =
|
||||||
|
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||||
@@ -699,6 +699,15 @@ namespace DyeingComputer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Locked state 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string LockedState {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LockedState", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Low-water level 的本地化字符串。
|
/// 查找类似 Low-water level 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -897,6 +906,15 @@ namespace DyeingComputer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 please continue after the restriction is lifted 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string PCATRIL {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("PCATRIL", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 PHControl 的本地化字符串。
|
/// 查找类似 PHControl 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1338,6 +1356,15 @@ namespace DyeingComputer.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 The current operation is restricted 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TCOIR {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TCOIR", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Process 的本地化字符串。
|
/// 查找类似 Process 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -591,4 +591,13 @@
|
|||||||
<data name="Inspect" xml:space="preserve">
|
<data name="Inspect" xml:space="preserve">
|
||||||
<value>Waiting For Check</value>
|
<value>Waiting For Check</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LockedState" xml:space="preserve">
|
||||||
|
<value>Locked state</value>
|
||||||
|
</data>
|
||||||
|
<data name="TCOIR" xml:space="preserve">
|
||||||
|
<value>The current operation is restricted</value>
|
||||||
|
</data>
|
||||||
|
<data name="PCATRIL" xml:space="preserve">
|
||||||
|
<value>please continue after the restriction is lifted</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -591,4 +591,13 @@
|
|||||||
<data name="Inspect" xml:space="preserve">
|
<data name="Inspect" xml:space="preserve">
|
||||||
<value>Inspect</value>
|
<value>Inspect</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LockedState" xml:space="preserve">
|
||||||
|
<value>Locked state</value>
|
||||||
|
</data>
|
||||||
|
<data name="TCOIR" xml:space="preserve">
|
||||||
|
<value>The current operation is restricted</value>
|
||||||
|
</data>
|
||||||
|
<data name="PCATRIL" xml:space="preserve">
|
||||||
|
<value>please continue after the restriction is lifted</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -591,4 +591,13 @@
|
|||||||
<data name="Inspect" xml:space="preserve">
|
<data name="Inspect" xml:space="preserve">
|
||||||
<value>等待检查</value>
|
<value>等待检查</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LockedState" xml:space="preserve">
|
||||||
|
<value>锁定状态</value>
|
||||||
|
</data>
|
||||||
|
<data name="TCOIR" xml:space="preserve">
|
||||||
|
<value>当前操作已限制</value>
|
||||||
|
</data>
|
||||||
|
<data name="PCATRIL" xml:space="preserve">
|
||||||
|
<value>请解除限制后继续</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -591,4 +591,13 @@
|
|||||||
<data name="Inspect" xml:space="preserve">
|
<data name="Inspect" xml:space="preserve">
|
||||||
<value>等待檢查</value>
|
<value>等待檢查</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LockedState" xml:space="preserve">
|
||||||
|
<value>锁定状态</value>
|
||||||
|
</data>
|
||||||
|
<data name="TCOIR" xml:space="preserve">
|
||||||
|
<value>目前操作已限制</value>
|
||||||
|
</data>
|
||||||
|
<data name="PCATRIL" xml:space="preserve">
|
||||||
|
<value>請解除限制後繼續</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -73,7 +73,7 @@ namespace DyeingComputer.UserClass
|
|||||||
API_LOG.Add("NAME", WorkOrder);
|
API_LOG.Add("NAME", WorkOrder);
|
||||||
API_LOG.Add("ERRID", ERRID);
|
API_LOG.Add("ERRID", ERRID);
|
||||||
API_LOG.Add("MESSAGE", MESSAGE);
|
API_LOG.Add("MESSAGE", MESSAGE);
|
||||||
API_LOG.Add("TIME", Time);
|
API_LOG.Add("TIME", MainWindowViewModel.SYSTime);
|
||||||
LOGDB("ERRLog", API_LOG);//行插入
|
LOGDB("ERRLog", API_LOG);//行插入
|
||||||
API_LOG.Clear();
|
API_LOG.Clear();
|
||||||
}
|
}
|
||||||
@@ -94,16 +94,25 @@ namespace DyeingComputer.UserClass
|
|||||||
if(DBQueue.Count==0) QueueT=false;
|
if(DBQueue.Count==0) QueueT=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LOGDB()//从队列写入数据库
|
public static void LOGnew()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(LOGAddress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(LOGAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
}//
|
||||||
|
public static DataTable LOGSELECT(string select)
|
||||||
|
{
|
||||||
|
var dat = SQLiteHelpers.ExecuteDataSet(select, null);
|
||||||
|
DataTable dt = dat.Tables[0];
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
public static void LOGDB()//从队列写入数据库
|
||||||
|
{
|
||||||
while (DBQueue.Count > 0)//信息发送队列
|
while (DBQueue.Count > 0)//信息发送队列
|
||||||
{
|
{
|
||||||
QueueString t = DBQueue.Dequeue();
|
QueueString t = DBQueue.Dequeue();
|
||||||
SQLiteHelpers.InsertData(t.ID, t.DAT);//行插入
|
SQLiteHelpers.InsertData(t.ID, t.DAT);//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
QueueT = false;
|
QueueT = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
using DyeingComputer.UserClass;
|
using DyeingComputer.UserClass;
|
||||||
|
using DyeingComputer.View;
|
||||||
|
using DyeingComputer.ViewModel;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
|
||||||
using TouchSocket.Core;
|
|
||||||
using TouchSocket.Sockets;
|
|
||||||
using DyeingComputer.ViewModel;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using static System.Windows.Forms.AxHost;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using static DyeingComputer.UserClass.SqliteHelper;
|
|
||||||
using DyeingComputer.View;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using TouchSocket.Sockets;
|
||||||
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
using static System.Net.WebRequestMethods;
|
using static System.Net.WebRequestMethods;
|
||||||
using System.Collections;
|
using static System.Windows.Forms.AxHost;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||||
|
|
||||||
namespace DyeingComputer.UserClass
|
namespace DyeingComputer.UserClass
|
||||||
{/// <summary>
|
{/// <summary>
|
||||||
@@ -69,10 +70,11 @@ namespace DyeingComputer.UserClass
|
|||||||
|
|
||||||
|
|
||||||
public static string[] Prohibit = new string[10] { "S01", "S02", "S03", "S05", "S06", "S07", "SL1", "SL2", "SL3", ""};//禁止操作的指令
|
public static string[] Prohibit = new string[10] { "S01", "S02", "S03", "S05", "S06", "S07", "SL1", "SL2", "SL3", ""};//禁止操作的指令
|
||||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
public static async Task Main()
|
public static async Task Main()
|
||||||
{
|
{
|
||||||
|
NetFwManger.AllowPort(7789, "TCP");//开放7790端口
|
||||||
NetFwManger.AllowPort(7790,"TCP");//开放7790端口
|
NetFwManger.AllowPort(7790,"TCP");//开放7790端口
|
||||||
TcpService service = new TcpService();
|
TcpService service = new TcpService();
|
||||||
service.Connecting = (client, e) => { return EasyTask.CompletedTask; };//有客户端正在连接
|
service.Connecting = (client, e) => { return EasyTask.CompletedTask; };//有客户端正在连接
|
||||||
@@ -109,29 +111,23 @@ namespace DyeingComputer.UserClass
|
|||||||
Dictionary<string, object> WorkOrder_dat;
|
Dictionary<string, object> WorkOrder_dat;
|
||||||
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
//WorkOrder_dat.GetValue("WorkOrder");
|
//WorkOrder_dat.GetValue("WorkOrder");
|
||||||
bool dat_w = SQLDATA.WorkOrder(
|
|
||||||
WorkOrder_dat.GetValue("WorkOrder").ToString(),
|
object i = MainWindow.SQLiteHelpers.ExecuteScalar("select * from WorkOrder where WorkOrder = " + WorkOrder_dat.GetValue("WorkOrder").ToString(), null);
|
||||||
WorkOrder_dat.GetValue("ProgramName").ToString(),
|
Dictionary<string, object> Step_new = new Dictionary<string, object>();//缓存函数
|
||||||
WorkOrder_dat.GetValue("StartTime").ToString(),
|
Step_new.Add("WorkOrder", WorkOrder_dat.GetValue("WorkOrder").ToString());
|
||||||
WorkOrder_dat.GetValue("EndTime").ToString(),
|
Step_new.Add("ReDye", WorkOrder_dat.GetValue("ReDye").ToString());
|
||||||
WorkOrder_dat.GetValue("Time").ToString(),
|
if (i != null)
|
||||||
WorkOrder_dat.GetValue("Remark").ToString(),
|
|
||||||
WorkOrder_dat.GetValue("lock").ToString(),
|
|
||||||
WorkOrder_dat.GetValue("State").ToString(),
|
|
||||||
WorkOrder_dat.GetValue("ProgramID").ToString(),
|
|
||||||
WorkOrder_dat.GetValue("color").ToString(),
|
|
||||||
WorkOrder_dat.GetValue("Dyelot").ToString());
|
|
||||||
if (!dat_w)
|
|
||||||
{
|
{
|
||||||
client.SendAsync("SC910" + "[" + MainWindowViewModel.S01 + "]" +
|
client.SendAsync("SC910" + "[" + MainWindowViewModel.S01 + "]" + Step_new.ToJsonString());
|
||||||
WorkOrder_dat.GetValue("WorkOrder").ToString());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client.SendAsync("SC810" + "[" + MainWindowViewModel.S01 + "]" +
|
client.SendAsync("SC810" + "[" + MainWindowViewModel.S01 + "]" + Step_new.ToJsonString());
|
||||||
WorkOrder_dat.GetValue("WorkOrder").ToString()); MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainWindow.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_dat);
|
||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -150,15 +146,16 @@ namespace DyeingComputer.UserClass
|
|||||||
DataTable WorkOrder_dat;
|
DataTable WorkOrder_dat;
|
||||||
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<DataTable>(SYSDAT);
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<DataTable>(SYSDAT);
|
||||||
bool dat_w = SQLDATA.WorkOderStep(WorkOrder_dat);
|
bool dat_w = SQLDATA.WorkOderStep(WorkOrder_dat);
|
||||||
|
Dictionary<string, object> Step_new = new Dictionary<string, object>();//缓存函数
|
||||||
|
Step_new.Add("WorkOrder", WorkOrder_dat.Select().First().Field<object>("WorkOrder"));
|
||||||
|
Step_new.Add("ReDye", WorkOrder_dat.Select().First().Field<object>("ReDye"));
|
||||||
if (!dat_w)
|
if (!dat_w)
|
||||||
{
|
{
|
||||||
client.SendAsync("SC911" + "[" + MainWindowViewModel.S01 + "]" +
|
client.SendAsync("SC911" + "[" + MainWindowViewModel.S01 + "]" + Step_new.ToJsonString());
|
||||||
WorkOrder_dat.Select().First().Field<object>("WorkOrder"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client.SendAsync("SC811" + "[" + MainWindowViewModel.S01 + "]" +
|
client.SendAsync("SC811" + "[" + MainWindowViewModel.S01 + "]" + Step_new.ToJsonString());
|
||||||
WorkOrder_dat.Select().First().Field<object>("WorkOrder"));
|
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
}
|
}
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
@@ -170,6 +167,31 @@ namespace DyeingComputer.UserClass
|
|||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}//WorkOrderstep表信息检查写入
|
}//WorkOrderstep表信息检查写入
|
||||||
|
else if (SYSAPI == "SC812")
|
||||||
|
{
|
||||||
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Dictionary<string, object> WorkOrder_dat;
|
||||||
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
|
MainWindow.SQLiteHelpers.InsertData("WorkorderSet", WorkOrder_dat);//行插入
|
||||||
|
|
||||||
|
Dictionary<string, object> Step_new = new Dictionary<string, object>();//缓存函数
|
||||||
|
Step_new.Add("WorkOrder", WorkOrder_dat.GetValue("WorkOrder").ToString());
|
||||||
|
Step_new.Add("ReDye", WorkOrder_dat.GetValue("ReDye").ToString());
|
||||||
|
|
||||||
|
client.SendAsync("SC812" + "[" + MainWindowViewModel.S01 + "]" + Step_new.ToJsonString());
|
||||||
|
MainWindowViewModel.TX++;
|
||||||
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
client.SendAsync("SC992" + "[" + MainWindowViewModel.S01 + "]" + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { client.SendAsync("SC999"); }
|
||||||
|
}//WorkOrderset表信息检查写入
|
||||||
else if (SYSAPI == "SC813")
|
else if (SYSAPI == "SC813")
|
||||||
{
|
{
|
||||||
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
@@ -193,7 +215,7 @@ namespace DyeingComputer.UserClass
|
|||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
}
|
}
|
||||||
catch (Exception ex) { client.SendAsync("SC991" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
catch (Exception ex) { client.SendAsync("SC993" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}//写入领料单
|
}//写入领料单
|
||||||
@@ -228,29 +250,80 @@ namespace DyeingComputer.UserClass
|
|||||||
dat_821 = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
dat_821 = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
if (dat_821.GetValue("INSTRUCTION").ToString() == "START")
|
if (dat_821.GetValue("INSTRUCTION").ToString() == "START")
|
||||||
{
|
{
|
||||||
SQLDATA.TechnologicalProcess_START(dat_821.GetValue("ProgramID").ToString());
|
MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where ReDye=0 AND WorkOrder = '" +
|
||||||
|
dat_821.GetValue("WorkOrder").ToString() + "'", null).Tables[0];
|
||||||
|
var DT_Set = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from WorkOrderSet where WorkOrder = '" +
|
||||||
|
dat_821.GetValue("WorkOrder").ToString() + "'", null).Tables[0].Rows[0];
|
||||||
|
MainWindowViewModel.Updata_dtm("1020", DT_Set.Field<int>("PumpSpeed"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1030", DT_Set.Field<int>("Swing"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1021", DT_Set.Field<int>("Blower"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1025", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1026", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1027", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1028", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1029", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1035", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1036", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1037", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1038", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1039", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1040", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1041", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
DataTable WorkorderSteps = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
|
"select * from WorkorderSteps where ReDye=0 AND WorkOrder='" + dat_821.GetValue("WorkOrder").ToString() + "'", null).Tables[0]; //读取表写入缓存
|
||||||
|
DataTable Workorder = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
|
"select * from Workorder where ReDye=0 AND WorkOrder='" + dat_821.GetValue("WorkOrder").ToString() + "'", null).Tables[0]; //读取表写入缓存
|
||||||
|
MainWindowViewModel.ProgramName = Workorder.Rows[0].Field<string>("ProgramName");
|
||||||
|
MainWindowViewModel.WorkNumder = Workorder.Rows[0].Field<string>("WorkOrder");
|
||||||
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||||
|
for (int i = 0; i < WorkorderSteps.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
DataRow dr = WorkorderSteps.Rows[i];//行转
|
||||||
|
|
||||||
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dr));//行插入
|
||||||
|
}
|
||||||
|
Dictionary<string, object> updata_temp = new Dictionary<string, object>();//缓存函数
|
||||||
|
updata_temp.Add("State", 205);
|
||||||
|
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + dat_821.GetValue("WorkOrder").ToString() + "'", null);
|
||||||
|
updata_temp.Clear(); //使用前清缓存
|
||||||
|
updata_temp.Add("RUN", 1);
|
||||||
|
MainWindow.SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null);
|
||||||
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
|
/*触发启动*/
|
||||||
|
string Numder = WorkorderSteps.Select("Step = 1").First().Field<string>("StepID");//
|
||||||
|
double P1 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter1");
|
||||||
|
double P2 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter2");
|
||||||
|
double P3 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter3");
|
||||||
|
double P4 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter4");
|
||||||
|
double P5 = WorkorderSteps.Select("Step = 1").First().Field<double>("Parameter5");
|
||||||
|
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(1);//插入步骤号
|
||||||
|
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3),
|
||||||
|
Convert.ToDouble(P4), Convert.ToDouble(P5));
|
||||||
|
MainWindowViewModel.WORK_RUN = 2;
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "START", "STEP = " +
|
||||||
|
MainWindowViewModel.RUN_STEPID + ";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
|
||||||
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
||||||
}
|
}
|
||||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "STOP")
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "STOP")
|
||||||
{
|
{
|
||||||
MainWindowViewModel.WORK_RUN = 0;//停止
|
MainWindowViewModel.WORK_RUN = 0;//停止
|
||||||
MainWindowViewModel.DIDETime = 0;
|
MainWindowViewModel.DIDETime = 0;
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "STOP", MainWindowViewModel.WorkNumder.ToString());
|
||||||
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
||||||
}
|
}//停止
|
||||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE")
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "PAUSE")
|
||||||
{
|
{
|
||||||
MainWindowViewModel.WORK_RUN = 1;//暂停
|
MainWindowViewModel.WORK_RUN = 1;//暂停
|
||||||
|
MainWindowViewModel.errTabler.Clear();
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "PAUSE", MainWindowViewModel.WorkNumder.ToString());
|
||||||
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
||||||
}
|
}//暂停
|
||||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE")
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE")
|
||||||
{
|
{
|
||||||
|
|
||||||
MainWindowViewModel.errTabler.Clear();
|
MainWindowViewModel.errTabler.Clear();
|
||||||
MainWindowViewModel.WORK_RUN = 2;//
|
MainWindowViewModel.WORK_RUN = 2;//PAUSE
|
||||||
//
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "CONTINUE", MainWindowViewModel.WorkNumder.ToString());
|
||||||
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
||||||
}//运行
|
}//运行
|
||||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP")
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP")
|
||||||
@@ -259,15 +332,20 @@ namespace DyeingComputer.UserClass
|
|||||||
MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")),
|
MainWindowViewModel.STEP_START(dat_821.GetValue("Numder").ToString(), Convert.ToDouble(dat_821.GetValue("P1")),
|
||||||
Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")),
|
Convert.ToDouble(dat_821.GetValue("P2")), Convert.ToDouble(dat_821.GetValue("P3")),
|
||||||
Convert.ToDouble(dat_821.GetValue("P4")), Convert.ToDouble(dat_821.GetValue("P5")));
|
Convert.ToDouble(dat_821.GetValue("P4")), Convert.ToDouble(dat_821.GetValue("P5")));
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "JUMP", "STEP = " +
|
||||||
|
MainWindowViewModel.RUN_STEPID + ";"+dat_821.GetValue("Numder").ToString()+";P1="+
|
||||||
|
Convert.ToDouble(dat_821.GetValue("P1")) + ";P2=" + Convert.ToDouble(dat_821.GetValue("P2")) + ";P3=" +
|
||||||
|
Convert.ToDouble(dat_821.GetValue("P3")) + ";P4=" + Convert.ToDouble(dat_821.GetValue("P4")) + ";P5=" +
|
||||||
|
Convert.ToDouble(dat_821.GetValue("P5")));
|
||||||
}//跳步
|
}//跳步
|
||||||
else if (dat_821.GetValue("INSTRUCTION").ToString() == "INSERT")
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "INSERT")
|
||||||
{
|
{
|
||||||
int d = Convert.ToInt16(dat_821.GetValue("ID"));
|
int d = Convert.ToInt16(dat_821.GetValue("ID"));
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
/**插入行**/
|
/**插入行**/
|
||||||
string ProgramID = SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
string ProgramID = MainWindow.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
||||||
string ProgramNAME = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
string ProgramNAME = MainWindow.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||||
// TechnologicalProcessView.SQLiteHelpers.Close();
|
// TechnologicalProcessView.SQLiteHelpers.Close();
|
||||||
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
||||||
dr["ProgramID"] = ProgramID;
|
dr["ProgramID"] = ProgramID;
|
||||||
@@ -286,7 +364,27 @@ namespace DyeingComputer.UserClass
|
|||||||
drtt["Parameter3"] = dat_821.GetValue("Parameter3").ToString();
|
drtt["Parameter3"] = dat_821.GetValue("Parameter3").ToString();
|
||||||
drtt["Parameter4"] = dat_821.GetValue("Parameter4").ToString();
|
drtt["Parameter4"] = dat_821.GetValue("Parameter4").ToString();
|
||||||
drtt["Parameter5"] = dat_821.GetValue("Parameter5").ToString();
|
drtt["Parameter5"] = dat_821.GetValue("Parameter5").ToString();
|
||||||
|
drtt["Parameter1_S1"] = dat_821.GetValue("Parameter1_S1").ToString();
|
||||||
|
drtt["Parameter2_S1"] = dat_821.GetValue("Parameter2_S1").ToString();
|
||||||
|
drtt["Parameter3_S1"] = dat_821.GetValue("Parameter3_S1").ToString();
|
||||||
|
drtt["Parameter4_S1"] = dat_821.GetValue("Parameter4_S1").ToString();
|
||||||
|
drtt["Parameter5_S1"] = dat_821.GetValue("Parameter5_S1").ToString();
|
||||||
|
drtt["Parameter1_S2"] = dat_821.GetValue("Parameter1_S2").ToString();
|
||||||
|
drtt["Parameter2_S2"] = dat_821.GetValue("Parameter2_S2").ToString();
|
||||||
|
drtt["Parameter3_S2"] = dat_821.GetValue("Parameter3_S2").ToString();
|
||||||
|
drtt["Parameter4_S2"] = dat_821.GetValue("Parameter4_S2").ToString();
|
||||||
|
drtt["Parameter5_S2"] = dat_821.GetValue("Parameter5_S2").ToString();
|
||||||
|
drtt["Parameter1_S3"] = dat_821.GetValue("Parameter1_S3").ToString();
|
||||||
|
drtt["Parameter2_S3"] = dat_821.GetValue("Parameter2_S3").ToString();
|
||||||
|
drtt["Parameter3_S3"] = dat_821.GetValue("Parameter3_S3").ToString();
|
||||||
|
drtt["Parameter4_S3"] = dat_821.GetValue("Parameter4_S3").ToString();
|
||||||
|
drtt["Parameter5_S3"] = dat_821.GetValue("Parameter5_S3").ToString();
|
||||||
|
drtt["StepName_S1"] = dat_821.GetValue("StepName_S1").ToString();
|
||||||
|
drtt["StepName_S2"] = dat_821.GetValue("StepName_S2").ToString();
|
||||||
|
drtt["StepName_S3"] = dat_821.GetValue("StepName_S3").ToString();
|
||||||
|
drtt["StepID_S1"] = dat_821.GetValue("StepID_S1").ToString();
|
||||||
|
drtt["StepID_S2"] = dat_821.GetValue("StepID_S2").ToString();
|
||||||
|
drtt["StepID_S3"] = dat_821.GetValue("StepID_S3").ToString();
|
||||||
drtt["RUN"] = "0";
|
drtt["RUN"] = "0";
|
||||||
drtt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
drtt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
drtt.EndEdit();
|
drtt.EndEdit();
|
||||||
@@ -298,24 +396,18 @@ namespace DyeingComputer.UserClass
|
|||||||
/**存入信息**/
|
/**存入信息**/
|
||||||
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
// SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
|
||||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
data_t.Clear();//清空
|
|
||||||
|
|
||||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||||
DataRow drT = data_t.NewRow();
|
dt.BeginEdit(); //添加订单号
|
||||||
drT.ItemArray = dt.ItemArray;
|
dt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
data_t.Rows.InsertAt(drT, 0);
|
dt.EndEdit();
|
||||||
drT.BeginEdit(); //添加订单号
|
|
||||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
|
||||||
drT.EndEdit();
|
|
||||||
|
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "INSERT", drtt.ToJsonString());
|
||||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
}//插入
|
}//插入
|
||||||
@@ -333,32 +425,47 @@ namespace DyeingComputer.UserClass
|
|||||||
dr["Parameter3"] = dat_821.GetValue("Parameter3").ToString();
|
dr["Parameter3"] = dat_821.GetValue("Parameter3").ToString();
|
||||||
dr["Parameter4"] = dat_821.GetValue("Parameter4").ToString();
|
dr["Parameter4"] = dat_821.GetValue("Parameter4").ToString();
|
||||||
dr["Parameter5"] = dat_821.GetValue("Parameter5").ToString();
|
dr["Parameter5"] = dat_821.GetValue("Parameter5").ToString();
|
||||||
|
dr["Parameter1_S1"] = dat_821.GetValue("Parameter1_S1").ToString();
|
||||||
|
dr["Parameter2_S1"] = dat_821.GetValue("Parameter2_S1").ToString();
|
||||||
|
dr["Parameter3_S1"] = dat_821.GetValue("Parameter3_S1").ToString();
|
||||||
|
dr["Parameter4_S1"] = dat_821.GetValue("Parameter4_S1").ToString();
|
||||||
|
dr["Parameter5_S1"] = dat_821.GetValue("Parameter5_S1").ToString();
|
||||||
|
dr["Parameter1_S2"] = dat_821.GetValue("Parameter1_S2").ToString();
|
||||||
|
dr["Parameter2_S2"] = dat_821.GetValue("Parameter2_S2").ToString();
|
||||||
|
dr["Parameter3_S2"] = dat_821.GetValue("Parameter3_S2").ToString();
|
||||||
|
dr["Parameter4_S2"] = dat_821.GetValue("Parameter4_S2").ToString();
|
||||||
|
dr["Parameter5_S2"] = dat_821.GetValue("Parameter5_S2").ToString();
|
||||||
|
dr["Parameter1_S3"] = dat_821.GetValue("Parameter1_S3").ToString();
|
||||||
|
dr["Parameter2_S3"] = dat_821.GetValue("Parameter2_S3").ToString();
|
||||||
|
dr["Parameter3_S3"] = dat_821.GetValue("Parameter3_S3").ToString();
|
||||||
|
dr["Parameter4_S3"] = dat_821.GetValue("Parameter4_S3").ToString();
|
||||||
|
dr["Parameter5_S3"] = dat_821.GetValue("Parameter5_S3").ToString();
|
||||||
|
dr["StepName_S1"] = dat_821.GetValue("StepName_S1").ToString();
|
||||||
|
dr["StepName_S2"] = dat_821.GetValue("StepName_S2").ToString();
|
||||||
|
dr["StepName_S3"] = dat_821.GetValue("StepName_S3").ToString();
|
||||||
|
dr["StepID_S1"] = dat_821.GetValue("StepID_S1").ToString();
|
||||||
|
dr["StepID_S2"] = dat_821.GetValue("StepID_S2").ToString();
|
||||||
|
dr["StepID_S3"] = dat_821.GetValue("StepID_S3").ToString();
|
||||||
dr.EndEdit();
|
dr.EndEdit();
|
||||||
|
|
||||||
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
var _TechnologicalProcessView = Application.Current.Windows.Cast<UserControl>().FirstOrDefault(window => window is TechnologicalProcessView) as TechnologicalProcessView;//跨页面
|
||||||
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
// _TechnologicalProcessView.Grid.ItemsSource = TechnologicalProcessView.sql.Tables[0].DefaultView;
|
||||||
_TechnologicalProcessView.GridSTEP.SelectedIndex = -1;
|
_TechnologicalProcessView.GridSTEP.SelectedIndex = -1;
|
||||||
/**存入信息**/
|
/**存入信息**/
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
data_t.Clear();//清空
|
|
||||||
|
|
||||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||||
DataRow drT = data_t.NewRow();
|
dt.BeginEdit(); //添加订单号
|
||||||
drT.ItemArray = dt.ItemArray;
|
dt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
data_t.Rows.InsertAt(drT, 0);
|
dt.EndEdit();
|
||||||
drT.BeginEdit(); //添加订单号
|
|
||||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
|
||||||
drT.EndEdit();
|
|
||||||
|
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
|
||||||
}
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
|
||||||
|
|
||||||
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
|
} //SQLiteHelpers.Close(); //关闭连接
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "EDIT", dr.ToJsonString());
|
||||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
}//编辑
|
}//编辑
|
||||||
@@ -368,26 +475,21 @@ namespace DyeingComputer.UserClass
|
|||||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1);
|
MainWindowViewModel.dt_TP.Rows.RemoveAt(d - 1);
|
||||||
TechnologicalProcessView.Dat();
|
TechnologicalProcessView.Dat();
|
||||||
/**存入信息**/
|
/**存入信息**/
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
data_t.Clear();//清空
|
|
||||||
|
|
||||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||||
DataRow drT = data_t.NewRow();
|
dt.BeginEdit(); //添加订单号
|
||||||
drT.ItemArray = dt.ItemArray;
|
dt["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
data_t.Rows.InsertAt(drT, 0);
|
dt.EndEdit();
|
||||||
drT.BeginEdit(); //添加订单号
|
|
||||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
|
||||||
drT.EndEdit();
|
|
||||||
|
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "CentralControl", "DELETE","ID="+ dat_821.GetValue("ID").ToString());
|
||||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
}//删除
|
}//删除
|
||||||
@@ -401,18 +503,35 @@ namespace DyeingComputer.UserClass
|
|||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
}//启停跳步指令
|
}//启停跳步指令
|
||||||
|
else if (SYSAPI == "SC822")
|
||||||
|
{
|
||||||
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataTable Workorder = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
|
"select * from Workorder where ReDye=0 AND State='101'AND StartTime >'"+
|
||||||
|
DateTime.Now.AddHours(-1).ToString("yyyy/MM/dd HH:mm:ss") +"'", null).Tables[0]; //读取表写入缓存
|
||||||
|
|
||||||
|
client.SendAsync("SC822" + "[" + MainWindowViewModel.S01 + "]" + Workorder.ToJsonString());
|
||||||
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
|
}
|
||||||
|
catch (Exception ex) { client.SendAsync("SC922" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||||
|
}
|
||||||
|
else { client.SendAsync("SC999"); }
|
||||||
|
}//最近可用工艺
|
||||||
else if (SYSAPI == "SC827")
|
else if (SYSAPI == "SC827")
|
||||||
{
|
{
|
||||||
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
if (SYSKEY == MainWindowViewModel.SYSKEY)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from Dyelot where State = '201' AND WorkOrder = '" +
|
string sql_script = "select * from Dyelot where State = '201' AND WorkOrder = '" +
|
||||||
MainWindowViewModel.WorkNumder + "'";
|
MainWindowViewModel.WorkNumder + "'";
|
||||||
DataTable dt = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换
|
DataTable dt = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
client.SendAsync("SC827" + "[" + MainWindowViewModel.S01 + "]" + dt.ToJsonString());
|
client.SendAsync("SC827" + "[" + MainWindowViewModel.S01 + "]" + dt.ToJsonString());
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
@@ -430,8 +549,8 @@ namespace DyeingComputer.UserClass
|
|||||||
Dictionary<string, object> Dyelot_dat;
|
Dictionary<string, object> Dyelot_dat;
|
||||||
Dyelot_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
Dyelot_dat = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
Dictionary<string, object> Product_data = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Product_data = new Dictionary<string, object>();//缓存函数
|
||||||
|
|
||||||
Product_data.Add("State", Dyelot_dat.GetValue("State"));
|
Product_data.Add("State", Dyelot_dat.GetValue("State"));
|
||||||
@@ -440,17 +559,17 @@ namespace DyeingComputer.UserClass
|
|||||||
Product_data.Add("Amount", Dyelot_dat.GetValue("Amount"));
|
Product_data.Add("Amount", Dyelot_dat.GetValue("Amount"));
|
||||||
Product_data.Add("DispenseEndTime", Dyelot_dat.GetValue("DispenseEndTime"));
|
Product_data.Add("DispenseEndTime", Dyelot_dat.GetValue("DispenseEndTime"));
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Update("Dyelot", Product_data, "Dyelot ='" + Dyelot_dat.GetValue("Dyelot")
|
MainWindow.SQLiteHelpers.Update("Dyelot", Product_data, "Dyelot ='" + Dyelot_dat.GetValue("Dyelot")
|
||||||
+ "' AND Step ='" + Dyelot_dat.GetValue("Step") + "' AND ProductCode='" +
|
+ "' AND Step ='" + Dyelot_dat.GetValue("Step") + "' AND ProductCode='" +
|
||||||
Dyelot_dat.GetValue("ProductCode") + "'", null);
|
Dyelot_dat.GetValue("ProductCode") + "'", null);
|
||||||
MainWindowViewModel.Dyelot_dat = SQLiteHelpers.ExecuteDataSet(
|
MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
"select * from Dyelot where WorkOrder = '" +
|
"select * from Dyelot where WorkOrder = '" +
|
||||||
MainWindowViewModel.WorkNumder + "'", null).Tables[0];
|
MainWindowViewModel.WorkNumder + "'", null).Tables[0];
|
||||||
int dt = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot='" +
|
int dt = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot='" +
|
||||||
Dyelot_dat.GetValue("Dyelot") + "' AND State ='201'", null).Tables[0].Rows.Count;
|
Dyelot_dat.GetValue("Dyelot") + "' AND State ='201'", null).Tables[0].Rows.Count;
|
||||||
if (dt == 0) MainWindowViewModel.CALL_FR = false;
|
if (dt == 0) MainWindowViewModel.CALL_FR = false;
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
client.SendAsync("SC828" + SYSKEY + SYSDAT);
|
client.SendAsync("SC828" + SYSKEY + SYSDAT);
|
||||||
|
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
@@ -574,11 +693,11 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from Dyelot where WorkOrder = '" + MainWindowViewModel.WorkNumder + "'";
|
string sql_script = "select * from Dyelot where WorkOrder = '" + MainWindowViewModel.WorkNumder + "'";
|
||||||
DataTable dt = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换
|
DataTable dt = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
// SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
client.SendAsync("SC833" + "[" + MainWindowViewModel.S01 + "]" + dt.ToJsonString());
|
client.SendAsync("SC833" + "[" + MainWindowViewModel.S01 + "]" + dt.ToJsonString());
|
||||||
MainWindowViewModel.TX++;
|
MainWindowViewModel.TX++;
|
||||||
@@ -656,57 +775,46 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// SQLiteHelper SQLiteHelpersLOG = new SQLiteHelper(Environment.CurrentDirectory+"\\DataBase\\LOG.db"); //数据库连接路径
|
||||||
|
// SQLiteHelpersLOG.Open(); //打开数据库
|
||||||
Dictionary<string, object> dat_859;
|
Dictionary<string, object> dat_859;
|
||||||
dat_859 = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
dat_859 = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||||
|
|
||||||
if (dat_859.GetValue("INSTRUCTION").ToString() == "SERVER")
|
if (dat_859.GetValue("INSTRUCTION").ToString() == "SERVER")
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper("\\DataBase\\LOG.db"); //数据库连接路径
|
var dt_ = APILog.LOGSELECT("select * from SERVER where TIME >'" +
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "' and TIME <'" +
|
||||||
DataTable dt_ = SQLiteHelpers.ExecuteDataSet("select * from SERVER where TIME >"+
|
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "'");
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "TIME <"+
|
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss"), null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
|
||||||
|
|
||||||
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
}
|
}
|
||||||
else if (dat_859.GetValue("INSTRUCTION").ToString() == "OperationLog")
|
else if (dat_859.GetValue("INSTRUCTION").ToString() == "OperationLog")
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper("\\DataBase\\LOG.db"); //数据库连接路径
|
var dt_ = APILog.LOGSELECT("select * from OperationLog where TIME >'" +
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "' and TIME <'" +
|
||||||
DataTable dt_ = SQLiteHelpers.ExecuteDataSet("select * from OperationLog where TIME >" +
|
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "'");
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "TIME <" +
|
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss"), null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
|
||||||
|
|
||||||
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
}
|
}
|
||||||
else if (dat_859.GetValue("INSTRUCTION").ToString() == "IOLog")
|
else if (dat_859.GetValue("INSTRUCTION").ToString() == "IOLog")
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper("\\DataBase\\LOG.db"); //数据库连接路径
|
var dt_ = APILog.LOGSELECT("select * from IOLog where TIME >'" +
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "' and TIME <'" +
|
||||||
DataTable dt_ = SQLiteHelpers.ExecuteDataSet("select * from IOLog where TIME >" +
|
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "'");
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "TIME <" +
|
dt_.Columns.Remove("type");
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss"), null).Tables[0];
|
dt_.Columns.Remove("Value");
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
dt_.Columns.Remove("PLC");
|
||||||
|
|
||||||
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
}
|
}
|
||||||
else if (dat_859.GetValue("INSTRUCTION").ToString() == "ERRLog")
|
else if (dat_859.GetValue("INSTRUCTION").ToString() == "ERRLog")
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper("\\DataBase\\LOG.db"); //数据库连接路径
|
var dt_ = APILog.LOGSELECT("select * from ERRLog where TIME >'" +
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "' and TIME <'" +
|
||||||
DataTable dt_ = SQLiteHelpers.ExecuteDataSet("select * from ERRLog where TIME >" +
|
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "'");
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_S").ToString()).ToString("yyyy/MM/dd HH:mm:ss") + "TIME <" +
|
|
||||||
DateTime.Parse(dat_859.GetValue("TIME_E").ToString()).ToString("yyyy/MM/dd HH:mm:ss"), null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
|
||||||
|
|
||||||
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
client.SendAsync("SC859" + "[" + MainWindowViewModel.S01 + "]" + dt_.ToJsonString());//缓存信息
|
||||||
|
|
||||||
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
APILog.DBlog(client.IP, SYSKEY, SYSAPI, SYSDAT);//记录指令
|
||||||
@@ -714,7 +822,7 @@ namespace DyeingComputer.UserClass
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
client.SendAsync("SC959" + "[" + MainWindowViewModel.S01 + "]" + ex);
|
client.SendAsync("SC959" + "[" + MainWindowViewModel.S01 + "]" + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { client.SendAsync("SC999"); }
|
else { client.SendAsync("SC999"); }
|
||||||
@@ -731,11 +839,11 @@ namespace DyeingComputer.UserClass
|
|||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
datagrid_v.Add("Value", dat_861.GetValue("Value"));
|
datagrid_v.Add("Value", dat_861.GetValue("Value"));
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("Parameters", datagrid_v, "ParameterID ='" + dat_861.GetValue("ID") + "'", null);//更新
|
MainWindow.SQLiteHelpers.Update("Parameters", datagrid_v, "ParameterID ='" + dat_861.GetValue("ID") + "'", null);//更新
|
||||||
MainWindowViewModel.dt_ParameterSet = SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0];
|
MainWindowViewModel.dt_ParameterSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0];
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
|
|
||||||
client.SendAsync("SC854" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_ParameterSet.ToJsonString());//缓存信息
|
client.SendAsync("SC854" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_ParameterSet.ToJsonString());//缓存信息
|
||||||
|
|
||||||
@@ -766,11 +874,11 @@ namespace DyeingComputer.UserClass
|
|||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
datagrid_v.Add("Value", dat_862.GetValue("Value"));
|
datagrid_v.Add("Value", dat_862.GetValue("Value"));
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + dat_862.GetValue("ID") + "'", null);//更新
|
MainWindow.SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + dat_862.GetValue("ID") + "'", null);//更新
|
||||||
MainWindowViewModel.dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
MainWindowViewModel.dt_SysSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
|
|
||||||
client.SendAsync("SC855" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_SysSet.ToJsonString());//缓存信息
|
client.SendAsync("SC855" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_SysSet.ToJsonString());//缓存信息
|
||||||
|
|
||||||
@@ -789,16 +897,14 @@ namespace DyeingComputer.UserClass
|
|||||||
};
|
};
|
||||||
|
|
||||||
await service.SetupAsync(new TouchSocketConfig()//载入配置
|
await service.SetupAsync(new TouchSocketConfig()//载入配置
|
||||||
.SetMaxBufferSize(1024 * 1024)
|
.SetMaxBufferSize(1024 * 1024 * 100)
|
||||||
.SetMinBufferSize(1024 * 64)
|
.SetMinBufferSize(1024 * 1024)
|
||||||
.SetListenIPHosts(new IPHost[] { new IPHost("tcp://127.0.0.1:7789"), new IPHost(7790) })//同时监听两个地址
|
.SetListenIPHosts(new IPHost[] { new IPHost(7789), new IPHost(7790) })//同时监听两个地址
|
||||||
.ConfigureContainer(a =>//容器的配置顺序应该在最前面
|
.ConfigureContainer(a =>//容器的配置顺序应该在最前面
|
||||||
{
|
{
|
||||||
//a.AddConsoleLogger();//添加一个控制台日志注入(注意:在maui中控制台日志不可用)
|
|
||||||
})
|
})
|
||||||
.ConfigurePlugins(a =>
|
.ConfigurePlugins(a =>
|
||||||
{
|
{
|
||||||
//a.Add<DifferentProtocolPlugin>();
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
await service.StartAsync();//启动
|
await service.StartAsync();//启动
|
||||||
|
|||||||
@@ -0,0 +1,262 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DyeingComputer.UserClass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 加注曲线类型
|
||||||
|
/// </summary>
|
||||||
|
public enum DosingCurveType
|
||||||
|
{
|
||||||
|
Linear, // 线性曲线
|
||||||
|
Parabolic, // 抛物线曲线(开始快,后来慢)
|
||||||
|
Exponential // 指数曲线(开始慢,后来快)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 液体加注PID控制器
|
||||||
|
/// </summary>
|
||||||
|
public class LiquidDosingController
|
||||||
|
{
|
||||||
|
private DateTime _startTime;
|
||||||
|
private DateTime _lastUpdateTime;
|
||||||
|
private double _lastLevel;
|
||||||
|
private bool _isDosingActive;
|
||||||
|
|
||||||
|
// PID控制器参数
|
||||||
|
private double _proportionalGain;
|
||||||
|
private double _integralGain;
|
||||||
|
private double _derivativeGain;
|
||||||
|
private double _integralTerm;
|
||||||
|
private double _lastError;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前比例阀开度 (0-100%)
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentValveOpening { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标完成时间 (秒)
|
||||||
|
/// </summary>
|
||||||
|
public double TargetTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加注曲线类型
|
||||||
|
/// </summary>
|
||||||
|
public DosingCurveType CurveType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 容器最大容量
|
||||||
|
/// </summary>
|
||||||
|
public double MaxCapacity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前液位
|
||||||
|
/// </summary>
|
||||||
|
public double CurrentLevel { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已加注体积
|
||||||
|
/// </summary>
|
||||||
|
public double DosedVolume { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 液体加注事件
|
||||||
|
/// </summary>
|
||||||
|
public event Action<double> OnDosingUpdate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化液体加注控制器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetTime">目标加注时间(秒)</param>
|
||||||
|
/// <param name="maxCapacity">容器最大容量</param>
|
||||||
|
/// <param name="curveType">加注曲线类型</param>
|
||||||
|
/// <param name="kP">比例增益</param>
|
||||||
|
/// <param name="kI">积分增益</param>
|
||||||
|
/// <param name="kD">微分增益</param>
|
||||||
|
public LiquidDosingController(double targetTime, double maxCapacity,
|
||||||
|
DosingCurveType curveType = DosingCurveType.Linear,
|
||||||
|
double kP = 1.0, double kI = 0.1, double kD = 0.01)
|
||||||
|
{
|
||||||
|
TargetTime = targetTime;
|
||||||
|
MaxCapacity = maxCapacity;
|
||||||
|
CurveType = curveType;
|
||||||
|
|
||||||
|
_proportionalGain = kP;
|
||||||
|
_integralGain = kI;
|
||||||
|
_derivativeGain = kD;
|
||||||
|
|
||||||
|
_isDosingActive = false;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始加注过程
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="initialLevel">初始液位</param>
|
||||||
|
public void StartDosing(double initialLevel)
|
||||||
|
{
|
||||||
|
if (_isDosingActive) return;
|
||||||
|
|
||||||
|
_lastLevel = initialLevel;
|
||||||
|
CurrentLevel = initialLevel;
|
||||||
|
DosedVolume = 0;
|
||||||
|
_integralTerm = 0;
|
||||||
|
_lastError = 0;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
|
||||||
|
_startTime = DateTime.Now;
|
||||||
|
_lastUpdateTime = _startTime;
|
||||||
|
|
||||||
|
_isDosingActive = true;
|
||||||
|
|
||||||
|
OnDosingUpdate?.Invoke(CurrentValveOpening);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止加注过程
|
||||||
|
/// </summary>
|
||||||
|
public void StopDosing()
|
||||||
|
{
|
||||||
|
_isDosingActive = false;
|
||||||
|
CurrentValveOpening = 0;
|
||||||
|
OnDosingUpdate?.Invoke(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新当前液位并计算新的阀门开度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentLevel">当前液位</param>
|
||||||
|
/// <returns>新的阀门开度</returns>
|
||||||
|
public double UpdateLevel(double currentLevel)
|
||||||
|
{
|
||||||
|
if (!_isDosingActive) return 0;
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
DateTime currentTime = DateTime.Now;
|
||||||
|
|
||||||
|
// 计算时间间隔
|
||||||
|
double timeInterval = (currentTime - _lastUpdateTime).TotalSeconds;
|
||||||
|
|
||||||
|
// 如果时间间隔太小,避免计算过于频繁
|
||||||
|
if (timeInterval < 0.1) return CurrentValveOpening;
|
||||||
|
|
||||||
|
// 更新液位
|
||||||
|
CurrentLevel = currentLevel;
|
||||||
|
|
||||||
|
// 计算这段时间内的液体减少量
|
||||||
|
double volumeDosedInInterval = _lastLevel - currentLevel;
|
||||||
|
DosedVolume += volumeDosedInInterval;
|
||||||
|
_lastLevel = currentLevel;
|
||||||
|
|
||||||
|
// 计算已用时间和剩余时间
|
||||||
|
double elapsedTime = (currentTime - _startTime).TotalSeconds;
|
||||||
|
double remainingTime = TargetTime - elapsedTime;
|
||||||
|
|
||||||
|
// 如果已超过目标时间,完全关闭阀门
|
||||||
|
if (remainingTime <= 0)
|
||||||
|
{
|
||||||
|
StopDosing();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算期望的加注速率(基于所选曲线类型)
|
||||||
|
double desiredDosingRate = CalculateDesiredDosingRate(elapsedTime, remainingTime);
|
||||||
|
|
||||||
|
// 计算实际加注速率(升/秒)
|
||||||
|
double actualDosingRate = volumeDosedInInterval / timeInterval;
|
||||||
|
|
||||||
|
// 计算误差(期望速率与实际速率之差)
|
||||||
|
double error = desiredDosingRate - actualDosingRate;
|
||||||
|
|
||||||
|
// PID计算
|
||||||
|
double proportionalTerm = _proportionalGain * error;
|
||||||
|
|
||||||
|
_integralTerm += _integralGain * error * timeInterval;
|
||||||
|
// 积分项抗饱和
|
||||||
|
_integralTerm = Math.Max(Math.Min(_integralTerm, 100), 0);
|
||||||
|
|
||||||
|
double derivativeTerm = _derivativeGain * (error - _lastError) / timeInterval;
|
||||||
|
_lastError = error;
|
||||||
|
|
||||||
|
// 计算新的阀门开度
|
||||||
|
double newValveOpening = CurrentValveOpening + proportionalTerm + _integralTerm + derivativeTerm;
|
||||||
|
|
||||||
|
// 限制阀门开度在0-100%范围内
|
||||||
|
newValveOpening = Math.Max(Math.Min(newValveOpening, 100), 0);
|
||||||
|
|
||||||
|
CurrentValveOpening = newValveOpening;
|
||||||
|
|
||||||
|
// 更新最后更新时间
|
||||||
|
_lastUpdateTime = currentTime;
|
||||||
|
|
||||||
|
// 触发更新事件
|
||||||
|
OnDosingUpdate?.Invoke(CurrentValveOpening);
|
||||||
|
|
||||||
|
// 检查是否已完成加注
|
||||||
|
if (CurrentLevel <= 0)
|
||||||
|
{
|
||||||
|
StopDosing();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CurrentValveOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据曲线类型计算期望的加注速率
|
||||||
|
/// </summary>
|
||||||
|
private double CalculateDesiredDosingRate(double elapsedTime, double remainingTime)
|
||||||
|
{
|
||||||
|
double remainingVolume = CurrentLevel;
|
||||||
|
|
||||||
|
// 确保不会除零
|
||||||
|
if (remainingTime <= 0) return 0;
|
||||||
|
|
||||||
|
double progress = elapsedTime / TargetTime;
|
||||||
|
|
||||||
|
switch (CurveType)
|
||||||
|
{
|
||||||
|
case DosingCurveType.Linear:
|
||||||
|
// 线性:恒定速率
|
||||||
|
return remainingVolume / remainingTime;
|
||||||
|
|
||||||
|
case DosingCurveType.Parabolic:
|
||||||
|
// 抛物线:开始快,后来慢
|
||||||
|
// 使用二次函数减少速率
|
||||||
|
double parabolicFactor = 1.0 - Math.Pow(progress, 2);
|
||||||
|
return (remainingVolume / remainingTime) * parabolicFactor;
|
||||||
|
|
||||||
|
case DosingCurveType.Exponential:
|
||||||
|
// 指数:开始慢,后来快
|
||||||
|
// 使用指数函数增加速率
|
||||||
|
double exponentialFactor = Math.Exp(progress) / Math.Exp(1);
|
||||||
|
return (remainingVolume / remainingTime) * exponentialFactor;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return remainingVolume / remainingTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置PID参数
|
||||||
|
/// </summary>
|
||||||
|
public void SetPIDParameters(double kP, double kI, double kD)
|
||||||
|
{
|
||||||
|
_proportionalGain = kP;
|
||||||
|
_integralGain = kI;
|
||||||
|
_derivativeGain = kD;
|
||||||
|
|
||||||
|
// 重置积分项和误差
|
||||||
|
_integralTerm = 0;
|
||||||
|
_lastError = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查加注是否正在进行中
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDosingActive => _isDosingActive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,8 +10,8 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
public class LogGing
|
public class LogGing
|
||||||
{
|
{
|
||||||
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
public static bool sqld=false;
|
public static bool sqld=false;
|
||||||
public static void LogGingDATA(string dat)
|
public static void LogGingDATA(string dat)
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ namespace DyeingComputer.UserClass
|
|||||||
if (!sqld)
|
if (!sqld)
|
||||||
{
|
{
|
||||||
sqld = true;
|
sqld = true;
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
string Log_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
Dictionary<string, object> logsql = new Dictionary<string, object>();
|
Dictionary<string, object> logsql = new Dictionary<string, object>();
|
||||||
// 添加元素
|
// 添加元素
|
||||||
@@ -60,9 +60,9 @@ namespace DyeingComputer.UserClass
|
|||||||
logsql.Add("API", api);
|
logsql.Add("API", api);
|
||||||
logsql.Add("MESSAGE", dat);
|
logsql.Add("MESSAGE", dat);
|
||||||
logsql.Add("TIME", Log_time);
|
logsql.Add("TIME", Log_time);
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.InsertData("SERVER", logsql);//行插入
|
MainWindow.SQLiteHelpers.InsertData("SERVER", logsql);//行插入
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
sqld = false;
|
sqld = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,85 +14,58 @@ namespace DyeingComputer.UserClass
|
|||||||
{
|
{
|
||||||
public class SQLDATA
|
public class SQLDATA
|
||||||
{
|
{
|
||||||
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// private static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
|
||||||
|
|
||||||
//WorkOrder表检查写入
|
|
||||||
public static bool WorkOrder(string WorkOrder, string ProgramName, string StartTime, string EndTime, string Time, string Remark,string lock_,string state,string ProgramID, string color,string dyelot)
|
|
||||||
{
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
|
||||||
object i = SQLiteHelpers.ExecuteScalar("select * from WorkOrder where WorkOrder = "+ WorkOrder,null);
|
|
||||||
if (i!=null)
|
|
||||||
{
|
|
||||||
SQLiteHelpers.Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Dictionary<string, object> WorkOrder_new = new Dictionary<string, object>();//缓存函数
|
|
||||||
WorkOrder_new.Add("WorkOrder", WorkOrder);
|
|
||||||
WorkOrder_new.Add("ProgramName", ProgramName);
|
|
||||||
WorkOrder_new.Add("StartTime", StartTime);
|
|
||||||
WorkOrder_new.Add("EndTime", EndTime);
|
|
||||||
WorkOrder_new.Add("Time", Time);
|
|
||||||
WorkOrder_new.Add("Remark", Remark);
|
|
||||||
WorkOrder_new.Add("lock", Convert.ToInt16(lock_));
|
|
||||||
WorkOrder_new.Add("state", Convert.ToInt16(state));
|
|
||||||
WorkOrder_new.Add("ProgramID", ProgramID);
|
|
||||||
WorkOrder_new.Add("color", color);
|
|
||||||
WorkOrder_new.Add("Dyelot", dyelot);
|
|
||||||
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);
|
|
||||||
SQLiteHelpers.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool WorkOderStep(DataTable WorkOrderStep_)
|
public static bool WorkOderStep(DataTable WorkOrderStep_)
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
int a = WorkOrderStep_.Rows.Count;
|
int a = WorkOrderStep_.Rows.Count;
|
||||||
if (a < 1)
|
if (a < 1)
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close();
|
MainWindow.SQLiteHelpers.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string Program = WorkOrderStep_.Rows[0][0].ToString();
|
string Program = WorkOrderStep_.Rows[0][0].ToString();
|
||||||
object n = SQLiteHelpers.ExecuteScalar("select * from WorkorderSteps where Program = " + Program, null);
|
object n = MainWindow.SQLiteHelpers.ExecuteScalar("select * from WorkorderSteps where Program = " + Program, null);
|
||||||
if (n != null)//如id存在着返回错误状态
|
if (n != null)//如id存在着返回错误状态
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
{
|
{
|
||||||
SQLiteHelpers.InsertData("WorkorderSteps", SQLiteHelpers.ToDictionary(WorkOrderStep_.Rows[i]));//行插入
|
MainWindow.SQLiteHelpers.InsertData("WorkorderSteps", MainWindow.SQLiteHelpers.ToDictionary(WorkOrderStep_.Rows[i]));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TechnologicalProcess_START(string workName)
|
public static void TechnologicalProcess_START(string workName)
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
int r = 0;
|
|
||||||
string sql_script = "select * from WorkorderSteps where ProgramID = '" + workName + "'";
|
string sql_script = "select * from WorkorderSteps where ProgramID = '" + workName + "'";
|
||||||
// if (TechnologicalProcessView.sql != null) TechnologicalProcessView.sql.Clear(); //清空缓存
|
// if (TechnologicalProcessView.sql != null) TechnologicalProcessView.sql.Clear(); //清空缓存
|
||||||
MainWindowViewModel.dt_TP = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
MainWindowViewModel.dt_TP = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
||||||
MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select ProgramName from Workorder where ProgramID = '" + workName + "'", null).ToString();
|
MainWindowViewModel.ProgramName = MainWindow.SQLiteHelpers.ExecuteScalar("select ProgramName from Workorder where ProgramID = '" + workName + "'", null).ToString();
|
||||||
|
|
||||||
SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||||
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
{
|
{
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(MainWindowViewModel.dt_TP.Rows[i]));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(MainWindowViewModel.dt_TP.Rows[i]));//行插入
|
||||||
}
|
}
|
||||||
//数据插入
|
//数据插入
|
||||||
MainWindowViewModel.WorkNumder = SQLiteHelpers.ExecuteDataSet("select WorkOrder from Workorder where ProgramID = '" + workName + "'", null);;
|
MainWindowViewModel.WorkNumder = MainWindow.SQLiteHelpers.ExecuteDataSet("select WorkOrder from Workorder where ProgramID = '" + workName + "'", null);;
|
||||||
TechnologicalProcessView.workName = workName;
|
TechnologicalProcessView.workName = workName;
|
||||||
MainWindowViewModel.SYS_REDYE = 0;
|
MainWindowViewModel.SYS_REDYE = 0;
|
||||||
MainWindowViewModel.ViewID = 1;
|
MainWindowViewModel.ViewID = 1;
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Dyelot(DataTable Dyelot_)//领料单
|
public static bool Dyelot(DataTable Dyelot_)//领料单
|
||||||
@@ -127,19 +100,19 @@ namespace DyeingComputer.UserClass
|
|||||||
int a = DyelotTable.Rows.Count;
|
int a = DyelotTable.Rows.Count;
|
||||||
if (a < 1) return false;
|
if (a < 1) return false;
|
||||||
string Dyelot = DyelotTable.Rows[0][0].ToString();
|
string Dyelot = DyelotTable.Rows[0][0].ToString();
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
object n = SQLiteHelpers.ExecuteScalar("select * from Dyelot where Dyelot = " + Dyelot, null);
|
object n = MainWindow.SQLiteHelpers.ExecuteScalar("select * from Dyelot where Dyelot = " + Dyelot, null);
|
||||||
if (n != null)//如id存在着返回错误状态
|
if (n != null)//如id存在着返回错误状态
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
{
|
{
|
||||||
SQLiteHelpers.InsertData("Dyelot", SQLiteHelpers.ToDictionary(DyelotTable.Rows[i]));//行插入
|
MainWindow.SQLiteHelpers.InsertData("Dyelot", MainWindow.SQLiteHelpers.ToDictionary(DyelotTable.Rows[i]));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:DyeingComputer.View"
|
xmlns:local="clr-namespace:DyeingComputer.View"
|
||||||
xmlns:lang="clr-namespace:DyeingComputer.Properties"
|
xmlns:lang="clr-namespace:DyeingComputer.Properties"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="500" d:DesignWidth="800">
|
d:DesignHeight="500" d:DesignWidth="1200">
|
||||||
<Grid>
|
<Grid>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
|
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
@@ -17,8 +17,47 @@
|
|||||||
<TextBlock Name="RX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="5,0,0,0"/>
|
<TextBlock Name="RX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="5,0,0,0"/>
|
||||||
<TextBlock Name="TX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="200,0,0,0"/>
|
<TextBlock Name="TX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="200,0,0,0"/>
|
||||||
|
|
||||||
<Button Content="{x:Static lang:Resources.Shutdown}" x:Name="Shutdown" FontSize="20" HorizontalAlignment="Right" Height="40" Margin="0,0,10,10"
|
<DataGrid x:Name="_set" AutoGenerateColumns="False" FontSize="15" ColumnHeaderHeight="40" Width="600"
|
||||||
VerticalAlignment="Bottom" Width="200" Background="White" Click="Shutdown_Click"/>
|
HorizontalAlignment="Right" Margin="0,10,10,200" Background="{x:Null}" >
|
||||||
|
<DataGrid.RowStyle >
|
||||||
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Height" Value="30" />
|
||||||
|
<Setter Property="FontSize" Value="25" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||||
|
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||||
|
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="False"/>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinWidth" Value="20"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||||
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="Key" Binding="{Binding Key}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="Type" Binding="{Binding Value}" Width="200"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<TextBlock Text="SUNLIGHT 838 b0.0.1 (master 2025/03/18)" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="30" Width="600" Margin="0,0,10,160" FontSize="22"/>
|
||||||
|
<TextBlock x:Name="SocketIP" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="30" Width="600" Margin="0,0,10,130" FontSize="22"/>
|
||||||
|
|
||||||
|
<Button Content="{x:Static lang:Resources.Shutdown}" x:Name="Shutdown" FontSize="20" HorizontalAlignment="Right" Height="40" Margin="0,0,20,20"
|
||||||
|
VerticalAlignment="Bottom" Width="200" Background="White" Click="Shutdown_Click"/>
|
||||||
|
<Button Content="{x:Static lang:Resources.Quit}" x:Name="Quit" FontSize="20" HorizontalAlignment="Right" Height="40" Margin="0,0,300,20"
|
||||||
|
VerticalAlignment="Bottom" Width="200" Background="White" Click="Quit_Click"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -22,6 +25,7 @@ namespace DyeingComputer.View
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class EngineerSetView : UserControl
|
public partial class EngineerSetView : UserControl
|
||||||
{
|
{
|
||||||
|
int _S=0;
|
||||||
public EngineerSetView()
|
public EngineerSetView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -38,10 +42,33 @@ namespace DyeingComputer.View
|
|||||||
string[] Language = { "en-US", "zh-CN", "zh -TW" };
|
string[] Language = { "en-US", "zh-CN", "zh -TW" };
|
||||||
comboBoxLanguage.ItemsSource = Language;
|
comboBoxLanguage.ItemsSource = Language;
|
||||||
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
|
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
|
||||||
|
|
||||||
|
SocketIP.Text = "SocketIP:"+ GetLocalIPAddress()+"[7789][7799]";
|
||||||
}
|
}
|
||||||
//调用配置文件
|
//调用配置文件
|
||||||
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
|
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
|
||||||
|
|
||||||
|
public static string GetLocalIPAddress()
|
||||||
|
{
|
||||||
|
// 获取主机名和所有 IP 地址
|
||||||
|
var hostEntry = Dns.GetHostEntry(Dns.GetHostName());
|
||||||
|
|
||||||
|
// 优先尝试获取非内部、非虚拟网卡的 IPv4 地址(如以太网、Wi-Fi)
|
||||||
|
var ipAddress = hostEntry.AddressList
|
||||||
|
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork
|
||||||
|
&& !IPAddress.IsLoopback(ip)
|
||||||
|
&& ip.ToString().StartsWith("192.168")); // 示例:优先 192.168 网段
|
||||||
|
|
||||||
|
// 如果没找到优先的,则选择第一个非环回的 IPv4 地址
|
||||||
|
if (ipAddress == null)
|
||||||
|
{
|
||||||
|
ipAddress = hostEntry.AddressList
|
||||||
|
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork
|
||||||
|
&& !IPAddress.IsLoopback(ip));
|
||||||
|
}
|
||||||
|
// 如果还是没找到,返回环回地址或抛出异常
|
||||||
|
return ipAddress?.ToString() ?? "127.0.0.1";
|
||||||
|
}
|
||||||
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Configini.IniWritevalue("SYS", "COM", comboBoxCOM.SelectedValue.ToString());
|
Configini.IniWritevalue("SYS", "COM", comboBoxCOM.SelectedValue.ToString());
|
||||||
@@ -69,6 +96,29 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
RX.Text = MainWindowViewModel.RX.ToString();
|
RX.Text = MainWindowViewModel.RX.ToString();
|
||||||
TX.Text = MainWindowViewModel.TX.ToString();
|
TX.Text = MainWindowViewModel.TX.ToString();
|
||||||
|
|
||||||
|
_S++;
|
||||||
|
if (_S > 60)
|
||||||
|
{
|
||||||
|
_S = 0;
|
||||||
|
var displayData = MainWindowViewModel.Hardware.Select(kvp => new AdvancedDictionaryEntry
|
||||||
|
{
|
||||||
|
Key = kvp.Key,
|
||||||
|
Value = kvp.Value
|
||||||
|
}).ToList();
|
||||||
|
_set.ItemsSource = displayData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Quit_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.Quit, "800", MessageBoxButton.YesNo);
|
||||||
|
if (messageBoxResult == MessageBoxResult.No) return;
|
||||||
|
if (messageBoxResult == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
// Application.Current.Shutdown();
|
||||||
|
System.Environment.Exit(0);//退出
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Shutdown_Click(object sender, RoutedEventArgs e)
|
private void Shutdown_Click(object sender, RoutedEventArgs e)
|
||||||
@@ -78,8 +128,15 @@ namespace DyeingComputer.View
|
|||||||
if (messageBoxResult == MessageBoxResult.Yes)
|
if (messageBoxResult == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
// Application.Current.Shutdown();
|
// Application.Current.Shutdown();
|
||||||
System.Environment.Exit(0);//退出
|
//System.Environment.Exit(0);//退出
|
||||||
|
Process.Start("shutdown", "/s /t 10");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AdvancedDictionaryEntry
|
||||||
|
{
|
||||||
|
public string Key { get; set; }
|
||||||
|
public object Value { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -21,24 +22,375 @@ namespace DyeingComputer.View
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// EquipmentSimulationView.xaml 的交互逻辑
|
/// EquipmentSimulationView.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class EquipmentSimulationView : UserControl
|
public partial class EquipmentSimulationView : UserControl, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
if (PropertyChanged != null)
|
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
public void RaisePropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
if (PropertyChanged != null)
|
||||||
|
{
|
||||||
|
if (propertyName != null)
|
||||||
|
{
|
||||||
|
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public EquipmentSimulationView()
|
public EquipmentSimulationView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
DataContext = this;
|
||||||
CountDown();
|
CountDown();
|
||||||
|
IOdata();
|
||||||
|
}
|
||||||
|
bool _ID3007, _ID3008, _ID3009, _ID3010, _ID3011, _ID3013, _ID3014, _ID3015,
|
||||||
|
_ID3016, _ID3017, _ID3018, _ID3019, _ID3020, _ID3035, _ID3036, _ID3037,
|
||||||
|
_ID3038, _ID3039, _ID3040, _ID3041, _ID3042, _ID3043, _ID3044, _ID3045, _ID3046,
|
||||||
|
_ID3047, _ID3048, _ID3049, _ID3050, _ID3051, _ID3052, _ID3053,
|
||||||
|
_ID3054, _ID3076, _ID3077;
|
||||||
|
public bool ID3007
|
||||||
|
{
|
||||||
|
get => _ID3007;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3007 = value;
|
||||||
|
OnPropertyChanged("ID3007");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3008
|
||||||
|
{
|
||||||
|
get => _ID3008;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3008 = value;
|
||||||
|
OnPropertyChanged("ID3008");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3009
|
||||||
|
{
|
||||||
|
get => _ID3009;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3009 = value;
|
||||||
|
OnPropertyChanged("ID3009");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3010
|
||||||
|
{
|
||||||
|
get => _ID3010;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3010 = value;
|
||||||
|
OnPropertyChanged("ID3010");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3011
|
||||||
|
{
|
||||||
|
get => _ID3011;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3011 = value;
|
||||||
|
OnPropertyChanged("ID3011");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3013
|
||||||
|
{
|
||||||
|
get => _ID3013;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3013 = value;
|
||||||
|
OnPropertyChanged("ID3013");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3014
|
||||||
|
{
|
||||||
|
get => _ID3014;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3014 = value;
|
||||||
|
OnPropertyChanged("ID3014");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3015
|
||||||
|
{
|
||||||
|
get => _ID3015;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3015 = value;
|
||||||
|
OnPropertyChanged("ID3015");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3016
|
||||||
|
{
|
||||||
|
get => _ID3016;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3016 = value;
|
||||||
|
OnPropertyChanged("ID3016");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3017
|
||||||
|
{
|
||||||
|
get => _ID3017;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3017 = value;
|
||||||
|
OnPropertyChanged("ID3017");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3018
|
||||||
|
{
|
||||||
|
get => _ID3018;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3018 = value;
|
||||||
|
OnPropertyChanged("ID3018");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3019
|
||||||
|
{
|
||||||
|
get => _ID3019;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3019 = value;
|
||||||
|
OnPropertyChanged("ID3019");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3020
|
||||||
|
{
|
||||||
|
get => _ID3020;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3020 = value;
|
||||||
|
OnPropertyChanged("ID3020");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3035
|
||||||
|
{
|
||||||
|
get => _ID3035;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3035 = value;
|
||||||
|
OnPropertyChanged("ID3035");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3036
|
||||||
|
{
|
||||||
|
get => _ID3036;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3036 = value;
|
||||||
|
OnPropertyChanged("ID3036");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3037
|
||||||
|
{
|
||||||
|
get => _ID3037;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3037 = value;
|
||||||
|
OnPropertyChanged("ID3037");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3038
|
||||||
|
{
|
||||||
|
get => _ID3038;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3038 = value;
|
||||||
|
OnPropertyChanged("ID3038");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3039
|
||||||
|
{
|
||||||
|
get => _ID3039;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3039 = value;
|
||||||
|
OnPropertyChanged("ID3039");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3040
|
||||||
|
{
|
||||||
|
get => _ID3040;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3040 = value;
|
||||||
|
OnPropertyChanged("ID3040");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3041
|
||||||
|
{
|
||||||
|
get => _ID3041;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3041 = value;
|
||||||
|
OnPropertyChanged("ID3041");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3042
|
||||||
|
{
|
||||||
|
get => _ID3042;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3042 = value;
|
||||||
|
OnPropertyChanged("ID3042");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3043
|
||||||
|
{
|
||||||
|
get => _ID3043;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3043 = value;
|
||||||
|
OnPropertyChanged("ID3043");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3044
|
||||||
|
{
|
||||||
|
get => _ID3044;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3044 = value;
|
||||||
|
OnPropertyChanged("ID3044");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3045
|
||||||
|
{
|
||||||
|
get => _ID3045;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3045 = value;
|
||||||
|
OnPropertyChanged("ID3045");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3046
|
||||||
|
{
|
||||||
|
get => _ID3046;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3046 = value;
|
||||||
|
OnPropertyChanged("ID3046");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3047
|
||||||
|
{
|
||||||
|
get => _ID3047;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3047 = value;
|
||||||
|
OnPropertyChanged("ID3047");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3048
|
||||||
|
{
|
||||||
|
get => _ID3048;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3048 = value;
|
||||||
|
OnPropertyChanged("ID3048");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3049
|
||||||
|
{
|
||||||
|
get => _ID3049;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3049 = value;
|
||||||
|
OnPropertyChanged("ID3049");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3050
|
||||||
|
{
|
||||||
|
get => _ID3050;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3050 = value;
|
||||||
|
OnPropertyChanged("ID3050");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3051
|
||||||
|
{
|
||||||
|
get => _ID3051;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3051 = value;
|
||||||
|
OnPropertyChanged("ID3051");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3052
|
||||||
|
{
|
||||||
|
get => _ID3052;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3052 = value;
|
||||||
|
OnPropertyChanged("ID3052");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3053
|
||||||
|
{
|
||||||
|
get => _ID3053;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3053 = value;
|
||||||
|
OnPropertyChanged("ID3053");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3054
|
||||||
|
{
|
||||||
|
get => _ID3054;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3054 = value;
|
||||||
|
OnPropertyChanged("ID3054");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3076
|
||||||
|
{
|
||||||
|
get => _ID3076;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3076 = value;
|
||||||
|
OnPropertyChanged("ID3076");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool ID3077
|
||||||
|
{
|
||||||
|
get => _ID3077;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ID3077 = value;
|
||||||
|
OnPropertyChanged("ID3077");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindowViewModel.MT20 == 1)
|
||||||
|
{
|
||||||
|
MP1.Visibility = Visibility.Collapsed;
|
||||||
|
MPF1.Visibility = Visibility.Collapsed;
|
||||||
|
MP2.Visibility = Visibility.Collapsed;
|
||||||
|
MPF2.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else if (MainWindowViewModel.MT20 == 2)
|
||||||
|
{
|
||||||
|
MP2.Visibility = Visibility.Collapsed;
|
||||||
|
MPF2.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
CountDown();
|
||||||
|
IOdata();
|
||||||
|
}
|
||||||
|
|
||||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||||
{
|
{
|
||||||
M_T.Text = string.Format(" {0:###.#}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1010"))) + "°C";//主缸温度
|
IOdata();
|
||||||
M_L.Text = string.Format("{0:D4}", Convert.ToInt16(MainWindowViewModel.Selet_dtm("1015"))) + "L";//主缸水
|
|
||||||
if (MainWindowViewModel.Selet_dtd("3023") || MainWindowViewModel.Selet_dtd("3024"))//摆动显示
|
|
||||||
{ Swing_.Visibility = Visibility.Visible; }
|
|
||||||
else { Swing_.Visibility = Visibility.Collapsed; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CountDown()
|
public void CountDown()
|
||||||
{
|
{
|
||||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
||||||
@@ -48,5 +400,259 @@ namespace DyeingComputer.View
|
|||||||
timer1s.Tick += Tick_Event_1S;
|
timer1s.Tick += Tick_Event_1S;
|
||||||
timer1s.Start();
|
timer1s.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void M_D1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.Updata_dtm("1020",Convert.ToInt16( M_D1.Value));
|
||||||
|
}
|
||||||
|
private void S1_D2_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.Updata_dta("5005", Convert.ToInt16(S1_D2.Value * 10));
|
||||||
|
SL1.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5005")) / 1000);//
|
||||||
|
}
|
||||||
|
private void S2_D3_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.Updata_dta("5006", Convert.ToInt16(S2_D3.Value * 10));
|
||||||
|
SL2.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5006"))/ 1000);//
|
||||||
|
}
|
||||||
|
private void ID3007_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3007 = !ID3007;
|
||||||
|
MainWindowViewModel.Updata_dtd("3007", ID3007);
|
||||||
|
}
|
||||||
|
private void ID3008_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3008 = !ID3008;
|
||||||
|
MainWindowViewModel.Updata_dtd("3008", ID3008);
|
||||||
|
}
|
||||||
|
private void ID3009_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3009 = !ID3009;
|
||||||
|
MainWindowViewModel.Updata_dtd("3009", ID3009);
|
||||||
|
}
|
||||||
|
private void ID3010_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3010 = !ID3010;
|
||||||
|
MainWindowViewModel.Updata_dtd("3010", ID3010);
|
||||||
|
}
|
||||||
|
private void ID3011_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3011 = !ID3011;
|
||||||
|
MainWindowViewModel.Updata_dtd("3011", ID3011);
|
||||||
|
}
|
||||||
|
private void ID3013_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3013 = !ID3013;
|
||||||
|
MainWindowViewModel.Updata_dtd("3013", ID3013);
|
||||||
|
}
|
||||||
|
private void ID3014_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3014 = !ID3014;
|
||||||
|
MainWindowViewModel.Updata_dtd("3014", ID3014);
|
||||||
|
}
|
||||||
|
private void ID3015_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3015 = !ID3015;
|
||||||
|
MainWindowViewModel.Updata_dtd("3015", ID3015);
|
||||||
|
}
|
||||||
|
private void ID3016_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3016 = !ID3016;
|
||||||
|
MainWindowViewModel.Updata_dtd("3016", ID3016);
|
||||||
|
}
|
||||||
|
private void ID3017_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3017 = !ID3017;
|
||||||
|
MainWindowViewModel.Updata_dtd("3017", ID3017);
|
||||||
|
}
|
||||||
|
private void ID3018_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3018 = !ID3018;
|
||||||
|
MainWindowViewModel.Updata_dtd("3018", ID3018);
|
||||||
|
}
|
||||||
|
private void ID3019_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3019 = !ID3019;
|
||||||
|
MainWindowViewModel.Updata_dtd("3019", ID3019);
|
||||||
|
}
|
||||||
|
private void ID3020_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3020 = !ID3020;
|
||||||
|
MainWindowViewModel.Updata_dtd("3020", ID3020);
|
||||||
|
}
|
||||||
|
private void ID3035_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3035 = !ID3035;
|
||||||
|
MainWindowViewModel.Updata_dtd("3035", ID3035);
|
||||||
|
}
|
||||||
|
private void ID3036_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3036 = !ID3036;
|
||||||
|
MainWindowViewModel.Updata_dtd("3036", ID3036);
|
||||||
|
}
|
||||||
|
private void ID3037_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3037 = !ID3037;
|
||||||
|
MainWindowViewModel.Updata_dtd("3037", ID3037);
|
||||||
|
}
|
||||||
|
private void ID3038_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3038 = !ID3038;
|
||||||
|
MainWindowViewModel.Updata_dtd("3038", ID3038);
|
||||||
|
}
|
||||||
|
private void ID3039_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3039 = !ID3039;
|
||||||
|
MainWindowViewModel.Updata_dtd("3039", ID3039);
|
||||||
|
}
|
||||||
|
private void ID3040_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3040 = !ID3040;
|
||||||
|
MainWindowViewModel.Updata_dtd("3040", ID3040);
|
||||||
|
}
|
||||||
|
private void ID3041_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3041 = !ID3041;
|
||||||
|
MainWindowViewModel.Updata_dtd("3041", ID3041);
|
||||||
|
}
|
||||||
|
private void ID3042_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3042 = !ID3042;
|
||||||
|
MainWindowViewModel.Updata_dtd("3042", ID3042);
|
||||||
|
}
|
||||||
|
private void ID3043_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3043 = !ID3043;
|
||||||
|
MainWindowViewModel.Updata_dtd("3043", ID3043);
|
||||||
|
}
|
||||||
|
private void ID3044_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3044 = !ID3044;
|
||||||
|
MainWindowViewModel.Updata_dtd("3044", ID3044);
|
||||||
|
}
|
||||||
|
private void ID3045_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3045 = !ID3045;
|
||||||
|
MainWindowViewModel.Updata_dtd("3045", ID3045);
|
||||||
|
}
|
||||||
|
private void ID3046_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3046 = !ID3046;
|
||||||
|
MainWindowViewModel.Updata_dtd("3046", ID3046);
|
||||||
|
}
|
||||||
|
private void ID3047_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3047 = !ID3047;
|
||||||
|
MainWindowViewModel.Updata_dtd("3047", ID3047);
|
||||||
|
}
|
||||||
|
private void ID3048_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3048 = !ID3048;
|
||||||
|
MainWindowViewModel.Updata_dtd("3048", ID3048);
|
||||||
|
}
|
||||||
|
private void ID3049_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3049 = !ID3049;
|
||||||
|
MainWindowViewModel.Updata_dtd("3049", ID3049);
|
||||||
|
}
|
||||||
|
private void ID3050_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3050 = !ID3050;
|
||||||
|
MainWindowViewModel.Updata_dtd("3050", ID3050);
|
||||||
|
}
|
||||||
|
private void ID3051_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3051 = !ID3051;
|
||||||
|
MainWindowViewModel.Updata_dtd("3051", ID3051);
|
||||||
|
}
|
||||||
|
private void ID3052_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3052 = !ID3052;
|
||||||
|
MainWindowViewModel.Updata_dtd("3052", ID3052);
|
||||||
|
}
|
||||||
|
private void ID3053_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3053 = !ID3053;
|
||||||
|
MainWindowViewModel.Updata_dtd("3053", ID3053);
|
||||||
|
}
|
||||||
|
private void ID3054_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3054 = !ID3054;
|
||||||
|
MainWindowViewModel.Updata_dtd("3054", ID3054);
|
||||||
|
}
|
||||||
|
private void ID3076_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3076 = !ID3076;
|
||||||
|
MainWindowViewModel.Updata_dtd("3076", ID3076);
|
||||||
|
}
|
||||||
|
private void ID3077_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
ID3077 = !ID3077;
|
||||||
|
MainWindowViewModel.Updata_dtd("3077", ID3077);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void IOdata()
|
||||||
|
{
|
||||||
|
M_T.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1010"))) + "°C";//主缸温度
|
||||||
|
M_L.Text = string.Format("{0:D4}", Convert.ToInt16(MainWindowViewModel.Selet_dtm("1015"))) + "L";//主缸水
|
||||||
|
S1_T.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1012"))) + "°C";//缸1温度
|
||||||
|
S1_L.Text = string.Format("{0:D4}", Convert.ToInt16(MainWindowViewModel.Selet_dtm("1017"))) + "L";//缸1水
|
||||||
|
S2_T.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1013"))) + "°C";//缸2温度
|
||||||
|
S2_L.Text = string.Format("{0:D4}", Convert.ToInt16(MainWindowViewModel.Selet_dtm("1018"))) + "L";//缸2水
|
||||||
|
MtH.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5001"))/1000);//升温
|
||||||
|
Mtl.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5002"))/1000);//降温
|
||||||
|
SL1.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5005")) / 1000);//
|
||||||
|
SL2.Text = string.Format(" {0:P1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("5006")) / 1000);//
|
||||||
|
M1031.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1031")))+"bar";//
|
||||||
|
M1032.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1032"))) + "bar";//
|
||||||
|
M1033.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1033"))) + "bar";//
|
||||||
|
M1034.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1034"))) + "L";//
|
||||||
|
A4006.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("4006"))) + "L";//
|
||||||
|
A4014.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("4014"))) + "L";//
|
||||||
|
A4015.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("4015"))) + "L";//
|
||||||
|
A4016.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("4016"))) + "Kw";//
|
||||||
|
A4029.Text = string.Format(" {0:F1}", Convert.ToDouble(MainWindowViewModel.Selet_dta("4029"))) + "pH";//
|
||||||
|
|
||||||
|
M_D1.Value = Convert.ToDouble(MainWindowViewModel.Selet_dta("5003"));//
|
||||||
|
S1_D2.Value = Convert.ToDouble(MainWindowViewModel.Selet_dta("5005")) / 10;//
|
||||||
|
S2_D3.Value = Convert.ToDouble(MainWindowViewModel.Selet_dta("5006")) / 10;//
|
||||||
|
|
||||||
|
ID3007 = MainWindowViewModel.Selet_dtd("3007");
|
||||||
|
ID3008 = MainWindowViewModel.Selet_dtd("3008");
|
||||||
|
ID3009 = MainWindowViewModel.Selet_dtd("3009");
|
||||||
|
ID3010 = MainWindowViewModel.Selet_dtd("3010");
|
||||||
|
ID3011 = MainWindowViewModel.Selet_dtd("3011");
|
||||||
|
ID3013 = MainWindowViewModel.Selet_dtd("3013");
|
||||||
|
ID3014 = MainWindowViewModel.Selet_dtd("3014");
|
||||||
|
ID3015 = MainWindowViewModel.Selet_dtd("3015");
|
||||||
|
ID3016 = MainWindowViewModel.Selet_dtd("3016");
|
||||||
|
ID3017 = MainWindowViewModel.Selet_dtd("3017");
|
||||||
|
ID3018 = MainWindowViewModel.Selet_dtd("3018");
|
||||||
|
ID3019 = MainWindowViewModel.Selet_dtd("3019");
|
||||||
|
ID3020 = MainWindowViewModel.Selet_dtd("3020");
|
||||||
|
ID3035 = MainWindowViewModel.Selet_dtd("3035");
|
||||||
|
ID3036 = MainWindowViewModel.Selet_dtd("3036");
|
||||||
|
ID3037 = MainWindowViewModel.Selet_dtd("3037");
|
||||||
|
ID3038 = MainWindowViewModel.Selet_dtd("3038");
|
||||||
|
ID3039 = MainWindowViewModel.Selet_dtd("3039");
|
||||||
|
ID3040 = MainWindowViewModel.Selet_dtd("3040");
|
||||||
|
ID3041 = MainWindowViewModel.Selet_dtd("3041");
|
||||||
|
ID3042 = MainWindowViewModel.Selet_dtd("3042");
|
||||||
|
ID3043 = MainWindowViewModel.Selet_dtd("3043");
|
||||||
|
ID3044 = MainWindowViewModel.Selet_dtd("3044");
|
||||||
|
ID3045 = MainWindowViewModel.Selet_dtd("3045");
|
||||||
|
ID3046 = MainWindowViewModel.Selet_dtd("3046");
|
||||||
|
ID3047 = MainWindowViewModel.Selet_dtd("3047");
|
||||||
|
ID3048 = MainWindowViewModel.Selet_dtd("3048");
|
||||||
|
ID3049 = MainWindowViewModel.Selet_dtd("3049");
|
||||||
|
ID3050 = MainWindowViewModel.Selet_dtd("3050");
|
||||||
|
ID3051 = MainWindowViewModel.Selet_dtd("3051");
|
||||||
|
ID3052 = MainWindowViewModel.Selet_dtd("3052");
|
||||||
|
ID3053 = MainWindowViewModel.Selet_dtd("3053");
|
||||||
|
ID3054 = MainWindowViewModel.Selet_dtd("3054");
|
||||||
|
ID3076 = MainWindowViewModel.Selet_dtd("3076");
|
||||||
|
ID3077 = MainWindowViewModel.Selet_dtd("3077");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,18 +26,18 @@ namespace DyeingComputer.View
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class HistoryRecordsView : UserControl
|
public partial class HistoryRecordsView : UserControl
|
||||||
{
|
{
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataTable GRIDDB = new DataTable();
|
DataTable GRIDDB = new DataTable();
|
||||||
public HistoryRecordsView()
|
public HistoryRecordsView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = new HistoryRecordsViewModel();
|
DataContext = new HistoryRecordsViewModel();
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
GRIDDB = SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime > '" + DateTime.Now.AddDays(-30).ToString("yyyy/MM/dd HH:mm:ss") + "order by StartTime'", null).Tables[0];
|
GRIDDB = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from WorkOrder where StartTime > '" + DateTime.Now.AddDays(-30).ToString("yyyy/MM/dd HH:mm:ss") + "order by StartTime'", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
|
|
||||||
gridH.ItemsSource = GRIDDB.DefaultView;
|
gridH.ItemsSource = GRIDDB.DefaultView;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
<ColumnDefinition/>
|
<ColumnDefinition/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DataGrid x:Name="Grid_D" AlternationCount="2" SelectionChanged="Grid_D_SelectionChanged"
|
<DataGrid x:Name="Grid_D" AlternationCount="2" SelectionChanged="Grid_D_SelectionChanged" PreparingCellForEdit="Grid_D_PreparingCellForEdit"
|
||||||
CellEditEnding="Grid_D_CellEditEnding" BeginningEdit="Grid_D_BeginningEdit" d:ItemsSource="{d:SampleData ItemCount=512}"
|
CellEditEnding="Grid_D_CellEditEnding" BeginningEdit="Grid_D_BeginningEdit" d:ItemsSource="{d:SampleData ItemCount=512}"
|
||||||
Margin="0,0,0,0" ItemsSource="{Binding Path=SYSData_D,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" MinColumnWidth="30"
|
Margin="0,0,0,0" ItemsSource="{Binding Path=SYSData_D,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
</DataGridTextColumn>
|
</DataGridTextColumn>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<DataGrid x:Name="Grid_A" AlternationCount="2" SelectionChanged="Grid_A_SelectionChanged"
|
<DataGrid x:Name="Grid_A" AlternationCount="2" SelectionChanged="Grid_A_SelectionChanged" PreparingCellForEdit="Grid_A_PreparingCellForEdit"
|
||||||
CellEditEnding="Grid_A_CellEditEnding" BeginningEdit="Grid_A_BeginningEdit" d:ItemsSource="{d:SampleData ItemCount=256}"
|
CellEditEnding="Grid_A_CellEditEnding" BeginningEdit="Grid_A_BeginningEdit" d:ItemsSource="{d:SampleData ItemCount=256}"
|
||||||
Margin="0,0,0,0" ItemsSource="{Binding Path=SYSData_A,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" MinColumnWidth="30"
|
Margin="0,0,0,0" ItemsSource="{Binding Path=SYSData_A,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.KEY;
|
||||||
|
using DyeingComputer.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -28,75 +30,146 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
string ID;
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
private TextBox currentTextBox;
|
||||||
|
private TouchKeyboardNumeral numeralKeyboard;
|
||||||
|
// private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
|
||||||
private void Grid_D_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Grid_D_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Grid_A_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Grid_M_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void Grid_D_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
|
||||||
{
|
|
||||||
string ID;
|
|
||||||
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
|
||||||
|
|
||||||
int rownum = Grid_D.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_D.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
ID = (Grid_D.Columns[0].GetCellContent(Grid_D.Items[rownum]) as TextBlock).Text;//定位第0列,
|
ID = (Grid_D.Columns[0].GetCellContent(Grid_D.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
|
||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
|
||||||
datagrid_v.Add("PLC", newValue);
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
|
||||||
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
|
||||||
}
|
}
|
||||||
MainWindowViewModel.SQL_data();//重新获得io表
|
}
|
||||||
MainWindowViewModel.D_view = true;
|
private void Grid_A_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
int rownum = Grid_A.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
ID = (Grid_A.Columns[0].GetCellContent(Grid_A.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Grid_M_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_D_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
private void Grid_D_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
{
|
{
|
||||||
MainWindowViewModel.D_view = false;
|
MainWindowViewModel.D_view = false;
|
||||||
}
|
}
|
||||||
|
private void Grid_D_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||||
private void Grid_A_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
{
|
||||||
|
currentTextBox = e.EditingElement as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void Grid_D_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
string ID;
|
|
||||||
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
if (newValue.Count() == 4)
|
||||||
int rownum = Grid_A.SelectedIndex;//获取鼠标选中行并定义变量
|
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
|
||||||
{
|
{
|
||||||
ID = (Grid_A.Columns[0].GetCellContent(Grid_A.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
||||||
|
|
||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
datagrid_v.Add("PLC", newValue);
|
datagrid_v.Add("PLC", newValue);
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
MainWindow.SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
}
|
}
|
||||||
MainWindowViewModel.SQL_data();//重新获得io表
|
MainWindowViewModel.SQL_data();//重新获得io表
|
||||||
MainWindowViewModel.A_view = true;
|
MainWindowViewModel.D_view = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_A_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
private void Grid_A_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
{
|
{
|
||||||
MainWindowViewModel.A_view = false;
|
MainWindowViewModel.A_view = false;
|
||||||
}
|
}
|
||||||
|
private void Grid_A_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = e.EditingElement as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void Grid_A_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
if (newValue.Count() == 4)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
|
datagrid_v.Add("PLC", newValue);
|
||||||
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
|
MainWindow.SQLiteHelpers.Update("IOName", datagrid_v, "ID ='" + ID + "'", null);//更新
|
||||||
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
|
}
|
||||||
|
MainWindowViewModel.SQL_data();//重新获得io表
|
||||||
|
MainWindowViewModel.A_view = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新键盘位置
|
||||||
|
private void UpdateKeyboardPosition()
|
||||||
|
{
|
||||||
|
if (numeralKeyboard == null) return;
|
||||||
|
|
||||||
|
// 获取主窗口的位置
|
||||||
|
var mainWindowWidth = this.Width;
|
||||||
|
var mainWindowHeight = this.Height;
|
||||||
|
|
||||||
|
// 计算键盘位置(主窗口底部中央)
|
||||||
|
numeralKeyboard.Left = (mainWindowWidth - numeralKeyboard.Width) / 2;
|
||||||
|
numeralKeyboard.Top = mainWindowHeight / 2;
|
||||||
|
}
|
||||||
|
// 键盘按键事件处理
|
||||||
|
private void NumeralKeyboard_KeyPressed(object sender, TouchKeyboardNumeral.KeyPressedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.KeyType)
|
||||||
|
{
|
||||||
|
/* case KeyType.Character:
|
||||||
|
currentTextBox.Text += e.KeyValue;
|
||||||
|
break;
|
||||||
|
case KeyType.Backspace:
|
||||||
|
if (currentTextBox.Text.Length > 0)
|
||||||
|
{
|
||||||
|
currentTextBox.Text = currentTextBox.Text.Substring(0, currentTextBox.Text.Length - 1);
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
|
case KeyType.Enter:
|
||||||
|
// 回车键处理
|
||||||
|
if (!String.IsNullOrEmpty(e.KeyValue))
|
||||||
|
{
|
||||||
|
currentTextBox.Text = e.KeyValue;
|
||||||
|
}
|
||||||
|
numeralKeyboard.Close();
|
||||||
|
break;
|
||||||
|
case KeyType.Hide:
|
||||||
|
// 隐藏键盘处理
|
||||||
|
numeralKeyboard.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Grid_D.CommitEdit();
|
||||||
|
|
||||||
|
Grid_A.CommitEdit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
||||||
CellEditEnding="Grid_CellEditEnding" Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting"
|
||||||
|
CellEditEnding="Grid_CellEditEnding" PreparingCellForEdit="Grid_PreparingCellForEdit"
|
||||||
|
SelectionChanged="Grid_SelectionChanged">
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.KEY;
|
||||||
|
using DyeingComputer.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -29,43 +30,40 @@ namespace DyeingComputer.View
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ParameterSetView : UserControl
|
public partial class ParameterSetView : UserControl
|
||||||
{
|
{
|
||||||
|
private TextBox currentTextBox;
|
||||||
|
string ID;
|
||||||
|
private TouchKeyboard Keyboard;
|
||||||
public ParameterSetView()
|
public ParameterSetView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
set_sql();
|
set_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
//private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
|
||||||
public void set_sql()
|
public void set_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
MainWindowViewModel.dt_ParameterSet = SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
MainWindowViewModel.dt_ParameterSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
||||||
if (MainWindowViewModel.dt_ParameterSet.Rows.Count>0) Grid.ItemsSource = MainWindowViewModel.dt_ParameterSet.DefaultView; //转换显示计划表
|
if (MainWindowViewModel.dt_ParameterSet.Rows.Count>0) Grid.ItemsSource = MainWindowViewModel.dt_ParameterSet.DefaultView; //转换显示计划表
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)//数据表输入事件
|
private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)//数据表输入事件
|
||||||
{
|
{
|
||||||
string ID;
|
|
||||||
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
|
||||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
|
||||||
{
|
|
||||||
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
||||||
|
|
||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
datagrid_v.Add("Value", newValue);
|
datagrid_v.Add("Value", newValue);
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("Parameters", datagrid_v, "ParameterID ='" + ID + "'", null);//更新
|
MainWindow.SQLiteHelpers.Update("Parameters", datagrid_v, "ParameterID ='" + ID + "'", null);//更新
|
||||||
MainWindowViewModel.dt_ParameterSet = SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
MainWindowViewModel.dt_ParameterSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Parameters order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
}
|
|
||||||
MainWindowViewModel.set_ = true;
|
MainWindowViewModel.set_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,5 +94,74 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void Grid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = e.EditingElement as TextBox;
|
||||||
|
if (Keyboard == null)
|
||||||
|
{
|
||||||
|
Keyboard = new TouchKeyboard();
|
||||||
|
Keyboard.KeyPressed += Keyboard_KeyPressed;
|
||||||
|
Keyboard.Closed += (s, args) => { Keyboard = null; };
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
Keyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 更新键盘位置
|
||||||
|
private void UpdateKeyboardPosition()
|
||||||
|
{
|
||||||
|
if (Keyboard == null) return;
|
||||||
|
|
||||||
|
// 获取主窗口的位置
|
||||||
|
var mainWindowWidth = this.Width;
|
||||||
|
var mainWindowHeight = this.Height;
|
||||||
|
|
||||||
|
// 计算键盘位置(主窗口底部中央)
|
||||||
|
Keyboard.Left = (mainWindowWidth - Keyboard.Width) / 2;
|
||||||
|
Keyboard.Top = mainWindowHeight - (Keyboard.Height+50);
|
||||||
|
}
|
||||||
|
// 键盘按键事件处理
|
||||||
|
private void Keyboard_KeyPressed(object sender, TouchKeyboard.KeyPressedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.KeyType)
|
||||||
|
{
|
||||||
|
/* case KeyType.Character:
|
||||||
|
currentTextBox.Text += e.KeyValue;
|
||||||
|
break;
|
||||||
|
case KeyType.Backspace:
|
||||||
|
if (currentTextBox.Text.Length > 0)
|
||||||
|
{
|
||||||
|
currentTextBox.Text = currentTextBox.Text.Substring(0, currentTextBox.Text.Length - 1);
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
|
case KeyType.Enter:
|
||||||
|
// 回车键处理
|
||||||
|
if (!String.IsNullOrEmpty(e.KeyValue))
|
||||||
|
{
|
||||||
|
currentTextBox.Text = e.KeyValue;
|
||||||
|
}
|
||||||
|
Keyboard.Close();
|
||||||
|
break;
|
||||||
|
case KeyType.Hide:
|
||||||
|
// 隐藏键盘处理
|
||||||
|
Keyboard.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Grid.CommitEdit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,22 +32,22 @@ namespace DyeingComputer.View
|
|||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
//private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
|
|
||||||
public void Programgroup_sql()
|
public void Programgroup_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
string sql_script = "select * from ProgramName order by ProgramID desc";
|
string sql_script = "select * from ProgramName order by ProgramID desc";
|
||||||
|
|
||||||
if (sql != null) sql.Clear(); //清空缓存
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
sql = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
//sql.Clear(); //清除缓存
|
//sql.Clear(); //清除缓存
|
||||||
//System.GC.Collect();
|
//System.GC.Collect();
|
||||||
@@ -84,10 +84,10 @@ namespace DyeingComputer.View
|
|||||||
Program_new.Add("Time", "0:00");
|
Program_new.Add("Time", "0:00");
|
||||||
Program_new.Add("Notes", null);
|
Program_new.Add("Notes", null);
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
|
MainWindow.SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
Programgroup_Numder = VALUE;
|
Programgroup_Numder = VALUE;
|
||||||
Programgroup_ID = ID;
|
Programgroup_ID = ID;
|
||||||
@@ -103,10 +103,10 @@ namespace DyeingComputer.View
|
|||||||
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
||||||
{
|
{
|
||||||
///执行删除
|
///执行删除
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("ProgramName", "ProgramID='" + Programgroup_ID + "'", null);
|
MainWindow.SQLiteHelpers.Delete("ProgramName", "ProgramID='" + Programgroup_ID + "'", null);
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
}
|
}
|
||||||
Programgroup_Numder = null;
|
Programgroup_Numder = null;
|
||||||
@@ -129,10 +129,10 @@ namespace DyeingComputer.View
|
|||||||
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
|
||||||
Program_Rename.Add("ProgramName", VALUE);
|
Program_Rename.Add("ProgramName", VALUE);
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='"+ Programgroup_ID + "'",null);
|
MainWindow.SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='"+ Programgroup_ID + "'",null);
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
Programgroup_Numder = null;
|
Programgroup_Numder = null;
|
||||||
@@ -155,10 +155,10 @@ namespace DyeingComputer.View
|
|||||||
Dictionary<string, object> Program_Remark = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Program_Remark = new Dictionary<string, object>();//缓存函数
|
||||||
Program_Remark.Add("Notes", VALUE);
|
Program_Remark.Add("Notes", VALUE);
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("ProgramName", Program_Remark, "ProgramID='" + Programgroup_ID + "'", null);
|
MainWindow.SQLiteHelpers.Update("ProgramName", Program_Remark, "ProgramID='" + Programgroup_ID + "'", null);
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
Programgroup_Numder = null;
|
Programgroup_Numder = null;
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace DyeingComputer.View
|
|||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
//private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
|
|
||||||
string ProgramID;
|
string ProgramID;
|
||||||
@@ -54,13 +54,13 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
public void Programgroup_sql()
|
public void Programgroup_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc";
|
string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc";
|
||||||
|
|
||||||
if (sql != null) sql.Clear(); //清空缓存
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
sql = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
//sql.Tables[0].Rows.Add(datatable_t);
|
//sql.Tables[0].Rows.Add(datatable_t);
|
||||||
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
||||||
dr["ProgramID"] = ProgramID;
|
dr["ProgramID"] = ProgramID;
|
||||||
@@ -68,7 +68,7 @@ namespace DyeingComputer.View
|
|||||||
sql.Tables[0].Rows.Add(dr);
|
sql.Tables[0].Rows.Add(dr);
|
||||||
Dat();
|
Dat();
|
||||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
//sql.Clear(); //清除缓存
|
//sql.Clear(); //清除缓存
|
||||||
//System.GC.Collect();
|
//System.GC.Collect();
|
||||||
@@ -158,10 +158,10 @@ namespace DyeingComputer.View
|
|||||||
dr["StepName"] = e.StepNAME;
|
dr["StepName"] = e.StepNAME;
|
||||||
dr["ParameterName"] = e.PNAME;
|
dr["ParameterName"] = e.PNAME;
|
||||||
dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
||||||
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
|
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter2");
|
||||||
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
|
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter3");
|
||||||
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
|
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter4");
|
||||||
dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
|
dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter5");
|
||||||
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
|
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
|
||||||
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
|
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
|
||||||
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
|
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
|
||||||
@@ -258,9 +258,9 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
|
MainWindow.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
|
||||||
|
|
||||||
DataTable data_t = new DataTable();
|
DataTable data_t = new DataTable();
|
||||||
data_t = sql.Tables[0].Clone();
|
data_t = sql.Tables[0].Clone();
|
||||||
@@ -275,14 +275,14 @@ namespace DyeingComputer.View
|
|||||||
dr.ItemArray = dt.ItemArray;
|
dr.ItemArray = dt.ItemArray;
|
||||||
data_t.Rows.InsertAt(dr, 0);
|
data_t.Rows.InsertAt(dr, 0);
|
||||||
|
|
||||||
r = SQLiteHelpers.InsertData("ProgramSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
r = MainWindow.SQLiteHelpers.InsertData("ProgramSteps", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
|
||||||
Program_Step.Add("Step", a-1);
|
Program_Step.Add("Step", a-1);
|
||||||
SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null);
|
MainWindow.SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null);
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show(ProgramNAME, Properties.Resources.Save);
|
System.Windows.Forms.MessageBox.Show(ProgramNAME, Properties.Resources.Save);
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
||||||
CellEditEnding="Grid_CellEditEnding" Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
CellEditEnding="Grid_CellEditEnding" SelectionChanged="Grid_SelectionChanged" PreparingCellForEdit="Grid_PreparingCellForEdit"
|
||||||
|
Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DyeingComputer.ViewModel;
|
using DyeingComputer.KEY;
|
||||||
|
using DyeingComputer.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -24,43 +25,39 @@ namespace DyeingComputer.View
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SysSetView : UserControl
|
public partial class SysSetView : UserControl
|
||||||
{
|
{
|
||||||
|
private TextBox currentTextBox;
|
||||||
|
string ID;
|
||||||
|
private TouchKeyboard Keyboard;
|
||||||
public SysSetView()
|
public SysSetView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
set_sql();
|
set_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
//private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
|
|
||||||
public void set_sql()
|
public void set_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
MainWindowViewModel.dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
MainWindowViewModel.dt_SysSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0]; //读取计划表写入缓存
|
||||||
if (MainWindowViewModel.dt_SysSet.Rows.Count>0) Grid.ItemsSource = MainWindowViewModel.dt_SysSet.DefaultView; //转换显示计划表
|
if (MainWindowViewModel.dt_SysSet.Rows.Count>0) Grid.ItemsSource = MainWindowViewModel.dt_SysSet.DefaultView; //转换显示计划表
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)//数据表输入事件
|
private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)//数据表输入事件
|
||||||
{
|
{
|
||||||
string ID;
|
|
||||||
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
|
||||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
|
||||||
{
|
|
||||||
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
||||||
|
|
||||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
datagrid_v.Add("Value", newValue);
|
datagrid_v.Add("Value", newValue);
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + ID + "'", null);//更新
|
MainWindow.SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + ID + "'", null);//更新
|
||||||
MainWindowViewModel.dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
MainWindowViewModel.dt_SysSet = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
||||||
SQLiteHelpers.Close();//关闭数据库
|
//SQLiteHelpers.Close();//关闭数据库
|
||||||
}
|
|
||||||
|
|
||||||
MainWindowViewModel.set_ = true;
|
MainWindowViewModel.set_ = true;
|
||||||
}
|
}
|
||||||
@@ -92,5 +89,71 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Grid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = e.EditingElement as TextBox;
|
||||||
|
if (Keyboard == null)
|
||||||
|
{
|
||||||
|
Keyboard = new TouchKeyboard();
|
||||||
|
Keyboard.KeyPressed += Keyboard_KeyPressed;
|
||||||
|
Keyboard.Closed += (s, args) => { Keyboard = null; };
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
Keyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void UpdateKeyboardPosition()
|
||||||
|
{
|
||||||
|
if (Keyboard == null) return;
|
||||||
|
|
||||||
|
// 获取主窗口的位置
|
||||||
|
var mainWindowWidth = this.Width;
|
||||||
|
var mainWindowHeight = this.Height;
|
||||||
|
|
||||||
|
// 计算键盘位置(主窗口底部中央)
|
||||||
|
Keyboard.Left = (mainWindowWidth - Keyboard.Width) / 2;
|
||||||
|
Keyboard.Top = mainWindowHeight - (Keyboard.Height + 50);
|
||||||
|
}
|
||||||
|
// 键盘按键事件处理
|
||||||
|
private void Keyboard_KeyPressed(object sender, TouchKeyboard.KeyPressedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.KeyType)
|
||||||
|
{
|
||||||
|
/* case KeyType.Character:
|
||||||
|
currentTextBox.Text += e.KeyValue;
|
||||||
|
break;
|
||||||
|
case KeyType.Backspace:
|
||||||
|
if (currentTextBox.Text.Length > 0)
|
||||||
|
{
|
||||||
|
currentTextBox.Text = currentTextBox.Text.Substring(0, currentTextBox.Text.Length - 1);
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
|
case KeyType.Enter:
|
||||||
|
// 回车键处理
|
||||||
|
if (!String.IsNullOrEmpty(e.KeyValue))
|
||||||
|
{
|
||||||
|
currentTextBox.Text = e.KeyValue;
|
||||||
|
}
|
||||||
|
Keyboard.Close();
|
||||||
|
break;
|
||||||
|
case KeyType.Hide:
|
||||||
|
// 隐藏键盘处理
|
||||||
|
Keyboard.Close();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Grid.CommitEdit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,8 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<DataGrid x:Name="Parameter_set" Visibility="Collapsed" AutoGenerateColumns="False" FontSize="15" AlternationCount="2"
|
<DataGrid x:Name="Parameter_set" Visibility="Collapsed" AutoGenerateColumns="False" FontSize="15" AlternationCount="2"
|
||||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" ColumnHeaderHeight="40" CellEditEnding="Parameter_set_CellEditEnding">
|
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" ColumnHeaderHeight="40"
|
||||||
|
CellEditEnding="Parameter_set_CellEditEnding" BeginningEdit="Parameter_set_BeginningEdit" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.Swing + " (%)";//摆布速度
|
newRow["ParameterSet"] = Properties.Resources.Swing + " (%)";//摆布速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1041");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1030");
|
||||||
newRow["ID"] = "1041";
|
newRow["ID"] = "1030";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + " (M/min)";//布轮速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + " (M/min)";//布轮速度
|
||||||
@@ -148,54 +148,64 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "7 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "7 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1037");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1036");
|
||||||
newRow["ID"] = "1037";
|
newRow["ID"] = "1036";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
if (MainWindowViewModel.MT18 >= 8)
|
if (MainWindowViewModel.MT18 >= 8)
|
||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "8 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "8 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1039");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1037");
|
||||||
newRow["ID"] = "1039";
|
newRow["ID"] = "1037";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
if (MainWindowViewModel.MT18 >= 9)
|
if (MainWindowViewModel.MT18 >= 9)
|
||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "9 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "9 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1053");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1038");
|
||||||
newRow["ID"] = "1053";
|
newRow["ID"] = "1038";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
if (MainWindowViewModel.MT18 >= 10)
|
if (MainWindowViewModel.MT18 >= 10)
|
||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "10 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "10 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1055");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1039");
|
||||||
newRow["ID"] = "1055";
|
newRow["ID"] = "1039";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
if (MainWindowViewModel.MT18 >= 11)
|
if (MainWindowViewModel.MT18 >= 11)
|
||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "11 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "11 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1057");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1040");
|
||||||
newRow["ID"] = "1057";
|
newRow["ID"] = "1040";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
if (MainWindowViewModel.MT18 >= 12)
|
if (MainWindowViewModel.MT18 >= 12)
|
||||||
{
|
{
|
||||||
newRow = tblDatas.NewRow();
|
newRow = tblDatas.NewRow();
|
||||||
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "12 (M/min)";//提不论速度
|
newRow["ParameterSet"] = Properties.Resources.ClothWheel + "12 (M/min)";//提不论速度
|
||||||
newRow["Value"] = MainWindowViewModel.Selet_dtm("1059");
|
newRow["Value"] = MainWindowViewModel.Selet_dtm("1041");
|
||||||
newRow["ID"] = "1059";
|
newRow["ID"] = "1041";
|
||||||
tblDatas.Rows.Add(newRow);
|
tblDatas.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameter_set.ItemsSource = tblDatas.DefaultView;
|
Parameter_set.ItemsSource = tblDatas.DefaultView;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void Parameter_set_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindowViewModel._Lock_bool)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Parameter_set_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
private void Parameter_set_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
string VID;
|
string VID;
|
||||||
@@ -216,12 +226,12 @@ namespace DyeingComputer.View
|
|||||||
MainWindowViewModel.Updata_dtm("1028", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1028", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1029", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1029", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1035", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1035", Convert.ToDouble(newValue));
|
||||||
|
MainWindowViewModel.Updata_dtm("1036", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1037", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1037", Convert.ToDouble(newValue));
|
||||||
|
MainWindowViewModel.Updata_dtm("1038", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1039", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1039", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1053", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1040", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1055", Convert.ToDouble(newValue));
|
MainWindowViewModel.Updata_dtm("1041", Convert.ToDouble(newValue));
|
||||||
MainWindowViewModel.Updata_dtm("1057", Convert.ToDouble(newValue));
|
|
||||||
MainWindowViewModel.Updata_dtm("1059", Convert.ToDouble(newValue));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -234,7 +244,7 @@ namespace DyeingComputer.View
|
|||||||
MainWindowViewModel.Updata_dtm(VID, i);
|
MainWindowViewModel.Updata_dtm(VID, i);
|
||||||
}
|
}
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Parameter",
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Parameter",
|
||||||
"ID=" + VID + ";Name=" + Vname + ";Value="+newValue);
|
"ID=" + VID + ";Name=" + Vname + ";Value=" + newValue);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
ParameterSet_d();
|
ParameterSet_d();
|
||||||
@@ -249,22 +259,23 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
Receip.Visibility = Visibility.Visible;
|
Receip.Visibility = Visibility.Visible;
|
||||||
Parameter_set.Visibility = Visibility.Collapsed;
|
Parameter_set.Visibility = Visibility.Collapsed;
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from Dyelot where WorkOrder = '" + MainWindowViewModel.WorkNumder + "'";
|
string sql_script = "select * from Dyelot where WorkOrder = '" + MainWindowViewModel.WorkNumder + "'";
|
||||||
MainWindowViewModel.Dyelot_dat = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换显示
|
MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //转换显示
|
||||||
Receip.ItemsSource = MainWindowViewModel.Dyelot_dat.DefaultView;
|
Receip.ItemsSource = MainWindowViewModel.Dyelot_dat.DefaultView;
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
// SQLiteHelpers.Close(); //关闭连接
|
||||||
}
|
}
|
||||||
private void ParameterSet_Click(object sender, RoutedEventArgs e)//参数
|
private void ParameterSet_Click(object sender, RoutedEventArgs e)//参数
|
||||||
{
|
{
|
||||||
Parameter_set.Visibility = Visibility.Visible;
|
Parameter_set.Visibility = Visibility.Visible;
|
||||||
Receip.Visibility = Visibility.Collapsed;
|
Receip.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTable tblDatas = new DataTable("Datas");
|
DataTable tblDatas = new DataTable("Datas");
|
||||||
public static object workName;
|
public static object workName;
|
||||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
//public static DataSet sql; //内存数据缓存
|
//public static DataSet sql; //内存数据缓存
|
||||||
string Numder = null;
|
string Numder = null;
|
||||||
string ID = null;
|
string ID = null;
|
||||||
@@ -303,17 +314,17 @@ namespace DyeingComputer.View
|
|||||||
}*/
|
}*/
|
||||||
private void TechnologicalProcess_sql()
|
private void TechnologicalProcess_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from RUN";
|
string sql_script = "select * from RUN";
|
||||||
MainWindowViewModel.dt_TP = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
MainWindowViewModel.dt_TP = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MainWindowViewModel.ProgramName = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
MainWindowViewModel.ProgramName = MainWindow.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||||
MainWindowViewModel.WorkNumder = SQLiteHelpers.ExecuteScalar("select WorkOrder from RUN where Step = '1'", null).ToString();
|
MainWindowViewModel.WorkNumder = MainWindow.SQLiteHelpers.ExecuteScalar("select WorkOrder from RUN where Step = '1'", null).ToString();
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
// if (sql != null)
|
// if (sql != null)
|
||||||
}
|
}
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
@@ -322,17 +333,25 @@ namespace DyeingComputer.View
|
|||||||
// Grid.DataContext = new MainWindowViewModel();
|
// Grid.DataContext = new MainWindowViewModel();
|
||||||
}
|
}
|
||||||
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
|
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑按钮
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
// if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
// if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||||
if (ID == null) return;//ID = sql.Tables[0].Rows.Count.ToString();
|
if (ID == null) return;//ID = sql.Tables[0].Rows.Count.ToString();
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Edit", "STEP = " + ID);
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Edit", "STEP = " + ID);
|
||||||
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||||
viewstop.boxNAME.IsEnabled=false;
|
viewstop.boxNAME.IsEnabled = false;
|
||||||
//viewstop.no.IsEnabled = false;
|
//viewstop.no.IsEnabled = false;
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.ShowDialog();
|
viewstop.ShowDialog();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||||
{
|
{
|
||||||
int n = Convert.ToInt16(ID);
|
int n = Convert.ToInt16(ID);
|
||||||
@@ -381,18 +400,18 @@ namespace DyeingComputer.View
|
|||||||
MainWindowViewModel.User_Button = true;
|
MainWindowViewModel.User_Button = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||||
dt.BeginEdit(); //添加订单号
|
dt.BeginEdit(); //添加订单号
|
||||||
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
||||||
dt.EndEdit();
|
dt.EndEdit();
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dt));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "EDIT STEP = " + n,
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "EDIT STEP = " + n,
|
||||||
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
|
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
|
||||||
MainWindowViewModel.User_Button = true;
|
MainWindowViewModel.User_Button = true;
|
||||||
@@ -409,6 +428,8 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
|
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
int d = 0;
|
int d = 0;
|
||||||
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
int a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||||
@@ -418,9 +439,9 @@ namespace DyeingComputer.View
|
|||||||
Dat();
|
Dat();
|
||||||
GridSTEP.SelectedIndex = -1;
|
GridSTEP.SelectedIndex = -1;
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
DataTable data_t = MainWindowViewModel.dt_TP.Clone();
|
||||||
a = MainWindowViewModel.dt_TP.Rows.Count;
|
a = MainWindowViewModel.dt_TP.Rows.Count;
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
@@ -433,20 +454,29 @@ namespace DyeingComputer.View
|
|||||||
drT.BeginEdit(); //添加订单号
|
drT.BeginEdit(); //添加订单号
|
||||||
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
drT["DYELOT"] = MainWindowViewModel.WorkNumder;
|
||||||
drT.EndEdit();
|
drT.EndEdit();
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
|
||||||
MainWindowViewModel.User_Button = true;
|
MainWindowViewModel.User_Button = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
|
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
int d = 0;
|
int d = 0;
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string ProgramID = SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
string ProgramID = MainWindow.SQLiteHelpers.ExecuteScalar("select ProgramID from RUN where Step = '1'", null).ToString();
|
||||||
string ProgramNAME = SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
string ProgramNAME = MainWindow.SQLiteHelpers.ExecuteScalar("select Program from RUN where Step = '1'", null).ToString();
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
|
|
||||||
if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
|
if (ID != null) { d = Convert.ToInt16(ID); } else { return; }
|
||||||
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
DataRow dr = MainWindowViewModel.dt_TP.NewRow();//添加表数据
|
||||||
@@ -488,7 +518,7 @@ namespace DyeingComputer.View
|
|||||||
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
|
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
|
||||||
// ID = null;
|
// ID = null;
|
||||||
Dat();
|
Dat();
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert", "STEP = "+ID);
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert", "STEP = " + ID);
|
||||||
if (ID == null) return;// ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
if (ID == null) return;// ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
||||||
ViewStep viewstop = new ViewStep(null, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(null, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||||
viewstop.boxNAME.IsEnabled = false;
|
viewstop.boxNAME.IsEnabled = false;
|
||||||
@@ -497,6 +527,12 @@ namespace DyeingComputer.View
|
|||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_InsertClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_InsertClicked);
|
||||||
viewstop.ShowDialog();
|
viewstop.ShowDialog();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void Address_InsertClicked(object sender, AddressUpdateEventArgs e)//插入返回结果
|
private void Address_InsertClicked(object sender, AddressUpdateEventArgs e)//插入返回结果
|
||||||
{
|
{
|
||||||
int n = Convert.ToInt16(ID);
|
int n = Convert.ToInt16(ID);
|
||||||
@@ -545,23 +581,25 @@ namespace DyeingComputer.View
|
|||||||
MainWindowViewModel.User_Button = true;
|
MainWindowViewModel.User_Button = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("RUN", null, null);
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null);
|
||||||
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
for (int i = 0; i < MainWindowViewModel.dt_TP.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
DataRow dt = MainWindowViewModel.dt_TP.Rows[i];//行转换
|
||||||
dt.BeginEdit(); //添加订单号
|
dt.BeginEdit(); //添加订单号
|
||||||
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
dt["DYELOT"] = MainWindowViewModel.Dyelot;
|
||||||
dt.EndEdit();
|
dt.EndEdit();
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dt));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert STEP = " + n,
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert STEP = " + n,
|
||||||
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
|
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
|
||||||
MainWindowViewModel.User_Button = true;
|
MainWindowViewModel.User_Button = true;
|
||||||
}
|
}
|
||||||
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
|
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
DataRow dr = MainWindowViewModel.dt_TP.Select("Step='" + ID + "'").First();
|
DataRow dr = MainWindowViewModel.dt_TP.Select("Step='" + ID + "'").First();
|
||||||
dr.BeginEdit();
|
dr.BeginEdit();
|
||||||
@@ -573,7 +611,12 @@ namespace DyeingComputer.View
|
|||||||
Convert.ToDouble(P4), Convert.ToDouble(P5));
|
Convert.ToDouble(P4), Convert.ToDouble(P5));
|
||||||
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + ID +
|
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + ID +
|
||||||
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
|
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
}//跳步
|
}//跳步
|
||||||
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -40,13 +41,13 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string S09 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S09'", null).ToString(); //读取
|
string S09 = MainWindow.SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S09'", null).ToString(); //读取
|
||||||
string S10 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S10'", null).ToString();
|
string S10 = MainWindow.SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S10'", null).ToString();
|
||||||
string S11 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S11'", null).ToString();
|
string S11 = MainWindow.SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S11'", null).ToString();
|
||||||
string S18 = SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S18'", null).ToString();
|
string S18 = MainWindow.SQLiteHelpers.ExecuteScalar("select value from system where ParameterID = 'S18'", null).ToString();
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
if (S09 == "0") WorkOrderView_new.IsEnabled = false;//禁止用户新建
|
if (S09 == "0") WorkOrderView_new.IsEnabled = false;//禁止用户新建
|
||||||
if (S10 == "0") WorkOrderView_del.IsEnabled = false;
|
if (S10 == "0") WorkOrderView_del.IsEnabled = false;
|
||||||
if (S11 == "0") WorkOrderView_redy.IsEnabled = false;
|
if (S11 == "0") WorkOrderView_redy.IsEnabled = false;
|
||||||
@@ -72,8 +73,8 @@ namespace DyeingComputer.View
|
|||||||
if(!SQL_UPDATE) Workorder_sql();
|
if(!SQL_UPDATE) Workorder_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
//private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
//private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
Dictionary<string, object> updata_temp = new Dictionary<string, object>();//缓存函数
|
Dictionary<string, object> updata_temp = new Dictionary<string, object>();//缓存函数
|
||||||
DataTable dat = new DataTable();
|
DataTable dat = new DataTable();
|
||||||
@@ -89,16 +90,16 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
public void Workorder_sql()
|
public void Workorder_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
string sql_script = "select * from WorkOrder where EndTime > '" + DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'";
|
string sql_script = "select * from WorkOrder where EndTime > '" + DateTime.Now.AddHours(-8).ToString("yyyy/MM/dd HH:mm:ss") + "'";
|
||||||
|
|
||||||
if (sql != null) sql.Clear(); //清空缓存
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
sql = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
// WorkOrder_Numder = null;
|
// WorkOrder_Numder = null;
|
||||||
// Process_Name = null;
|
// Process_Name = null;
|
||||||
@@ -107,31 +108,47 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void WorkOrderView_lock_Click(object sender, RoutedEventArgs e)//锁定按钮
|
private void WorkOrderView_lock_Click(object sender, RoutedEventArgs e)//锁定按钮
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
if (WorkOrder_Numder == null) return;
|
if (WorkOrder_Numder == null) return;
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
updata_temp.Clear();//使用前清理缓存
|
updata_temp.Clear();//使用前清理缓存
|
||||||
if (_lock == "0") //改变lock的状态
|
if (_lock == "0") //改变lock的状态
|
||||||
{
|
{
|
||||||
updata_temp.Add("lock", 1);
|
updata_temp.Add("lock", 1);
|
||||||
SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updata_temp.Add("lock", 0);
|
updata_temp.Add("lock", 0);
|
||||||
SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
Workorder_sql();
|
Workorder_sql();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
|
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
ViewProgram viewProgram = new ViewProgram();
|
ViewProgram viewProgram = new ViewProgram();
|
||||||
viewProgram.AddressUpdated += new ViewProgram.AddressUpdateHandler(Address_ButtonClicked);
|
viewProgram.AddressUpdated += new ViewProgram.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewProgram.ShowDialog();
|
viewProgram.ShowDialog();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//新建返回结果
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//新建返回结果
|
||||||
{
|
{
|
||||||
SQL_UPDATE = false;
|
SQL_UPDATE = false;
|
||||||
@@ -155,34 +172,32 @@ namespace DyeingComputer.View
|
|||||||
WorkOrder_new.Add("color", "#FFFFFFFF");
|
WorkOrder_new.Add("color", "#FFFFFFFF");
|
||||||
WorkOrder_new.Add("USER", MainWindowViewModel.S01);
|
WorkOrder_new.Add("USER", MainWindowViewModel.S01);
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
/*插入表头信息*/
|
/*插入表头信息*/
|
||||||
SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);//
|
MainWindow.SQLiteHelpers.InsertData("WorkOrder", WorkOrder_new);//
|
||||||
/*获取转并插入步骤信息*/
|
/*获取转并插入步骤信息*/
|
||||||
DataTable step_dat = SQLiteHelpers.ExecuteDataSet(
|
DataTable step_dat = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
"select * from ProgramSteps where ProgramID='" + Process_id + "'", null).Tables[0]; //读取表写入缓存
|
"select * from ProgramSteps where ProgramID='" + Process_id + "'", null).Tables[0]; //读取表写入缓存
|
||||||
DataTable _t = step_dat.Clone();
|
step_dat.Columns.Add("WorkOrder", System.Type.GetType("System.String"));
|
||||||
_t.Columns.Add("WorkOrder", System.Type.GetType("System.String"));
|
step_dat.Columns.Add("DYELOT", System.Type.GetType("System.String"));
|
||||||
_t.Columns.Add("DYELOT", System.Type.GetType("System.String"));
|
|
||||||
int a = step_dat.Rows.Count;
|
int a = step_dat.Rows.Count;
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
{
|
{
|
||||||
_t.Clear();//清空
|
|
||||||
DataRow dt = step_dat.Rows[i];//行转
|
DataRow dt = step_dat.Rows[i];//行转
|
||||||
DataRow dr = _t.NewRow();
|
dt.BeginEdit(); //添加订单号
|
||||||
dr.ItemArray = dt.ItemArray;
|
dt["WorkOrder"] = WorkOrder_Numder;
|
||||||
dr.BeginEdit(); //添加订单号
|
dt["DYELOT"] = WorkOrder_Numder;
|
||||||
dr["WorkOrder"] = WorkOrder_Numder;
|
dt.EndEdit();
|
||||||
dr["DYELOT"] = WorkOrder_Numder;
|
|
||||||
dr.EndEdit();
|
|
||||||
_t.Rows.InsertAt(dr, 0); //行转换
|
|
||||||
|
|
||||||
SQLiteHelpers.InsertData("WorkorderSteps", SQLiteHelpers.DataTableToDictionary(_t));//行插入
|
MainWindow.SQLiteHelpers.InsertData("WorkorderSteps", MainWindow.SQLiteHelpers.ToDictionary(dt));//行插入
|
||||||
}
|
}
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
|
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
if (WorkOrder_Numder == null) return;
|
if (WorkOrder_Numder == null) return;
|
||||||
///弹窗提示确认删除
|
///弹窗提示确认删除
|
||||||
@@ -192,16 +207,24 @@ namespace DyeingComputer.View
|
|||||||
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
||||||
{
|
{
|
||||||
///执行删除
|
///执行删除
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + WorkOrder_Numder + "'", null);
|
MainWindow.SQLiteHelpers.Delete("WorkOrder", "WorkOrder='" + WorkOrder_Numder + "'", null);
|
||||||
SQLiteHelpers.Close();
|
//SQLiteHelpers.Close();
|
||||||
Workorder_sql();
|
Workorder_sql();
|
||||||
}
|
}
|
||||||
SQL_UPDATE = false;
|
SQL_UPDATE = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void WorkOrderView_redy_Click(object sender, RoutedEventArgs e)//重染按钮
|
private void WorkOrderView_redy_Click(object sender, RoutedEventArgs e)//重染按钮
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
string WorkNum = MainWindowViewModel.WorkNumder.ToString();
|
string WorkNum = MainWindowViewModel.WorkNumder.ToString();
|
||||||
if (WorkNum != null)
|
if (WorkNum != null)
|
||||||
@@ -216,6 +239,12 @@ namespace DyeingComputer.View
|
|||||||
}
|
}
|
||||||
SQL_UPDATE = false;
|
SQL_UPDATE = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
|
||||||
{
|
{
|
||||||
@@ -230,11 +259,11 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
SQL_UPDATE = true;
|
SQL_UPDATE = true;
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
dat = SQLiteHelpers.ExecuteDataSet(
|
dat = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
|
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
inf_cont = 0;
|
inf_cont = 0;
|
||||||
TEMP();
|
TEMP();
|
||||||
@@ -270,11 +299,11 @@ namespace DyeingComputer.View
|
|||||||
dataGrid.HorizontalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
dataGrid.HorizontalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
||||||
dataGrid.VerticalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
dataGrid.VerticalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
//SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'";
|
string sql_script = "select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'";
|
||||||
DataTable inf = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
DataTable inf = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取表写入缓存
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
dataGrid.ItemsSource = inf.DefaultView; //转换显示计划表
|
dataGrid.ItemsSource = inf.DefaultView; //转换显示计划表
|
||||||
|
|
||||||
Picture.Content = dataGrid;
|
Picture.Content = dataGrid;
|
||||||
@@ -294,11 +323,11 @@ namespace DyeingComputer.View
|
|||||||
dataGrid_.HorizontalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
dataGrid_.HorizontalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
||||||
dataGrid_.VerticalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
dataGrid_.VerticalGridLinesBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 201, 201, 201));
|
||||||
|
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
string sql_script = "select * from Workorder where WorkOrder='" + WorkOrder_Numder + "'";
|
string sql_script = "select * from Workorder where WorkOrder='" + WorkOrder_Numder + "'";
|
||||||
DataRow inf = SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0].Select().First(); //读取表写入缓存
|
DataRow inf = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0].Select().First(); //读取表写入缓存
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
// SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
DataTable dataTable = new DataTable();
|
DataTable dataTable = new DataTable();
|
||||||
dataTable.Columns.Add("NAME", Type.GetType("System.String"));
|
dataTable.Columns.Add("NAME", Type.GetType("System.String"));
|
||||||
@@ -329,6 +358,8 @@ namespace DyeingComputer.View
|
|||||||
((System.Windows.Controls.Image)sender).RenderTransform = new ScaleTransform(0.9, 0.9);
|
((System.Windows.Controls.Image)sender).RenderTransform = new ScaleTransform(0.9, 0.9);
|
||||||
}
|
}
|
||||||
private void Image_MouseLeftButtonUp1(object sender, MouseButtonEventArgs e)
|
private void Image_MouseLeftButtonUp1(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (!MainWindowViewModel._Lock_bool)
|
||||||
{
|
{
|
||||||
SQL_UPDATE = false;
|
SQL_UPDATE = false;
|
||||||
((System.Windows.Controls.Image)sender).RenderTransform = Transform.Identity;
|
((System.Windows.Controls.Image)sender).RenderTransform = Transform.Identity;
|
||||||
@@ -344,13 +375,13 @@ namespace DyeingComputer.View
|
|||||||
int a;
|
int a;
|
||||||
|
|
||||||
/*检查并写入run信息*/
|
/*检查并写入run信息*/
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
int R_D = SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0].Rows.Count; //读取表写入缓存
|
int R_D = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from RUN", null).Tables[0].Rows.Count; //读取表写入缓存
|
||||||
if (R_D > 0)//判断是否有运行中工艺
|
if (R_D > 0)//判断是否有运行中工艺
|
||||||
{
|
{
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(
|
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(
|
||||||
Properties.Resources.RunningProcess, "800", MessageBoxButton.YesNo);
|
Properties.Resources.RunningProcess, "800", MessageBoxButton.YesNo);
|
||||||
@@ -362,36 +393,49 @@ namespace DyeingComputer.View
|
|||||||
System.Windows.MessageBox.Show(Properties.Resources.refuse, "800", MessageBoxButton.OK);
|
System.Windows.MessageBox.Show(Properties.Resources.refuse, "800", MessageBoxButton.OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updata_temp.Clear(); //使用前清缓存
|
updata_temp.Clear(); //使用前清缓存
|
||||||
updata_temp.Add("State", 205);
|
updata_temp.Add("State", 205);
|
||||||
SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
MainWindow.SQLiteHelpers.Update("WorkOrder", updata_temp, "WorkOrder='" + WorkOrder_Numder + "'", null);
|
||||||
MainWindowViewModel.Dyelot_dat = SQLiteHelpers.ExecuteDataSet("select * from Dyelot where Dyelot = '" +
|
MainWindowViewModel.Dyelot_dat = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from Dyelot where WorkOrder = '" +
|
||||||
Dyelot + "'", null).Tables[0];
|
WorkOrder_Numder + "'", null).Tables[0];
|
||||||
WorkorderSteps = SQLiteHelpers.ExecuteDataSet(
|
var DT_Set = MainWindow.SQLiteHelpers.ExecuteDataSet("select * from WorkOrderSet where WorkOrder = '" +
|
||||||
|
WorkOrder_Numder + "'", null).Tables[0].Rows[0];
|
||||||
|
MainWindowViewModel.Updata_dtm("1020", DT_Set.Field<int>("PumpSpeed"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1030", DT_Set.Field<int>("Swing"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1021", DT_Set.Field<int>("Blower"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1025", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1026", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1027", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1028", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1029", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1035", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1036", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1037", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1038", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1039", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1040", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
MainWindowViewModel.Updata_dtm("1041", DT_Set.Field<int>("ClothWheel"));
|
||||||
|
WorkorderSteps = MainWindow.SQLiteHelpers.ExecuteDataSet(
|
||||||
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
|
"select * from WorkorderSteps where WorkOrder='" + WorkOrder_Numder + "'", null).Tables[0]; //读取表写入缓存
|
||||||
MainWindowViewModel.ProgramName = Process_Name;
|
MainWindowViewModel.ProgramName = Process_Name;
|
||||||
MainWindowViewModel.Dyelot = Dyelot;
|
MainWindowViewModel.Dyelot = Dyelot;
|
||||||
SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
MainWindow.SQLiteHelpers.Delete("RUN", null, null); //删除run信息
|
||||||
a = WorkorderSteps.Rows.Count;
|
a = WorkorderSteps.Rows.Count;
|
||||||
for (int i = 0; i < a; i++)
|
for (int i = 0; i < a; i++)
|
||||||
{
|
{
|
||||||
DataRow dr = WorkorderSteps.Rows[i];//行转
|
DataRow dr = WorkorderSteps.Rows[i];//行转
|
||||||
dr.BeginEdit(); //添加订单号
|
|
||||||
dr["ProgramID"] = Process_id;
|
|
||||||
dr["Program"] = MainWindowViewModel.ProgramName;
|
|
||||||
dr.EndEdit();
|
|
||||||
|
|
||||||
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.ToDictionary(dr));//行插入
|
MainWindow.SQLiteHelpers.InsertData("RUN", MainWindow.SQLiteHelpers.ToDictionary(dr));//行插入
|
||||||
}
|
}
|
||||||
updata_temp.Clear(); //使用前清缓存
|
updata_temp.Clear(); //使用前清缓存
|
||||||
updata_temp.Add("RUN", 1);
|
updata_temp.Add("RUN", 1);
|
||||||
SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null);
|
MainWindow.SQLiteHelpers.Update("RUN", updata_temp, "Step=1", null);
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
//SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
/*触发启动*/
|
/*触发启动*/
|
||||||
string Numder = WorkorderSteps.Select("Step = 1").First().Field<string>("StepID");//
|
string Numder = WorkorderSteps.Select("Step = 1").First().Field<string>("StepID");//
|
||||||
@@ -418,6 +462,12 @@ namespace DyeingComputer.View
|
|||||||
var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面
|
var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;//跨页面
|
||||||
_mainWindow.container.Content = new TechnologicalProcessView();//获取控件
|
_mainWindow.container.Content = new TechnologicalProcessView();//获取控件
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.USERinf(Properties.Resources.LockedState + "\n" +
|
||||||
|
Properties.Resources.TCOIR + "\n" + Properties.Resources.PCATRIL);
|
||||||
|
}
|
||||||
}//开始
|
}//开始
|
||||||
|
|
||||||
private void TEMP()
|
private void TEMP()
|
||||||
@@ -431,17 +481,17 @@ namespace DyeingComputer.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
for (int i = 0; i < dat.Rows.Count; i++)
|
for (int i = 0; i < dat.Rows.Count; i++)
|
||||||
{
|
{
|
||||||
switch (dat.Rows[i][5].ToString())//步骤用时计算
|
switch (dat.Rows[i].Field<string>("StepID"))//步骤用时计算
|
||||||
{
|
{
|
||||||
case "001":
|
case "001":
|
||||||
TT = MSTT;
|
TT = MSTT;
|
||||||
TC = (Double)dat.Rows[i][9];
|
TC = dat.Rows[i].Field<double>("Parameter2");
|
||||||
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||||
MSTT = (Double)dat.Rows[i][8];
|
MSTT = dat.Rows[i].Field<double>("Parameter1");
|
||||||
TT = Math.Abs(MSTT - TT) / TC * 60;
|
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][12]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "007":
|
case "007":
|
||||||
@@ -453,15 +503,15 @@ namespace DyeingComputer.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "013":
|
case "013":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][10] * (Double)dat.Rows[i][11]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3") * dat.Rows[i].Field<double>("Parameter4")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "015":
|
case "015":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][10]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "017":
|
case "017":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][10]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "020":
|
case "020":
|
||||||
@@ -473,24 +523,24 @@ namespace DyeingComputer.View
|
|||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "031":
|
case "031":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "065":
|
case "065":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][10]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter3")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "091":
|
case "091":
|
||||||
TT = MSTT;
|
TT = MSTT;
|
||||||
TC = (Double)dat.Rows[i][9];
|
TC = (Double)dat.Rows[i][7];
|
||||||
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||||
MSTT = (Double)dat.Rows[i][8];
|
MSTT = (Double)dat.Rows[i][6];
|
||||||
TT = Math.Abs(MSTT - TT) / TC * 60;
|
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
case "093":
|
case "093":
|
||||||
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss");
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(dat.Rows[i].Field<double>("Parameter1")).ToString("HH:mm:ss");
|
||||||
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -117,19 +117,13 @@ namespace DyeingComputer.ViewModel
|
|||||||
private List<DateTimePoint> STTC_values;
|
private List<DateTimePoint> STTC_values;
|
||||||
private List<DateTimePoint> STLC_values;
|
private List<DateTimePoint> STLC_values;
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
||||||
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
|
||||||
DataTable CDB = new DataTable();
|
DataTable CDB = new DataTable();
|
||||||
private int CDB_Count;//长度
|
private int CDB_Count;//长度
|
||||||
|
|
||||||
public CurveDiagramViewModel()
|
public CurveDiagramViewModel()
|
||||||
{
|
{
|
||||||
if (MainWindowViewModel.WorkNumder.ToString() != "----------")
|
CDB = MainWindow.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Time > '" +
|
||||||
{
|
DateTime.Now.AddHours(-6).ToString("yyyy/MM/dd HH:mm:ss") + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + MainWindowViewModel.WorkNumder + "'order by Time", null).Tables[0];
|
|
||||||
SQLiteHelpers.Close();
|
|
||||||
CDB_Count = CDB.Rows.Count;
|
CDB_Count = CDB.Rows.Count;
|
||||||
|
|
||||||
var MTT_items = new List<DateTimePoint>();
|
var MTT_items = new List<DateTimePoint>();
|
||||||
@@ -143,7 +137,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
var STLB_items = new List<DateTimePoint>();
|
var STLB_items = new List<DateTimePoint>();
|
||||||
var STTC_items = new List<DateTimePoint>();
|
var STTC_items = new List<DateTimePoint>();
|
||||||
var STLC_items = new List<DateTimePoint>();
|
var STLC_items = new List<DateTimePoint>();
|
||||||
for (var i = 0; i < CDB_Count; i++)
|
for (var i = 0; i < CDB_Count; i=i+10)
|
||||||
{
|
{
|
||||||
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
||||||
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
MTT_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MTT")));
|
||||||
@@ -315,5 +309,4 @@ namespace DyeingComputer.ViewModel
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -109,18 +109,18 @@ namespace DyeingComputer.ViewModel
|
|||||||
private ObservableCollection<DateTimePoint> STTC_values;
|
private ObservableCollection<DateTimePoint> STTC_values;
|
||||||
private ObservableCollection<DateTimePoint> STLC_values;
|
private ObservableCollection<DateTimePoint> STLC_values;
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
// private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
||||||
public DataTable CDB = new DataTable();
|
public DataTable CDB = new DataTable();
|
||||||
private int CDB_Count;//长度
|
private int CDB_Count;//长度
|
||||||
|
|
||||||
public HistoryRecordsViewModel()
|
public HistoryRecordsViewModel()
|
||||||
{
|
{
|
||||||
string Sys_Time = DateTime.Now.AddDays(-2).ToString("yyyy/MM/dd HH:mm:ss");
|
string Sys_Time = DateTime.Now.AddDays(-2).ToString("yyyy/MM/dd HH:mm:ss");
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where Time > '" + Sys_Time + "'order by Time", null).Tables[0];
|
CDB = MainWindow.SQLiteChartAdress.ExecuteDataSet("select * from Chart where Time > '" + Sys_Time + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
CDB_Count = CDB.Rows.Count;
|
CDB_Count = CDB.Rows.Count;
|
||||||
|
|
||||||
Chart_View();
|
Chart_View();
|
||||||
@@ -132,10 +132,10 @@ namespace DyeingComputer.ViewModel
|
|||||||
public static string etime;
|
public static string etime;
|
||||||
public void History()
|
public void History()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
// SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + name + "'order by Time", null).Tables[0];
|
CDB = MainWindow.SQLiteChartAdress.ExecuteDataSet("select * from Chart where DYELOT = '" + name + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
// SQLiteHelpers.Close();
|
||||||
CDB_Count = CDB.Rows.Count;
|
CDB_Count = CDB.Rows.Count;
|
||||||
|
|
||||||
Chart_View();
|
Chart_View();
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<Window x:Class="DyeingComputer.Windows.UserInf"
|
||||||
|
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:DyeingComputer.Windows"
|
||||||
|
xmlns:lang="clr-namespace:DyeingComputer.Properties"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Loaded ="Window_Loaded"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="SUNLIGHT 800" Height="400" Width="400">
|
||||||
|
<Grid>
|
||||||
|
<TextBox x:Name="INF_DATA" Margin="5,5,5,150" TextWrapping="Wrap" FontSize="30" IsReadOnly="True" />
|
||||||
|
|
||||||
|
<Image Height="100" Width="100" VerticalAlignment="Bottom" FlowDirection="LeftToRight"
|
||||||
|
HorizontalAlignment="Left" Margin="25,0,0,27" Source="/Lmage/IconParkInfo.png"/>
|
||||||
|
|
||||||
|
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Right" Height="35" Margin="50,70,20,20"
|
||||||
|
VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using DyeingComputer.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
|
using static DyeingComputer.Windows.ViewStep;
|
||||||
|
|
||||||
|
namespace DyeingComputer.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ViewProgram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserInf : Window
|
||||||
|
{
|
||||||
|
public string Inf_DAT;//信息
|
||||||
|
public UserInf()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
INF_DATA.Text = Inf_DAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void YES_Click(object sender, RoutedEventArgs e)//确认
|
||||||
|
{
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,21 +32,21 @@ namespace DyeingComputer.Windows
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Programgroup_sql();
|
Programgroup_sql();
|
||||||
}
|
}
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
// private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
// private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
public void Programgroup_sql()
|
public void Programgroup_sql()
|
||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
//SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
// SQLiteHelpers.Open(); //打开数据库
|
||||||
|
|
||||||
string sql_script = "select * from ProgramName order by ProgramID desc";
|
string sql_script = "select * from ProgramName order by ProgramID desc";
|
||||||
|
|
||||||
if (sql != null) sql.Clear(); //清空缓存
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
sql = MainWindow.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
// SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
//sql.Clear(); //清除缓存
|
//sql.Clear(); //清除缓存
|
||||||
//System.GC.Collect();
|
//System.GC.Collect();
|
||||||
|
|||||||
@@ -44,35 +44,40 @@
|
|||||||
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0"
|
<TextBox x:Name="P1" HorizontalAlignment="Right" Height="30" Margin="0,120,10,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||||
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False"
|
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P1_TextChanged"/>
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P1_TextChanged"
|
||||||
|
GotFocus="P1_GotFocus"/>
|
||||||
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="210,155,0,0"
|
<TextBlock x:Name="P2N" HorizontalAlignment="Left" Height="30" Margin="210,155,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0"
|
<TextBox x:Name="P2" HorizontalAlignment="Right" Height="30" Margin="0,155,10,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||||
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False"
|
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P2_TextChanged"/>
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P2_TextChanged"
|
||||||
|
GotFocus="P2_GotFocus"/>
|
||||||
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="210,190,0,0"
|
<TextBlock x:Name="P3N" HorizontalAlignment="Left" Height="30" Margin="210,190,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0"
|
<TextBox x:Name="P3" HorizontalAlignment="Right" Height="30" Margin="0,190,10,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||||
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False"
|
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P3_TextChanged"/>
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P3_TextChanged"
|
||||||
|
GotFocus="P3_GotFocus"/>
|
||||||
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="210,225,0,0"
|
<TextBlock x:Name="P4N" HorizontalAlignment="Left" Height="30" Margin="210,225,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0"
|
<TextBox x:Name="P4" HorizontalAlignment="Right" Height="30" Margin="0,225,10,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||||
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
|
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P4_TextChanged"/>
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P4_TextChanged"
|
||||||
|
GotFocus="P4_GotFocus"/>
|
||||||
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="210,260,0,0"
|
<TextBlock x:Name="P5N" HorizontalAlignment="Left" Height="30" Margin="210,260,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0"
|
<TextBox x:Name="P5" HorizontalAlignment="Right" Height="30" Margin="0,260,10,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
|
||||||
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
|
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P5_TextChanged"/>
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" TextChanged="P5_TextChanged"
|
||||||
|
GotFocus="P5_GotFocus"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
@@ -107,7 +112,7 @@
|
|||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
||||||
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP1p"
|
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP1p"
|
||||||
TextChanged="P1P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
TextChanged="P1P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" GotFocus="P1P_GotFocus"/>
|
||||||
<TextBlock x:Name="P2NP" HorizontalAlignment="Left" Height="30" Margin="210,205,0,0"
|
<TextBlock x:Name="P2NP" HorizontalAlignment="Left" Height="30" Margin="210,205,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
@@ -115,7 +120,7 @@
|
|||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
||||||
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP2p"
|
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP2p"
|
||||||
TextChanged="P2P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
TextChanged="P2P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" GotFocus="P2P_GotFocus"/>
|
||||||
<TextBlock x:Name="P3NP" HorizontalAlignment="Left" Height="30" Margin="210,240,0,0"
|
<TextBlock x:Name="P3NP" HorizontalAlignment="Left" Height="30" Margin="210,240,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
@@ -123,7 +128,7 @@
|
|||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
||||||
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP3p"
|
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP3p"
|
||||||
TextChanged="P3P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
TextChanged="P3P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" GotFocus="P3P_GotFocus"/>
|
||||||
<TextBlock x:Name="P4NP" HorizontalAlignment="Left" Height="30" Margin="210,275,0,0"
|
<TextBlock x:Name="P4NP" HorizontalAlignment="Left" Height="30" Margin="210,275,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
@@ -131,7 +136,7 @@
|
|||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
||||||
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP4p"
|
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP4p"
|
||||||
TextChanged="P4P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
TextChanged="P4P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" GotFocus="P4P_GotFocus"/>
|
||||||
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
|
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
|
||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
|
||||||
Background="#FFEFEEEE" Visibility="Hidden"/>
|
Background="#FFEFEEEE" Visibility="Hidden"/>
|
||||||
@@ -139,7 +144,7 @@
|
|||||||
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1"
|
||||||
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP5p"
|
ClipToBounds="True" Text="0" PreviewTextInput="Tb_KeyP5p"
|
||||||
TextChanged="P5P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
TextChanged="P5P_TextChanged" InputMethod.IsInputMethodEnabled="False"
|
||||||
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
|
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" GotFocus="P5P_GotFocus"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}"
|
<Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DyeingComputer.View;
|
using DyeingComputer.KEY;
|
||||||
|
using DyeingComputer.View;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -11,7 +12,6 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
@@ -27,6 +27,8 @@ namespace DyeingComputer.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ViewStep : Window
|
public partial class ViewStep : Window
|
||||||
{
|
{
|
||||||
|
private TouchKeyboardNumeral numeralKeyboard;
|
||||||
|
private TextBox currentTextBox;
|
||||||
public string data { get; set; }
|
public string data { get; set; }
|
||||||
private int dat_P = 0;
|
private int dat_P = 0;
|
||||||
//声明一个更新Address的委托
|
//声明一个更新Address的委托
|
||||||
@@ -343,7 +345,7 @@ namespace DyeingComputer.Windows
|
|||||||
|
|
||||||
|
|
||||||
private readonly string[] id_dat = {"001","007","008","013","015" , "020", "022", "031", "035", "036",
|
private readonly string[] id_dat = {"001","007","008","013","015" , "020", "022", "031", "035", "036",
|
||||||
"039", "040", "041", "049", "050", "051", "054", "055", "056","064","065","066","067", "090","091",
|
"039", "040", "041", "049", "050", "051", "054", "055", "056","064","065","066","067", "090",
|
||||||
"093","094" };
|
"093","094" };
|
||||||
private readonly string[] id_datp = {" " ,"017", "050", "051", "064", "066","090","091", "093","094" };
|
private readonly string[] id_datp = {" " ,"017", "050", "051", "064", "066","090","091", "093","094" };
|
||||||
|
|
||||||
@@ -373,7 +375,6 @@ namespace DyeingComputer.Windows
|
|||||||
this.boxID.Items.Add(Properties.Resources.CallDistribution);//呼叫输送066
|
this.boxID.Items.Add(Properties.Resources.CallDistribution);//呼叫输送066
|
||||||
this.boxID.Items.Add(Properties.Resources.CallPreparation);//呼叫准备067
|
this.boxID.Items.Add(Properties.Resources.CallPreparation);//呼叫准备067
|
||||||
this.boxID.Items.Add(Properties.Resources.RapidAcidAddition);//快速加酸090
|
this.boxID.Items.Add(Properties.Resources.RapidAcidAddition);//快速加酸090
|
||||||
this.boxID.Items.Add(Properties.Resources.PHTemperatureControl);//ph温度控制091
|
|
||||||
this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093
|
this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093
|
||||||
this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094
|
this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094
|
||||||
|
|
||||||
@@ -576,19 +577,17 @@ namespace DyeingComputer.Windows
|
|||||||
case "015":
|
case "015":
|
||||||
P1N.Text = Properties.Resources.Headwaters;
|
P1N.Text = Properties.Resources.Headwaters;
|
||||||
P2N.Text = Properties.Resources.WaterLevel;
|
P2N.Text = Properties.Resources.WaterLevel;
|
||||||
P3N.Text = Properties.Resources.Time;
|
P3N.Text = Properties.Resources.Flowmeter;
|
||||||
P4N.Text = Properties.Resources.Flowmeter;
|
|
||||||
P5N.Text = Properties.Resources.Target + Properties.Resources.Temperature;
|
|
||||||
P1.Visibility = Visibility.Visible;
|
P1.Visibility = Visibility.Visible;
|
||||||
P1N.Visibility = Visibility.Visible;
|
P1N.Visibility = Visibility.Visible;
|
||||||
P2.Visibility = Visibility.Visible;
|
P2.Visibility = Visibility.Visible;
|
||||||
P2N.Visibility = Visibility.Visible;
|
P2N.Visibility = Visibility.Visible;
|
||||||
P3.Visibility = Visibility.Visible;
|
P3.Visibility = Visibility.Visible;
|
||||||
P3N.Visibility = Visibility.Visible;
|
P3N.Visibility = Visibility.Visible;
|
||||||
P4.Visibility = Visibility.Visible;
|
P4.Visibility = Visibility.Collapsed;
|
||||||
P4N.Visibility = Visibility.Visible;
|
P4N.Visibility = Visibility.Collapsed;
|
||||||
P5.Visibility = Visibility.Visible;
|
P5.Visibility = Visibility.Collapsed;
|
||||||
P5N.Visibility = Visibility.Visible;
|
P5N.Visibility = Visibility.Collapsed;
|
||||||
imageP.Source = new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));
|
imageP.Source = new BitmapImage(new Uri("/Lmage/ID015.png", UriKind.Relative));
|
||||||
break;
|
break;
|
||||||
case "017":
|
case "017":
|
||||||
@@ -1729,5 +1728,529 @@ namespace DyeingComputer.Windows
|
|||||||
P4P.Text = dat_D.Field<double>("Parameter4_S3").ToString();
|
P4P.Text = dat_D.Field<double>("Parameter4_S3").ToString();
|
||||||
P5P.Text = dat_D.Field<double>("Parameter5_S3").ToString();
|
P5P.Text = dat_D.Field<double>("Parameter5_S3").ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void P1_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "007":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "008":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "020":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "022":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "031":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "050":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "051":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "067":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "090":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "093":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "094":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P2_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "007":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "008":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "020":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "022":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "050":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "051":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "090":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "094":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P3_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P4_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P5_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P1P_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAMEp.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "007":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "008":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "020":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "022":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "031":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "050":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "051":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "067":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "090":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "093":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "094":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P2P_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "007":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "008":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "020":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "022":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "050":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "051":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 3);
|
||||||
|
break;
|
||||||
|
case "090":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "094":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P3P_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "066":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void P4P_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
case "013":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.LimitedRange, currentTextBox, 1, 4);
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
case "064":
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.NumericOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
private void P5P_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
currentTextBox = sender as TextBox;
|
||||||
|
if (numeralKeyboard == null)
|
||||||
|
{
|
||||||
|
numeralKeyboard = new TouchKeyboardNumeral();
|
||||||
|
numeralKeyboard.KeyPressed += NumeralKeyboard_KeyPressed;
|
||||||
|
numeralKeyboard.Closed += (s, args) => { numeralKeyboard = null; };
|
||||||
|
}
|
||||||
|
switch (boxNAME.Text)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
numeralKeyboard.SetKeyboardMode(TouchKeyboardNumeral.KeyboardMode.DecimalOnly, currentTextBox);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 显示键盘
|
||||||
|
numeralKeyboard.Show();
|
||||||
|
// 定位键盘位置(在主窗口下方)
|
||||||
|
UpdateKeyboardPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新键盘位置
|
||||||
|
private void UpdateKeyboardPosition()
|
||||||
|
{
|
||||||
|
if (numeralKeyboard == null) return;
|
||||||
|
|
||||||
|
// 获取主窗口的位置
|
||||||
|
var mainWindowLeft = this.Left;
|
||||||
|
var mainWindowTop = this.Top;
|
||||||
|
var mainWindowWidth = this.Width;
|
||||||
|
var mainWindowHeight = this.Height;
|
||||||
|
|
||||||
|
// 计算键盘位置(主窗口底部中央)
|
||||||
|
numeralKeyboard.Left = mainWindowLeft + (mainWindowWidth - numeralKeyboard.Width) / 2;
|
||||||
|
numeralKeyboard.Top = mainWindowTop + mainWindowHeight/2;
|
||||||
|
}
|
||||||
|
// 键盘按键事件处理
|
||||||
|
private void NumeralKeyboard_KeyPressed(object sender, TouchKeyboardNumeral.KeyPressedEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.KeyType)
|
||||||
|
{
|
||||||
|
/* case KeyType.Character:
|
||||||
|
currentTextBox.Text += e.KeyValue;
|
||||||
|
break;
|
||||||
|
case KeyType.Backspace:
|
||||||
|
if (currentTextBox.Text.Length > 0)
|
||||||
|
{
|
||||||
|
currentTextBox.Text = currentTextBox.Text.Substring(0, currentTextBox.Text.Length - 1);
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
|
case KeyType.Enter:
|
||||||
|
// 回车键处理
|
||||||
|
if (!String.IsNullOrEmpty(e.KeyValue)) currentTextBox.Text = e.KeyValue;
|
||||||
|
numeralKeyboard.Close();
|
||||||
|
boxID.Focus();
|
||||||
|
break;
|
||||||
|
case KeyType.Hide:
|
||||||
|
// 隐藏键盘处理
|
||||||
|
numeralKeyboard.Close();
|
||||||
|
boxID.Focus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移动光标到文本末尾
|
||||||
|
currentTextBox.CaretIndex = currentTextBox.Text.Length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- UAC 清单选项
|
||||||
|
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||||
|
以下节点之一替换 requestedExecutionLevel 节点。
|
||||||
|
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||||
|
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
|
||||||
|
元素。
|
||||||
|
-->
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||||
|
Windows 版本的列表。取消评论适当的元素,
|
||||||
|
Windows 将自动选择最兼容的环境。 -->
|
||||||
|
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||||
|
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||||
|
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||||
|
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||||
|
|
||||||
|
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||||
|
<!--
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||||
|
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||||
|
<!--
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</assembly>
|
||||||