From 62e3ff7506396fcb7f7737900806e838c2466aa3 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期五, 09 五月 2025 16:22:15 +0800 Subject: [PATCH] 初始化仓库,修复成品出库的逻辑 --- swagger.js | 110 .vs/HH.WCS.Langchao/FileContentIndex/read.lock | 0 HH.WCS.Mobox3.DSZSH.csproj | 323 + .vs/HH.WCS.Langchao/FileContentIndex/4a385bfe-ecd2-4870-b27e-b29514f713d2.vsidx | 0 .vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/b73147f2-b5c8-4121-b1aa-5fa60c01a097.vsidx | 0 Helpers/DbHelper.cs | 134 .vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/9cdebdd3-1654-41dc-894c-c2dd9e6fc6e0.vsidx | 0 Helpers/Dispatch/NDCApi.cs | 272 + Properties/AssemblyInfo.cs | 36 Models/TN_Outbound_Detail.cs | 54 Dtos/Response/DebugResponse.cs | 18 .gitignore | 1 HH.WCS.Mobox3.DSZSH.sln | 30 Helpers/PathHelper.cs | 24 Services/MoboxService.cs | 492 ++ Models/TN_CAR_IN.cs | 21 Dtos/Request/MoboxRequest.cs | 161 Helpers/Model/ContainerHelper.cs | 141 AppStart/Startup.cs | 50 Models/TN_Outbound_Order.cs | 30 .vs/HH.WCS.Langchao/FileContentIndex/64fc2de3-4821-4c46-8f63-3c1f84a578ce.vsidx | 0 Devices/ProductionLineDevice.cs | 90 Models/TN_Task_Action.cs | 22 .vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/testlog.manifest | 0 Helpers/AgvHelper.cs | 64 .vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/read.lock | 0 ServiceCore/OutboundCore.cs | 172 Consts/AreaName.cs | 23 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/f695590c-9e16-47ef-9fb0-255e7f2c0f7b.vsidx | 0 Helpers/SysHelper.cs | 38 Dtos/Response/BaseResponse.cs | 20 Consts/TaskName.cs | 19 AppStart/Config.cs | 44 Helpers/Dispatch/GZRobot.cs | 393 ++ Helpers/Model/TaskHelper.cs | 473 ++ Models/TN_Inbound_Order.cs | 28 Helpers/Device/OpcUaHelper.cs | 193 + Devices/BaseModbusDevice.cs | 20 Helpers/Device/ModbusHelper.cs | 399 ++ AppStart/Settings.cs | 73 .vs/HH.WCS.Mobox3.DSZSH/config/applicationhost.config | 1026 +++++ .vs/HH.WCS.Langchao/FileContentIndex/095323c9-fab1-4a3d-bbb9-e016bdc026ba.vsidx | 0 Consts/LockStateName.cs | 17 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/8481878f-500a-4cd8-99a8-05771823e062.vsidx | 0 .vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/read.lock | 0 .vs/HH.WCS.Mobox3.WeiLi/FileContentIndex/57367193-8890-401b-95eb-fa75f34fc9b1.vsidx | 0 Helpers/Device/TcpClient.cs | 85 .vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/000.testlog | 0 Models/TN_Container.cs | 20 AppStart/SwaggerConfig.cs | 255 + Models/TN_Outbound_Task.cs | 27 Controllers/DebugController.cs | 176 + .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/read.lock | 0 .vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/3911a5fd-5b86-4edf-85b1-ca6ed438a43d.vsidx | 0 Dtos/Request/DebugRequest.cs | 29 .vs/HH.WCS.JunzhouLangchao/FileContentIndex/b5d4cc0d-d072-4a06-b41d-eed5482c7ae2.vsidx | 0 .editorconfig | 178 + Helpers/Device/S7Helper.cs | 423 ++ Helpers/Dispatch/HanAo.cs | 165 Models/TN_Location.cs | 90 .vs/HH.WCS.JunzhouLangchao/FileContentIndex/read.lock | 0 Controllers/MoboxController.cs | 138 Helpers/LogHelper.cs | 148 Helpers/ResultHelper.cs | 47 Helpers/DeviceProcess.cs | 26 Models/DebugModel.cs | 29 Helpers/Device/TcpServer.cs | 251 + Helpers/Model/LocationHelper.cs | 338 + Dtos/Request/AgvRequest.cs | 39 Consts/AgvStateCode.cs | 18 Services/AgvService.cs | 148 AppStart/SwaggerControllerDescProvider.cs | 82 Dtos/Response/AgvResponse.cs | 18 Dtos/Response/MoboxResponse.cs | 205 + Program.cs | 168 Models/BaseModel.cs | 45 Models/TN_Task.cs | 98 Controllers/AgvController.cs | 41 config/config.json | 164 ServiceCore/OfflineCore.cs | 81 ServiceCore/TaskCore.cs | 33 Helpers/Dispatch/NDC.cs | 164 packages.config | 55 .vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/99192c56-0abe-4e3f-b3f8-5389c9d993a4.vsidx | 0 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/63862922-b742-4750-aa86-cb418279e110.vsidx | 0 Helpers/Dispatch/HostToAGV.cs | 550 +++ Controllers/WmsController.cs | 16 .vs/HH.WCS.Mobox3.Template.csproj.dtbcache.json | 1 Models/TN_Loc_Container.cs | 40 Helpers/HttpHelper.cs | 286 + Consts/AgvStateName.cs | 17 Consts/LockStateCode.cs | 14 Models/TN_WorkOrder.cs | 17 Services/DebugService.cs | 253 + Controllers/ErpController.cs | 18 App.config | 74 Helpers/Device/PlcHelper.cs | 100 Helpers/Dispatch/NDCHelper.cs | 81 Models/TN_CG_Detail.cs | 53 Helpers/ExprHelper.cs | 175 + 100 files changed, 10,490 insertions(+), 0 deletions(-) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fc9bad4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,178 @@ +锘縖*.cs] + +# Default severity for all analyzer diagnostics +dotnet_analyzer_diagnostic.severity = none + +# CS1591: 缂哄皯瀵瑰叕鍏卞彲瑙佺被鍨嬫垨鎴愬憳鐨�XML 娉ㄩ噴 +dotnet_diagnostic.CS1591.severity = none + +[*.cs] +#### 鍛藉悕鏍峰紡 #### + +# 鍛藉悕瑙勫垯 + +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.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 + +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.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 +csharp_using_directive_placement = outside_namespace:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_conditional_delegate_call = true:suggestion +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent +csharp_style_var_elsewhere = false:silent +csharp_space_around_binary_operators = before_and_after +csharp_indent_labels = one_less_than_current + +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = true +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = block_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_prefer_static_local_function = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion + +[*.vb] +#### 鍛藉悕鏍峰紡 #### + +# 鍛藉悕瑙勫垯 + +dotnet_naming_rule.interface_should_be_浠i_寮�.severity = suggestion +dotnet_naming_rule.interface_should_be_浠i_寮�.symbols = interface +dotnet_naming_rule.interface_should_be_浠i_寮�.style = 浠i_寮� + +dotnet_naming_rule.绫诲瀷_should_be_甯曟柉鍗℃嫾鍐欐硶.severity = suggestion +dotnet_naming_rule.绫诲瀷_should_be_甯曟柉鍗℃嫾鍐欐硶.symbols = 绫诲瀷 +dotnet_naming_rule.绫诲瀷_should_be_甯曟柉鍗℃嫾鍐欐硶.style = 甯曟柉鍗℃嫾鍐欐硶 + +dotnet_naming_rule.闈炲瓧娈垫垚鍛榑should_be_甯曟柉鍗℃嫾鍐欐硶.severity = suggestion +dotnet_naming_rule.闈炲瓧娈垫垚鍛榑should_be_甯曟柉鍗℃嫾鍐欐硶.symbols = 闈炲瓧娈垫垚鍛�+dotnet_naming_rule.闈炲瓧娈垫垚鍛榑should_be_甯曟柉鍗℃嫾鍐欐硶.style = 甯曟柉鍗℃嫾鍐欐硶 + +# 绗﹀彿瑙勮寖 + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.绫诲瀷.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.绫诲瀷.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected +dotnet_naming_symbols.绫诲瀷.required_modifiers = + +dotnet_naming_symbols.闈炲瓧娈垫垚鍛�applicable_kinds = property, event, method +dotnet_naming_symbols.闈炲瓧娈垫垚鍛�applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected +dotnet_naming_symbols.闈炲瓧娈垫垚鍛�required_modifiers = + +# 鍛藉悕鏍峰紡 + +dotnet_naming_style.浠i_寮�.required_prefix = I +dotnet_naming_style.浠i_寮�.required_suffix = +dotnet_naming_style.浠i_寮�.word_separator = +dotnet_naming_style.浠i_寮�.capitalization = pascal_case + +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.required_prefix = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.required_suffix = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.word_separator = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.capitalization = pascal_case + +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.required_prefix = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.required_suffix = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.word_separator = +dotnet_naming_style.甯曟柉鍗℃嫾鍐欐硶.capitalization = pascal_case + +[*.{cs,vb}] +end_of_line = crlf +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_event = false:silent +tab_width = 4 +indent_size = 4 +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_code_quality_unused_parameters = all:suggestion +dotnet_style_readonly_field = true:suggestion +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_allow_multiple_blank_lines_experimental = true:silent +dotnet_style_allow_statement_immediately_after_block_experimental = true:silent +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_namespace_match_folder = true:suggestion \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1c38a68..b1f62fa 100644 --- a/.gitignore +++ b/.gitignore @@ -161,6 +161,7 @@ *.pfx *.publishsettings node_modules/ +*.py # RIA/Silverlight projects Generated_Code/ diff --git a/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/b5d4cc0d-d072-4a06-b41d-eed5482c7ae2.vsidx b/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/b5d4cc0d-d072-4a06-b41d-eed5482c7ae2.vsidx new file mode 100644 index 0000000..05edd6d --- /dev/null +++ b/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/b5d4cc0d-d072-4a06-b41d-eed5482c7ae2.vsidx Binary files differ diff --git a/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/read.lock b/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vs/HH.WCS.JunzhouLangchao/FileContentIndex/read.lock diff --git a/.vs/HH.WCS.Langchao/FileContentIndex/095323c9-fab1-4a3d-bbb9-e016bdc026ba.vsidx b/.vs/HH.WCS.Langchao/FileContentIndex/095323c9-fab1-4a3d-bbb9-e016bdc026ba.vsidx new file mode 100644 index 0000000..71c525f --- /dev/null +++ b/.vs/HH.WCS.Langchao/FileContentIndex/095323c9-fab1-4a3d-bbb9-e016bdc026ba.vsidx Binary files differ diff --git a/.vs/HH.WCS.Langchao/FileContentIndex/4a385bfe-ecd2-4870-b27e-b29514f713d2.vsidx b/.vs/HH.WCS.Langchao/FileContentIndex/4a385bfe-ecd2-4870-b27e-b29514f713d2.vsidx new file mode 100644 index 0000000..621de9e --- /dev/null +++ b/.vs/HH.WCS.Langchao/FileContentIndex/4a385bfe-ecd2-4870-b27e-b29514f713d2.vsidx Binary files differ diff --git a/.vs/HH.WCS.Langchao/FileContentIndex/64fc2de3-4821-4c46-8f63-3c1f84a578ce.vsidx b/.vs/HH.WCS.Langchao/FileContentIndex/64fc2de3-4821-4c46-8f63-3c1f84a578ce.vsidx new file mode 100644 index 0000000..42ed048 --- /dev/null +++ b/.vs/HH.WCS.Langchao/FileContentIndex/64fc2de3-4821-4c46-8f63-3c1f84a578ce.vsidx Binary files differ diff --git a/.vs/HH.WCS.Langchao/FileContentIndex/read.lock b/.vs/HH.WCS.Langchao/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vs/HH.WCS.Langchao/FileContentIndex/read.lock diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/63862922-b742-4750-aa86-cb418279e110.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/63862922-b742-4750-aa86-cb418279e110.vsidx new file mode 100644 index 0000000..fcb8aa2 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/63862922-b742-4750-aa86-cb418279e110.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/8481878f-500a-4cd8-99a8-05771823e062.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/8481878f-500a-4cd8-99a8-05771823e062.vsidx new file mode 100644 index 0000000..fe96324 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/8481878f-500a-4cd8-99a8-05771823e062.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/f695590c-9e16-47ef-9fb0-255e7f2c0f7b.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/f695590c-9e16-47ef-9fb0-255e7f2c0f7b.vsidx new file mode 100644 index 0000000..9ef3ee7 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/f695590c-9e16-47ef-9fb0-255e7f2c0f7b.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/read.lock b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/read.lock diff --git a/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/99192c56-0abe-4e3f-b3f8-5389c9d993a4.vsidx b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/99192c56-0abe-4e3f-b3f8-5389c9d993a4.vsidx new file mode 100644 index 0000000..60b568e --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/99192c56-0abe-4e3f-b3f8-5389c9d993a4.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/9cdebdd3-1654-41dc-894c-c2dd9e6fc6e0.vsidx b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/9cdebdd3-1654-41dc-894c-c2dd9e6fc6e0.vsidx new file mode 100644 index 0000000..80ce873 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/9cdebdd3-1654-41dc-894c-c2dd9e6fc6e0.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/b73147f2-b5c8-4121-b1aa-5fa60c01a097.vsidx b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/b73147f2-b5c8-4121-b1aa-5fa60c01a097.vsidx new file mode 100644 index 0000000..371ed53 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/b73147f2-b5c8-4121-b1aa-5fa60c01a097.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/read.lock b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/read.lock diff --git a/.vs/HH.WCS.Mobox3.DSZSH/config/applicationhost.config b/.vs/HH.WCS.Mobox3.DSZSH/config/applicationhost.config new file mode 100644 index 0000000..cdd2df8 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/config/applicationhost.config @@ -0,0 +1,1026 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + IIS configuration sections. + + For schema documentation, see + %IIS_BIN%\config\schema\IIS_schema.xml. + + Please make a backup of this file before making any changes to it. + + NOTE: The following environment variables are available to be used + within this file and are understood by the IIS Express. + + %IIS_USER_HOME% - The IIS Express home directory for the user + %IIS_SITES_HOME% - The default home directory for sites + %IIS_BIN% - The location of the IIS Express binaries + %SYSTEMDRIVE% - The drive letter of %IIS_BIN% + +--> +<configuration> + + <!-- + + The <configSections> section controls the registration of sections. + Section is the basic unit of deployment, locking, searching and + containment for configuration settings. + + Every section belongs to one section group. + A section group is a container of logically-related sections. + + Sections cannot be nested. + Section groups may be nested. + + <section + name="" [Required, Collection Key] [XML name of the section] + allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set] + overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode] + allowLocation="true" [true|false] [Allowed in location tags] + /> + + The recommended way to unlock sections is by using a location tag: + <location path="Default Web Site" overrideMode="Allow"> + <system.webServer> + <asp /> + </system.webServer> + </location> + + --> + <configSections> + <sectionGroup name="system.applicationHost"> + <section name="applicationPools" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="configHistory" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="customMetadata" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="listenerAdapters" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="log" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="serviceAutoStartProviders" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="sites" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="webLimits" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + </sectionGroup> + + <sectionGroup name="system.webServer"> + <section name="asp" overrideModeDefault="Deny" /> + <section name="caching" overrideModeDefault="Allow" /> + <section name="cgi" overrideModeDefault="Deny" /> + <section name="defaultDocument" overrideModeDefault="Allow" /> + <section name="directoryBrowse" overrideModeDefault="Allow" /> + <section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="globalModules" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="handlers" overrideModeDefault="Deny" /> + <section name="httpCompression" overrideModeDefault="Allow" allowDefinition="Everywhere" /> + <section name="httpErrors" overrideModeDefault="Allow" /> + <section name="httpLogging" overrideModeDefault="Deny" /> + <section name="httpProtocol" overrideModeDefault="Allow" /> + <section name="httpRedirect" overrideModeDefault="Allow" /> + <section name="httpTracing" overrideModeDefault="Deny" /> + <section name="isapiFilters" allowDefinition="MachineToApplication" overrideModeDefault="Deny" /> + <section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" /> + <section name="applicationInitialization" allowDefinition="MachineToApplication" overrideModeDefault="Allow" /> + <section name="odbcLogging" overrideModeDefault="Deny" /> + <sectionGroup name="security"> + <section name="access" overrideModeDefault="Deny" /> + <section name="applicationDependencies" overrideModeDefault="Deny" /> + <sectionGroup name="authentication"> + <section name="anonymousAuthentication" overrideModeDefault="Deny" /> + <section name="basicAuthentication" overrideModeDefault="Deny" /> + <section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" /> + <section name="digestAuthentication" overrideModeDefault="Deny" /> + <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" /> + <section name="windowsAuthentication" overrideModeDefault="Deny" /> + </sectionGroup> + <section name="authorization" overrideModeDefault="Allow" /> + <section name="ipSecurity" overrideModeDefault="Deny" /> + <section name="dynamicIpSecurity" overrideModeDefault="Deny" /> + <section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> + <section name="requestFiltering" overrideModeDefault="Allow" /> + </sectionGroup> + <section name="serverRuntime" overrideModeDefault="Deny" /> + <section name="serverSideInclude" overrideModeDefault="Deny" /> + <section name="staticContent" overrideModeDefault="Allow" /> + <sectionGroup name="tracing"> + <section name="traceFailedRequests" overrideModeDefault="Allow" /> + <section name="traceProviderDefinitions" overrideModeDefault="Deny" /> + </sectionGroup> + <section name="urlCompression" overrideModeDefault="Allow" /> + <section name="validation" overrideModeDefault="Allow" /> + <sectionGroup name="webdav"> + <section name="globalSettings" overrideModeDefault="Deny" /> + <section name="authoring" overrideModeDefault="Deny" /> + <section name="authoringRules" overrideModeDefault="Deny" /> + </sectionGroup> + <sectionGroup name="rewrite"> + <section name="allowedServerVariables" overrideModeDefault="Deny" /> + <section name="rules" overrideModeDefault="Allow" /> + <section name="outboundRules" overrideModeDefault="Allow" /> + <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" /> + <section name="providers" overrideModeDefault="Allow" /> + <section name="rewriteMaps" overrideModeDefault="Allow" /> + </sectionGroup> + <section name="webSocket" overrideModeDefault="Deny" /> + <section name="aspNetCore" overrideModeDefault="Allow" /></sectionGroup> + </configSections> + + <configProtectedData> + <providers> + <add name="IISWASOnlyRsaProvider" type="" description="Uses RsaCryptoServiceProvider to encrypt and decrypt" keyContainerName="iisWasKey" cspProviderName="" useMachineContainer="true" useOAEP="false" /> + <add name="AesProvider" type="Microsoft.ApplicationHost.AesProtectedConfigurationProvider" description="Uses an AES session key to encrypt and decrypt" keyContainerName="iisConfigurationKey" cspProviderName="" useOAEP="false" useMachineContainer="true" sessionKey="AQIAAA5mAAAApAAA/HKxkz6alrlAPez0IUgujj/6k3WxCDriHp6jvpv3yEZmo7h6SMzGLxo4mTrIQVHSkB7tmElHKfUFTzE2BWF7nFWHY6Z6qmGBauFzwJMwESjril7Gjz69RBFH259HQ6aRDq9Xfx7U7H4HtdmnKNqGjgl/hwPQBGeIlWiDh+sYv3vKB0QU971tjX6H2B+9armlnC8UOuA6JYMDMI/VLLL16sng0fWAy5JYe0YVABVjiAWDW264RZW9Tr1Oax4qHZKg+SdjULxeOc2YmpX+d0yeITo1HkPF1hN1gHpIPIUDo05ilHUNfR3OkjVCIQK4cFKCq1s8NH+y+13MxUC4Fn1AlQ==" /> + <add name="IISWASOnlyAesProvider" type="Microsoft.ApplicationHost.AesProtectedConfigurationProvider" description="Uses an AES session key to encrypt and decrypt" keyContainerName="iisWasKey" cspProviderName="" useOAEP="false" useMachineContainer="true" sessionKey="AQIAAA5mAAAApAAALmU8lTC+v2qtfQiiiquvvLpUQqKLEXs+jSKoWCM/uPhyB++k4dwug19mGidNK5FYiWK2KYE1yhjVJcbp12E98Q0R2nT7eBiCMY2JairxQ591rqABK7keGaIjwH7PwGzSpILl3RJ4YFvJ/7ZXEJxeDZIjW8ZxWVXx+/VyHs9U3WguLEkgMUX3jrxJi8LouxaIVPJAv/YQ1ZCWs8zImitxX/C/7o7yaIxznfsN5nGQzQfpUDPeby99aw2zPVTtZI2LaWIBON8guABvZ6JtJVDWmfdK6sodbnwdZkr6/Z2rfvamT1dC1SpQrGG7ulR/f9/GXvCaW10ZVKxekBF/CYlNMg==" /> + </providers> + </configProtectedData> + + <system.applicationHost> + + <applicationPools> + <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> + <add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> + <add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> + <add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> + <add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" /> + <applicationPoolDefaults managedRuntimeVersion="v4.0"> + <processModel loadUserProfile="true" setProfileEnvironment="false" /> + </applicationPoolDefaults> + </applicationPools> + + <!-- + + The <listenerAdapters> section defines the protocols with which the + Windows Process Activation Service (WAS) binds. + + --> + <listenerAdapters> + <add name="http" /> + </listenerAdapters> + + <sites> + <site name="WebSite1" id="1" serverAutoStart="true"> + <application path="/"> + <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" /> + </application> + <bindings> + <binding protocol="http" bindingInformation=":8080:localhost" /> + </bindings> + </site> + <siteDefaults> + <!-- To enable logging, please change the below attribute "enabled" to "true" --> + <logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" /> + <traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" /> + </siteDefaults> + <applicationDefaults applicationPool="Clr4IntegratedAppPool" /> + <virtualDirectoryDefaults allowSubDirConfig="true" /> + </sites> + + <webLimits /> + + </system.applicationHost> + + <system.webServer> + + <serverRuntime /> + + <asp scriptErrorSentToBrowser="true"> + <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" /> + <limits /> + </asp> + + <caching enabled="true" enableKernelCache="true"> + </caching> + + <cgi /> + + <defaultDocument enabled="true"> + <files> + <add value="Default.htm" /> + <add value="Default.asp" /> + <add value="index.htm" /> + <add value="index.html" /> + <add value="iisstart.htm" /> + <add value="default.aspx" /> + </files> + </defaultDocument> + + <directoryBrowse enabled="false" /> + + <fastCgi /> + + <!-- + + The <globalModules> section defines all native-code modules. + To enable a module, specify it in the <modules> section. + + --> + <globalModules> + <add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" /> + <add name="UriCacheModule" image="%IIS_BIN%\cachuri.dll" /> + <add name="TokenCacheModule" image="%IIS_BIN%\cachtokn.dll" /> + <add name="DynamicCompressionModule" image="%IIS_BIN%\compdyn.dll" /> + <add name="StaticCompressionModule" image="%IIS_BIN%\compstat.dll" /> + <add name="DefaultDocumentModule" image="%IIS_BIN%\defdoc.dll" /> + <add name="DirectoryListingModule" image="%IIS_BIN%\dirlist.dll" /> + <add name="ProtocolSupportModule" image="%IIS_BIN%\protsup.dll" /> + <add name="HttpRedirectionModule" image="%IIS_BIN%\redirect.dll" /> + <add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" /> + <add name="StaticFileModule" image="%IIS_BIN%\static.dll" /> + <add name="AnonymousAuthenticationModule" image="%IIS_BIN%\authanon.dll" /> + <add name="CertificateMappingAuthenticationModule" image="%IIS_BIN%\authcert.dll" /> + <add name="UrlAuthorizationModule" image="%IIS_BIN%\urlauthz.dll" /> + <add name="BasicAuthenticationModule" image="%IIS_BIN%\authbas.dll" /> + <add name="WindowsAuthenticationModule" image="%IIS_BIN%\authsspi.dll" /> + <add name="IISCertificateMappingAuthenticationModule" image="%IIS_BIN%\authmap.dll" /> + <add name="IpRestrictionModule" image="%IIS_BIN%\iprestr.dll" /> + <add name="DynamicIpRestrictionModule" image="%IIS_BIN%\diprestr.dll" /> + <add name="RequestFilteringModule" image="%IIS_BIN%\modrqflt.dll" /> + <add name="CustomLoggingModule" image="%IIS_BIN%\logcust.dll" /> + <add name="CustomErrorModule" image="%IIS_BIN%\custerr.dll" /> + <add name="FailedRequestsTracingModule" image="%IIS_BIN%\iisfreb.dll" /> + <add name="RequestMonitorModule" image="%IIS_BIN%\iisreqs.dll" /> + <add name="IsapiModule" image="%IIS_BIN%\isapi.dll" /> + <add name="IsapiFilterModule" image="%IIS_BIN%\filter.dll" /> + <add name="CgiModule" image="%IIS_BIN%\cgi.dll" /> + <add name="FastCgiModule" image="%IIS_BIN%\iisfcgi.dll" /> +<!-- <add name="WebDAVModule" image="%IIS_BIN%\webdav.dll" /> --> + <add name="RewriteModule" image="%IIS_BIN%\rewrite.dll" /> + <add name="ConfigurationValidationModule" image="%IIS_BIN%\validcfg.dll" /> + <add name="WebSocketModule" image="%IIS_BIN%\iiswsock.dll" /> + <add name="WebMatrixSupportModule" image="%IIS_BIN%\webmatrixsup.dll" /> + <add name="ManagedEngine" image="%windir%\Microsoft.NET\Framework\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" /> + <add name="ManagedEngine64" image="%windir%\Microsoft.NET\Framework64\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness64" /> + <add name="ManagedEngineV4.0_32bit" image="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" /> + <add name="ManagedEngineV4.0_64bit" image="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" /> + <add name="ApplicationInitializationModule" image="%IIS_BIN%\warmup.dll" /> + <add name="AspNetCoreModule" image="%IIS_BIN%\aspnetcore.dll" /> + <add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" /> + </globalModules> + + <httpCompression directory="%TEMP%"> + <scheme name="gzip" dll="%IIS_BIN%\gzip.dll" /> + <dynamicTypes> + <add mimeType="text/*" enabled="true" /> + <add mimeType="message/*" enabled="true" /> + <add mimeType="application/x-javascript" enabled="true" /> + <add mimeType="application/javascript" enabled="true" /> + <add mimeType="*/*" enabled="false" /> + <add mimeType="text/event-stream" enabled="false" /> + </dynamicTypes> + <staticTypes> + <add mimeType="text/*" enabled="true" /> + <add mimeType="message/*" enabled="true" /> + <add mimeType="application/javascript" enabled="true" /> + <add mimeType="application/atom+xml" enabled="true" /> + <add mimeType="application/xaml+xml" enabled="true" /> + <add mimeType="image/svg+xml" enabled="true" /> + <add mimeType="*/*" enabled="false" /> + </staticTypes> + </httpCompression> + + <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath"> + <error statusCode="401" prefixLanguageFilePath="%IIS_BIN%\custerr" path="401.htm" /> + <error statusCode="403" prefixLanguageFilePath="%IIS_BIN%\custerr" path="403.htm" /> + <error statusCode="404" prefixLanguageFilePath="%IIS_BIN%\custerr" path="404.htm" /> + <error statusCode="405" prefixLanguageFilePath="%IIS_BIN%\custerr" path="405.htm" /> + <error statusCode="406" prefixLanguageFilePath="%IIS_BIN%\custerr" path="406.htm" /> + <error statusCode="412" prefixLanguageFilePath="%IIS_BIN%\custerr" path="412.htm" /> + <error statusCode="500" prefixLanguageFilePath="%IIS_BIN%\custerr" path="500.htm" /> + <error statusCode="501" prefixLanguageFilePath="%IIS_BIN%\custerr" path="501.htm" /> + <error statusCode="502" prefixLanguageFilePath="%IIS_BIN%\custerr" path="502.htm" /> + </httpErrors> + + <httpLogging dontLog="false" /> + + <httpProtocol> + <customHeaders> + <clear /> + <add name="X-Powered-By" value="ASP.NET" /> + </customHeaders> + <redirectHeaders> + <clear /> + </redirectHeaders> + </httpProtocol> + + <httpRedirect enabled="false" /> + + <httpTracing /> + + <isapiFilters> + <filter name="ASP.Net_2.0.50727-64" path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness64,runtimeVersionv2.0" /> + <filter name="ASP.Net_2.0.50727.0" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv2.0" /> + <filter name="ASP.Net_2.0_for_v1.1" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv1.1" /> + <filter name="ASP.Net_4.0_32bit" path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv4.0" /> + <filter name="ASP.Net_4.0_64bit" path="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="bitness64,runtimeVersionv4.0" /> + </isapiFilters> + + <odbcLogging /> + + <security> + + <access sslFlags="None" /> + + <applicationDependencies> + <application name="Active Server Pages" groupId="ASP" /> + </applicationDependencies> + + <authentication> + + <anonymousAuthentication enabled="true" userName="" /> + + <basicAuthentication enabled="false" /> + + <clientCertificateMappingAuthentication enabled="false" /> + + <digestAuthentication enabled="false" /> + + <iisClientCertificateMappingAuthentication enabled="false"> + </iisClientCertificateMappingAuthentication> + + <windowsAuthentication enabled="false"> + <providers> + <add value="Negotiate" /> + <add value="NTLM" /> + </providers> + </windowsAuthentication> + + </authentication> + + <authorization> + <add accessType="Allow" users="*" /> + </authorization> + + <ipSecurity allowUnlisted="true" /> + + <isapiCgiRestriction notListedIsapisAllowed="true" notListedCgisAllowed="true"> + <add path="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" allowed="true" groupId="ASP.NET_v4.0" description="ASP.NET_v4.0" /> + <add path="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" allowed="true" groupId="ASP.NET_v4.0" description="ASP.NET_v4.0" /> + <add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" /> + <add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" /> + </isapiCgiRestriction> + + <requestFiltering> + <fileExtensions allowUnlisted="true" applyToWebDAV="true"> + <add fileExtension=".asa" allowed="false" /> + <add fileExtension=".asax" allowed="false" /> + <add fileExtension=".ascx" allowed="false" /> + <add fileExtension=".master" allowed="false" /> + <add fileExtension=".skin" allowed="false" /> + <add fileExtension=".browser" allowed="false" /> + <add fileExtension=".sitemap" allowed="false" /> + <add fileExtension=".config" allowed="false" /> + <add fileExtension=".cs" allowed="false" /> + <add fileExtension=".csproj" allowed="false" /> + <add fileExtension=".vb" allowed="false" /> + <add fileExtension=".vbproj" allowed="false" /> + <add fileExtension=".webinfo" allowed="false" /> + <add fileExtension=".licx" allowed="false" /> + <add fileExtension=".resx" allowed="false" /> + <add fileExtension=".resources" allowed="false" /> + <add fileExtension=".mdb" allowed="false" /> + <add fileExtension=".vjsproj" allowed="false" /> + <add fileExtension=".java" allowed="false" /> + <add fileExtension=".jsl" allowed="false" /> + <add fileExtension=".ldb" allowed="false" /> + <add fileExtension=".dsdgm" allowed="false" /> + <add fileExtension=".ssdgm" allowed="false" /> + <add fileExtension=".lsad" allowed="false" /> + <add fileExtension=".ssmap" allowed="false" /> + <add fileExtension=".cd" allowed="false" /> + <add fileExtension=".dsprototype" allowed="false" /> + <add fileExtension=".lsaprototype" allowed="false" /> + <add fileExtension=".sdm" allowed="false" /> + <add fileExtension=".sdmDocument" allowed="false" /> + <add fileExtension=".mdf" allowed="false" /> + <add fileExtension=".ldf" allowed="false" /> + <add fileExtension=".ad" allowed="false" /> + <add fileExtension=".dd" allowed="false" /> + <add fileExtension=".ldd" allowed="false" /> + <add fileExtension=".sd" allowed="false" /> + <add fileExtension=".adprototype" allowed="false" /> + <add fileExtension=".lddprototype" allowed="false" /> + <add fileExtension=".exclude" allowed="false" /> + <add fileExtension=".refresh" allowed="false" /> + <add fileExtension=".compiled" allowed="false" /> + <add fileExtension=".msgx" allowed="false" /> + <add fileExtension=".vsdisco" allowed="false" /> + <add fileExtension=".rules" allowed="false" /> + </fileExtensions> + <verbs allowUnlisted="true" applyToWebDAV="true" /> + <hiddenSegments applyToWebDAV="true"> + <add segment="web.config" /> + <add segment="bin" /> + <add segment="App_code" /> + <add segment="App_GlobalResources" /> + <add segment="App_LocalResources" /> + <add segment="App_WebReferences" /> + <add segment="App_Data" /> + <add segment="App_Browsers" /> + </hiddenSegments> + </requestFiltering> + + </security> + + <serverSideInclude ssiExecDisable="false" /> + + <staticContent lockAttributes="isDocFooterFileName"> + <mimeMap fileExtension=".323" mimeType="text/h323" /> + <mimeMap fileExtension=".3g2" mimeType="video/3gpp2" /> + <mimeMap fileExtension=".3gp2" mimeType="video/3gpp2" /> + <mimeMap fileExtension=".3gp" mimeType="video/3gpp" /> + <mimeMap fileExtension=".3gpp" mimeType="video/3gpp" /> + <mimeMap fileExtension=".aac" mimeType="audio/aac" /> + <mimeMap fileExtension=".aaf" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".aca" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".accdb" mimeType="application/msaccess" /> + <mimeMap fileExtension=".accde" mimeType="application/msaccess" /> + <mimeMap fileExtension=".accdt" mimeType="application/msaccess" /> + <mimeMap fileExtension=".acx" mimeType="application/internet-property-stream" /> + <mimeMap fileExtension=".adt" mimeType="audio/vnd.dlna.adts" /> + <mimeMap fileExtension=".adts" mimeType="audio/vnd.dlna.adts" /> + <mimeMap fileExtension=".afm" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".ai" mimeType="application/postscript" /> + <mimeMap fileExtension=".aif" mimeType="audio/x-aiff" /> + <mimeMap fileExtension=".aifc" mimeType="audio/aiff" /> + <mimeMap fileExtension=".aiff" mimeType="audio/aiff" /> + <mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" /> + <mimeMap fileExtension=".application" mimeType="application/x-ms-application" /> + <mimeMap fileExtension=".art" mimeType="image/x-jg" /> + <mimeMap fileExtension=".asd" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".asf" mimeType="video/x-ms-asf" /> + <mimeMap fileExtension=".asi" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".asm" mimeType="text/plain" /> + <mimeMap fileExtension=".asr" mimeType="video/x-ms-asf" /> + <mimeMap fileExtension=".asx" mimeType="video/x-ms-asf" /> + <mimeMap fileExtension=".atom" mimeType="application/atom+xml" /> + <mimeMap fileExtension=".au" mimeType="audio/basic" /> + <mimeMap fileExtension=".avi" mimeType="video/avi" /> + <mimeMap fileExtension=".axs" mimeType="application/olescript" /> + <mimeMap fileExtension=".bas" mimeType="text/plain" /> + <mimeMap fileExtension=".bcpio" mimeType="application/x-bcpio" /> + <mimeMap fileExtension=".bin" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".bmp" mimeType="image/bmp" /> + <mimeMap fileExtension=".c" mimeType="text/plain" /> + <mimeMap fileExtension=".cab" mimeType="application/vnd.ms-cab-compressed" /> + <mimeMap fileExtension=".calx" mimeType="application/vnd.ms-office.calx" /> + <mimeMap fileExtension=".cat" mimeType="application/vnd.ms-pki.seccat" /> + <mimeMap fileExtension=".cdf" mimeType="application/x-cdf" /> + <mimeMap fileExtension=".chm" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".class" mimeType="application/x-java-applet" /> + <mimeMap fileExtension=".clp" mimeType="application/x-msclip" /> + <mimeMap fileExtension=".cmx" mimeType="image/x-cmx" /> + <mimeMap fileExtension=".cnf" mimeType="text/plain" /> + <mimeMap fileExtension=".cod" mimeType="image/cis-cod" /> + <mimeMap fileExtension=".cpio" mimeType="application/x-cpio" /> + <mimeMap fileExtension=".cpp" mimeType="text/plain" /> + <mimeMap fileExtension=".crd" mimeType="application/x-mscardfile" /> + <mimeMap fileExtension=".crl" mimeType="application/pkix-crl" /> + <mimeMap fileExtension=".crt" mimeType="application/x-x509-ca-cert" /> + <mimeMap fileExtension=".csh" mimeType="application/x-csh" /> + <mimeMap fileExtension=".css" mimeType="text/css" /> + <mimeMap fileExtension=".csv" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".cur" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".dcr" mimeType="application/x-director" /> + <mimeMap fileExtension=".deploy" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".der" mimeType="application/x-x509-ca-cert" /> + <mimeMap fileExtension=".dib" mimeType="image/bmp" /> + <mimeMap fileExtension=".dir" mimeType="application/x-director" /> + <mimeMap fileExtension=".disco" mimeType="text/xml" /> + <mimeMap fileExtension=".dll" mimeType="application/x-msdownload" /> + <mimeMap fileExtension=".dll.config" mimeType="text/xml" /> + <mimeMap fileExtension=".dlm" mimeType="text/dlm" /> + <mimeMap fileExtension=".doc" mimeType="application/msword" /> + <mimeMap fileExtension=".docm" mimeType="application/vnd.ms-word.document.macroEnabled.12" /> + <mimeMap fileExtension=".docx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" /> + <mimeMap fileExtension=".dot" mimeType="application/msword" /> + <mimeMap fileExtension=".dotm" mimeType="application/vnd.ms-word.template.macroEnabled.12" /> + <mimeMap fileExtension=".dotx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.template" /> + <mimeMap fileExtension=".dsp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".dtd" mimeType="text/xml" /> + <mimeMap fileExtension=".dvi" mimeType="application/x-dvi" /> + <mimeMap fileExtension=".dvr-ms" mimeType="video/x-ms-dvr" /> + <mimeMap fileExtension=".dwf" mimeType="drawing/x-dwf" /> + <mimeMap fileExtension=".dwp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".dxr" mimeType="application/x-director" /> + <mimeMap fileExtension=".eml" mimeType="message/rfc822" /> + <mimeMap fileExtension=".emz" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> + <mimeMap fileExtension=".eps" mimeType="application/postscript" /> + <mimeMap fileExtension=".esd" mimeType="application/vnd.ms-cab-compressed" /> + <mimeMap fileExtension=".etx" mimeType="text/x-setext" /> + <mimeMap fileExtension=".evy" mimeType="application/envoy" /> + <mimeMap fileExtension=".exe" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".exe.config" mimeType="text/xml" /> + <mimeMap fileExtension=".fdf" mimeType="application/vnd.fdf" /> + <mimeMap fileExtension=".fif" mimeType="application/fractals" /> + <mimeMap fileExtension=".fla" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".flr" mimeType="x-world/x-vrml" /> + <mimeMap fileExtension=".flv" mimeType="video/x-flv" /> + <mimeMap fileExtension=".gif" mimeType="image/gif" /> + <mimeMap fileExtension=".glb" mimeType="model/gltf-binary" /> + <mimeMap fileExtension=".gtar" mimeType="application/x-gtar" /> + <mimeMap fileExtension=".gz" mimeType="application/x-gzip" /> + <mimeMap fileExtension=".h" mimeType="text/plain" /> + <mimeMap fileExtension=".hdf" mimeType="application/x-hdf" /> + <mimeMap fileExtension=".hdml" mimeType="text/x-hdml" /> + <mimeMap fileExtension=".hhc" mimeType="application/x-oleobject" /> + <mimeMap fileExtension=".hhk" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".hhp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".hlp" mimeType="application/winhlp" /> + <mimeMap fileExtension=".hqx" mimeType="application/mac-binhex40" /> + <mimeMap fileExtension=".hta" mimeType="application/hta" /> + <mimeMap fileExtension=".htc" mimeType="text/x-component" /> + <mimeMap fileExtension=".htm" mimeType="text/html" /> + <mimeMap fileExtension=".html" mimeType="text/html" /> + <mimeMap fileExtension=".htt" mimeType="text/webviewhtml" /> + <mimeMap fileExtension=".hxt" mimeType="text/html" /> + <mimeMap fileExtension=".ico" mimeType="image/x-icon" /> + <mimeMap fileExtension=".ics" mimeType="text/calendar" /> + <mimeMap fileExtension=".ief" mimeType="image/ief" /> + <mimeMap fileExtension=".iii" mimeType="application/x-iphone" /> + <mimeMap fileExtension=".inf" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".ins" mimeType="application/x-internet-signup" /> + <mimeMap fileExtension=".isp" mimeType="application/x-internet-signup" /> + <mimeMap fileExtension=".IVF" mimeType="video/x-ivf" /> + <mimeMap fileExtension=".jar" mimeType="application/java-archive" /> + <mimeMap fileExtension=".java" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".jck" mimeType="application/liquidmotion" /> + <mimeMap fileExtension=".jcz" mimeType="application/liquidmotion" /> + <mimeMap fileExtension=".jfif" mimeType="image/pjpeg" /> + <mimeMap fileExtension=".jpb" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".jpe" mimeType="image/jpeg" /> + <mimeMap fileExtension=".jpeg" mimeType="image/jpeg" /> + <mimeMap fileExtension=".jpg" mimeType="image/jpeg" /> + <mimeMap fileExtension=".js" mimeType="application/javascript" /> + <mimeMap fileExtension=".json" mimeType="application/json" /> + <mimeMap fileExtension=".jsonld" mimeType="application/ld+json" /> + <mimeMap fileExtension=".jsx" mimeType="text/jscript" /> + <mimeMap fileExtension=".latex" mimeType="application/x-latex" /> + <mimeMap fileExtension=".less" mimeType="text/css" /> + <mimeMap fileExtension=".lit" mimeType="application/x-ms-reader" /> + <mimeMap fileExtension=".lpk" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".lsf" mimeType="video/x-la-asf" /> + <mimeMap fileExtension=".lsx" mimeType="video/x-la-asf" /> + <mimeMap fileExtension=".lzh" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".m13" mimeType="application/x-msmediaview" /> + <mimeMap fileExtension=".m14" mimeType="application/x-msmediaview" /> + <mimeMap fileExtension=".m1v" mimeType="video/mpeg" /> + <mimeMap fileExtension=".m2ts" mimeType="video/vnd.dlna.mpeg-tts" /> + <mimeMap fileExtension=".m3u" mimeType="audio/x-mpegurl" /> + <mimeMap fileExtension=".m4a" mimeType="audio/mp4" /> + <mimeMap fileExtension=".m4v" mimeType="video/mp4" /> + <mimeMap fileExtension=".man" mimeType="application/x-troff-man" /> + <mimeMap fileExtension=".manifest" mimeType="application/x-ms-manifest" /> + <mimeMap fileExtension=".map" mimeType="text/plain" /> + <mimeMap fileExtension=".mdb" mimeType="application/x-msaccess" /> + <mimeMap fileExtension=".mdp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".me" mimeType="application/x-troff-me" /> + <mimeMap fileExtension=".mht" mimeType="message/rfc822" /> + <mimeMap fileExtension=".mhtml" mimeType="message/rfc822" /> + <mimeMap fileExtension=".mid" mimeType="audio/mid" /> + <mimeMap fileExtension=".midi" mimeType="audio/mid" /> + <mimeMap fileExtension=".mix" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".mmf" mimeType="application/x-smaf" /> + <mimeMap fileExtension=".mno" mimeType="text/xml" /> + <mimeMap fileExtension=".mny" mimeType="application/x-msmoney" /> + <mimeMap fileExtension=".mov" mimeType="video/quicktime" /> + <mimeMap fileExtension=".movie" mimeType="video/x-sgi-movie" /> + <mimeMap fileExtension=".mp2" mimeType="video/mpeg" /> + <mimeMap fileExtension=".mp3" mimeType="audio/mpeg" /> + <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> + <mimeMap fileExtension=".mp4v" mimeType="video/mp4" /> + <mimeMap fileExtension=".mpa" mimeType="video/mpeg" /> + <mimeMap fileExtension=".mpe" mimeType="video/mpeg" /> + <mimeMap fileExtension=".mpeg" mimeType="video/mpeg" /> + <mimeMap fileExtension=".mpg" mimeType="video/mpeg" /> + <mimeMap fileExtension=".mpp" mimeType="application/vnd.ms-project" /> + <mimeMap fileExtension=".mpv2" mimeType="video/mpeg" /> + <mimeMap fileExtension=".ms" mimeType="application/x-troff-ms" /> + <mimeMap fileExtension=".msi" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".mso" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".mvb" mimeType="application/x-msmediaview" /> + <mimeMap fileExtension=".mvc" mimeType="application/x-miva-compiled" /> + <mimeMap fileExtension=".nc" mimeType="application/x-netcdf" /> + <mimeMap fileExtension=".nsc" mimeType="video/x-ms-asf" /> + <mimeMap fileExtension=".nws" mimeType="message/rfc822" /> + <mimeMap fileExtension=".ocx" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".oda" mimeType="application/oda" /> + <mimeMap fileExtension=".odc" mimeType="text/x-ms-odc" /> + <mimeMap fileExtension=".ods" mimeType="application/oleobject" /> + <mimeMap fileExtension=".oga" mimeType="audio/ogg" /> + <mimeMap fileExtension=".ogg" mimeType="video/ogg" /> + <mimeMap fileExtension=".ogv" mimeType="video/ogg" /> + <mimeMap fileExtension=".one" mimeType="application/onenote" /> + <mimeMap fileExtension=".onea" mimeType="application/onenote" /> + <mimeMap fileExtension=".onetoc" mimeType="application/onenote" /> + <mimeMap fileExtension=".onetoc2" mimeType="application/onenote" /> + <mimeMap fileExtension=".onetmp" mimeType="application/onenote" /> + <mimeMap fileExtension=".onepkg" mimeType="application/onenote" /> + <mimeMap fileExtension=".osdx" mimeType="application/opensearchdescription+xml" /> + <mimeMap fileExtension=".otf" mimeType="font/otf" /> + <mimeMap fileExtension=".p10" mimeType="application/pkcs10" /> + <mimeMap fileExtension=".p12" mimeType="application/x-pkcs12" /> + <mimeMap fileExtension=".p7b" mimeType="application/x-pkcs7-certificates" /> + <mimeMap fileExtension=".p7c" mimeType="application/pkcs7-mime" /> + <mimeMap fileExtension=".p7m" mimeType="application/pkcs7-mime" /> + <mimeMap fileExtension=".p7r" mimeType="application/x-pkcs7-certreqresp" /> + <mimeMap fileExtension=".p7s" mimeType="application/pkcs7-signature" /> + <mimeMap fileExtension=".pbm" mimeType="image/x-portable-bitmap" /> + <mimeMap fileExtension=".pcx" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".pcz" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".pdf" mimeType="application/pdf" /> + <mimeMap fileExtension=".pfb" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".pfm" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".pfx" mimeType="application/x-pkcs12" /> + <mimeMap fileExtension=".pgm" mimeType="image/x-portable-graymap" /> + <mimeMap fileExtension=".pko" mimeType="application/vnd.ms-pki.pko" /> + <mimeMap fileExtension=".pma" mimeType="application/x-perfmon" /> + <mimeMap fileExtension=".pmc" mimeType="application/x-perfmon" /> + <mimeMap fileExtension=".pml" mimeType="application/x-perfmon" /> + <mimeMap fileExtension=".pmr" mimeType="application/x-perfmon" /> + <mimeMap fileExtension=".pmw" mimeType="application/x-perfmon" /> + <mimeMap fileExtension=".png" mimeType="image/png" /> + <mimeMap fileExtension=".pnm" mimeType="image/x-portable-anymap" /> + <mimeMap fileExtension=".pnz" mimeType="image/png" /> + <mimeMap fileExtension=".pot" mimeType="application/vnd.ms-powerpoint" /> + <mimeMap fileExtension=".potm" mimeType="application/vnd.ms-powerpoint.template.macroEnabled.12" /> + <mimeMap fileExtension=".potx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.template" /> + <mimeMap fileExtension=".ppam" mimeType="application/vnd.ms-powerpoint.addin.macroEnabled.12" /> + <mimeMap fileExtension=".ppm" mimeType="image/x-portable-pixmap" /> + <mimeMap fileExtension=".pps" mimeType="application/vnd.ms-powerpoint" /> + <mimeMap fileExtension=".ppsm" mimeType="application/vnd.ms-powerpoint.slideshow.macroEnabled.12" /> + <mimeMap fileExtension=".ppsx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow" /> + <mimeMap fileExtension=".ppt" mimeType="application/vnd.ms-powerpoint" /> + <mimeMap fileExtension=".pptm" mimeType="application/vnd.ms-powerpoint.presentation.macroEnabled.12" /> + <mimeMap fileExtension=".pptx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation" /> + <mimeMap fileExtension=".prf" mimeType="application/pics-rules" /> + <mimeMap fileExtension=".prm" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".prx" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".ps" mimeType="application/postscript" /> + <mimeMap fileExtension=".psd" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".psm" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".psp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".pub" mimeType="application/x-mspublisher" /> + <mimeMap fileExtension=".qt" mimeType="video/quicktime" /> + <mimeMap fileExtension=".qtl" mimeType="application/x-quicktimeplayer" /> + <mimeMap fileExtension=".qxd" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".ra" mimeType="audio/x-pn-realaudio" /> + <mimeMap fileExtension=".ram" mimeType="audio/x-pn-realaudio" /> + <mimeMap fileExtension=".rar" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".ras" mimeType="image/x-cmu-raster" /> + <mimeMap fileExtension=".rf" mimeType="image/vnd.rn-realflash" /> + <mimeMap fileExtension=".rgb" mimeType="image/x-rgb" /> + <mimeMap fileExtension=".rm" mimeType="application/vnd.rn-realmedia" /> + <mimeMap fileExtension=".rmi" mimeType="audio/mid" /> + <mimeMap fileExtension=".roff" mimeType="application/x-troff" /> + <mimeMap fileExtension=".rpm" mimeType="audio/x-pn-realaudio-plugin" /> + <mimeMap fileExtension=".rtf" mimeType="application/rtf" /> + <mimeMap fileExtension=".rtx" mimeType="text/richtext" /> + <mimeMap fileExtension=".scd" mimeType="application/x-msschedule" /> + <mimeMap fileExtension=".sct" mimeType="text/scriptlet" /> + <mimeMap fileExtension=".sea" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".setpay" mimeType="application/set-payment-initiation" /> + <mimeMap fileExtension=".setreg" mimeType="application/set-registration-initiation" /> + <mimeMap fileExtension=".sgml" mimeType="text/sgml" /> + <mimeMap fileExtension=".sh" mimeType="application/x-sh" /> + <mimeMap fileExtension=".shar" mimeType="application/x-shar" /> + <mimeMap fileExtension=".sit" mimeType="application/x-stuffit" /> + <mimeMap fileExtension=".sldm" mimeType="application/vnd.ms-powerpoint.slide.macroEnabled.12" /> + <mimeMap fileExtension=".sldx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slide" /> + <mimeMap fileExtension=".smd" mimeType="audio/x-smd" /> + <mimeMap fileExtension=".smi" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".smx" mimeType="audio/x-smd" /> + <mimeMap fileExtension=".smz" mimeType="audio/x-smd" /> + <mimeMap fileExtension=".snd" mimeType="audio/basic" /> + <mimeMap fileExtension=".snp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".spc" mimeType="application/x-pkcs7-certificates" /> + <mimeMap fileExtension=".spl" mimeType="application/futuresplash" /> + <mimeMap fileExtension=".spx" mimeType="audio/ogg" /> + <mimeMap fileExtension=".src" mimeType="application/x-wais-source" /> + <mimeMap fileExtension=".ssm" mimeType="application/streamingmedia" /> + <mimeMap fileExtension=".sst" mimeType="application/vnd.ms-pki.certstore" /> + <mimeMap fileExtension=".stl" mimeType="application/vnd.ms-pki.stl" /> + <mimeMap fileExtension=".sv4cpio" mimeType="application/x-sv4cpio" /> + <mimeMap fileExtension=".sv4crc" mimeType="application/x-sv4crc" /> + <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> + <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" /> + <mimeMap fileExtension=".swf" mimeType="application/x-shockwave-flash" /> + <mimeMap fileExtension=".t" mimeType="application/x-troff" /> + <mimeMap fileExtension=".tar" mimeType="application/x-tar" /> + <mimeMap fileExtension=".tcl" mimeType="application/x-tcl" /> + <mimeMap fileExtension=".tex" mimeType="application/x-tex" /> + <mimeMap fileExtension=".texi" mimeType="application/x-texinfo" /> + <mimeMap fileExtension=".texinfo" mimeType="application/x-texinfo" /> + <mimeMap fileExtension=".tgz" mimeType="application/x-compressed" /> + <mimeMap fileExtension=".thmx" mimeType="application/vnd.ms-officetheme" /> + <mimeMap fileExtension=".thn" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".tif" mimeType="image/tiff" /> + <mimeMap fileExtension=".tiff" mimeType="image/tiff" /> + <mimeMap fileExtension=".toc" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".tr" mimeType="application/x-troff" /> + <mimeMap fileExtension=".trm" mimeType="application/x-msterminal" /> + <mimeMap fileExtension=".ts" mimeType="video/vnd.dlna.mpeg-tts" /> + <mimeMap fileExtension=".tsv" mimeType="text/tab-separated-values" /> + <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".tts" mimeType="video/vnd.dlna.mpeg-tts" /> + <mimeMap fileExtension=".txt" mimeType="text/plain" /> + <mimeMap fileExtension=".u32" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".uls" mimeType="text/iuls" /> + <mimeMap fileExtension=".ustar" mimeType="application/x-ustar" /> + <mimeMap fileExtension=".vbs" mimeType="text/vbscript" /> + <mimeMap fileExtension=".vcf" mimeType="text/x-vcard" /> + <mimeMap fileExtension=".vcs" mimeType="text/plain" /> + <mimeMap fileExtension=".vdx" mimeType="application/vnd.ms-visio.viewer" /> + <mimeMap fileExtension=".vml" mimeType="text/xml" /> + <mimeMap fileExtension=".vsd" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".vss" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".vst" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".vsto" mimeType="application/x-ms-vsto" /> + <mimeMap fileExtension=".vsw" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".vsx" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".vtx" mimeType="application/vnd.visio" /> + <mimeMap fileExtension=".wasm" mimeType="application/wasm" /> + <mimeMap fileExtension=".wav" mimeType="audio/wav" /> + <mimeMap fileExtension=".wax" mimeType="audio/x-ms-wax" /> + <mimeMap fileExtension=".wbmp" mimeType="image/vnd.wap.wbmp" /> + <mimeMap fileExtension=".wcm" mimeType="application/vnd.ms-works" /> + <mimeMap fileExtension=".wdb" mimeType="application/vnd.ms-works" /> + <mimeMap fileExtension=".webm" mimeType="video/webm" /> + <mimeMap fileExtension=".wks" mimeType="application/vnd.ms-works" /> + <mimeMap fileExtension=".wm" mimeType="video/x-ms-wm" /> + <mimeMap fileExtension=".wma" mimeType="audio/x-ms-wma" /> + <mimeMap fileExtension=".wmd" mimeType="application/x-ms-wmd" /> + <mimeMap fileExtension=".wmf" mimeType="application/x-msmetafile" /> + <mimeMap fileExtension=".wml" mimeType="text/vnd.wap.wml" /> + <mimeMap fileExtension=".wmlc" mimeType="application/vnd.wap.wmlc" /> + <mimeMap fileExtension=".wmls" mimeType="text/vnd.wap.wmlscript" /> + <mimeMap fileExtension=".wmlsc" mimeType="application/vnd.wap.wmlscriptc" /> + <mimeMap fileExtension=".wmp" mimeType="video/x-ms-wmp" /> + <mimeMap fileExtension=".wmv" mimeType="video/x-ms-wmv" /> + <mimeMap fileExtension=".wmx" mimeType="video/x-ms-wmx" /> + <mimeMap fileExtension=".wmz" mimeType="application/x-ms-wmz" /> + <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> + <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> + <mimeMap fileExtension=".wps" mimeType="application/vnd.ms-works" /> + <mimeMap fileExtension=".wri" mimeType="application/x-mswrite" /> + <mimeMap fileExtension=".wrl" mimeType="x-world/x-vrml" /> + <mimeMap fileExtension=".wrz" mimeType="x-world/x-vrml" /> + <mimeMap fileExtension=".wsdl" mimeType="text/xml" /> + <mimeMap fileExtension=".wtv" mimeType="video/x-ms-wtv" /> + <mimeMap fileExtension=".wvx" mimeType="video/x-ms-wvx" /> + <mimeMap fileExtension=".x" mimeType="application/directx" /> + <mimeMap fileExtension=".xaf" mimeType="x-world/x-vrml" /> + <mimeMap fileExtension=".xaml" mimeType="application/xaml+xml" /> + <mimeMap fileExtension=".xap" mimeType="application/x-silverlight-app" /> + <mimeMap fileExtension=".xbap" mimeType="application/x-ms-xbap" /> + <mimeMap fileExtension=".xbm" mimeType="image/x-xbitmap" /> + <mimeMap fileExtension=".xdr" mimeType="text/plain" /> + <mimeMap fileExtension=".xht" mimeType="application/xhtml+xml" /> + <mimeMap fileExtension=".xhtml" mimeType="application/xhtml+xml" /> + <mimeMap fileExtension=".xla" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xlam" mimeType="application/vnd.ms-excel.addin.macroEnabled.12" /> + <mimeMap fileExtension=".xlc" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xlm" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xls" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xlsb" mimeType="application/vnd.ms-excel.sheet.binary.macroEnabled.12" /> + <mimeMap fileExtension=".xlsm" mimeType="application/vnd.ms-excel.sheet.macroEnabled.12" /> + <mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" /> + <mimeMap fileExtension=".xlt" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xltm" mimeType="application/vnd.ms-excel.template.macroEnabled.12" /> + <mimeMap fileExtension=".xltx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.template" /> + <mimeMap fileExtension=".xlw" mimeType="application/vnd.ms-excel" /> + <mimeMap fileExtension=".xml" mimeType="text/xml" /> + <mimeMap fileExtension=".xof" mimeType="x-world/x-vrml" /> + <mimeMap fileExtension=".xpm" mimeType="image/x-xpixmap" /> + <mimeMap fileExtension=".xps" mimeType="application/vnd.ms-xpsdocument" /> + <mimeMap fileExtension=".xsd" mimeType="text/xml" /> + <mimeMap fileExtension=".xsf" mimeType="text/xml" /> + <mimeMap fileExtension=".xsl" mimeType="text/xml" /> + <mimeMap fileExtension=".xslt" mimeType="text/xml" /> + <mimeMap fileExtension=".xsn" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".xtp" mimeType="application/octet-stream" /> + <mimeMap fileExtension=".xwd" mimeType="image/x-xwindowdump" /> + <mimeMap fileExtension=".z" mimeType="application/x-compress" /> + <mimeMap fileExtension=".zip" mimeType="application/x-zip-compressed" /> + </staticContent> + + <tracing> + + <traceFailedRequests> + <add path="*"> + <traceAreas> + <add provider="ASP" verbosity="Verbose" /> + <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" /> + <add provider="ISAPI Extension" verbosity="Verbose" /> + <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,Rewrite,WebSocket" verbosity="Verbose" /> + </traceAreas> + <failureDefinitions statusCodes="200-999" /> + </add> + </traceFailedRequests> + + <traceProviderDefinitions> + <add name="WWW Server" guid="{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}"> + <areas> + <clear /> + <add name="Authentication" value="2" /> + <add name="Security" value="4" /> + <add name="Filter" value="8" /> + <add name="StaticFile" value="16" /> + <add name="CGI" value="32" /> + <add name="Compression" value="64" /> + <add name="Cache" value="128" /> + <add name="RequestNotifications" value="256" /> + <add name="Module" value="512" /> + <add name="Rewrite" value="1024" /> + <add name="FastCGI" value="4096" /> + <add name="WebSocket" value="16384" /> + <add name="ANCM" value="65536" /> + </areas> + </add> + <add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}"> + <areas> + <clear /> + </areas> + </add> + <add name="ISAPI Extension" guid="{a1c2040e-8840-4c31-ba11-9871031a19ea}"> + <areas> + <clear /> + </areas> + </add> + <add name="ASPNET" guid="{AFF081FE-0247-4275-9C4E-021F3DC1DA35}"> + <areas> + <add name="Infrastructure" value="1" /> + <add name="Module" value="2" /> + <add name="Page" value="4" /> + <add name="AppServices" value="8" /> + </areas> + </add> + </traceProviderDefinitions> + + </tracing> + + <urlCompression /> + + <validation /> + <webdav> + <globalSettings> + <propertyStores> + <add name="webdav_simple_prop" image="%IIS_BIN%\webdav_simple_prop.dll" image32="%IIS_BIN%\webdav_simple_prop.dll" /> + </propertyStores> + <lockStores> + <add name="webdav_simple_lock" image="%IIS_BIN%\webdav_simple_lock.dll" image32="%IIS_BIN%\webdav_simple_lock.dll" /> + </lockStores> + + </globalSettings> + <authoring> + <locks enabled="true" lockStore="webdav_simple_lock" /> + </authoring> + <authoringRules /> + </webdav> + <webSocket /> + <applicationInitialization /> + + </system.webServer> + <location path="" overrideMode="Allow"> + <system.webServer> + <modules> + <add name="IsapiFilterModule" lockItem="true" /> + <add name="BasicAuthenticationModule" lockItem="true" /> + <add name="IsapiModule" lockItem="true" /> + <add name="HttpLoggingModule" lockItem="true" /> + <add name="DynamicCompressionModule" lockItem="true" /> + <add name="StaticCompressionModule" lockItem="true" /> + <add name="DefaultDocumentModule" lockItem="true" /> + <add name="DirectoryListingModule" lockItem="true" /> + <add name="ProtocolSupportModule" lockItem="true" /> + <add name="HttpRedirectionModule" lockItem="true" /> + <add name="ServerSideIncludeModule" lockItem="true" /> + <add name="StaticFileModule" lockItem="true" /> + <add name="AnonymousAuthenticationModule" lockItem="true" /> + <add name="CertificateMappingAuthenticationModule" lockItem="true" /> + <add name="UrlAuthorizationModule" lockItem="true" /> + <add name="WindowsAuthenticationModule" lockItem="true" /> + <add name="IISCertificateMappingAuthenticationModule" lockItem="true" /> + <add name="WebMatrixSupportModule" lockItem="true" /> + <add name="IpRestrictionModule" lockItem="true" /> + <add name="DynamicIpRestrictionModule" lockItem="true" /> + <add name="RequestFilteringModule" lockItem="true" /> + <add name="CustomLoggingModule" lockItem="true" /> + <add name="CustomErrorModule" lockItem="true" /> + <add name="FailedRequestsTracingModule" lockItem="true" /> + <add name="CgiModule" lockItem="true" /> + <add name="FastCgiModule" lockItem="true" /> +<!-- <add name="WebDAVModule" /> --> + <add name="RewriteModule" /> + <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" preCondition="managedHandler" /> + <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="managedHandler" /> + <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" preCondition="managedHandler" /> + <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="managedHandler" /> + <add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" preCondition="managedHandler" /> + <add name="RoleManager" type="System.Web.Security.RoleManagerModule" preCondition="managedHandler" /> + <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" preCondition="managedHandler" /> + <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" preCondition="managedHandler" /> + <add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" preCondition="managedHandler" /> + <add name="Profile" type="System.Web.Profile.ProfileModule" preCondition="managedHandler" /> + <add name="UrlMappingsModule" type="System.Web.UrlMappingsModule" preCondition="managedHandler" /> + <add name="ApplicationInitializationModule" lockItem="true" /> + <add name="WebSocketModule" lockItem="true" /> + <add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule,System.ServiceModel.Activation,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" /> + <add name="ConfigurationValidationModule" lockItem="true" /> + <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler,runtimeVersionv4.0" /> + <add name="ScriptModule-4.0" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" /> + <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" /> + <add name="AspNetCoreModule" lockItem="true" /> + <add name="AspNetCoreModuleV2" lockItem="true" /> + </modules> + <handlers accessPolicy="Read, Script"> +<!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> --> + <add name="AXD-ISAPI-4.0_64bit" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="PageHandlerFactory-ISAPI-4.0_64bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="SimpleHandlerFactory-ISAPI-4.0_64bit" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="WebServiceHandlerFactory-ISAPI-4.0_64bit" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-rem-ISAPI-4.0_64bit" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-soap-ISAPI-4.0_64bit" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="svc-ISAPI-4.0_64bit" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" /> + <add name="rules-ISAPI-4.0_64bit" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" /> + <add name="xoml-ISAPI-4.0_64bit" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" /> + <add name="xamlx-ISAPI-4.0_64bit" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" /> + <add name="aspq-ISAPI-4.0_64bit" path="*.aspq" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="cshtm-ISAPI-4.0_64bit" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="cshtml-ISAPI-4.0_64bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="vbhtm-ISAPI-4.0_64bit" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="vbhtml-ISAPI-4.0_64bit" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" /> + <add name="xoml-Integrated" path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="xoml-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" /> + <add name="rules-Integrated" path="*.rules" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="rules-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" /> + <add name="AXD-ISAPI-4.0_32bit" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="PageHandlerFactory-ISAPI-4.0_32bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="SimpleHandlerFactory-ISAPI-4.0_32bit" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="WebServiceHandlerFactory-ISAPI-4.0_32bit" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-rem-ISAPI-4.0_32bit" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-soap-ISAPI-4.0_32bit" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="svc-ISAPI-4.0_32bit" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> + <add name="rules-ISAPI-4.0_32bit" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> + <add name="xoml-ISAPI-4.0_32bit" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> + <add name="xamlx-ISAPI-4.0_32bit" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" /> + <add name="aspq-ISAPI-4.0_32bit" path="*.aspq" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="cshtm-ISAPI-4.0_32bit" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="cshtml-ISAPI-4.0_32bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="vbhtm-ISAPI-4.0_32bit" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="vbhtml-ISAPI-4.0_32bit" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="TraceHandler-Integrated-4.0" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="WebAdminHandler-Integrated-4.0" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="AssemblyResourceLoader-Integrated-4.0" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="PageHandlerFactory-Integrated-4.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="WebServiceHandlerFactory-Integrated-4.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="HttpRemotingHandlerFactory-rem-Integrated-4.0" path="*.rem" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="HttpRemotingHandlerFactory-soap-Integrated-4.0" path="*.soap" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="svc-Integrated-4.0" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="rules-Integrated-4.0" path="*.rules" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="xoml-Integrated-4.0" path="*.xoml" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="xamlx-Integrated-4.0" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" type="System.Xaml.Hosting.XamlHttpHandlerFactory, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="aspq-Integrated-4.0" path="*.aspq" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="cshtm-Integrated-4.0" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="cshtml-Integrated-4.0" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="vbhtm-Integrated-4.0" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="vbhtml-Integrated-4.0" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="ScriptHandlerFactoryAppServices-Integrated-4.0" path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="ScriptResourceIntegrated-4.0" path="*ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode,runtimeVersionv4.0" /> + <add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" resourceType="File" /> + <add name="SecurityCertificate" path="*.cer" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" resourceType="File" /> + <add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" /> + <add name="TraceHandler-Integrated" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="WebAdminHandler-Integrated" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="AssemblyResourceLoader-Integrated" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="PageHandlerFactory-Integrated" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="WebServiceHandlerFactory-Integrated" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Services.Protocols.WebServiceHandlerFactory,System.Web.Services,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="HttpRemotingHandlerFactory-rem-Integrated" path="*.rem" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,System.Runtime.Remoting,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="HttpRemotingHandlerFactory-soap-Integrated" path="*.soap" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,System.Runtime.Remoting,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" /> + <add name="AXD-ISAPI-2.0" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="SimpleHandlerFactory-ISAPI-2.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="WebServiceHandlerFactory-ISAPI-2.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-rem-ISAPI-2.0" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-soap-ISAPI-2.0" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> + <add name="svc-ISAPI-2.0-64" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" /> + <add name="AXD-ISAPI-2.0-64" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="SimpleHandlerFactory-ISAPI-2.0-64" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="WebServiceHandlerFactory-ISAPI-2.0-64" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-rem-ISAPI-2.0-64" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="HttpRemotingHandlerFactory-soap-ISAPI-2.0-64" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" /> + <add name="rules-64-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" /> + <add name="xoml-64-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" /> + <add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" /> + <add name="SSINC-stm" path="*.stm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" /> + <add name="SSINC-shtm" path="*.shtm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" /> + <add name="SSINC-shtml" path="*.shtml" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" /> + <add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" /> + <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" /> + <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> + <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> + <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" /> + <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> + </handlers> + </system.webServer> + </location> +</configuration> diff --git a/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/000.testlog b/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/000.testlog new file mode 100644 index 0000000..b0cab18 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/000.testlog Binary files differ diff --git a/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/testlog.manifest b/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/testlog.manifest new file mode 100644 index 0000000..e92ede2 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.DSZSH/v17/TestStore/0/testlog.manifest Binary files differ diff --git a/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/3911a5fd-5b86-4edf-85b1-ca6ed438a43d.vsidx b/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/3911a5fd-5b86-4edf-85b1-ca6ed438a43d.vsidx new file mode 100644 index 0000000..4e00dab --- /dev/null +++ b/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/3911a5fd-5b86-4edf-85b1-ca6ed438a43d.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/read.lock b/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.LNYKAG/FileContentIndex/read.lock diff --git a/.vs/HH.WCS.Mobox3.Template.csproj.dtbcache.json b/.vs/HH.WCS.Mobox3.Template.csproj.dtbcache.json new file mode 100644 index 0000000..e552514 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.Template.csproj.dtbcache.json @@ -0,0 +1 @@ +{"RootPath":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\HH.WCS.Mobox3.Template","ProjectFileName":"HH.WCS.Mobox3.Template.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"api\\MoboxController.cs"},{"SourceFile":"api\\AgvController.cs"},{"SourceFile":"api\\ApiModel.cs"},{"SourceFile":"core\\WMSCore.cs"},{"SourceFile":"device\\ModbusHelper.cs"},{"SourceFile":"device\\PlcHelper.cs"},{"SourceFile":"device\\TcpClient.cs"},{"SourceFile":"device\\TcpServer.cs"},{"SourceFile":"dispatch\\GZRobot.cs"},{"SourceFile":"dispatch\\NDC.cs"},{"SourceFile":"core\\Monitor.cs"},{"SourceFile":"models\\BaseModel.cs"},{"SourceFile":"models\\Area.cs"},{"SourceFile":"models\\TN_ASN_Detail.cs"},{"SourceFile":"models\\TN_ASN_Order.cs"},{"SourceFile":"models\\TN_AZ_Inventory.cs"},{"SourceFile":"models\\TN_Business_Source.cs"},{"SourceFile":"models\\CntrItemRel.cs"},{"SourceFile":"models\\TN_Check_Detail.cs"},{"SourceFile":"models\\TN_Check_List.cs"},{"SourceFile":"models\\TN_Check_Order.cs"},{"SourceFile":"models\\Container.cs"},{"SourceFile":"models\\TN_Container_Good.cs"},{"SourceFile":"models\\TN_Equipment.cs"},{"SourceFile":"models\\TN_Factory.cs"},{"SourceFile":"models\\TN_Function_Area.cs"},{"SourceFile":"models\\TN_Inspect_Detail.cs"},{"SourceFile":"models\\TN_Inspect_Order.cs"},{"SourceFile":"models\\TN_Inspect_Record.cs"},{"SourceFile":"models\\TN_LC_Log.cs"},{"SourceFile":"models\\Location.cs"},{"SourceFile":"models\\TN_Lock.cs"},{"SourceFile":"models\\LocCntrRel.cs"},{"SourceFile":"models\\TN_Loc_EQ_Link.cs"},{"SourceFile":"models\\TN_Material.cs"},{"SourceFile":"models\\TN_MQ_EQAction.cs"},{"SourceFile":"models\\TN_MQ_EQAction_Msg.cs"},{"SourceFile":"models\\TN_OnOff_Shelves.cs"},{"SourceFile":"models\\TN_OOS_Detail.cs"},{"SourceFile":"models\\TN_OOS_Order.cs"},{"SourceFile":"models\\WMSTask.cs"},{"SourceFile":"models\\TN_Outbound_Detail.cs"},{"SourceFile":"models\\TN_Outbound_Order.cs"},{"SourceFile":"models\\TN_Purchase_Detail.cs"},{"SourceFile":"models\\TN_Purchase_Order.cs"},{"SourceFile":"models\\TN_Putaway_Detail.cs"},{"SourceFile":"models\\TN_Putaway_Order.cs"},{"SourceFile":"models\\TN_Receipt_Detail.cs"},{"SourceFile":"models\\TN_Receipt_Order.cs"},{"SourceFile":"models\\ShippingDetail.cs"},{"SourceFile":"models\\ShippingOrder.cs"},{"SourceFile":"models\\TN_Sorting_Compose.cs"},{"SourceFile":"models\\TN_Sorting_Detail.cs"},{"SourceFile":"models\\SortingOrder.cs"},{"SourceFile":"models\\TN_Sorting_Result.cs"},{"SourceFile":"models\\TN_Supplier.cs"},{"SourceFile":"models\\WCSTask.cs"},{"SourceFile":"models\\TaskAction.cs"},{"SourceFile":"models\\TN_Warehouse.cs"},{"SourceFile":"process\\DeviceProcess.cs"},{"SourceFile":"core\\WCSCore.cs"},{"SourceFile":"api\\WmsController.cs"},{"SourceFile":"api\\ApiHelper.cs"},{"SourceFile":"dispatch\\HostToAGV.cs"},{"SourceFile":"process\\TaskProcess.cs"},{"SourceFile":"util\\LogHelper.cs"},{"SourceFile":"util\\StrHelper.cs"},{"SourceFile":"util\\STAttribute.cs"},{"SourceFile":"wms\\ContainerHelper.cs"},{"SourceFile":"wms\\LocationHelper.cs"},{"SourceFile":"wms\\WMSHelper.cs"},{"SourceFile":"wms\\SYSHelper.cs"},{"SourceFile":"wms\\TEST.cs"},{"SourceFile":"device\\OITcpHelper.cs"},{"SourceFile":"Program.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"util\\Settings.cs"},{"SourceFile":"util\\SqlHelper.cs"},{"SourceFile":"api\\Startup.cs"},{"SourceFile":"dispatch\\NDCHelper.cs"},{"SourceFile":"util\\HttpHelper.cs"},{"SourceFile":"wms\\NormalArea.cs"},{"SourceFile":"wms\\WCSHelper.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs"}],"References":[{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\HH.WCS.Mobox3.Template\\packages\\EasyModbusTCP.5.6.0\\lib\\net40\\EasyModbus.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Microsoft.Bcl.AsyncInterfaces.7.0.0\\lib\\netstandard2.0\\Microsoft.Bcl.AsyncInterfaces.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Microsoft.Owin.4.2.2\\lib\\net45\\Microsoft.Owin.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Microsoft.Owin.Host.HttpListener.4.2.2\\lib\\net45\\Microsoft.Owin.Host.HttpListener.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Microsoft.Owin.Hosting.4.2.2\\lib\\net45\\Microsoft.Owin.Hosting.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\Microsoft.Win32.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\netfx.force.conflicts.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\netstandard.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\IIS\\Microsoft Web Deploy V3\\Newtonsoft.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\NLog.5.1.1\\lib\\net45\\NLog.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Owin.1.0\\lib\\net40\\Owin.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\SqlSugar.5.1.3.47\\lib\\SqlSugar.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.AppContext.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Buffers.4.5.1\\lib\\net461\\System.Buffers.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Collections.Concurrent.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Collections.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Collections.NonGeneric.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Collections.Specialized.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ComponentModel.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ComponentModel.EventBasedAsync.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ComponentModel.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ComponentModel.TypeConverter.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Configuration.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Configuration.Install.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Console.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Data.Common.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.Contracts.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.Debug.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.FileVersionInfo.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.Process.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.StackTrace.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.TextWriterTraceListener.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.Tools.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.TraceSource.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Diagnostics.Tracing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Drawing.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Dynamic.Runtime.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Globalization.Calendars.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Globalization.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Globalization.Extensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.Compression.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.Compression.ZipFile.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.FileSystem.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.FileSystem.DriveInfo.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.FileSystem.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.FileSystem.Watcher.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.IsolatedStorage.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.MemoryMappedFiles.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.Pipes.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.IO.UnmanagedMemoryStream.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Linq.Expressions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Linq.Parallel.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Linq.Queryable.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Memory.4.5.5\\lib\\net461\\System.Memory.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Net.Http.Formatting.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.NameResolution.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.NetworkInformation.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Ping.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Requests.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Security.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.Sockets.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.WebHeaderCollection.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.WebSockets.Client.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Net.WebSockets.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Numerics.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Numerics.Vectors.4.5.0\\lib\\net46\\System.Numerics.Vectors.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ObjectModel.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Reflection.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Reflection.Extensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Reflection.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Resources.Reader.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Resources.ResourceManager.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Resources.Writer.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Runtime.CompilerServices.Unsafe.6.0.0\\lib\\net461\\System.Runtime.CompilerServices.Unsafe.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.CompilerServices.VisualC.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Extensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Handles.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.InteropServices.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.InteropServices.RuntimeInformation.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Numerics.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Serialization.Formatters.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Serialization.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Serialization.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Runtime.Serialization.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Claims.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Cryptography.Algorithms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Cryptography.Csp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Cryptography.Encoding.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Cryptography.Primitives.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Cryptography.X509Certificates.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.Principal.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Security.SecureString.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.ServiceProcess.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Text.Encoding.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Text.Encoding.Extensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Text.Encodings.Web.7.0.0\\lib\\netstandard2.0\\System.Text.Encodings.Web.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Text.Json.7.0.0\\lib\\netstandard2.0\\System.Text.Json.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Text.RegularExpressions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.Overlapped.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.Tasks.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Threading.Tasks.Extensions.4.5.4\\lib\\net461\\System.Threading.Tasks.Extensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.Tasks.Parallel.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.Thread.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.ThreadPool.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Threading.Timer.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.ValueTuple.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Web.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Web.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\System.Web.Http.Owin.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Web.Services.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.ReaderWriter.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.XDocument.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.XmlDocument.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.XmlSerializer.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.XPath.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\Microsoft.NET.Build.Extensions\\net461\\lib\\System.Xml.XPath.XDocument.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Topshelf.4.3.0\\lib\\net452\\Topshelf.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\packages\\Topshelf.NLog.4.3.0\\lib\\net452\\Topshelf.NLog.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\HH.WCS.Mobox3.Template\\bin\\Debug\\HH.WCS.Mobox3.Template.exe","OutputItemRelativePath":"HH.WCS.Mobox3.Template.exe"},{"OutputItemFullPath":"D:\\ams\\wcs\\HH.WCS.Mobox3 - 鍓湰\\HH.WCS.Mobox3.Template\\bin\\Debug\\HH.WCS.Mobox3.Template.pdb","OutputItemRelativePath":"HH.WCS.Mobox3.Template.pdb"}],"CopyToOutputEntries":[]} \ No newline at end of file diff --git a/.vs/HH.WCS.Mobox3.WeiLi/FileContentIndex/57367193-8890-401b-95eb-fa75f34fc9b1.vsidx b/.vs/HH.WCS.Mobox3.WeiLi/FileContentIndex/57367193-8890-401b-95eb-fa75f34fc9b1.vsidx new file mode 100644 index 0000000..9ad48f2 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.WeiLi/FileContentIndex/57367193-8890-401b-95eb-fa75f34fc9b1.vsidx Binary files differ diff --git a/App.config b/App.config new file mode 100644 index 0000000..189fb44 --- /dev/null +++ b/App.config @@ -0,0 +1,74 @@ +锘�?xml version="1.0" encoding="utf-8"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /> + </startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.122.21.1" newVersion="4.122.21.1" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Formats.Asn1" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> diff --git a/AppStart/Config.cs b/AppStart/Config.cs new file mode 100644 index 0000000..5335b21 --- /dev/null +++ b/AppStart/Config.cs @@ -0,0 +1,44 @@ +锘縰sing System.Collections.Generic; + +// 鏍规嵁 JSON 鏂囦欢 鐢熸垚瀵瑰簲鐨�C# 瀵硅薄锛涚綉鍧�細https://json2csharp.com/ +// 1. 灏�config.json 鏂囦欢澶嶅埗鍒扮綉鍧�腑 +// 2. 灏嗗緱鍒扮殑鍐呭澶嶅埗鍒�namespace HH.WCS.Mobox3.{椤圭洰浠e彿}.AppStart { } 澶ф嫭鍙峰唴閮紙C# 10 鎵嶆敮鎸�鏂囦欢鑼冨洿鍐呯殑鍛藉悕绌洪棿锛�+// 3. 灏�Root 鏇村悕涓�Config +// 琛ュ厖锛氳繖绉嶆柟寮忔病娉曚繚鐣欐敞閲婏紝闇�鐔熸倝 Config 鏂囦欢鐨勫瓧娈靛惈涔夛紙鏆備笉鑰冭檻浠g爜鐢熸垚 Json 鏂囦欢锛�+ +namespace HH.WCS.Mobox3.DSZSH.AppStart { + // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse); + public class Area { + public string Name { get; set; } + public List<string> Codes { get; set; } + } + + public class ProductionLine { + public string Id { get; set; } + public string Name { get; set; } + public string PlcIp { get; set; } + public int PlcPort { get; set; } + public int SlaveId { get; set; } + public List<string> OnLoc { get; set; } + public List<string> OffLoc { get; set; } + } + + public class Config { + public string WebApiUrl { get; set; } + public string NdcApiUrl { get; set; } + public string SqlServer { get; set; } + public string TcpServerIp { get; set; } + public int TcpServerPort { get; set; } + public List<Area> Areas { get; set; } + public List<Task> Tasks { get; set; } + public List<ProductionLine> ProductionLines { get; set; } + } + + public class Task { + public string Name { get; set; } + public List<string> StartAreas { get; set; } + public List<string> EndAreas { get; set; } + } + + +} diff --git a/AppStart/Settings.cs b/AppStart/Settings.cs new file mode 100644 index 0000000..0e6e19e --- /dev/null +++ b/AppStart/Settings.cs @@ -0,0 +1,73 @@ +锘縰sing System; +using System.Collections.Generic; +using System.IO; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace HH.WCS.Mobox3.DSZSH.AppStart { + public class Settings + { + /// <summary> + /// 閰嶇疆鏂囦欢 + /// </summary> + public static Config Config { get; set; } + + /// <summary> + /// 搴撳尯瀛楀吀锛堝姞杞藉悗灏变笉鍙橈級 + /// </summary> + public static Dictionary<string, List<string>> AreaMap { get; set; } = new Dictionary<string, List<string>>(); + + /// <summary> + /// 浠诲姟瀛楀吀锛堝姞杞藉悗灏变笉鍙橈級 + /// </summary> + public static Dictionary<string, AppStart.Task> TaskMap { get; set; } = new Dictionary<string, AppStart.Task>(); + + public static void Init() { + // 鍔犺浇閰嶇疆鏂囦欢 + LoadJson(); + + // 閽堝 Areas 杩涜杞崲锛氬皢 Config 鐨�List 鍔犺浇鍒�Dict 涓�+ LoadAreas(); + + // 閽堝 Tasks 杩涜杞崲 + LoadTasks(); + } + + private static void LoadJson() { + LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 寮�"); + // JSON 鏂囦欢璺緞 + string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "./config/config.json"); + + try { + // 璇诲彇 JSON 鏂囦欢鍐呭 + string jsonContent = File.ReadAllText(filePath); + + // 鍙嶅簭鍒楀寲涓�Config 瀵硅薄 + Config = JsonConvert.DeserializeObject<Config>(jsonContent); + } + catch (FileNotFoundException) { + LogHelper.Info("JSON 鏂囦欢鏈壘鍒�); + } + catch (JsonException ex) { + LogHelper.Info($"JSON 瑙f瀽閿欒: {ex.Message}"); + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓閿欒: {ex.Message}"); + } + LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚"); + } + + private static void LoadAreas() { + foreach (var area in Config.Areas) { + AreaMap.Add(area.Name, area.Codes); + } + } + + private static void LoadTasks() { + foreach (var task in Config.Tasks) { + TaskMap.Add(task.Name, task); + } + } + } +} diff --git a/AppStart/Startup.cs b/AppStart/Startup.cs new file mode 100644 index 0000000..373c710 --- /dev/null +++ b/AppStart/Startup.cs @@ -0,0 +1,50 @@ +锘縰sing System; +using System.Linq; +using System.Net.Http.Formatting; +using System.Threading.Tasks; +using System.Web.Http; +using Microsoft.Owin; +using Owin; +using Swashbuckle.Application; + +[assembly: OwinStartup(typeof(HH.WCS.Mobox3.DSZSH.Startup))] + +namespace HH.WCS.Mobox3.DSZSH { + public class Startup { + public void Configuration(IAppBuilder app) { + // 鏈夊叧濡備綍閰嶇疆搴旂敤绋嬪簭鐨勮缁嗕俊鎭紝璇疯闂�https://go.microsoft.com/fwlink/?LinkID=316888 + HttpConfiguration config = new HttpConfiguration(); + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{action}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + + // Web API routes + + //config.MapHttpAttributeRoutes(); + //config.EnableSwagger(c => c.SingleApiVersion("v1", "hh wms api")) + // .EnableSwaggerUi(); + //config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); + //config.Formatters.Add(new JsonMediaTypeFormatter()); + + //WebApiConfig.Register(config); + + // Web API routes + config.MapHttpAttributeRoutes(); + config.EnableSwagger(c => { + c.SingleApiVersion("v1", "hh wms api"); + c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + "\\HH.WCS.Mobox3.DSZSH.xml"); + c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{System.AppDomain.CurrentDomain.BaseDirectory}\\HH.WCS.Mobox3.DSZSH.xml")); + c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); + } + ).EnableSwaggerUi(c => { + c.InjectJavaScript(System.Reflection.Assembly.GetExecutingAssembly(), "swagger.js"); + }); + config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); + config.Formatters.Add(new JsonMediaTypeFormatter()); + + app.UseWebApi(config); + } + } +} diff --git a/AppStart/SwaggerConfig.cs b/AppStart/SwaggerConfig.cs new file mode 100644 index 0000000..557097d --- /dev/null +++ b/AppStart/SwaggerConfig.cs @@ -0,0 +1,255 @@ +using System.Web.Http; +using WebActivatorEx; +using HH.WCS.Mobox3.Template; +using Swashbuckle.Application; + +[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] + +namespace HH.WCS.Mobox3.Template +{ + public class SwaggerConfig + { + public static void Register() + { + var thisAssembly = typeof(SwaggerConfig).Assembly; + + GlobalConfiguration.Configuration + .EnableSwagger(c => + { + // By default, the service root url is inferred from the request used to access the docs. + // However, there may be situations (e.g. proxy and load-balanced environments) where this does not + // resolve correctly. You can workaround this by providing your own code to determine the root URL. + // + //c.RootUrl(req => GetRootUrlFromAppConfig()); + + // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access + // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit + // about them, you can use the "Schemes" option as shown below. + // + //c.Schemes(new[] { "http", "https" }); + + // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to + // hold additional metadata for an API. Version and title are required but you can also provide + // additional fields by chaining methods off SingleApiVersion. + // + c.SingleApiVersion("v1", "HH.WCS.Mobox3.Template"); + + // If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option. + // + //c.PrettyPrint(); + + // If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". + // In this case, you must provide a lambda that tells Swashbuckle which actions should be + // included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" + // returns an "Info" builder so you can provide additional metadata per API version. + // + //c.MultipleApiVersions( + // (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), + // (vc) => + // { + // vc.Version("v2", "Swashbuckle Dummy API V2"); + // vc.Version("v1", "Swashbuckle Dummy API V1"); + // }); + + // You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. + // See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. + // NOTE: These only define the schemes and need to be coupled with a corresponding "security" property + // at the document or operation level to indicate which schemes are required for an operation. To do this, + // you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties + // according to your specific authorization implementation + // + //c.BasicAuth("basic") + // .Description("Basic HTTP Authentication"); + // + // NOTE: You must also configure 'EnableApiKeySupport' below in the SwaggerUI section + //c.ApiKey("apiKey") + // .Description("API Key Authentication") + // .Name("apiKey") + // .In("header"); + // + //c.OAuth2("oauth2") + // .Description("OAuth2 Implicit Grant") + // .Flow("implicit") + // .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") + // //.TokenUrl("https://tempuri.org/token") + // .Scopes(scopes => + // { + // scopes.Add("read", "Read access to protected resources"); + // scopes.Add("write", "Write access to protected resources"); + // }); + + // Set this flag to omit descriptions for any actions decorated with the Obsolete attribute + //c.IgnoreObsoleteActions(); + + // Each operation be assigned one or more tags which are then used by consumers for various reasons. + // For example, the swagger-ui groups operations according to the first tag of each operation. + // By default, this will be controller name but you can use the "GroupActionsBy" option to + // override with any value. + // + //c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); + + // You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate + // the order in which operations are listed. For example, if the default grouping is in place + // (controller name) and you specify a descending alphabetic sort order, then actions from a + // ProductsController will be listed before those from a CustomersController. This is typically + // used to customize the order of groupings in the swagger-ui. + // + //c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); + + // If you annotate Controllers and API Types with + // Xml comments (http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx), you can incorporate + // those comments into the generated docs and UI. You can enable this by providing the path to one or + // more Xml comment files. + // + //c.IncludeXmlComments(GetXmlCommentsPath()); + + // Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types + // exposed in your API. However, there may be occasions when more control of the output is needed. + // This is supported through the "MapType" and "SchemaFilter" options: + // + // Use the "MapType" option to override the Schema generation for a specific type. + // It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. + // While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. + // It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only + // use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a + // complex Schema, use a Schema filter. + // + //c.MapType<ProductType>(() => new Schema { type = "integer", format = "int32" }); + + // If you want to post-modify "complex" Schemas once they've been generated, across the board or for a + // specific type, you can wire up one or more Schema filters. + // + //c.SchemaFilter<ApplySchemaVendorExtensions>(); + + // In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique + // Schema Id. By default, Swashbuckle does NOT use the full type name in Schema Ids. In most cases, this + // works well because it prevents the "implementation detail" of type namespaces from leaking into your + // Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll + // need to opt out of this behavior to avoid Schema Id conflicts. + // + //c.UseFullTypeNameInSchemaIds(); + + // Alternatively, you can provide your own custom strategy for inferring SchemaId's for + // describing "complex" types in your API. + // + //c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName); + + // Set this flag to omit schema property descriptions for any type properties decorated with the + // Obsolete attribute + //c.IgnoreObsoleteProperties(); + + // In accordance with the built in JsonSerializer, Swashbuckle will, by default, describe enums as integers. + // You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given + // enum type. Swashbuckle will honor this change out-of-the-box. However, if you use a different + // approach to serialize enums as strings, you can also force Swashbuckle to describe them as strings. + // + //c.DescribeAllEnumsAsStrings(); + + // Similar to Schema filters, Swashbuckle also supports Operation and Document filters: + // + // Post-modify Operation descriptions once they've been generated by wiring up one or more + // Operation filters. + // + //c.OperationFilter<AddDefaultResponse>(); + // + // If you've defined an OAuth2 flow as described above, you could use a custom filter + // to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required + // to execute the operation + // + //c.OperationFilter<AssignOAuth2SecurityRequirements>(); + + // Post-modify the entire Swagger document by wiring up one or more Document filters. + // This gives full control to modify the final SwaggerDocument. You should have a good understanding of + // the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md + // before using this option. + // + //c.DocumentFilter<ApplyDocumentVendorExtensions>(); + + // In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL + // to an action. As a result, Swashbuckle will raise an exception if it encounters multiple actions + // with the same path (sans query string) and HTTP method. You can workaround this by providing a + // custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs + // + //c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); + + // Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an + // alternative implementation for ISwaggerProvider with the CustomProvider option. + // + //c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider)); + }) + .EnableSwaggerUi(c => + { + // Use the "DocumentTitle" option to change the Document title. + // Very helpful when you have multiple Swagger pages open, to tell them apart. + // + //c.DocumentTitle("My Swagger UI"); + + // Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. + // The file must be included in your project as an "Embedded Resource", and then the resource's + // "Logical Name" is passed to the method as shown below. + // + //c.InjectStylesheet(containingAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); + + // Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui + // has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's + // "Logical Name" is passed to the method as shown above. + // + //c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); + + // The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" + // strings as the possible choices. You can use this option to change these to something else, + // for example 0 and 1. + // + //c.BooleanValues(new[] { "0", "1" }); + + // By default, swagger-ui will validate specs against swagger.io's online validator and display the result + // in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the + // feature entirely. + //c.SetValidatorUrl("http://localhost/validator"); + //c.DisableValidator(); + + // Use this option to control how the Operation listing is displayed. + // It can be set to "None" (default), "List" (shows operations for each resource), + // or "Full" (fully expanded: shows operations and their details). + // + //c.DocExpansion(DocExpansion.List); + + // Specify which HTTP operations will have the 'Try it out!' option. An empty paramter list disables + // it for all operations. + // + //c.SupportedSubmitMethods("GET", "HEAD"); + + // Use the CustomAsset option to provide your own version of assets used in the swagger-ui. + // It's typically used to instruct Swashbuckle to return your version instead of the default + // when a request is made for "index.html". As with all custom content, the file must be included + // in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to + // the method as shown below. + // + //c.CustomAsset("index", containingAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); + + // If your API has multiple versions and you've applied the MultipleApiVersions setting + // as described above, you can also enable a select box in the swagger-ui, that displays + // a discovery URL for each version. This provides a convenient way for users to browse documentation + // for different API versions. + // + //c.EnableDiscoveryUrlSelector(); + + // If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to + // the Swagger 2.0 specification, you can enable UI support as shown below. + // + //c.EnableOAuth2Support( + // clientId: "test-client-id", + // clientSecret: null, + // realm: "test-realm", + // appName: "Swagger UI" + // //additionalQueryStringParams: new Dictionary<string, string>() { { "foo", "bar" } } + //); + + // If your API supports ApiKey, you can override the default values. + // "apiKeyIn" can either be "query" or "header" + // + //c.EnableApiKeySupport("apiKey", "header"); + }); + } + } +} diff --git a/AppStart/SwaggerControllerDescProvider.cs b/AppStart/SwaggerControllerDescProvider.cs new file mode 100644 index 0000000..3db338d --- /dev/null +++ b/AppStart/SwaggerControllerDescProvider.cs @@ -0,0 +1,82 @@ +锘縰sing Swashbuckle.Swagger; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Xml; + +namespace HH.WCS.Mobox3.DSZSH { + /// <summary> + /// Swagger 鏄剧ず鎺у埗鍣ㄧ殑鎻忚堪 + /// </summary> + public class SwaggerCacheProvider : ISwaggerProvider + { + private readonly ISwaggerProvider _swaggerProvider; + private static ConcurrentDictionary<string, SwaggerDocument> _cache = new ConcurrentDictionary<string, SwaggerDocument>(); + private readonly string _xmlPath; + + /// <summary> + /// + /// </summary> + /// <param name="swaggerProvider"></param> + /// <param name="xmlpath">xml鏂囨。璺緞</param> + public SwaggerCacheProvider(ISwaggerProvider swaggerProvider, string xmlpath) + { + _swaggerProvider = swaggerProvider; + _xmlPath = xmlpath; + } + + public SwaggerDocument GetSwagger(string rootUrl, string apiVersion) + { + var cacheKey = string.Format("{0}_{1}", rootUrl, apiVersion); + // 鍙鍙栦竴娆�+ if (!_cache.TryGetValue(cacheKey, out SwaggerDocument srcDoc)) + { + srcDoc = _swaggerProvider.GetSwagger(rootUrl, apiVersion); + + srcDoc.vendorExtensions = new Dictionary<string, object> + { + { "ControllerDesc", GetControllerDesc() } + }; + _cache.TryAdd(cacheKey, srcDoc); + } + return srcDoc; + } + + /// <summary> + /// 浠嶢PI鏂囨。涓鍙栨帶鍒跺櫒鎻忚堪 + /// </summary> + /// <returns>鎵�湁鎺у埗鍣ㄦ弿杩�/returns> + public ConcurrentDictionary<string, string> GetControllerDesc() + { + ConcurrentDictionary<string, string> controllerDescDict = new ConcurrentDictionary<string, string>(); + if (File.Exists(_xmlPath)) + { + XmlDocument xmldoc = new XmlDocument(); + xmldoc.Load(_xmlPath); + + string[] arrPath; + int cCount = "Controller".Length; + foreach (XmlNode node in xmldoc.SelectNodes("//member")) + { + string type = node.Attributes["name"].Value; + if (type.StartsWith("T:")) + { + arrPath = type.Split('.'); + string controllerName = arrPath[arrPath.Length - 1]; + if (controllerName.EndsWith("Controller")) // 鎺у埗鍣�+ { + // 鑾峰彇鎺у埗鍣ㄦ敞閲�+ XmlNode summaryNode = node.SelectSingleNode("summary"); + string key = controllerName.Remove(controllerName.Length - cCount, cCount); + if (summaryNode != null && !string.IsNullOrEmpty(summaryNode.InnerText) && !controllerDescDict.ContainsKey(key)) + { + controllerDescDict.TryAdd(key, summaryNode.InnerText.Trim()); + } + } + } + } + } + return controllerDescDict; + } + } +} diff --git a/Consts/AgvStateCode.cs b/Consts/AgvStateCode.cs new file mode 100644 index 0000000..3c0eab5 --- /dev/null +++ b/Consts/AgvStateCode.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + public class AgvStateCode { + public const int 绛夊緟 = 0; + public const int 鎵ц = 1; + public const int 瀹屾垚 = 2; + public const int 寮�鍙栬揣 = 3; + public const int 鍙栬揣瀹屾垚 = 4; + public const int 寮�鍗歌揣 = 5; + public const int 鍗歌揣瀹屾垚 = 6; + public const int 寮傚父 = 7; + } +} diff --git a/Consts/AgvStateName.cs b/Consts/AgvStateName.cs new file mode 100644 index 0000000..5d524e5 --- /dev/null +++ b/Consts/AgvStateName.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + public class AgvStateName { + public const string 鎵ц = "鎵ц"; + public const string 瀹屾垚 = "瀹屾垚"; + public const string 寮�鍙栬揣 = "寮�鍙栬揣"; + public const string 鍙栬揣瀹屾垚 = "鍙栬揣瀹屾垚"; + public const string 寮�鍗歌揣 = "寮�鍗歌揣"; + public const string 鍗歌揣瀹屾垚 = "鍗歌揣瀹屾垚"; + public const string 寮傚父 = "寮傚父"; + } +} diff --git a/Consts/AreaName.cs b/Consts/AreaName.cs new file mode 100644 index 0000000..06dfb06 --- /dev/null +++ b/Consts/AreaName.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + public class AreaName { + public const string 鍖呰鍖�= "鍖呰鍖�; + public const string 鎿嶄綔鍖�= "鎿嶄綔鍖�; + + public const string 绌烘墭瀛樻斁鍖�= "绌烘墭瀛樻斁鍖�; + + public const string 璐ф灦鍖�= "璐ф灦鍖�; + public const string 绌虹瀛樻斁鍖�= "绌虹瀛樻斁鍖�; + public const string 婊℃墭瀛樻斁鍖�= "婊℃墭瀛樻斁鍖�; + public const string 婊$瀛樻斁鍖�= "婊$瀛樻斁鍖�; + + public const string 浜哄伐_AGV鎺ラ┏鍖�= "浜哄伐-AGV鎺ラ┏鍖�; + public const string 绌烘墭鐩樻帴椹冲尯 = "绌烘墭鐩樻帴椹冲尯"; + public const string 绌虹鎺ラ┏鍖�= "绌虹鎺ラ┏鍖�; + } +} diff --git a/Consts/LockStateCode.cs b/Consts/LockStateCode.cs new file mode 100644 index 0000000..c9eef27 --- /dev/null +++ b/Consts/LockStateCode.cs @@ -0,0 +1,14 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + public class LockStateCode { + public const int 鏃�= 0; + public const int 鍏ュ簱閿�= 1; + public const int 鍑哄簱閿�= 2; + public const int 鍏朵粬閿�= 3; + } +} diff --git a/Consts/LockStateName.cs b/Consts/LockStateName.cs new file mode 100644 index 0000000..5b4e967 --- /dev/null +++ b/Consts/LockStateName.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + /// <summary> + /// 銆愭鏋躲�浣嶇疆閿佸悕绉�瀛楃涓插父閲�+ /// </summary> + public class LockStateName { + public const string 鏃�= "鏃�; + public const string 鍏ュ簱閿�= "鍏ュ簱閿�; + public const string 鍑哄簱閿�= "鍑哄簱閿�; + public const string 鍏朵粬閿�= "鍏朵粬閿�; + } +} diff --git a/Consts/TaskName.cs b/Consts/TaskName.cs new file mode 100644 index 0000000..aac3d8b --- /dev/null +++ b/Consts/TaskName.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Consts { + public class TaskName { + public const string 濂借繍绠盻婊$涓嬬嚎鍏ュ簱 = "濂借繍绠�婊$涓嬬嚎鍏ュ簱"; + public const string 濂借繍绠盻绌虹涓婄嚎 = "濂借繍绠�绌虹涓婄嚎"; + public const string 濂借繍绠盻绌虹鍏ュ簱 = "濂借繍绠�绌虹鍏ュ簱"; + public const string 濂借繍绠盻绌虹缁戝畾 = "濂借繍绠�绌虹缁戝畾"; + public const string 鎴愬搧鑳跺嚭搴�= "鎴愬搧鑳跺嚭搴�; + public const string 鎵樼洏_婊℃墭涓嬬嚎鍏ュ簱 = "鎵樼洏-婊℃墭涓嬬嚎鍏ュ簱"; + public const string 鎵樼洏_绌烘墭涓婄嚎 = "鎵樼洏-绌烘墭涓婄嚎"; + public const string 鎵樼洏_绌烘墭鍏ュ簱 = "鎵樼洏-绌烘墭鍏ュ簱"; + public const string 鎵樼洏_绌烘墭缁戝畾 = "鎵樼洏-绌烘墭缁戝畾"; + } +} diff --git a/Controllers/AgvController.cs b/Controllers/AgvController.cs new file mode 100644 index 0000000..fd80ca8 --- /dev/null +++ b/Controllers/AgvController.cs @@ -0,0 +1,41 @@ +锘縰sing System.Web.Http; + +using HH.WCS.Mobox3.DSZSH.Services; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; + +namespace HH.WCS.Mobox3.DSZSH.Controllers { + /// <summary> + /// 璁惧淇℃伅涓婃姤锛圚ostToAGV涓婃姤銆佹澀濂ュ爢鍨涙満銆佸浗鑷狝GV锛�+ /// </summary> + [RoutePrefix("agv")] + public class AgvController : ApiController + { + /// <summary> + /// NDC HostToAGV 浠诲姟鐘舵�鍥炴姤 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + [Route("AGVCallbackState")] + public ReturnResult AGVCallbackState(AgvTaskState model) + { + LogHelper.Info("NDC HostToAGV 浠诲姟鐘舵�鍥炴姤锛� + JsonConvert.SerializeObject(model), "HosttoagvTask"); + return AgvService.OperateAgvTaskStatus(model); + } + + /// <summary> + /// AGV 涓庝骇绾胯繘琛屽畨鍏ㄤ氦浜�+ /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + [Route("SafetyInteraction")] + public ReturnResult SafetyInteraction(SafetyInteractionInfo model) { + return AgvService.SafetyInteraction(model); + } + } +} diff --git a/Controllers/DebugController.cs b/Controllers/DebugController.cs new file mode 100644 index 0000000..174d012 --- /dev/null +++ b/Controllers/DebugController.cs @@ -0,0 +1,176 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Web.Http; + +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Services; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.DebugRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.DebugResponse; + +namespace HH.WCS.Mobox3.DSZSH.Controllers { + /// <summary> + /// 娴嬭瘯鐢細濡傛灉椤圭洰涓鍜岃澶囧鎺ワ紝鍓嶆湡璁惧鏃犳硶娴嬭瘯锛岀敤鎺ュ彛妯℃嫙 + /// </summary> + [RoutePrefix("api")] + public class DebugController : ApiController + { + /// <summary> + /// 妯℃嫙 AGV 澶氭鍥炴姤浠诲姟鐘舵� + /// </summary> + /// <param name="model">瀹瑰櫒鍙�/param> + /// <returns></returns> + [HttpPost] + [Route("AgvSeriesReports")] + public ReturnResults AgvSeriesReports(UpdateTaskState model) + { + return DebugService.AgvSeriesReports(model); + } + + /// <summary> + /// 鍒濆鍖栨暟鎹簱 + /// </summary> + /// <returns></returns> + [HttpPost] + [Route("BuildDB")] + public string BuildDB() + { + try + { + var db = DbHelper.GetDbClient(); + //db.CodeFirst.InitTables<WCSTask>(); //鎵�湁搴撻兘鏀寔 + //db.CodeFirst.InitTables<Zone>(); + //db.CodeFirst.InitTables<Area>(); + + //db.CodeFirst.InitTables<Location>(); + //db.CodeFirst.InitTables<LocCntrRel>(); + //db.CodeFirst.InitTables<Container>(); + //db.CodeFirst.InitTables<SYSHelper.OI_SYS_MAXID>(); + + db.CodeFirst.InitTables<TN_CG_Detail>(); + db.CodeFirst.InitTables<TN_WorkOrder>(); + db.CodeFirst.InitTables<TN_CAR_IN>(); + + db.CodeFirst.InitTables<TN_Task_Action>(); + db.CodeFirst.InitTables<TN_Task>(); + db.CodeFirst.InitTables<TN_Location>(); + db.CodeFirst.InitTables<TN_Loc_Container>(); + + db.CodeFirst.InitTables<TN_Outbound_Order>(); + db.CodeFirst.InitTables<TN_Outbound_Detail>(); + db.CodeFirst.InitTables<TN_Outbound_Task>(); + } + catch (Exception ex) + { + LogHelper.Info($"鍙戠敓浜嗗紓甯�); + return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message; + } + //return res ? "鎴愬姛" : "澶辫触"; + return "鎴愬姛"; + } + + [HttpPost] + [Route("InsertLocation")] + public string InsertLocation(InsertLocationInfo model) { + try { + var db = DbHelper.GetDbClient(); + + var locList = new List<TN_Location>(); + locList.Add(new TN_Location { S_AREA_CODE = model.AreaCode, S_CODE = model.Code}); + + if (db.Insertable<TN_Location>(locList).ExecuteCommand() <= 0) { + return "澶辫触"; + } + + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓浜嗗紓甯�); + return "娣诲姞璐т綅閿欒" + ex.Message; + } + //return res ? "鎴愬姛" : "澶辫触"; + return "鎴愬姛"; + } + + /// <summary> + /// DEBUG锛氭彃鍏ヨ揣浣嶃�瀹瑰櫒銆佽揣鍝佷俊鎭�+ /// </summary> + /// <returns></returns> + [HttpPost] + [Route("InsertLocCntrCg")] + public string InsertLocCntrCg() { + return DebugService.InsertLocCntrCg(); + } + + public string AddCgCntrLocRel(CgInfo model) { + var db = DbHelper.GetDbClient(); + + try { + using (var tran = db.Ado.UseTran()) { + var loc = db.Queryable<TN_Location>().First(a => a.S_CODE == model.LocId); + if (loc == null) { + var newLoc = new TN_Location { S_CODE = model.LocId, N_CURRENT_NUM = 1 }; + if (db.Insertable<TN_Location>(newLoc).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return $"鎻掑叆浣嶇疆{model.LocId}澶辫触"; + } + loc = db.Queryable<TN_Location>().First(a => a.S_CODE == model.LocId); + } + if (loc.N_CURRENT_NUM == 0) { + loc.N_CURRENT_NUM = 1; + if (db.Updateable<TN_Location>(loc).UpdateColumns( + it => new { it.N_CURRENT_NUM, it.T_MODIFY }).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return $"淇敼浣嶇疆{model.LocId}澶辫触"; + } + } + + var locCntrRel = db.Queryable<TN_Loc_Container>().First(a => a.S_LOC_CODE == model.LocId && a.S_CNTR_CODE == model.CntId); + if (locCntrRel == null) { + var locList = new List<TN_Loc_Container>(); + locList.Add(new TN_Loc_Container { S_LOC_CODE = model.LocId, S_CNTR_CODE = model.CntId }); + if (db.Insertable<TN_Loc_Container>(locList).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return $"鎻掑叆浣嶇疆鎵樼洏鍏崇郴{model.LocId}-{model.CntId}澶辫触"; + } + } + + var cgDetail = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == model.CntId && a.S_CG_ID == model.CgId); + if (cgDetail == null) { + var locList = new List<TN_CG_Detail>(); + locList.Add(new TN_CG_Detail { S_CNTR_CODE = model.CntId, S_CG_ID = model.CntId }); + if (db.Insertable<TN_CG_Detail>(locList).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return $"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{model.CntId}-{model.CgId}澶辫触"; + } + } + + tran.CommitTran(); + } + } + catch (Exception ex) { + return $"鍑洪敊锛歿ex}"; + } + + return "success"; + } + } + + public class CgInfo { + public string CgId { get; set; } + public string CntId { get; set; } + public string LocId { get; set; } + } + + public class InsertLocationInfo { + public string Code { set; get; } + public string AreaCode { set; get; } + } + + public class UpdateTaskWeightInfo { + public string TaskID { set; get; } + public float Weight { set; get; } + } +} diff --git a/Controllers/ErpController.cs b/Controllers/ErpController.cs new file mode 100644 index 0000000..7607f1f --- /dev/null +++ b/Controllers/ErpController.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Web.Http; + + +namespace HH.WCS.Mobox3.DSZSH.Controllers { + /// <summary> + /// ERP 璋冪敤鐨勬帴鍙�+ /// </summary> + [RoutePrefix("api")] + public class ErpController : ApiController { + + + + } +} \ No newline at end of file diff --git a/Controllers/MoboxController.cs b/Controllers/MoboxController.cs new file mode 100644 index 0000000..9d9bfe2 --- /dev/null +++ b/Controllers/MoboxController.cs @@ -0,0 +1,138 @@ +锘縰sing System.Web.Http; + +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Services; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.MoboxRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; +using static HH.WCS.Mobox3.DSZSH.Helpers.ResultHelper; + +namespace HH.WCS.Mobox3.DSZSH.Controllers { + /// <summary> + /// Mobox3 璋冪敤锛岃剼鏈腑璋冪敤锛堝寘鎷�PDA 鐨勬帴鍙o級 + /// </summary> + [RoutePrefix("api")] + public class MoboxController : ApiController { + + #region PDA 鎺ュ彛 + /// <summary> + /// 濂借繍绠�婊℃墭涓嬬嚎鍏ュ簱(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + [Route("GoodpackOffline")] + public SimpleResult GoodpackOffline(GoodpackOfflineInfo model) { + LogHelper.InfoApi("濂借繍绠�婊℃墭涓嬬嚎鍏ュ簱(PDA)", model); + return MoboxService.GoodpackOffline(model); + } + + /// <summary> + /// 绌烘墭/绌虹缁戝畾 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public SimpleResult EmptyBind(EmptyBindInfo model) { + LogHelper.InfoApi("绌烘墭/绌虹缁戝畾", model); + + if (model.CntrType == "鎵樼洏") { + //LogHelper.Info($"瑙﹀彂API锛氱┖鎵樼粦瀹�" + JsonConvert.SerializeObject(model), "API"); + return MoboxService.EmptyBindPallet(model); + } + else if (model.CntrType == "濂借繍绠�) { + //LogHelper.Info($"瑙﹀彂API锛氱┖绠辩粦瀹�" + JsonConvert.SerializeObject(model), "API"); + return MoboxService.EmptyBindGoodpack(model); + } + else { + return BuildSimpleResult(-1, $"涓嶅悎娉曠殑瀹瑰櫒绫诲瀷锛�{model.CntrType}'"); + } + } + + /// <summary> + /// 绌烘墭/绌虹鍏ュ簱(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public SimpleResult EmptyInbound(EmptyInboundInfo model) { + LogHelper.InfoApi("绌烘墭/绌虹鍏ュ簱", model); + + var db = DbHelper.GetDbClient(); + var locCntrRel = db.Queryable<TN_Loc_Container>() + .Where(lc => lc.S_LOC_CODE == model.LocCode).First(); + + if (locCntrRel == null) { + return BuildSimpleResult(-1, $"涓嶅瓨鍦ㄥ凡缁戝畾瀹瑰櫒鐨勮揣浣嶅彿锛�{model.LocCode}'"); + } + + if (locCntrRel.S_CNTR_TYPE == "鎵樼洏") { + + return MoboxService.EmptyInboundPallet(new EmptyInboundDetailInfo { + StartLoc = locCntrRel.S_LOC_CODE, + CntId = locCntrRel.S_CNTR_TYPE + }); + } + else if (locCntrRel.S_CNTR_TYPE == "濂借繍绠�) { + + return MoboxService.EmptyInboundGoodpack(new EmptyInboundDetailInfo { + StartLoc = locCntrRel.S_LOC_CODE, + CntId = locCntrRel.S_CNTR_TYPE + }); + } + else { + return BuildSimpleResult(-2, $"涓嶅悎娉曠殑瀹瑰櫒绫诲瀷锛�{locCntrRel.S_CNTR_CODE}'"); + } + } + + /// <summary> + /// 绌烘墭/绌虹涓婄嚎(PDA) + /// </summary> + /// <returns> + /// 浜哄伐浣跨敤PDA鎵爜锛屾牴鎹墿鏂欑被鍨嬪垽鏂笂绾跨┖鎵�绌虹 + /// </returns> + public SimpleResult EmptyOnline(EmptyOnlineInfo model) { + var db = DbHelper.GetDbClient(); + var locCntrRel = db.Queryable<TN_Loc_Container>() + .LeftJoin<TN_CG_Detail>((lc, cd) => lc.S_CNTR_CODE == cd.S_CNTR_CODE) + .Where((lc, cd) => cd.S_CG_ID == model.CgId) + .First(); + + if (locCntrRel.S_CNTR_TYPE == "鎵樼洏") { + + return MoboxService.EmptyOnlinePallet(new EmptyOnlinePalletInfo { + CntId = locCntrRel.S_CNTR_CODE, + EndLoc = model.EndLoc + }); + } + else if (locCntrRel.S_CNTR_TYPE == "濂借繍绠�) { + + return MoboxService.EmptyOnlineGoodpack(new EmptyOnlineGoodpackInfo { + CntId = locCntrRel.S_CNTR_CODE, + EndLoc = model.EndLoc + }); + } + else { + return BuildSimpleResult(-1, $"涓嶅悎娉曠殑瀹瑰櫒绫诲瀷锛�{locCntrRel.S_CNTR_CODE}'"); + } + } + #endregion + + #region Mobox 鎺ュ彛 + /// <summary> + /// 鎴愬搧鑳跺嚭搴�WMS) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public SimpleResult FinishedOutbound(FinishedOutboundInfo model) { + LogHelper.InfoApi("鎴愬搧鑳跺嚭搴�WMS)", model); + if (model.Forced) { + return MoboxService.FinishedOutboundForce(model); + } + return MoboxService.FinishedOutbound(model); + } + #endregion + } +} diff --git a/Controllers/WmsController.cs b/Controllers/WmsController.cs new file mode 100644 index 0000000..075593b --- /dev/null +++ b/Controllers/WmsController.cs @@ -0,0 +1,16 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Web.Http; + +namespace HH.WCS.Mobox3.DSZSH.Controllers +{ + /// <summary> + /// 绗笁鏂硅皟鐢ㄧ殑鎺ュ彛 + /// </summary> + [RoutePrefix("api")] + public class WmsController : ApiController + { + + } +} diff --git a/Devices/BaseModbusDevice.cs b/Devices/BaseModbusDevice.cs new file mode 100644 index 0000000..831a19a --- /dev/null +++ b/Devices/BaseModbusDevice.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Devices { + /// <summary> + /// 妯℃澘鎶借薄绫伙細Modbus 鍗忚璁惧 + /// </summary> + public abstract class BaseModbusDevice { + public BaseModbusDevice(string ip, int port) { + Ip = ip; + Port = port; + } + + public string Ip { get; set; } + public int Port { get; set; } + } +} diff --git a/Devices/ProductionLineDevice.cs b/Devices/ProductionLineDevice.cs new file mode 100644 index 0000000..19e3d74 --- /dev/null +++ b/Devices/ProductionLineDevice.cs @@ -0,0 +1,90 @@ +锘縰sing System; + +using HH.WCS.Mobox3.DSZSH.Helpers; + +using Newtonsoft.Json; + +namespace HH.WCS.Mobox3.DSZSH.Devices { + /// <summary> + /// 杈撻�绾縋LC璁惧 + /// </summary> + public class ProductionLineDevice : BaseModbusDevice { + + + public ProductionLineDevice(string ip, int port) : base(ip, port) { + } + + public ProductionLineDevice(string id, string ip, int port) : base(ip, port) { + Id = id; + } + + public string Id { get; set; } + + + + /// <summary> + /// 绯荤粺鐘舵�锛�鏈湴 1鑱斿姩(AGV妯″紡) 2鏁呴殰 + /// </summary> + public int SystemState { get; set; } + + /// <summary> + /// 婊″灈涓嬬嚎锛�杈撻�绾挎湯绔湁鎴愬搧鏂欙紝闇�AGV鎼繍 0榛樿鍊�+ /// </summary> + public int FullOffline { get; set; } + + /// <summary> + /// 鍛煎彨鎵樼洏鍨涳細1闇�绌烘墭锛屽懠鍙獳GV閰嶉� 0榛樿鍊�+ /// </summary> + public int CallPallet { get; set; } + + /// <summary> + /// 鍏佽 AGV 鏀炬墭鐩樺灈锛�鍏佽鏀惧灈 0榛樿鍊�+ /// </summary> + public int AllowAgvPlacePallet { get; set; } + + private int _agvPicking; + private int _agvPlacingPallet; + + /// <summary> + /// AGV 姝e湪鍙栬揣锛氫笅绾緼GV鍐欏叆1锛屽彇璐у畬鎴愬悗鎭㈠0 + /// </summary> + public int AgvPicking { + get => _agvPicking; + set { + var isOk = ModbusHelper.WriteSingleRegister(10, value, Ip, Port); + _agvPicking = isOk ? value : throw new Exception($"淇敼 [AGV 姝e湪鍙栬揣] 涓�'{value}' 澶辫触"); + } + } + + /// <summary> + /// AGV 姝e湪鏀炬墭鐩樺灈锛氫笂绾緼GV鍐欏叆1锛屾斁鎵樺畬鎴愬悗鎭㈠0 + /// </summary> + public int AgvPlacingPallet { + get => _agvPlacingPallet; + set { + var isOk = ModbusHelper.WriteSingleRegister(11, value, Ip, Port); + _agvPlacingPallet = isOk ? value : throw new Exception($"淇敼 [AGV 姝e湪鏀炬墭鐩樺灈] 涓�'{value}' 澶辫触"); + } + } + + public bool LoadDeviceStateOk() { + var readArray = ModbusHelper.ReadHoldingRegisters(0, 20, Ip, Port); + if (readArray == null || readArray.Length < 12) { + return false; + } + + // 鍙鍦板潃鏁版嵁 + SystemState = readArray[0]; + FullOffline = readArray[1]; + CallPallet = readArray[2]; + AllowAgvPlacePallet = readArray[3]; + // 鍙啓鍦板潃鏁版嵁 + _agvPicking = readArray[10]; + _agvPlacingPallet = readArray[11]; + + var log = JsonConvert.SerializeObject(readArray); + LogHelper.Info(log); + return true; + } + } +} diff --git a/Dtos/Request/AgvRequest.cs b/Dtos/Request/AgvRequest.cs new file mode 100644 index 0000000..6227225 --- /dev/null +++ b/Dtos/Request/AgvRequest.cs @@ -0,0 +1,39 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Request { + public class AgvRequest { + /// <summary> + /// HostToAGV 涓婃姤浠诲姟鐘舵� + /// </summary> + public class AgvTaskState { + public int State { get; set; } + public string TaskNo { get; set; } + public string ForkliftNo { get; set; } + + /// <summary> + /// 瀹夊叏闂ㄧ紪鍙�+ /// </summary> + public string lock_no { get; set; } + public string ext_data { get; set; } + } + + public class SafetyInteractionInfo { + public int station_id { get; set; } + + /// <summary> + /// 璇锋眰涓婄嚎/涓嬬嚎鐨勭殑绔欏彴搴撲綅鍚嶇О锛屼緥濡倃ork6銆亀ork8 + /// </summary> + public string station_name { get; set; } + + /// <summary> + /// 璇锋眰鐮�+ /// </summary> + public string apply_code { get; set; } + public string task_no { set; get; } + } + } +} diff --git a/Dtos/Request/DebugRequest.cs b/Dtos/Request/DebugRequest.cs new file mode 100644 index 0000000..76822a7 --- /dev/null +++ b/Dtos/Request/DebugRequest.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using HH.WCS.Mobox3.DSZSH.Consts; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Request { + public class DebugRequest { + /// <summary> + /// 妯℃嫙 AGV 浼犻�淇″彿锛岀敤浜庢洿鏀逛换鍔$姸鎬�+ /// </summary> + public class UpdateTaskState { + /// <summary> + /// 浠诲姟ID + /// </summary> + public string TaskID { set; get; } + /// <summary> + /// AGV 灏忚溅鍙�+ /// </summary> + public string ForkliftNo { set; get; } + /// <summary> + /// AGV 涓嬩竴涓姸鎬�+ /// </summary> + public int NextState { set; get; } + } + } +} diff --git a/Dtos/Request/MoboxRequest.cs b/Dtos/Request/MoboxRequest.cs new file mode 100644 index 0000000..0e87376 --- /dev/null +++ b/Dtos/Request/MoboxRequest.cs @@ -0,0 +1,161 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Newtonsoft.Json; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Request { + public class MoboxRequest { + + #region PDA 鏁版嵁 + /// <summary> + /// 鎴愬搧鑳跺ソ杩愮涓嬬嚎淇℃伅 + /// </summary> + public class GoodpackOfflineInfo : StartCntInfo { + public string CgId { get; set; } + } + + /// <summary> + /// API锛氱┖鎵�绌虹缁戝畾鏁版嵁绫�+ /// </summary> + public class EmptyBindInfo { + /// <summary> + /// 瀹瑰櫒缂栫爜 + /// </summary> + public string CntrCode { get; set; } + + /// <summary> + /// 瀹瑰櫒绫诲瀷 + /// </summary> + public string CntrType { get; set; } + + /// <summary> + /// 鎵樼洏鏁伴噺锛堜粎褰撳鍣ㄧ被鍨嬩负鎵樼洏鏃朵娇鐢級 + /// </summary> + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public int PalletCount { get; set; } + + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + public string LocCode { get; set; } + } + + public class EmptyBindPalletInfo { + /// <summary> + /// 瀹瑰櫒缂栫爜 + /// </summary> + public string CntrCode { get; set; } + + /// <summary> + /// 鎵樼洏鏁伴噺 + /// </summary> + public int PalletCount { get; set; } + + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + public string LocCode { get; set; } + } + + public class EmptyBindGoodpackInfo { + /// <summary> + /// 瀹瑰櫒缂栫爜 + /// </summary> + public string CntrCode { get; set; } + + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + public string LocCode { get; set; } + } + + public class EmptyInboundInfo { + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + public string LocCode { get; set; } + } + + public class EmptyInboundDetailInfo : StartCntInfo { } + + public class EmptyOnlineInfo { + public string CgId { get; set; } + public string PatchNo { get; set; } + public string EndLoc { get; set; } + } + + public class EmptyOnlinePalletInfo { + public string CntId { get; set; } + public string EndLoc { get; set; } + } + + public class EmptyOnlineGoodpackInfo : StartCntEndInfo { } + #endregion + + #region WMS 鏁版嵁 + /// <summary> + /// 鎴愬搧鑳舵墭鐩樺嚭搴撲俊鎭�+ /// </summary> + public class FinishedOutboundInfo { + /// <summary> + /// 鍑哄簱鍗�+ /// </summary> + public string No { get; set; } + + public bool Forced { get; set; } + public List<FinishedOutboundDetailInfo> OutboundDetails { get; set; } + } + + public class FinishedOutboundDetailInfo { + public string CgCode { get; set; } + public string CgName { get; set; } + public string PatchNo { get; set; } + public string CntrType { get; set; } + public int Qty { get; set; } + + public string EndArea { get; set; } + //public bool Forced { get; set; } + } + #endregion + + //------------------------------------------------------------------------------ + + #region 妯℃澘鏁版嵁 + /// <summary> + /// 妯℃澘鎶借薄鏁版嵁绫伙細璧风偣璐т綅銆佸鍣ㄥ彿銆佺粓鐐硅揣浣�+ /// </summary> + public abstract class StartCntEndInfo { + /// <summary> + /// 璧风偣璐т綅 + /// </summary> + public string StartLoc { get; set; } + /// <summary> + /// 瀹瑰櫒鍙�+ /// </summary> + public string CntId { get; set; } + /// <summary> + /// 缁堢偣璐т綅 + /// </summary> + public string EndLoc { get; set; } + } + + /// <summary> + /// 妯℃澘鎶借薄鏁版嵁绫伙細璧风偣璐т綅銆佸鍣ㄥ彿 + /// </summary> + public abstract class StartCntInfo { + /// <summary> + /// 璧风偣璐т綅 + /// </summary> + public string StartLoc { get; set; } + /// <summary> + /// 瀹瑰櫒鍙�+ /// </summary> + public string CntId { get; set; } + } + #endregion + + } +} diff --git a/Dtos/Response/AgvResponse.cs b/Dtos/Response/AgvResponse.cs new file mode 100644 index 0000000..5401c4f --- /dev/null +++ b/Dtos/Response/AgvResponse.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Response { + public class AgvResponse : BaseResponse { + /// <summary> + /// 杩斿洖缁�HostToAgv + /// </summary> + public class ReturnResult { + public int ResultCode { get; set; } + public string ResultMsg { get; set; } + } + + } +} diff --git a/Dtos/Response/BaseResponse.cs b/Dtos/Response/BaseResponse.cs new file mode 100644 index 0000000..314a681 --- /dev/null +++ b/Dtos/Response/BaseResponse.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Response { + /// <summary> + /// 妯℃澘鎶借薄绫伙細杩斿洖淇℃伅 DTO 鍩虹被 + /// </summary> + public abstract class BaseResponse { + /// <summary> + /// 榛樿鐨�杩斿洖缁撴灉 鏁版嵁绫�{ int Code; string Message; } + /// </summary> + public class Result { + public int Code { get; set; } + public string Message { get; set; } + } + } +} diff --git a/Dtos/Response/DebugResponse.cs b/Dtos/Response/DebugResponse.cs new file mode 100644 index 0000000..3ae23e1 --- /dev/null +++ b/Dtos/Response/DebugResponse.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Response { + public class DebugResponse { + /// <summary> + /// + /// </summary> + public class ReturnResults { + public List<ReturnResult> ResultList { set; get; } + } + } +} diff --git a/Dtos/Response/MoboxResponse.cs b/Dtos/Response/MoboxResponse.cs new file mode 100644 index 0000000..8ebf56f --- /dev/null +++ b/Dtos/Response/MoboxResponse.cs @@ -0,0 +1,205 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Dtos.Response { + public class MoboxResponse : BaseResponse { + /// <summary> + /// Mobox 鎺ュ彛杩斿洖 + /// </summary> + public class SimpleResult : Result { + public List<object> Results { get; set; } = new List<object>(); + } + + /// <summary> + /// mobox 鍙栨秷浠诲姟銆佹爣璁板畬鎴愪换鍔�+ /// </summary> + public class MoboxTaskBase { + public string TaskNo { get; set; } + } + + /// <summary> + /// 缁戝畾 鍙傛暟 + /// </summary> + public class BindParme { + /// <summary> + /// 鎵樼洏缂栫爜 + /// </summary> + public string CntrCode { get; set; } + /// <summary> + /// 鎵樼洏绫诲瀷 + /// </summary> + public string CntrType { get; set; } + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + public string LocCode { get; set; } + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + public string ItemCode { get; set; } + /// <summary> + /// 鐗╂枡鏁伴噺 + /// </summary> + public int ItemQuantity { get; set; } + } + + /// <summary> + /// 瑙g粦 鍙傛暟 + /// </summary> + public class UnBindParme { + /// <summary> + /// 鎵樼洏缂栫爜 + /// </summary> + public string CntrCode { get; set; } + + } + + public class sendTask { + + /// <summary> + /// 璁㈠崟鍚�+ /// </summary> + public string ts { get; set; } + } + + /// <summary> + /// 鏇存柊琛ヨ揣鐘舵�鍙傛暟 + /// </summary> + public class replenishmentParme { + /// <summary> + /// Y寮�浜哄伐琛ヨ揣杩涘叆浜ら�绠″埗,N琛ㄧず浜哄伐琛ヨ揣瀹屾垚鍙互寮�惎鑷姩杞繍 + /// </summary> + public string stauts { get; set; } + } + + + public class orderStatusReportParme { + /// <summary> + /// 璁㈠崟ID + /// </summary> + public int orderID { get; set; } + /// <summary> + /// 璁㈠崟鍚�+ /// </summary> + public string orderName { get; set; } + /// <summary> + /// 璁㈠崟鐘舵� + /// </summary> + public string orderStatus { get; set; } + /// <summary> + /// agv杞﹀彿鍒楄〃 + /// </summary> + public string agvIDList { get; set; } + /// <summary> + /// 浼樺厛绾�+ /// </summary> + public string priority { get; set; } + /// <summary> + /// 璁㈠崟褰撳墠鐨勭洰鐨勫湴 + /// </summary> + public string currentDes { get; set; } + + + /// <summary> + /// 褰撳墠鎸囦护 + /// </summary> + public string currentCmd { get; set; } + + /// <summary> + /// 閿欒鐮�+ /// </summary> + public int errorCode { get; set; } + + /// <summary> + /// 璁㈠崟鐨勬埅鑷虫椂闂�+ /// </summary> + public string deadLine { get; set; } + + /// <summary> + /// 璁㈠崟鐨勫垱寤烘椂闂�+ /// </summary> + public string createdTime { get; set; } + + /// <summary> + /// 棰濆淇℃伅1 + /// </summary> + public string extraInfo1 { get; set; } + + /// <summary> + /// 棰濆淇℃伅2 + /// </summary> + public string extraInfo2 { get; set; } + } + + /// <summary> + /// 鍒嗘嫞纭 + /// </summary> + public class SortingResultCheck { + public string sortNo { get; set; } + public string cntrCode { get; set; } + public string itemCode { get; set; } + public float qty { get; set; } + } + public class CheckSortingWholeCntr { + public string cntr { get; set; } + /// <summary> + /// 榛樿0锛�琛ㄧず鑷姩鐢熸垚鍒嗘嫞缁撴灉 + /// </summary> + public int autoSort { get; set; } + } + + /// <summary> + /// lua 璋冪敤鎺ュ彛锛岀爜鐩樹俊鎭�+ /// </summary> + public class PalletSorting { + public string cntr_code { get; set; } + public string item_code { get; set; } + public float qty { get; set; } + public string arrival_no { get; set; } + } + public class PalletSorting1 { + public string cntr_code { get; set; } + public string bar_code { get; set; } + public string org { get; set; } + public float qty { get; set; } + } + + public class ShippingOrderCheck { + /// <summary> + /// 澶氫釜鍙戣揣鍗曞彿 + /// </summary> + public string out_nos { get; set; } + } + public class SortingOrderCheck { + + public string s_no { get; set; } + } + + public class ReturnResult1 { + public int code { get; set; } + public string msg { get; set; } + + } + + /// <summary> + /// 瀹夊叏浜や簰 + /// </summary> + public class Interaction { + public string station_name { get; set; } + public string apply_code { get; set; } + public int orderid { get; set; } + + } + /// <summary> + /// 杩斿洖缁橤Z + /// </summary> + public class GzResult { + public int resultCode { get; set; } + public string msg { get; set; } + public int orderID { get; set; } + } + } +} diff --git a/HH.WCS.Mobox3.DSZSH.csproj b/HH.WCS.Mobox3.DSZSH.csproj new file mode 100644 index 0000000..5fefc35 --- /dev/null +++ b/HH.WCS.Mobox3.DSZSH.csproj @@ -0,0 +1,323 @@ +锘�?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>HH.WCS.Mobox3.DSZSH</RootNamespace> + <AssemblyName>HH.WCS.Mobox3.DSZSH</AssemblyName> + <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + <TargetFrameworkProfile /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>x86</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <DocumentationFile>bin\Debug\HH.WCS.Mobox3.DSZSH.xml</DocumentationFile> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <NoWarn>$(NoWarn);CS1591</NoWarn> + </PropertyGroup> + <PropertyGroup> + <StartupObject>HH.WCS.Mobox3.DSZSH.Program</StartupObject> + </PropertyGroup> + <ItemGroup> + <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> + <HintPath>packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath> + </Reference> + <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> + <HintPath>packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath> + </Reference> + <Reference Include="CsvHelper, Version=33.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL"> + <HintPath>packages\CsvHelper.33.0.1\lib\net462\CsvHelper.dll</HintPath> + </Reference> + <Reference Include="EasyModbus, Version=5.6.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=3.1.32.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.Extensions.Logging.Abstractions.3.1.32\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Owin.Host.HttpListener, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Owin.Host.HttpListener.4.2.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Owin.Hosting, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Owin.Hosting.4.2.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Web.Infrastructure, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.Web.Infrastructure.2.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath> + </Reference> + <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> + <HintPath>packages\NLog.5.3.4\lib\net46\NLog.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Client, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Client.1.5.374.126\lib\netstandard2.0\Opc.Ua.Client.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Configuration, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.5.374.126\lib\netstandard2.0\Opc.Ua.Configuration.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Core, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.5.374.126\lib\netstandard2.0\Opc.Ua.Core.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Gds.Client.Common, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common.1.5.374.126\lib\netstandard2.0\Opc.Ua.Gds.Client.Common.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Gds.Server.Common, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common.1.5.374.126\lib\netstandard2.0\Opc.Ua.Gds.Server.Common.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Security.Certificates, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.5.374.126\lib\netstandard2.0\Opc.Ua.Security.Certificates.dll</HintPath> + </Reference> + <Reference Include="Opc.Ua.Server, Version=1.5.374.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL"> + <HintPath>packages\OPCFoundation.NetStandard.Opc.Ua.Server.1.5.374.126\lib\netstandard2.0\Opc.Ua.Server.dll</HintPath> + </Reference> + <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL"> + <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> + </Reference> + <Reference Include="S7.Net, Version=0.20.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL"> + <HintPath>..\packages\S7netplus.0.20.0\lib\net452\S7.Net.dll</HintPath> + </Reference> + <Reference Include="SqlSugar, Version=5.1.4.168, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>packages\SqlSugar.5.1.4.169\lib\SqlSugar.dll</HintPath> + </Reference> + <Reference Include="Swashbuckle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd1bb07a5ac7c7bc, processorArchitecture=MSIL"> + <HintPath>..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> + </Reference> + <Reference Include="System.ComponentModel.Composition" /> + <Reference Include="System.Configuration" /> + <Reference Include="System.Configuration.Install" /> + <Reference Include="System.Core" /> + <Reference Include="System.Diagnostics.DiagnosticSource, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>packages\System.Diagnostics.DiagnosticSource.6.0.1\lib\net461\System.Diagnostics.DiagnosticSource.dll</HintPath> + </Reference> + <Reference Include="System.Formats.Asn1, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll</HintPath> + </Reference> + <Reference Include="System.IdentityModel" /> + <Reference Include="System.IO.Compression" /> + <Reference Include="System.Management" /> + <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath> + </Reference> + <Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath> + </Reference> + <Reference Include="System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath> + </Reference> + <Reference Include="System.Numerics" /> + <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> + </Reference> + <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> + </Reference> + <Reference Include="System.Runtime.Serialization" /> + <Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath> + </Reference> + <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath> + </Reference> + <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath> + </Reference> + <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath> + </Reference> + <Reference Include="System.ServiceModel" /> + <Reference Include="System.ServiceModel.Primitives, Version=4.10.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>packages\System.ServiceModel.Primitives.4.10.0\lib\net461\System.ServiceModel.Primitives.dll</HintPath> + </Reference> + <Reference Include="System.ServiceProcess" /> + <Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath> + </Reference> + <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> + </Reference> + <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> + <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> + </Reference> + <Reference Include="System.Web" /> + <Reference Include="System.Web.Http, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.AspNet.WebApi.Core.5.3.0\lib\net45\System.Web.Http.dll</HintPath> + </Reference> + <Reference Include="System.Web.Http.Owin, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.AspNet.WebApi.Owin.5.3.0\lib\net45\System.Web.Http.Owin.dll</HintPath> + </Reference> + <Reference Include="System.Web.Http.WebHost, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.3.0\lib\net45\System.Web.Http.WebHost.dll</HintPath> + </Reference> + <Reference Include="System.Web.Services" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Topshelf, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL"> + <HintPath>..\packages\Topshelf.4.3.0\lib\net452\Topshelf.dll</HintPath> + </Reference> + <Reference Include="Topshelf.NLog, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL"> + <HintPath>..\packages\Topshelf.NLog.4.3.0\lib\net452\Topshelf.NLog.dll</HintPath> + </Reference> + <Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL"> + <HintPath>packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="AppStart\Config.cs" /> + <Compile Include="Consts\AgvStateCode.cs" /> + <Compile Include="Consts\AgvStateName.cs" /> + <Compile Include="Consts\AreaName.cs" /> + <Compile Include="Consts\LockStateCode.cs" /> + <Compile Include="Consts\LockStateName.cs" /> + <Compile Include="Consts\TaskName.cs" /> + <Compile Include="Controllers\DebugController.cs" /> + <Compile Include="Controllers\ErpController.cs" /> + <Compile Include="Controllers\MoboxController.cs" /> + <Compile Include="Controllers\AgvController.cs" /> + <Compile Include="AppStart\SwaggerControllerDescProvider.cs" /> + <Compile Include="Dtos\Request\DebugRequest.cs" /> + <Compile Include="Dtos\Response\BaseResponse.cs" /> + <Compile Include="Dtos\Response\DebugResponse.cs" /> + <Compile Include="Helpers\AgvHelper.cs" /> + <Compile Include="Helpers\ExprHelper.cs" /> + <Compile Include="Helpers\PathHelper.cs" /> + <Compile Include="Helpers\ResultHelper.cs" /> + <Compile Include="Helpers\DbHelper.cs" /> + <Compile Include="Models\DebugModel.cs" /> + <Compile Include="Models\TN_Inbound_Order.cs" /> + <Compile Include="Models\TN_Outbound_Order.cs" /> + <Compile Include="Models\TN_Outbound_Detail.cs" /> + <Compile Include="Models\TN_Outbound_Task.cs" /> + <Compile Include="ServiceCore\OutboundCore.cs" /> + <Compile Include="Services\DebugService.cs" /> + <Compile Include="Devices\BaseModbusDevice.cs" /> + <Compile Include="Devices\ProductionLineDevice.cs" /> + <Compile Include="Helpers\Device\ModbusHelper.cs" /> + <Compile Include="Helpers\Device\OpcUaHelper.cs" /> + <Compile Include="Helpers\Device\PlcHelper.cs" /> + <Compile Include="Helpers\Device\S7Helper.cs" /> + <Compile Include="Helpers\Device\TcpClient.cs" /> + <Compile Include="Helpers\Device\TcpServer.cs" /> + <Compile Include="Helpers\Dispatch\GZRobot.cs" /> + <Compile Include="Helpers\Dispatch\HanAo.cs" /> + <Compile Include="Helpers\Dispatch\NDC.cs" /> + <Compile Include="ServiceCore\OfflineCore.cs" /> + <Compile Include="Helpers\Dispatch\NDCApi.cs" /> + <Compile Include="Dtos\Request\AgvRequest.cs" /> + <Compile Include="Dtos\Request\MoboxRequest.cs" /> + <Compile Include="Dtos\Response\AgvResponse.cs" /> + <Compile Include="Dtos\Response\MoboxResponse.cs" /> + <Compile Include="Models\BaseModel.cs" /> + <Compile Include="Models\TN_CG_Detail.cs" /> + <Compile Include="Models\TN_CAR_IN.cs" /> + <Compile Include="Models\TN_Container.cs" /> + <Compile Include="Models\TN_Location.cs" /> + <Compile Include="Models\TN_Loc_Container.cs" /> + <Compile Include="Models\TN_WorkOrder.cs" /> + <Compile Include="Models\TN_Task.cs" /> + <Compile Include="Models\TN_Task_Action.cs" /> + <Compile Include="Helpers\DeviceProcess.cs" /> + <Compile Include="ServiceCore\TaskCore.cs" /> + <Compile Include="Controllers\WmsController.cs" /> + <Compile Include="Helpers\Dispatch\HostToAGV.cs" /> + <Compile Include="Helpers\Model\TaskHelper.cs" /> + <Compile Include="Services\AgvService.cs" /> + <Compile Include="Services\MoboxService.cs" /> + <Compile Include="Helpers\LogHelper.cs" /> + <Compile Include="Helpers\Model\ContainerHelper.cs" /> + <Compile Include="Helpers\Model\LocationHelper.cs" /> + <Compile Include="Helpers\SysHelper.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="AppStart\Settings.cs" /> + <Compile Include="AppStart\Startup.cs" /> + <Compile Include="Helpers\Dispatch\NDCHelper.cs" /> + <Compile Include="Helpers\HttpHelper.cs" /> + </ItemGroup> + <ItemGroup> + <None Include=".editorconfig" /> + <None Include="App.config" /> + <None Include="config\config.comment.json" /> + <None Include="config\config.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + <None Include="debug\loc_cntr_cg.csv" /> + <None Include="debug\task.csv" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <None Include="debug\outbound_order.csv" /> + <Content Include="readme.dev.md" /> + <Content Include="readme.md" /> + <EmbeddedResource Include="swagger.js"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.6.2"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4.6.2 %28x86 鍜�x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> + <ItemGroup /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/HH.WCS.Mobox3.DSZSH.sln b/HH.WCS.Mobox3.DSZSH.sln new file mode 100644 index 0000000..7fe5cd1 --- /dev/null +++ b/HH.WCS.Mobox3.DSZSH.sln @@ -0,0 +1,30 @@ +锘�+Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HH.WCS.Mobox3.DSZSH", "HH.WCS.Mobox3.DSZSH.csproj", "{EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2B600D60-6469-4E6C-9692-C01E7A42018E}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBE15A59-A43A-43BE-8B4B-A6EC42E11DF6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8F82F32F-C59B-4BE6-A074-82CC2830FE2E} + EndGlobalSection +EndGlobal diff --git a/Helpers/AgvHelper.cs b/Helpers/AgvHelper.cs new file mode 100644 index 0000000..dda731c --- /dev/null +++ b/Helpers/AgvHelper.cs @@ -0,0 +1,64 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + public class AgvHelper { + /// <summary> + /// AGV 浠诲姟鐘舵�浼樺厛绾э細1->3->4->5->6->2 + /// </summary> + private static readonly int[] _agvTaskStatePri = { 0, 1, 6, 2, 3, 4, 5 }; + + /// <summary> + /// AGV 鐘舵�鍙樺寲琛細1->3->4->5->6->2 | 0->0 | 2->0 + /// </summary> + private static readonly int[] _agvNextState = new int[] { 0, 3, 0, 4, 5, 6, 2 }; + + /// <summary> + /// 鍒ゆ柇AGV鐘舵�鏄惁涓哄悎娉曠殑涓嬩釜鐘舵�锛堝寘鍚鏌ョ姸鎬佹槸鍚︿负浠诲姟鐘舵�锛�+ /// </summary> + /// <remarks> + /// 1. 鍓嶅悗鐘舵�鍙鏈変笉鍚堟硶閮戒細杩斿洖 <see langword="false"/><br/> + /// 2. nextState 鍙互涓�lastState 鐩稿悓 + /// </remarks> + /// <param name="lastState"></param> + /// <param name="nextState"></param> + /// <returns></returns> + public static bool IsNextStateOk(int lastState, int nextState) { + var lastPri = GetPri(lastState); + var nextPri = GetPri(nextState); + return lastPri != 0 && nextPri != 0 && lastPri <= nextState; + } + + /// <summary> + /// 鑾峰彇AGV褰撳墠鐘舵�鐨勪笅涓姸鎬侊細涓嶅悎娉曟垨涓�2(瀹屾垚) 鏃惰繑鍥�0 + /// </summary> + /// <param name="curState"></param> + /// <returns></returns> + public static int GetNextState(int curState) { + if (!IsTaskState(curState)) return 0; + return _agvNextState[curState]; + } + + /// <summary> + /// 鍒ゆ柇 AGV 鐘舵�鏄惁涓烘甯哥殑鎵ц浠诲姟鐘舵�锛�34562 + /// </summary> + /// <param name="state"></param> + /// <returns></returns> + private static bool IsTaskState(int state) { + return state > 0 && state < 7; + } + + /// <summary> + /// GetTaskStatePri锛氳幏鍙�AGV 浠诲姟鐘舵�鐨勪紭鍏堢骇锛堝寘鍚鏌ョ姸鎬佹槸鍚︿负浠诲姟鐘舵�锛�+ /// </summary> + /// <param name="state"></param> + /// <returns></returns> + private static int GetPri(int state) { + if (!IsTaskState(state)) { return 0; } + return _agvTaskStatePri[state]; + } + } +} diff --git a/Helpers/DbHelper.cs b/Helpers/DbHelper.cs new file mode 100644 index 0000000..ebe4313 --- /dev/null +++ b/Helpers/DbHelper.cs @@ -0,0 +1,134 @@ +锘縰sing System; +using System.Linq; + +using HH.WCS.Mobox3.DSZSH.AppStart; +using HH.WCS.Mobox3.DSZSH.Helpers; + +using SqlSugar; + +using Task = System.Threading.Tasks.Task; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + // SqlSugar 鏁欑▼锛歨ttps://www.donet5.com/Home/Doc + + /// <summary> + /// 鏁版嵁搴撳府鍔╃被锛氬寘鎷崟渚嬫ā寮忓拰鍒涘缓鏂拌繛鎺ョ殑鏂规硶 + /// </summary> + public static class DbHelper { + private static readonly SqlSugarScope _sqlSugar; + + static DbHelper() { + _sqlSugar = new SqlSugarScope(new ConnectionConfig() { + ConnectionString = Settings.Config.SqlServer, + DbType = DbType.SqlServer, + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute // 浠庣壒鎬ц鍙栦富閿嚜澧炰俊鎭�+ }, + db => { + // 鐩戞帶鎵�湁瓒呰繃1绉掔殑Sql + db.Aop.OnLogExecuted = (sql, p) => + { + // 鎵ц鏃堕棿瓒呰繃1绉�+ if (db.Ado.SqlExecutionTime.TotalSeconds > 1) { + Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(p.ToDictionary(it => it.ParameterName, it => it.Value))); + // 浠g爜CS鏂囦欢鍚�+ var fileName = db.Ado.SqlStackTrace.FirstFileName; + // 浠g爜琛屾暟 + var fileLine = db.Ado.SqlStackTrace.FirstLine; + // 鏂规硶鍚�+ var FirstMethodName = db.Ado.SqlStackTrace.FirstMethodName; + } + // 鐩稿綋浜嶦F鐨�PrintToMiniProfiler + }; + + // 姣忔璁剧疆鏁板�鏃堕兘鍘婚櫎鍓嶅鍚庡绌烘牸 + db.Aop.DataExecuted = (value, entity) => { + entity.EntityColumnInfos.ToList().ForEach(a => { + var pvalue = entity.GetValue(a.PropertyName); + if (pvalue != null && pvalue.GetType() == typeof(String)) { + entity.SetValue(a.PropertyName, pvalue.ToString().Trim()); + } + }); + }; + + // 閰嶇疆AOP鏃ュ織 + //db.Aop.OnLogExecuting = (sql, pars) => + //{ + // Console.WriteLine(sql); // 杈撳嚭绾疭QL璇彞 + //}; + + // 姣廚灏忔椂娓呯悊涓�缂撳瓨 + Task.Run(async () => { + while (true) { + await Task.Delay(TimeSpan.FromHours(2)); + db.QueryFilter.Clear(); + } + }); + }); + } + + /// <summary> + /// 鑾峰彇鐢ㄤ簬鎿嶆帶鏁版嵁搴撶殑 SqlSugarClient 瀵硅薄 + /// </summary> + /// <returns></returns> + public static SqlSugarScope GetDbClient() { + return _sqlSugar; + } + + /// <summary> + /// 鐢熸垚鐢ㄤ簬鎿嶆帶鏁版嵁搴撶殑 SqlSugarClient 瀵硅薄 + /// </summary> + /// <remarks> + /// 濡傛灉鐢�Oracle 鏁版嵁闇�鍖�Oracle.ManagedDataAccess/21.15.0锛岀幆澧�netframework 4.62锛屽お鏂颁簡 4.8 鏈夌殑鏈嶅姟鍣ㄥ畨瑁呬笉涓婂幓 + /// </remarks> + /// <param name="url"></param> + /// <returns></returns> + public static SqlSugarClient NewDbClient(string url = "") { + // 鍒涘缓鏁版嵁搴撳璞�+ SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { + ConnectionString = string.IsNullOrEmpty(url) ? Settings.Config.SqlServer : url, + DbType = DbType.SqlServer, + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute // 浠庣壒鎬ц鍙栦富閿嚜澧炰俊鎭�+ }); + + // 鐩戞帶鎵�湁瓒呰繃1绉掔殑Sql + db.Aop.OnLogExecuted = (sql, p) => { + // 鎵ц鏃堕棿瓒呰繃1绉�+ if (db.Ado.SqlExecutionTime.TotalSeconds > 1) { + Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(p.ToDictionary(it => it.ParameterName, it => it.Value))); + // 浠g爜CS鏂囦欢鍚�+ var fileName = db.Ado.SqlStackTrace.FirstFileName; + // 浠g爜琛屾暟 + var fileLine = db.Ado.SqlStackTrace.FirstLine; + // 鏂规硶鍚�+ var FirstMethodName = db.Ado.SqlStackTrace.FirstMethodName; + } + // 鐩稿綋浜嶦F鐨�PrintToMiniProfiler + }; + + // 姣忔璁剧疆鏁板�鏃堕兘鍘婚櫎鍓嶅鍚庡绌烘牸 + db.Aop.DataExecuted = (value, entity) => { + entity.EntityColumnInfos.ToList().ForEach(a => { + var pvalue = entity.GetValue(a.PropertyName); + if (pvalue != null && pvalue.GetType() == typeof(String)) { + entity.SetValue(a.PropertyName, pvalue.ToString().Trim()); + } + }); + }; + + // 鎹浆鎹�(ExecuteCommand 鎵嶄細鎷︽埅锛屾煡璇笉琛� + //db.Aop.DataExecuting = (value, entity) => { + // //var val=entity.EntityColumnInfo + // Console.WriteLine(entity.EntityName); + //}; + + // 鐢ㄤ簬鎵撳嵃 SqlSugar 瑙g爜鍚庣殑 SQL 璇彞 + db.Aop.OnLogExecuting = (sql, pars) => { + Console.WriteLine(sql); + }; + + return db; + } + } +} diff --git a/Helpers/Device/ModbusHelper.cs b/Helpers/Device/ModbusHelper.cs new file mode 100644 index 0000000..8408657 --- /dev/null +++ b/Helpers/Device/ModbusHelper.cs @@ -0,0 +1,399 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using EasyModbus; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + /// <summary> + /// modbus tcp 鐢ㄧ涓夋柟鐨勫寘 + /// </summary> + public class ModbusHelper { + // 鍐呭瓨锛岃繛鎺ヤ笂鐨�Modbus 閫氳瀵硅薄 + private static Dictionary<string, ModbusClient> _ipPort_ModbusClient = new Dictionary<string, ModbusClient>(); + + public ModbusHelper(string ip, int port = 502, byte slaveId = 1) { + Init(ip, port, slaveId); + } + + /// <summary> + /// Modbus 鍚姩鍒濆鍖�+ /// </summary> + public static void Init(string ip, int port = 502, byte slaveId = 1) { + // 閰嶇疆鏂囦欢璇诲彇鎵�湁鐨�Modbus 杩涜鍒濆鍖�+ try { + if (ip == null || ip.Trim() == "") { + // 璇诲彇閰嶇疆淇℃伅澶辫触 + LogHelper.Info("Modbus锛氳鍙栭厤缃俊鎭け璐�); + return; + } + + var modbusClient = new ModbusClient(ip, port); + _ipPort_ModbusClient.Add($"{ip}:{port}({slaveId})", modbusClient); + Link(modbusClient); + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + + /// <summary> + /// 閲嶈繛鎵�湁 Modbus 璁惧 + /// </summary> + public static void Relink() { + try { + if (_ipPort_ModbusClient.Count == 0) { + return; + } + + foreach (var item in _ipPort_ModbusClient) { + if (!item.Value.Connected) { + Link(item.Value); + } + } + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + + /// <summary> + /// 杩炴帴 Modbus 涓嬩綅鏈猴紙绉佹湁锛屽唴閮ㄨ皟鐢級 + /// </summary> + /// <param name="modbusClient"></param> + private static void Link(ModbusClient modbusClient) { + try { + modbusClient.Disconnect(); + modbusClient.Connect(); + if (modbusClient.Connected) { + //杩炴帴涓�+ } + else { + //娌¤繛涓�+ } + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + + /// <summary> + /// 璇讳竴涓垨澶氫釜绾垮湀锛岃繑鍥炰竴涓猙it鐪熷亣鏁扮粍 + /// </summary> + /// <param name="address"></param> + /// <param name="qty"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + /// <returns></returns> + public static bool[] ReadCoils(int address, int qty, string ip, int port = 502) { + bool[] res = new bool[0]; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + res = client.ReadCoils(address, qty); + if (res.Length != 0) { + //璇诲彇鎴愬姛 + } + else { + //璇诲彇澶辫触 + } + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + else { + + } + return res; + } + + /// <summary> + /// 鍐欏叆鍗曚釜绾垮湀 + /// </summary> + /// <param name="address"></param> + /// <param name="value"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + public static bool WriteSingleCoil(int address, bool value, string ip, int port = 502) { + var res = false; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + client.WriteSingleCoil(address, value); + res = value == client.ReadCoils(address, 1)[0]; + if (res) { + //鍐欏叆鎴愬姛 + } + else { + //鍐欏叆澶辫触 + } + } + catch (Exception ex) { + + } + } + else { + + } + return res; + } + /// <summary> + /// 鍐欏叆澶氫釜绾垮湀 + /// </summary> + /// <param name="address"></param> + /// <param name="values"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + public static bool WriteMultipleCoils(int address, bool[] values, string ip, int port = 502) { + var res = false; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + client.WriteMultipleCoils(address, values); + var dataRead = client.ReadCoils(address, values.Length); + res = values.SequenceEqual(dataRead); + if (res) { + //鍐欏叆鎴愬姛 + } + else { + //鍐欏叆澶辫触 + } + } + catch (Exception ex) { + + } + } + else { + + } + return res; + + } + + /// <summary> + /// 鎵归噺璇诲彇鎴栧崟鐙鍙栦繚鎸佸瘎瀛樺櫒锛岃繑鍥炵殑鏄�2浣峣nt鏁扮粍 + /// </summary> + /// <param name="address">璇诲彇璧峰浣�/param> + /// <param name="qty">璇诲彇鐨勬暟閲�/param> + /// <param name="ip">IP鍦板潃</param> + /// <param name="port">绔彛鍙�/param> + /// <returns></returns> + public static int[] ReadHoldingRegisters(int address, int qty, string ip, int port = 502) { + int[] res = new int[0]; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + //涓�釜瀵勫瓨鍣ㄦ槸16浣嶏紝杩斿洖2涓猧nt绫诲瀷 + res = client.ReadHoldingRegisters(address, qty); + if (res.Length != 0) { + //璇诲彇鎴愬姛 + } + else { + //璇诲彇澶辫触 + } + } + catch (Exception ex) { + //濡傛灉璇锋眰鏁伴噺瓒呭嚭淇濇寔瀵勫瓨鍣ㄧ殑鏈�ぇ鏁版嵁琛屾暟锛屼細鎶ラ敊 + LogHelper.Info($"鍙戠敓浜嗗紓甯�{ex.Message},IP:{ip},Port:{port}", "Error"); + } + } + else { + LogHelper.Info($"鏈壘鍒癕odbus璁惧瀹炰緥瀵硅薄:IP:{ip},Port:{port}"); + } + return res; + } + + /// <summary> + /// 鍐欏叆鍗曚釜瀵勫瓨鍣ㄦ暟鎹�+ /// </summary> + /// <param name="address"></param> + /// <param name="value"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + public static bool WriteSingleRegister(int address, int value, string ip, int port = 502) { + var res = false; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + client.WriteSingleRegister(address, value); + res = value == client.ReadHoldingRegisters(address, 1)[0]; + if (res) { + //鍐欏叆鎴愬姛 + } + else { + //鍐欏叆澶辫触 + } + } + catch (Exception ex) { + + } + } + else { + + } + return res; + } + + /// <summary> + /// 鍐欏叆澶氫釜瀵勫瓨鍣ㄦ暟鎹�+ /// </summary> + /// <param name="address"></param> + /// <param name="values"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + public static bool WriteMultipleRegisters(int address, int[] values, string ip, int port = 502) { + var res = false; + var client = GetModbusClient(ip, port); + var log = string.Join(",", values.Select(x => x.ToString())); + if (client != null && client.Connected) { + try { + client.WriteMultipleRegisters(address, values); + var dataRead = client.ReadHoldingRegisters(address, values.Length); + res = values.SequenceEqual(dataRead); + if (res) { + LogHelper.Info($"鍐欏叆鎴愬姛,IP:{ip},Port:{port},{log}"); + } + else { + LogHelper.Info($"鍐欏叆澶辫触,IP:{ip},Port:{port},{log}"); + } + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓浜嗗紓甯�{ex.Message},IP:{ip},Port:{port},{log}", "Error"); + } + } + else { + LogHelper.Info($"鏈厤缃殑璁惧淇℃伅,IP:{ip},Port:{port},{log}"); + } + return res; + } + + /// <summary> + /// 璇讳竴涓垨澶氫釜绂绘暎杈撳叆锛岃繑鍥炰竴涓猙it鐪熷亣鏁扮粍 + /// </summary> + /// <param name="address"></param> + /// <param name="qty"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + /// <returns></returns> + public static bool[] ReadDiscreteInputs(int address, int qty, string ip, int port = 502) { + bool[] res = new bool[0]; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + res = client.ReadDiscreteInputs(address, qty); + if (res.Length != 0) { + //璇诲彇鎴愬姛 + } + else { + //璇诲彇澶辫触 + } + } + catch (Exception ex) { + + } + } + else { + + } + return res; + + } + + /// <summary> + /// 璇讳竴涓垨澶氫釜杈撳叆瀵勫瓨鍣紝杩斿洖涓�釜int32浣嶆暟缁�+ /// </summary> + /// <param name="address"></param> + /// <param name="qty"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + /// <returns></returns> + public static int[] ReadInputRegisters(int address, int qty, string ip, int port = 502) { + int[] res = new int[0]; + var client = GetModbusClient(ip, port); + if (client != null && client.Connected) { + try { + res = client.ReadInputRegisters(address, qty); + if (res.Length != 0) { + //璇诲彇鎴愬姛 + } + else { + //璇诲彇澶辫触 + } + } + catch (Exception ex) { + + } + } + else { + + } + return res; + } + + public static string ReadHoldingRegistersToString(int address, int qty, string ip, int port = 502) { + var readArray = ReadHoldingRegisters(address, qty, ip, port); + return RegistersToString(readArray); + } + + #region Modbus 鍗忚璇诲啓瀛楃涓�+ // 灏嗗瓧绗︿覆杞崲涓�Modbus 瀵勫瓨鍣ㄦ暟缁勶紙int[] 褰㈠紡锛屾瘡涓猧nt瀛樹竴涓�6浣嶅�锛�+ private static int[] StringToRegisters(string text) { + // 濉厖涓哄伓鏁伴暱搴�+ if (text.Length % 2 != 0) { + text += '\0'; + } + + byte[] bytes = Encoding.ASCII.GetBytes(text); + int[] registers = new int[bytes.Length / 2]; + + for (int i = 0; i < registers.Length; i++) { + // 澶х搴忥細楂樹綅瀛楄妭鍦ㄥ墠 + registers[i] = (bytes[i * 2] << 8) | bytes[i * 2 + 1]; + } + + return registers; + } + + // 灏�Modbus 瀵勫瓨鍣ㄦ暟缁�int[])杞崲涓哄瓧绗︿覆 + private static string RegistersToString(int[] registers) { + byte[] bytes = new byte[registers.Length * 2]; + + for (int i = 0; i < registers.Length; i++) { + // 鎻愬彇浣�6浣嶏紙蹇界暐楂�6浣嶏級 + ushort registerValue = (ushort)(registers[i] & 0xFFFF); + + // 瑙f瀽澶х搴�+ bytes[i * 2] = (byte)(registerValue >> 8); // 楂樹綅瀛楄妭 + bytes[i * 2 + 1] = (byte)(registerValue & 0xFF); // 浣庝綅瀛楄妭 + } + + // 鍘婚櫎濉厖鐨勭┖瀛楃 + string result = Encoding.ASCII.GetString(bytes).TrimEnd('\0'); + return result; + } + #endregion + + /// <summary> + /// 鑾峰彇 Modbus 閫氳瀵硅薄锛堢鏈夛紝鍐呴儴璋冪敤锛�+ /// </summary> + /// <param name="ip"></param> + /// <param name="port"></param> + /// <param name="slaveId"></param> + /// <returns></returns> + private static ModbusClient GetModbusClient(string ip, int port = 502, byte slaveId = 1) { + if (_ipPort_ModbusClient.TryGetValue($"{ip}:{port}({slaveId})", out var modbusClient)) { + return modbusClient; + } + return null; + + //if (_ipPort_ModbusClient.ContainsKey($"{ip}:{port}({slaveId})")) { + // return _ipPort_ModbusClient[$"{ip}:{port}({slaveId})"]; + //} + //else { + // return null; + //} + } + } +} diff --git a/Helpers/Device/OpcUaHelper.cs b/Helpers/Device/OpcUaHelper.cs new file mode 100644 index 0000000..555fea1 --- /dev/null +++ b/Helpers/Device/OpcUaHelper.cs @@ -0,0 +1,193 @@ +锘縰sing Opc.Ua.Client; +using Opc.Ua; +using System; +using Opc.Ua.Configuration; + + +namespace HH.WCS.Mobox3.DSZSH.device +{ + internal class OpcUaHelper + { + private static Opc.Ua.Client.Session session; + + static OpcUaHelper() + { + CreateUpcSession(); + } + + /// <summary> + /// 杩炴帴OPC鏈嶅姟 + /// </summary> + internal static async void CreateUpcSession() + { + try + { + // 鍒涘缓涓�釜搴旂敤閰嶇疆瀵硅薄锛岀敤浜庤缃簲鐢ㄥ悕绉般�鍞竴鏍囪瘑銆佺被鍨嬨�璇佷功鍜屽畨鍏ㄧ瓥鐣�+ var config = new ApplicationConfiguration() + { + ApplicationName = "MyClient", + ApplicationUri = Utils.Format(@"urn:{0}:MyClient", System.Net.Dns.GetHostName()), + ApplicationType = ApplicationType.Client, + SecurityConfiguration = new SecurityConfiguration + { + ApplicationCertificate = new CertificateIdentifier { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\MachineDefault", SubjectName = "MyClientSubjectName" }, + TrustedIssuerCertificates = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\UA Certificate Authorities" }, + TrustedPeerCertificates = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\UA Applications" }, + RejectedCertificateStore = new CertificateTrustList { StoreType = @"Directory", StorePath = @"%CommonApplicationData%\OPC Foundation\CertificateStores\RejectedCertificates" }, + AutoAcceptUntrustedCertificates = true, + RejectSHA1SignedCertificates = false, + MinimumCertificateKeySize = 1024, + NonceLength = 32, + }, + TransportConfigurations = new TransportConfigurationCollection(), + TransportQuotas = new TransportQuotas { OperationTimeout = 15000 }, + ClientConfiguration = new ClientConfiguration { DefaultSessionTimeout = 60000 }, + TraceConfiguration = new TraceConfiguration() + }; + + // 楠岃瘉搴旂敤閰嶇疆瀵硅薄 + await config.Validate(ApplicationType.Client); + + // 璁剧疆璇佷功楠岃瘉浜嬩欢锛岀敤浜庤嚜鍔ㄦ帴鍙椾笉鍙椾俊浠荤殑璇佷功 + if (config.SecurityConfiguration.AutoAcceptUntrustedCertificates) + { + config.CertificateValidator.CertificateValidation += (s, e) => { e.Accept = (e.Error.StatusCode == StatusCodes.BadCertificateUntrusted); }; + } + + // 鍒涘缓涓�釜搴旂敤瀹炰緥瀵硅薄锛岀敤浜庢鏌ヨ瘉涔�+ var application = new ApplicationInstance(config); + + // 妫�煡搴旂敤瀹炰緥瀵硅薄鐨勮瘉涔�+ bool check = await application.CheckApplicationInstanceCertificate(false, 2048); + // 鍒涘缓涓�釜浼氳瘽瀵硅薄锛岀敤浜庤繛鎺ュ埌 OPC UA 鏈嶅姟鍣�+ EndpointDescription endpointDescription = CoreClientUtils.SelectEndpoint("opc.tcp://172.16.57.41:4840", true); + EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(config); + ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration); + session = await Session.Create(config, endpoint, false, false, "DataCollector", 60000, new UserIdentity(), null); + if (session != null && session.Connected) + { + Console.WriteLine("The session is connected to the OPC UA server."); + LogHelper.Info($"鍒涘缓OPC杩炴帴鎴愬姛", "OPC"); + } + else + { + Console.WriteLine("The session is not connected to the OPC UA server."); + LogHelper.Info($"鍒涘缓OPC杩炴帴澶辫触", "OPC"); + } + } + catch (Exception e) + { + LogHelper.Info($"杩炴帴OPC鏈嶅姟寮傚父" + e.Message, "OPC"); + } + } + + /// <summary> + /// 璇诲彇OPC鑺傜偣鏁版嵁 + /// </summary> + /// <param name="nodeId"></param> + internal static object ReadOpcValue(string nodeId) + { + try + { + if (session != null && session.Connected) + { + // 璇诲彇鏁版嵁鑺傜偣 + DataValue item = session.ReadValue(nodeId: nodeId); + LogHelper.Info($"OPC璇诲彇:nodeid:{nodeId},value:{item.Value}", "OPC"); + return item.Value; + } + else + { + Console.WriteLine("The session is not connected to the OPC UA server."); + LogHelper.Info($"OPC杩炴帴澶辫触", "OPC"); + CreateUpcSession(); + } + + } + catch (Exception e) + { + + LogHelper.Info($"璇诲彇OPC鏁版嵁寮傚父" + e.Message, "OPC"); + } + return null; + } + + /// <summary> + /// 鍐橭PC鑺傜偣鏁版嵁 + /// </summary> + /// <param name="nodeId"></param> + /// <param name="val"></param> + internal static void WriteOpcValue(string nodeId,bool val) + { + try + { + if (session != null && session.Connected) + { + // 鍐欏叆鏁版嵁鍒拌妭鐐�+ WriteValue writeValue = new WriteValue + { + NodeId = new NodeId(nodeId), + AttributeId = Attributes.Value, + Value = new DataValue(val) + }; + + StatusCodeCollection results; + DiagnosticInfoCollection diagnosticInfos; + session.Write(null, new WriteValueCollection { writeValue }, out results, out diagnosticInfos); + Console.WriteLine($"Write Status for {nodeId}: {results[0]}"); + LogHelper.Info($"OPC鍐欏叆:nodeid:{nodeId},value:{val}", "OPC"); + } + else + { + Console.WriteLine("The session is not connected to the OPC UA server."); + LogHelper.Info($"OPC杩炴帴澶辫触", "OPC"); + CreateUpcSession(); + } + + } + catch (Exception e) + { + LogHelper.Info($"鍐欏叆OPC鏁版嵁寮傚父" + e.Message, "OPC"); + } + } + + /// <summary> + /// 鍐橭PC鑺傜偣鏁版嵁 + /// </summary> + /// <param name="nodeId"></param> + /// <param name="val"></param> + internal static void WriteOpcValue(string nodeId, int val) + { + try + { + if (session != null && session.Connected) + { + // 鍐欏叆鏁版嵁鍒拌妭鐐�+ WriteValue writeValue = new WriteValue + { + NodeId = new NodeId(nodeId), + AttributeId = Attributes.Value, + Value = new DataValue(val) + }; + + StatusCodeCollection results; + DiagnosticInfoCollection diagnosticInfos; + session.Write(null, new WriteValueCollection { writeValue }, out results, out diagnosticInfos); + Console.WriteLine($"Write Status for {nodeId}: {results[0]}"); + LogHelper.Info($"OPC鍐欏叆:nodeid:{nodeId},value:{val}", "OPC"); + } + else + { + Console.WriteLine("The session is not connected to the OPC UA server."); + LogHelper.Info($"OPC杩炴帴澶辫触", "OPC"); + CreateUpcSession(); + } + + } + catch (Exception e) + { + LogHelper.Info($"鍐欏叆OPC鏁版嵁寮傚父" + e.Message, "OPC"); + } + } + } +} diff --git a/Helpers/Device/PlcHelper.cs b/Helpers/Device/PlcHelper.cs new file mode 100644 index 0000000..be02f92 --- /dev/null +++ b/Helpers/Device/PlcHelper.cs @@ -0,0 +1,100 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.Helpers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.device +{ + internal class PlcHelper + { + internal static void Receive(string ip, string msg) { + //澶勭悊璁惧淇″彿 + DeviceProcess.Analysis(msg, ip); + } + internal static bool SendHex(string ip, string msg) { + return TcpServer.TcpServerSend(ip, Hex2Bytes(msg)); + + } + internal static void SendAscii(string ip, string msg) { + TcpServer.TcpServerSend(ip, Encoding.ASCII.GetBytes(msg)); + } + + internal static byte[] Hex2Bytes(string hexString) { + hexString = hexString.Replace(" ", ""); + if ((hexString.Length % 2) != 0) + hexString += " "; + byte[] returnBytes = new byte[hexString.Length / 2]; + for (int i = 0; i < returnBytes.Length; i++) + returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); + + return returnBytes; + } + internal static string Hex2Ascii(string hexString) { + hexString = hexString.Replace(" ", ""); + if ((hexString.Length % 2) != 0) + hexString += " "; + byte[] returnBytes = new byte[hexString.Length / 2]; + for (int i = 0; i < returnBytes.Length; i++) + returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); + + return Encoding.ASCII.GetString(returnBytes); + } + + #region 杩涘埗杞崲+CRC + internal static bool CheckCRC(string hex) { + var result = false; + var data = hex.Replace(" ", ""); + if (data.Length % 2 == 0) { + var code1 = data.Substring(data.Length - 4, 4).ToLower(); + var code2 = BitConverter.ToString(CRC16LH(Hex2Bytes(data.Substring(0, data.Length - 4)))).Replace("-", "").Replace(" ", "").ToLower(); + result = code1 == code2; + } + return result; + } + internal static byte[] CRC16LH(byte[] pDataBytes) { + ushort crc = 0xffff; + ushort polynom = 0xA001; + + for (int i = 0; i < pDataBytes.Length; i++) { + crc ^= pDataBytes[i]; + for (int j = 0; j < 8; j++) { + if ((crc & 0x01) == 0x01) { + crc >>= 1; + crc ^= polynom; + } + else { + crc >>= 1; + } + } + } + + byte[] result = BitConverter.GetBytes(crc); + return result; + } + internal static byte[] CRC16HL(byte[] pDataBytes) { + ushort crc = 0xffff; + ushort polynom = 0xA001; + + for (int i = 0; i < pDataBytes.Length; i++) { + crc ^= pDataBytes[i]; + for (int j = 0; j < 8; j++) { + if ((crc & 0x01) == 0x01) { + crc >>= 1; + crc ^= polynom; + } + else { + crc >>= 1; + } + } + } + + byte[] result = BitConverter.GetBytes(crc).Reverse().ToArray(); + return result; + } + + #endregion + + } +} diff --git a/Helpers/Device/S7Helper.cs b/Helpers/Device/S7Helper.cs new file mode 100644 index 0000000..492db2c --- /dev/null +++ b/Helpers/Device/S7Helper.cs @@ -0,0 +1,423 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.Controllers; +using Newtonsoft.Json.Linq; +using S7.Net; +using S7.Net.Types; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Services.Description; + +namespace HH.WCS.Mobox3.DSZSH.device +{ + + /// <summary> + /// 瑗块棬瀛恜lc + /// </summary> + public class S7Helper + { + public static Dictionary<string, Plc> ip_Plc = new Dictionary<string, Plc>();//鍐呭瓨锛岃繛鎺ヤ笂鐨凱LC閫氳瀵硅薄 + + public S7Helper(string ip, short rack, short slot) + { + Init(new S7ConfigModel() { Ip = ip, Rack = rack, Slot = slot, CpuType = CpuType.S71500 }); + } + + /// <summary> + /// S7鍚姩鍒濆鍖�+ /// </summary> + public static void Init(S7ConfigModel s7ConfigInfo) + { + //閰嶇疆鏂囦欢璇诲彇鎵�湁鐨刾lc杩涜鍒濆鍖�+ try + { + if (s7ConfigInfo == null) + { + //璇诲彇閰嶇疆淇℃伅澶辫触 + return; + } + + var plc = new Plc(s7ConfigInfo.CpuType, s7ConfigInfo.Ip, s7ConfigInfo.Rack, s7ConfigInfo.Slot); + ip_Plc.Add(s7ConfigInfo.Ip, plc); + Link(plc); + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + } + + /// <summary> + /// 閲嶈繛 + /// </summary> + public static void RestLink() + { + if (ip_Plc.Count>0) + { + foreach (var item in ip_Plc) + { + if(!item.Value.IsConnected) + { + Link(item.Value); + } + } + } + } + + + /// <summary> + /// 杩炴帴PLC + /// </summary> + /// <param name="plc"></param> + private static void Link(Plc plc) + { + try + { + plc.Close(); + plc.Open(); + if (plc.IsConnected) + { + LogHelper.Info($"杩炴帴涓妠plc.IP}");//杩炴帴涓�+ } + else + { + LogHelper.Info($"娌¤繛涓妠plc.IP}");//娌¤繛涓�+ } + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + } + + /// <summary> + /// 鎵归噺璇诲彇鎴栧崟鐙鍙朌B鍧楁暟鎹紙8浣峛yte锛夛紝骞惰浆鎹㈡垚瀛楃涓插舰寮�+ /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="count">璇诲彇鐨勪釜鏁帮紝1涓�8浣嶅崄鍏繘鍒舵暟</param> + /// <returns></returns> + public static string ReadString(string deviceIp, int dbNo, int startByteAdr, int count) + { + string result = ""; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + var data = plc.ReadBytes(DataType.DataBlock, dbNo, startByteAdr, count); + result = System.Text.Encoding.UTF8.GetString(data).TrimEnd('\0').TrimEnd('\n').TrimEnd('\r'); ;//姝ゆ柟娉曞彲浠ユ妸byte鏁扮粍杞崲鎴愬瓧绗︿覆锛屼絾鏄細閫犳垚\0\u缁撴潫绗︿笉鏄剧ず锛岄渶瑕佷笅浣嶆満姝g‘鐨勬暟鎹�+ if (result == string.Empty) + { + Link(plc);//璁惧鍙戦�鐨勬暟鎹负绌猴紝閲嶈繛 + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + LogHelper.Info($"涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥�");//涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鎵归噺鍐欏叆鎴栧崟鐙啓鍏B鍧楁暟鎹紙8浣峛yte锛夛紝浠ュ瓧绗︿覆杞崲byte褰㈠紡鍐欏叆 + /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="data">瑕佸啓鍏ョ殑鏁版嵁</param> + /// <returns></returns> + public static bool WriteString(string deviceIp, int dbNo, int startByteAdr, string data) + { + var result = false; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + byte[] bytes = System.Text.Encoding.UTF8.GetBytes(data); + plc.WriteBytes(DataType.DataBlock, dbNo, startByteAdr, bytes); + + if (!result) + { + //鍐欏畬鍐嶈涓�纭 + var readData = ReadString(deviceIp, dbNo, startByteAdr, data.Length); + result = readData == data; + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + //涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鎵归噺璇诲彇鎴栧崟鐙鍙朌B鍧楁暟鎹紙8浣峛yte锛�+ /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="count">璇诲彇鐨勪釜鏁帮紝1涓�8浣嶅崄鍏繘鍒舵暟</param> + /// <returns></returns> + public static byte[] ReadBytes(string deviceIp, int dbNo, int startByteAdr, int count) + { + byte[] result = null; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + result = plc.ReadBytes(DataType.DataBlock, dbNo, startByteAdr, count); + + if (result.Length == 0) + { + Link(plc);//璁惧鍙戦�鐨勬暟鎹负绌猴紝閲嶈繛 + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + LogHelper.Info($"涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥�");//涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鎵归噺鍐欏叆鎴栧崟鐙啓鍏B鍧楁暟鎹紙8浣峛yte锛�+ /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="data">瑕佸啓鍏ョ殑鏁版嵁</param> + /// <returns></returns> + public static bool WriteBytes(string deviceIp, int dbNo, int startByteAdr, byte[] data) + { + var result = false; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + plc.WriteBytes(DataType.DataBlock, dbNo, startByteAdr, data); + + if (!result) + { + //鍐欏畬鍐嶈涓�纭 + var readData = ReadBytes(deviceIp, dbNo, startByteAdr, data.Length); + result = readData.SequenceEqual(data); + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + LogHelper.Info($"涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥�");//涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鎵归噺璇诲彇鎴栧崟鐙鍙朌B鍧楁暟鎹紙1浣峛it锛�+ /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="count">瑕佽鍙栧灏戜綅</param> + /// <param name="bitAdr">浠庣鍑犱綅寮�璇诲彇</param> + /// <returns></returns> + public static BitArray ReadBits(string deviceIp, int dbNo, int startByteAdr, int count, byte bitAdr = 0) + { + BitArray result = null; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + var data = plc.Read(DataType.DataBlock, dbNo, startByteAdr, VarType.Bit, count, bitAdr); + if (count == 1) + { + result = new BitArray(new bool[] { (bool)data }); + } + else + { + result = (BitArray)data; + } + if (result.Length == 0) + { + Link(plc);//璁惧鍙戦�鐨勬暟鎹负绌猴紝閲嶈繛 + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + LogHelper.Info($"涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥�");//涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鎵归噺鍐欏叆鎴栧崟鐙啓鍏B鍧楁暟鎹紙1浣峛it锛�+ /// </summary> + /// <param name="deviceIp">plc璁惧閫氳鍦板潃</param> + /// <param name="dbNo">DB鍧楀彿</param> + /// <param name="startByteAdr">璧峰byte鍦板潃锛屾渶灏忓�0锛�=8浣�1涓狟lock</param> + /// <param name="biteAdr">璧峰bit鍦板潃锛屼粠绗嚑浣嶅紑濮嬪啓k</param> + /// <param name="bitValue">瑕佸啓鍏ョ殑鏁版嵁</param> + /// <returns></returns> + public static bool WriteBits(string deviceIp, int dbNo, int startByteAdr, byte biteAdr, BitArray bitValue) + { + var result = false; + try + { + var plc = GetPlc(deviceIp); + if (plc != null) + { + if (plc.IsConnected) + { + for (int i = 0; i < bitValue.Length; i++) + { + plc.WriteBit(DataType.DataBlock, dbNo, startByteAdr, biteAdr + i, bitValue[i]); + } + + if (!result) + { + //鍐欏畬鍐嶈涓�纭 + var readData = ReadBits(deviceIp, dbNo, startByteAdr, bitValue.Length, biteAdr); + result = CompareBitArray(readData, bitValue); + } + } + else + { + Link(plc);//璁惧鏈繛鎺ワ紝閲嶈繛 + } + } + else + { + LogHelper.Info($"涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥�");//涓嶅瓨鍦ㄧ殑璁惧銆傞厤缃枃浠朵腑鏄惁鍖呭惈鍏惰澶囥� + } + + } + catch (Exception ex) + { + LogHelper.Info($"{ex.Message}\r\n{ex.StackTrace}"); + } + return result; + } + + /// <summary> + /// 鑾峰彇PLC璇诲啓瀵硅薄 + /// </summary> + /// <param name="plc"></param> + /// <returns></returns> + private static Plc GetPlc(string plc) + { + if (ip_Plc.ContainsKey(plc)) + { + return ip_Plc[plc]; + } + else + { + return null; + } + } + + /// <summary> + /// 姣旇緝涓や釜浜岃繘鍒剁殑鏁板�鏄惁鐩稿悓 + /// </summary> + /// <param name="b1"></param> + /// <param name="b2"></param> + /// <returns></returns> + private static bool CompareBitArray(BitArray b1, BitArray b2) + { + bool result = true; + b1.Xor(b2).Not();//寮傛垨鎿嶄綔 鐒跺悗 闈炴搷浣�+ + foreach (var item in b1) + { + if (!(bool)item) + { + result = false; + break; + } + } + return result; + } + + /// <summary> + /// 閫氳繃S7鍗忚杩炴帴涓嬩綅鏈烘椂闇�鐨刴odel锛屽簲璇ユ斁鍦╩odel灞傦紝杩欓噷鎴戞噿浜�+ /// </summary> + public class S7ConfigModel + { + public CpuType CpuType { set; get; }//鍗忚绫诲瀷 + public string Ip { set; get; }//IP鍦板潃 + public short Rack { set; get; }//鏋跺瓙鍙�+ public short Slot { set; get; }//鎻掓Ы鍙�+ } + + } +} diff --git a/Helpers/Device/TcpClient.cs b/Helpers/Device/TcpClient.cs new file mode 100644 index 0000000..54af524 --- /dev/null +++ b/Helpers/Device/TcpClient.cs @@ -0,0 +1,85 @@ +锘縰sing HH.WCS.Mobox3.DSZSH; +using HH.WCS.Mobox3.DSZSH.device; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.device { + internal class TcpClient + { + /// <summary> + /// + /// </summary> + /// <param name="ip">127.0.0.1</param> + /// <param name="port">8888</param> + /// <param name="hex">01 02 00 00 00 0C 78 0F</param> + /// <returns></returns> + private static string SendHexOnce(string ip, int port, string hex) { + var res = string.Empty; + Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + client.Connect(ip, port); + client.ReceiveTimeout = 2000; + if (client.Connected) { + client.Send(PlcHelper.Hex2Bytes(hex)); + byte[] buffer = new byte[1024]; + try { + var length = client.Receive(buffer, SocketFlags.None); + byte[] data = new byte[length]; + Array.Copy(buffer, data, length); + res = BitConverter.ToString(data).Replace("-", ""); + } + catch (Exception ex) { + LogHelper.Error(ex.Message, ex); + } + client.Disconnect(true); + client.Dispose(); + } + client = null; + return res; + } + + /// <summary> + /// 璇讳繚鎸佸瘎瀛樺櫒锛宮odbus rtu鐨勫皝瑁�+ /// </summary> + /// <param name="address"></param> + /// <param name="qty"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + /// <returns></returns> + internal int[] ReadInputRegistersRtu(int address, int qty, string ip, int port = 502) { + List<int> res = new List<int>(); + var hex = $"0103{address.ToString("X4")}{qty.ToString("X4")}"; + hex = hex + BitConverter.ToString(PlcHelper.CRC16LH(PlcHelper.Hex2Bytes(hex))).Replace("-", "").Replace(" ", ""); + var data = SendHexOnce(ip, port, hex); + if (!string.IsNullOrEmpty(data)) { + if (PlcHelper.CheckCRC(data)) { + var lenght = Convert.ToInt16(data.Substring(4, 2), 16) / 2; + for (int i = 0; i < lenght; i++) { + res[i] = Convert.ToInt16(data.Substring(6 + 4 * 1, 4), 16); + } + } + } + return res.ToArray(); + } + /// <summary> + /// 鍐欏崟涓瘎瀛樺櫒 + /// </summary> + /// <param name="address"></param> + /// <param name="value"></param> + /// <param name="ip"></param> + /// <param name="port"></param> + internal bool WriteSingleRegisterRtu(int address, int value, string ip, int port = 502) { + var res = false; + var hex = $"0106{address.ToString("X4")}{value.ToString("X4")}"; + hex = hex + BitConverter.ToString(PlcHelper.CRC16LH(PlcHelper.Hex2Bytes(hex))).Replace("-", "").Replace(" ", ""); + var data = SendHexOnce(ip, port, hex); + if (!string.IsNullOrEmpty(data)) { + res = true; + } + return res; + } + } +} diff --git a/Helpers/Device/TcpServer.cs b/Helpers/Device/TcpServer.cs new file mode 100644 index 0000000..e1f1fa4 --- /dev/null +++ b/Helpers/Device/TcpServer.cs @@ -0,0 +1,251 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.Dispatch; +using HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; + +namespace HH.WCS.Mobox3.DSZSH.device +{ + public class TcpServer + { + public TcpServer(string ip, int port) + { + Init(ip, port); + } + private void Init(string ip, int port) + { + //鍒涘缓涓�釜鏂扮殑Socket,杩欓噷鎴戜滑浣跨敤鏈�父鐢ㄧ殑鍩轰簬TCP鐨凷tream Socket锛堟祦寮忓鎺ュ瓧锛�+ var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + try + { + //灏嗚socket缁戝畾鍒颁富鏈轰笂闈㈢殑鏌愪釜绔彛锛岀鍙e簲璇ユ斁鍒伴厤缃枃浠朵腑 + socket.Bind(new IPEndPoint(IPAddress.Parse(ip), port)); + Console.WriteLine(port); + //鍚姩鐩戝惉锛屽苟涓旇缃竴涓渶澶х殑闃熷垪闀垮害 + socket.Listen(30); + //寮�鎺ュ彈瀹㈡埛绔繛鎺ヨ姹�+ socket.BeginAccept(new AsyncCallback(ClientAccepted), socket); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + public static Dictionary<string, Socket> clients = new Dictionary<string, Socket>(); + public static Dictionary<string, byte[]> buffers = new Dictionary<string, byte[]>(); + public static Dictionary<string,bool> isSend = new Dictionary<string, bool>(); + public static Dictionary<string,bool> isCheck = new Dictionary<string, bool>(); + + public static Dictionary<string,int> saoMa = new Dictionary<string, int>(); + + public static void ClientAccepted(IAsyncResult ar) + { + + var socket = ar.AsyncState as Socket; + var client = socket.EndAccept(ar); + string remote_ip = ((System.Net.IPEndPoint)client.RemoteEndPoint).Address.ToString(); + if (clients.Keys.Contains(remote_ip)) + { + clients[remote_ip] = client; + } + else + { + clients.Add(remote_ip, client); + } + if (!buffers.Keys.Contains(remote_ip)) + { + buffers.Add(remote_ip, new byte[1024]); + } + + if (!isSend.Keys.Contains(remote_ip)) + { + isSend.Add(remote_ip, false); + } + + if (!isCheck.Keys.Contains(remote_ip)) + { + isCheck.Add(remote_ip, false); + } + + //缁欏鎴风鍙戦�涓�釜娆㈣繋娑堟伅 + //client.Send(Encoding.Unicode.GetBytes("Hi there, I accept you request at " + DateTime.Now.ToString())); + Console.WriteLine(remote_ip); + + try + { + client.BeginReceive(buffers[remote_ip], 0, buffers[remote_ip].Length, SocketFlags.None, new AsyncCallback(ReceiveMessage), client); + } + catch (Exception ex) + { + Console.WriteLine($"銆愭帴鏀跺鎴风鐨勬秷鎭紓甯搞�锛� + ex.Message); + } + //鍑嗗鎺ュ彈涓嬩竴涓鎴风璇锋眰 + socket.BeginAccept(new AsyncCallback(ClientAccepted), socket); + } + + + public static void ReceiveMessage(IAsyncResult ar) + { + try + { + var socket = ar.AsyncState as Socket; + string remote_ip = ((System.Net.IPEndPoint)socket.RemoteEndPoint).Address.ToString(); + var length = socket.EndReceive(ar); + if (length == 0) + { + clients.Remove(remote_ip); + buffers.Remove(remote_ip); + isSend.Remove(remote_ip); + isCheck.Remove(remote_ip); + saoMa.Remove(remote_ip); + return; + } + else + { + if (!clients.Keys.Contains(remote_ip)) + { + clients.Add(remote_ip, socket); + } + if (!buffers.Keys.Contains(remote_ip)) + { + buffers.Add(remote_ip, new byte[1024]); + + } + if (!isSend.Keys.Contains(remote_ip)) + { + isSend.Add(remote_ip, false); + } + if (!isCheck.Keys.Contains(remote_ip)) + { + isCheck.Add(remote_ip, false); + } + if (!saoMa.Keys.Contains(remote_ip)) + { + saoMa.Add(remote_ip, 3); + } + } + + //LogHelper.Info($"鎺ユ敹鍒颁俊鎭紝IP锛歿remote_ip},MSG锛歿BitConverter.ToString(buffers[remote_ip])}"); + + if (buffers.Keys.Contains(remote_ip)) + { + var messageBytes = new byte[length]; + Array.Copy(buffers[remote_ip], 0, messageBytes, 0, length); + + try + { + //璇诲崱鍣ㄦ牎楠�+ var message = BitConverter.ToString(messageBytes); + + if (!saoMa.ContainsKey(remote_ip)) + { + saoMa.Add(remote_ip, 3); + } + if (messageBytes.Length <= 20 && messageBytes.Length > 0) + { + saoMa[remote_ip] = 3;//鏈壂鍒扮爜 + } + + if (messageBytes.Length >= 21 && isCheck[remote_ip]) + { + byte[] rfid = new byte[12]; + Array.Copy(messageBytes, 9, rfid, 0, 12); + + string rfids16 = BitConverter.ToString(rfid); + string rfids = Encoding.ASCII.GetString(rfid); + //LogHelper.Info($"璇诲崱鍣ㄦ牎楠屽搴斿鍣ㄥ彿锛歿rfids}锛屽叾16杩涘埗褰㈠紡锛歿rfids16}"); + //if (ScanCodeHelper.Analysis(remote_ip, rfids))//鏍¢獙RFID + //{ + // isCheck[remote_ip] = false; + // saoMa[remote_ip] = 1;//鎵爜鍖归厤 + //} + //else + //{ + // isCheck[remote_ip] = false; + // saoMa[remote_ip] = 2;//鎵爜涓嶅尮閰�+ //} + } + else + { + LogHelper.Info($"涓嶆弧瓒宠鍗″櫒鏍¢獙瑙勫畾锛欼P锛歿remote_ip},MSG锛歿message}"); + } + } + catch(Exception ex) + { + LogHelper.Info($"鎵爜鏍¢獙鍙戠敓浜嗗紓甯革細{ex.Message}"); + saoMa[remote_ip] = 4;//鎵爜寮傚父 + } + + try + { + + } + catch(Exception ex) + { + LogHelper.Info($"鍗峰笜闂ㄦ牎楠屽彂鐢熶簡寮傚父锛歿ex.Message}"); + } + //TcpServerSend(remote_ip, System.Text.Encoding.Default.GetBytes(msgSend)); + Array.Clear(buffers[remote_ip], 0, buffers[remote_ip].Length);//娓呯┖褰撳墠IP Buffer + } + else + { + if (!buffers.Keys.Contains(remote_ip)) + { + buffers.Add(remote_ip, new byte[1024]); + } + } + + //鎺ユ敹涓嬩竴涓秷鎭�鍥犱负杩欐槸涓�釜閫掑綊鐨勮皟鐢紝鎵�互杩欐牱灏卞彲浠ヤ竴鐩存帴鏀舵秷鎭簡锛�+ socket.BeginReceive(buffers[remote_ip], 0, buffers[remote_ip].Length, SocketFlags.None, new AsyncCallback(ReceiveMessage), socket); + } + catch (Exception ex) + { + + } + } + + private static string GetHexString(byte[] buffer, int lenght) + { + return BitConverter.ToString(buffer, 0, lenght).Replace("-", string.Empty).ToLower(); + } + + public static bool TcpServerSend(string ip, byte[] msg) + { + if (clients.Keys.Contains(ip)) + { + var client = clients[ip]; + if (client.Connected) + { + try + { + client.Send(msg); + LogHelper.Info($"宸插彂閫佺粰璇GV鍦板潃{ip}锛寋msg}"); + return true; + } + catch (SocketException ex) + { + LogHelper.Info(ex.Message, "Error"); + clients[ip].Close(); + clients.Remove(ip); + } + } + else + { + clients[ip].Close(); + clients.Remove(ip); + } + } + else + { + LogHelper.Info("鏈壘鍒拌璁惧锛屾槸鍚﹀凡杩炴帴锛�); + } + return false; + + } + + } +} diff --git a/Helpers/DeviceProcess.cs b/Helpers/DeviceProcess.cs new file mode 100644 index 0000000..cb4c322 --- /dev/null +++ b/Helpers/DeviceProcess.cs @@ -0,0 +1,26 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.device; + +using HH.WCS.Mobox3.DSZSH.Dispatch; +using HH.WCS.Mobox3.DSZSH.AppStart; +using HH.WCS.Mobox3.DSZSH.Helper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace HH.WCS.Mobox3.DSZSH.Helpers +{ + /// <summary> + /// 璁惧淇″彿澶勭悊锛屼富瑕佹槸tcp淇″彿锛屾垜浠仛server琚姩鎺ユ敹淇″彿鏉ュ鐞嗭紝鏍规嵁椤圭洰瀹氬埗鐨�+ /// </summary> + internal class DeviceProcess + { + internal static void Analysis(string data, string ip) { + if (data.Length >= 6) { + //鍘绘帀娑堟伅澶�F 00 + data = data.Substring(4); + //Console.WriteLine($"{ip}-{data}"); + } + } + } +} diff --git a/Helpers/Dispatch/GZRobot.cs b/Helpers/Dispatch/GZRobot.cs new file mode 100644 index 0000000..570065f --- /dev/null +++ b/Helpers/Dispatch/GZRobot.cs @@ -0,0 +1,393 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.device; +using HH.WCS.Mobox3.DSZSH.ServiceCore; +using HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Web.Caching; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Devices; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Services; +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; + +namespace HH.WCS.Mobox3.DSZSH.Dispatch +{ + /// <summary> + /// 鍥借嚜璋冨害杈呭姪绫�+ /// </summary> + public class GZRobot { + private static readonly HttpHelper apiHelper = new HttpHelper(); + private static readonly string baseUrl = "";//閰嶇疆鏂囦欢鑾峰彇鍥借嚜璋冨害鍦板潃 + //private static readonly string logName = "guozi"; + public static List<IOState> GetIO() { + var result = apiHelper.Get(baseUrl + "api/engine/view/iostates/"); + var data = JsonConvert.DeserializeObject<gzResult<IOState>>(result); + return data.data; + } + public static void UpdateIOState() { + var data = new { data = new List<IOSateInfo>() }; + var result = apiHelper.Post(baseUrl + "api/engine/tasks/iostates/", JsonConvert.SerializeObject(data)); + var dataResult = JsonConvert.DeserializeObject<gzResult<IOStatesInfoResult>>(result); + } + + public static int CreateOrder(string taskNo, int priority, string param, string ts = "churuku", string created_user = "hanhe") { + LogHelper.Info($"CreateOrder鍙傛暟淇℃伅:taskNo:{taskNo},priority:{priority},param:{param},ts:{ts}锛宑reated_user锛歿created_user}", "API"); + var msg = ""; + var orderId = 0; + var data = new OrderInfo() { order_name = taskNo, priority = priority, dead_line = DateTime.Now, ts_name = ts, parameters = param, created_user = created_user }; + var request = JsonConvert.SerializeObject(data); + var response = apiHelper.Post(baseUrl + "api/om/order/", request); + LogHelper.Info($"CreateOrder:url:{baseUrl}api/om/order/,request:{request}", "API"); + msg = $"[guozi-CreateOrder] request={request} response={response}"; + Console.WriteLine(msg); + if (response != "") { + try { + var dataResult = JsonConvert.DeserializeObject<gzResult<OrderInfoResult>>(response); + if (dataResult.code == 0) { + orderId = dataResult.data[0].in_order_id; + } + } + catch (Exception ex) { + } + } + else { + msg = "[guozi-CreateOrder]鍒涘缓璁㈠崟澶辫触"; + Console.WriteLine(msg); + LogHelper.Info($"鍒涘缓璁㈠崟澶辫触", "API"); + } + + + return orderId; + } + public static bool CancelOrder(int orderId) { + bool result = false; + string msg = ""; + var request = new CancelOrderInfo() { order_list = new List<int>(orderId) }; + var response = apiHelper.Post(baseUrl + "api/om/order/cancel/", JsonConvert.SerializeObject(request)); + msg = $"[guozi-CancelOrder] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<gzResult<CancelOrderInfoResult>>(response); + if (dataResult.code == 0) { + result = true; + } + } + else { + msg = "[guozi-CancelOrder]鍙栨秷璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + return result; + } + + public static bool CancelGZOrder(int orderId) { + bool result = false; + string msg = ""; + List<CancelGZOrderInfo> requests = new List<CancelGZOrderInfo>(); + var request = new CancelGZOrderInfo() { order_id = orderId, order_command_type_id = 2 }; + requests.Add(request); + var response = apiHelper.Put(baseUrl + "api/om/order/order-command/", JsonConvert.SerializeObject(requests)); + msg = $"[guozi-CancelOrder] request={requests};response={response}"; + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<CancelGZOrderResult>(response); + if (dataResult.code == 0) { + msg = "[guozi-CancelOrder]鍙栨秷璁㈠崟鎴愬姛"; + Console.WriteLine(msg); + result = true; + return result; + } + } + else { + msg = "[guozi-CancelOrder]鍙栨秷璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + return result; + } + + + /// <summary> + /// 璁㈠崟鐘舵�鍙嶉 + /// </summary> + /// <returns></returns> + public static GzResult orderStatusReport(orderStatusReportParme model) { + GzResult result = new GzResult(); + AgvTaskState agv = new AgvTaskState(); + + if (model == null) { + result.resultCode = 1; + result.orderID = model.orderID; + result.msg = "杩斿洖璁㈠崟鐘舵�澶辫触"; + } + + switch (model.orderStatus) { + case "active": + agv.State = 1; + break; + case "waiting": + agv.State = 1; + break; + case "source_finish": + //鍙栬揣瀹屾垚 + agv.State = 4; + break; + case "dest_finish": + //鍗歌揣瀹屾垚 + agv.State = 6; + break; + case "finish": + agv.State = 2; + break; + case "manually_finish": + agv.State = 2; + break; + case "cancel_finish": + agv.State = 7; + break; + case "error": + agv.State = 7; + break; + default: + agv.State = 0; + break; + } + if (agv.State != 0) { + agv.TaskNo = model.orderName; + agv.ForkliftNo = model.agvIDList; + AgvService.OperateAgvTaskStatus(agv); + } + + result.resultCode = 0; + result.msg = "杩斿洖璁㈠崟鐘舵�鎴愬姛"; + result.orderID = model.orderID; + LogHelper.Info("orderStatusReport杩斿洖淇℃伅" + JsonConvert.SerializeObject(result), "API"); + return result; + } + + + + public class CancelGZOrderInfo + { + public int order_id { get; set; } + + public int order_command_type_id { get; set; } + + } + + + public static QueryOrderResult QueryOrder(int id) { + // + var result = new QueryOrderResult() { agv_list = new List<int> { 0 } }; + string msg = ""; + var response = apiHelper.Get(baseUrl + $"/api/om/order/{id}/"); + msg = $"[guozi-QueryOrderResult] request={id};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var data = JsonConvert.DeserializeObject<gzResult<QueryOrderResult>>(response); + result = data.data[0]; + } + else { + msg = "[guozi-QueryOrderResult]鏌ヨ璁㈠崟淇℃伅澶辫触"; + Console.WriteLine(msg); + } + return result; + } + + /// <summary> + /// 鑾峰彇浜や簰淇℃伅 + /// </summary> + /// <param name="typeId">1浠诲姟鐘舵� 2寮�棬鎴栦氦绠� 3鐩殑鐐�/param> + /// <param name="status"></param> + /// <returns></returns> + public static List<InteractInfoResult> QueryInteractInfo(int typeId, string status = "active") { + + //string aaa = "{\"app_name\": \"Gouzi client\", \"version\": \"1.0.0\", \"code\": 0, \"msg\": \"success\", \"data\": [{\"interaction_info_id\": 233, \"interaction_info_name\": \"TN2012030001\", \"interaction_info_desp\": null, \"interaction_info_type_id\": 3, \"value_json\": {\"state\": \"4\"}, \"info_status\": \"active\", \"return_value\": null}]}"; + //var data = JsonConvert.DeserializeObject<gzResult<InteractInfoResult>>(aaa); + var list = new List<InteractInfoResult>(); + string msg = ""; + var result = apiHelper.Get(baseUrl + $"api/om/interaction_info/find_by_type/?type_id={typeId}&info_status={status}"); + if (!string.IsNullOrEmpty(result)) { + Console.WriteLine(result); + // {"app_name": "Gouzi client", "version": "1.0.0", "code": 0, "msg": "success", "data": [{"interaction_info_id": 230, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "4"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 231, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "6"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 232, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "2"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 233, "interaction_info_name": "TN2012030001", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "4"}, "info_status": "active", "return_value": null}]} + try { + var data = JsonConvert.DeserializeObject<gzResult<InteractInfoResult>>(result); + if (data.data != null) { + list = data.data; + } + + } + catch (Exception ex) { + Console.WriteLine(ex.Message); + } + + } + else { + msg = "[guozi-QueryInteractInfo]璇诲彇浜や簰淇℃伅澶辫触"; + Console.WriteLine(msg); + } + return list; + } + public static bool UpdateInteractInfo(UpdateInteractInfo interactInfo) { + string msg = ""; + var result = false; + var request = JsonConvert.SerializeObject(interactInfo); + var response = apiHelper.Post(baseUrl + "api/om/interaction_info/update/", request); + msg = $"[mes-UpdateInteractInfo] request={request};response={response}"; + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<gzResult<object>>(response); + result = dataResult.code == 0; + } + else { + msg = "[guozi-UpdateInteractInfo]鏇存柊浜や簰淇℃伅澶辫触"; + Console.WriteLine(msg); + } + return result; + } + + } + + public class gzResult<T> + { + public string app_name { get; set; } + public string version { get; set; } + public int code { get; set; } + public string msg { get; set; } + public List<T> data { get; set; } + } + public class IOState + { + public int io_id { get; set; } + public string io_name { get; set; } + public string io_type_id { get; set; } + public string io_type { get; set; } + public int io_status_id { get; set; } + public string io_status_type { get; set; } + public string parameter_definition_int4_1 { get; set; } + public int io_value_int4_1 { get; set; } + public string parameter_definition_int4_2 { get; set; } + public int io_value_int4_2 { get; set; } + public string parameter_definition_int4_3 { get; set; } + public int io_value_int4_3 { get; set; } + public string parameter_definition_int4_4 { get; set; } + public int io_value_int4_4 { get; set; } + public string parameter_definition_json { get; set; } + public string io_value_json { get; set; } + } + public class IOSateInfo + { + public int io_id { get; set; } + public int io_status_id { get; set; } + public int io_value_int4_1 { get; set; } + public int io_value_int4_2 { get; set; } + public int io_value_int4_3 { get; set; } + public int io_value_int4_4 { get; set; } + public string io_value_json { get; set; } + } + public class IOStatesInfoResult + { + public List<ResultInfo> success_list { get; set; } + public List<ResultInfo> error_list { get; set; } + public class ResultInfo { public int io_id { get; set; } } + } + public class OrderInfo + { + public string order_name { get; set; } + public int priority { get; set; } + public DateTime dead_line { get; set; } + public string ts_name { get; set; } + public string parameters { get; set; }//{\"dock\":1} + public string created_user { get; set; } + + + } + public class OrderInfoResult + { + public int in_order_id { get; set; } + } + public class CancelOrderInfo + { + public List<int> order_list { get; set; } + } + public class CancelOrderInfoResult + { + public List<ResultInfo> success_list { get; set; } + public List<ResultInfo> error_list { get; set; } + public class ResultInfo { public int order_id { get; set; } } + } + public class cancle + { + public List<success_list> success_list { get; set; } + public List<error_list> error_list { get; set; } + } + public class success_list + { + public int order_id { get; set; } + } + + public class error_list + { + } + public class CancelGZOrderResult + { + public string app_name { get; set; } + public string version { get; set; } + public int code { get; set; } + public string msg { get; set; } + public cancle data { get; set; } + public List<int> success_list { get; set; } + public List<int> error_list { get; set; } + } + public class QueryOrderResult + { + public int order_id { get; set; } + public string order_name { get; set; } + public int priority { get; set; } + public DateTime dead_line { get; set; } + public string ts_id { get; set; } + public string parameters { get; set; }//{"TN_LocationName":"3-2-B", "PalletType":1}", + public string trigger { get; set; } + public string command { get; set; } + public string status { get; set; } + public List<int> agv_list { get; set; } + public string current_task { get; set; } + public string current_dest { get; set; } + public string current_opt { get; set; } + public string current_omi { get; set; } + public DateTime create_time { get; set; } + public DateTime? active_time { get; set; } + public DateTime? finished_time { get; set; } + public DateTime? cancel_time { get; set; } + public string response_timespan { get; set; } + public string execute_timespa { get; set; } + public string total_timespan { get; set; } + } + public class InteractInfoResult + { + public int interaction_info_id { get; set; } + public string interaction_info_name { get; set; } + public string interaction_info_desp { get; set; } + public int interaction_info_type_id { get; set; } + public object value_json { get; set; }//{"dock": 1}, + public string info_status { get; set; } + public string return_value { get; set; } + } + public class UpdateInteractInfo + { + public int interaction_info_id { get; set; } + public string info_status { get; set; } + public string return_value { get; set; } + } + public class interaction_state + { + public string state { get; set; } + } + public class interaction_door + { + public string door { get; set; } + } + public class interaction_bit + { + public string order { get; set; } + } +} + diff --git a/Helpers/Dispatch/HanAo.cs b/Helpers/Dispatch/HanAo.cs new file mode 100644 index 0000000..80664b5 --- /dev/null +++ b/Helpers/Dispatch/HanAo.cs @@ -0,0 +1,165 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Web.Services.Description; + +namespace HH.WCS.Mobox3.DSZSH.Dispatch { + /// <summary> + /// 鍥借嚜璋冨害杈呭姪绫�+ /// </summary> + public class HanAo { + private static readonly HttpHelper apiHelper = new HttpHelper(); + private static readonly string baseUrl ="";//閰嶇疆鏂囦欢閲岃幏鍙栧浗鑷皟搴﹀湴鍧�+ //private static readonly string logName = "hanao"; + + public static bool CreateOrder(TaskInfoModel model) { + var msg = ""; + var result = true; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Post(baseUrl + ":9001/wcs-admin/api/receive", request); + msg = $"[hanao-CreateOrder] request={request} response={response}"; + Console.WriteLine(msg); + if (response != "") { + try { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + catch (Exception ex) { + Console.WriteLine(ex.Message); + } + } + else { + msg = "[hanao-CreateOrder]鍒涘缓璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + + LogHelper.Info(msg,"鏉ゥ"); + return result; + } + + public static bool CancelOrder(CancelModel model) { + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Post(baseUrl + ":9002/wcs-admin/api/cancel", request); + msg = $"[hanao-CancelOrder] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + else { + msg = "[hanao-CancelOrder]鍙栨秷璁㈠崟澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "鏉ゥ"); + return result; + } + + public static bool QueryDevice(DeviceInfoModel model) { + bool result = false; + string msg = ""; + var request = JsonConvert.SerializeObject(model); + var response = apiHelper.Get(baseUrl + ":9003//wcs-admin/api/dvc-state/", request); + msg = $"[hanao-QueryDeviceResult] request={request};response={response}"; + Console.WriteLine(msg); + if (response != "") { + var dataResult = JsonConvert.DeserializeObject<HAResult>(response); + if (dataResult.code == "0") { + result = true; + } + } + else { + msg = "[hanao-QueryOrderResult]鏌ヨ璁㈠崟淇℃伅澶辫触"; + Console.WriteLine(msg); + } + LogHelper.Info(msg, "鏉ゥ"); + return result; + } + + + public class TaskInfoModel { + /// <summary> + /// 璇锋眰pk + /// </summary> + public string requestPk { get; set; } + /// <summary> + /// 鎵樼洏鏉$爜 + /// </summary> + public string contNo { get; set; } + /// <summary> + /// 鎵樼洏绫诲瀷 + /// </summary> + public string contType { get; set; } = ""; + /// <summary> + /// 浠诲姟绫诲瀷 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 + /// </summary> + public string trkType { get; set; } + /// <summary> + /// 1-999锛堝�瓒婂ぇ浼樺厛绾ц秺楂橈級 + /// </summary> + public string trkPrty { get; set; } = "1"; + public string frmPos { get; set; } + public string toPos { get; set; } + public string noticeInfo { get; set; } = ""; + /// <summary> + /// 0-绌烘墭鐩�1-瀹炵墿 + /// </summary> + public string isFull { get; set; } = "0"; + public string groupNo { get; set; } = ""; + public string clientCode { get; set; } = "WMS"; + /// <summary> + /// 鏍煎紡锛�022-11-11 11:32:08 + /// </summary> + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + } + public class HAResult { + public string code { get; set; } + public string msg { get; set; } + /// <summary> + /// + /// </summary> + public string requestPk { get; set; } + } + public class CancelModel { + public string requestPk { get; set; } + public string contNo { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + public class DeviceInfoModel { + public string requestPk { get; set; } + public string dvcNo { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + public class TaskStateInfoModel { + public string requestPk { get; set; } + public string contNo { get; set; } + /// <summary> + /// 鍙屾柟绯荤粺鍏卞悓瀹氫箟 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 锛堝悗缁鏈夊鍔犲啀鍗忓畾锛�+ /// </summary> + public string noticeType { get; set; } + public string curPos { get; set; } + public string noticeInfo { get; set; } + /// <summary> + /// 0-鎴愬姛 锛堝叆搴撲笂鏋跺畬鎴�鍑哄簱涓嬫灦瀹屾垚/搴撳唴绉诲簱瀹屾垚锛氱Щ搴撳彧涓婃姤鏈�粓绉诲簱涓婃灦锛�鎴�鍏朵粬-寮傚父鐮�鍙嶉鐩稿叧缁撴灉鍘熷洜锛學MS鏍规嵁鎯呭喌澶勭悊 + /// 1-鍏ュ簱鏈夎揣 2-鍏ヨ繙杩戞湁璐�3-鍑哄簱鏃犺揣 4-鍑鸿繙杩戞湁璐� + /// </summary> + public string code { get; set; } + public string result { get; set; } + public string clientCode { get; set; } + public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + + } + + +} + diff --git a/Helpers/Dispatch/HostToAGV.cs b/Helpers/Dispatch/HostToAGV.cs new file mode 100644 index 0000000..1583115 --- /dev/null +++ b/Helpers/Dispatch/HostToAGV.cs @@ -0,0 +1,550 @@ +锘�/------------------------------------------------------------------------------ +// <auto-generated> +// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆�+// 杩愯鏃剁増鏈�4.0.30319.42000 +// +// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�+// 閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便� +// </auto-generated> +//------------------------------------------------------------------------------ + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Web.Services; +using System.Web.Services.Protocols; +using System.Xml.Serialization; + +// +// 姝ゆ簮浠g爜鐢�wsdl 鑷姩鐢熸垚, Version=4.6.1055.0銆�+// + + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +[System.Web.Services.WebServiceBindingAttribute(Name="HostToAGV", Namespace="http://127.0.0.1:9988/HostToAGV.wsdl")] +public class HostToAGV : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private System.Threading.SendOrPostCallback StartNewOrderWithQCmdOperationCompleted; + + private System.Threading.SendOrPostCallback AddNewOrderOperationCompleted; + + private System.Threading.SendOrPostCallback CancelOrderOperationCompleted; + + private System.Threading.SendOrPostCallback ChangeOrderOperationCompleted; + + private System.Threading.SendOrPostCallback QueryOrderOperationCompleted; + + private System.Threading.SendOrPostCallback OrderAddOperationCompleted; + + private System.Threading.SendOrPostCallback OrderChangeParamOperationCompleted; + + /// <remarks/> + public HostToAGV() { + this.Url = "http://127.0.0.1:9988/HostToAGV.cgi"; + } + + /// <remarks/> + public event StartNewOrderWithQCmdCompletedEventHandler StartNewOrderWithQCmdCompleted; + + /// <remarks/> + public event AddNewOrderCompletedEventHandler AddNewOrderCompleted; + + /// <remarks/> + public event CancelOrderCompletedEventHandler CancelOrderCompleted; + + /// <remarks/> + public event ChangeOrderCompletedEventHandler ChangeOrderCompleted; + + /// <remarks/> + public event QueryOrderCompletedEventHandler QueryOrderCompleted; + + /// <remarks/> + public event OrderAddCompletedEventHandler OrderAddCompleted; + + /// <remarks/> + public event OrderChangeParamCompletedEventHandler OrderChangeParamCompleted; + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string StartNewOrderWithQCmd([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { + object[] results = this.Invoke("StartNewOrderWithQCmd", new object[] { + bufin}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginStartNewOrderWithQCmd(string bufin, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("StartNewOrderWithQCmd", new object[] { + bufin}, callback, asyncState); + } + + /// <remarks/> + public string EndStartNewOrderWithQCmd(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void StartNewOrderWithQCmdAsync(string bufin) { + this.StartNewOrderWithQCmdAsync(bufin, null); + } + + /// <remarks/> + public void StartNewOrderWithQCmdAsync(string bufin, object userState) { + if ((this.StartNewOrderWithQCmdOperationCompleted == null)) { + this.StartNewOrderWithQCmdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStartNewOrderWithQCmdOperationCompleted); + } + this.InvokeAsync("StartNewOrderWithQCmd", new object[] { + bufin}, this.StartNewOrderWithQCmdOperationCompleted, userState); + } + + private void OnStartNewOrderWithQCmdOperationCompleted(object arg) { + if ((this.StartNewOrderWithQCmdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.StartNewOrderWithQCmdCompleted(this, new StartNewOrderWithQCmdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string AddNewOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { + object[] results = this.Invoke("AddNewOrder", new object[] { + bufin}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginAddNewOrder(string bufin, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddNewOrder", new object[] { + bufin}, callback, asyncState); + } + + /// <remarks/> + public string EndAddNewOrder(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void AddNewOrderAsync(string bufin) { + this.AddNewOrderAsync(bufin, null); + } + + /// <remarks/> + public void AddNewOrderAsync(string bufin, object userState) { + if ((this.AddNewOrderOperationCompleted == null)) { + this.AddNewOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddNewOrderOperationCompleted); + } + this.InvokeAsync("AddNewOrder", new object[] { + bufin}, this.AddNewOrderOperationCompleted, userState); + } + + private void OnAddNewOrderOperationCompleted(object arg) { + if ((this.AddNewOrderCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddNewOrderCompleted(this, new AddNewOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string CancelOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { + object[] results = this.Invoke("CancelOrder", new object[] { + bufin}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginCancelOrder(string bufin, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("CancelOrder", new object[] { + bufin}, callback, asyncState); + } + + /// <remarks/> + public string EndCancelOrder(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void CancelOrderAsync(string bufin) { + this.CancelOrderAsync(bufin, null); + } + + /// <remarks/> + public void CancelOrderAsync(string bufin, object userState) { + if ((this.CancelOrderOperationCompleted == null)) { + this.CancelOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCancelOrderOperationCompleted); + } + this.InvokeAsync("CancelOrder", new object[] { + bufin}, this.CancelOrderOperationCompleted, userState); + } + + private void OnCancelOrderOperationCompleted(object arg) { + if ((this.CancelOrderCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CancelOrderCompleted(this, new CancelOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string ChangeOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { + object[] results = this.Invoke("ChangeOrder", new object[] { + bufin}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginChangeOrder(string bufin, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ChangeOrder", new object[] { + bufin}, callback, asyncState); + } + + /// <remarks/> + public string EndChangeOrder(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void ChangeOrderAsync(string bufin) { + this.ChangeOrderAsync(bufin, null); + } + + /// <remarks/> + public void ChangeOrderAsync(string bufin, object userState) { + if ((this.ChangeOrderOperationCompleted == null)) { + this.ChangeOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeOrderOperationCompleted); + } + this.InvokeAsync("ChangeOrder", new object[] { + bufin}, this.ChangeOrderOperationCompleted, userState); + } + + private void OnChangeOrderOperationCompleted(object arg) { + if ((this.ChangeOrderCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ChangeOrderCompleted(this, new ChangeOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string QueryOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { + object[] results = this.Invoke("QueryOrder", new object[] { + bufin}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginQueryOrder(string bufin, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("QueryOrder", new object[] { + bufin}, callback, asyncState); + } + + /// <remarks/> + public string EndQueryOrder(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void QueryOrderAsync(string bufin) { + this.QueryOrderAsync(bufin, null); + } + + /// <remarks/> + public void QueryOrderAsync(string bufin, object userState) { + if ((this.QueryOrderOperationCompleted == null)) { + this.QueryOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnQueryOrderOperationCompleted); + } + this.InvokeAsync("QueryOrder", new object[] { + bufin}, this.QueryOrderOperationCompleted, userState); + } + + private void OnQueryOrderOperationCompleted(object arg) { + if ((this.QueryOrderCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.QueryOrderCompleted(this, new QueryOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestElementName="Order-Add", RequestNamespace="urn:HostToAGV", ResponseElementName="Order-AddResponse", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("pszResponse", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string OrderAdd([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string pszRequest) { + object[] results = this.Invoke("OrderAdd", new object[] { + pszRequest}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginOrderAdd(string pszRequest, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("OrderAdd", new object[] { + pszRequest}, callback, asyncState); + } + + /// <remarks/> + public string EndOrderAdd(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void OrderAddAsync(string pszRequest) { + this.OrderAddAsync(pszRequest, null); + } + + /// <remarks/> + public void OrderAddAsync(string pszRequest, object userState) { + if ((this.OrderAddOperationCompleted == null)) { + this.OrderAddOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOrderAddOperationCompleted); + } + this.InvokeAsync("OrderAdd", new object[] { + pszRequest}, this.OrderAddOperationCompleted, userState); + } + + private void OnOrderAddOperationCompleted(object arg) { + if ((this.OrderAddCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OrderAddCompleted(this, new OrderAddCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestElementName="Order-ChangeParam", RequestNamespace="urn:HostToAGV", ResponseElementName="Order-ChangeParamResponse", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute("pszResponse", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string OrderChangeParam([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string pszRequest) { + object[] results = this.Invoke("OrderChangeParam", new object[] { + pszRequest}); + return ((string)(results[0])); + } + + /// <remarks/> + public System.IAsyncResult BeginOrderChangeParam(string pszRequest, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("OrderChangeParam", new object[] { + pszRequest}, callback, asyncState); + } + + /// <remarks/> + public string EndOrderChangeParam(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// <remarks/> + public void OrderChangeParamAsync(string pszRequest) { + this.OrderChangeParamAsync(pszRequest, null); + } + + /// <remarks/> + public void OrderChangeParamAsync(string pszRequest, object userState) { + if ((this.OrderChangeParamOperationCompleted == null)) { + this.OrderChangeParamOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOrderChangeParamOperationCompleted); + } + this.InvokeAsync("OrderChangeParam", new object[] { + pszRequest}, this.OrderChangeParamOperationCompleted, userState); + } + + private void OnOrderChangeParamOperationCompleted(object arg) { + if ((this.OrderChangeParamCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.OrderChangeParamCompleted(this, new OrderChangeParamCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// <remarks/> + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void StartNewOrderWithQCmdCompletedEventHandler(object sender, StartNewOrderWithQCmdCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class StartNewOrderWithQCmdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal StartNewOrderWithQCmdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void AddNewOrderCompletedEventHandler(object sender, AddNewOrderCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class AddNewOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddNewOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void CancelOrderCompletedEventHandler(object sender, CancelOrderCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class CancelOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CancelOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void ChangeOrderCompletedEventHandler(object sender, ChangeOrderCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class ChangeOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ChangeOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void QueryOrderCompletedEventHandler(object sender, QueryOrderCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class QueryOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal QueryOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void OrderAddCompletedEventHandler(object sender, OrderAddCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class OrderAddCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OrderAddCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +public delegate void OrderChangeParamCompletedEventHandler(object sender, OrderChangeParamCompletedEventArgs e); + +/// <remarks/> +[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.ComponentModel.DesignerCategoryAttribute("code")] +public class OrderChangeParamCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal OrderChangeParamCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// <remarks/> + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } +} diff --git a/Helpers/Dispatch/NDC.cs b/Helpers/Dispatch/NDC.cs new file mode 100644 index 0000000..77e1153 --- /dev/null +++ b/Helpers/Dispatch/NDC.cs @@ -0,0 +1,164 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +namespace HH.WCS.Mobox3.DSZSH.Dispatch +{ + public class NDC + { + private static HostToAGV callClient = null; + static NDC() { + callClient = new HostToAGV(); + //callClient.Url = AppStart.Settings.Config.HostToAgvServerUrl; + } + private static string GetReqStrNew(int ts, int pri, string taskNo, Dictionary<string, string> param) { + /*<Req> + <Order TS='5' Pri='80' No='666' NoCallback='0' Ext1='' Ext2='' Ext3=''> + <Param Name='From' Value='10' /> + <Param Name='To' Value='20' /> + <Param Name='Func' Value='1' /> + <Param Name='Data' Value='7' /> + <Param Name='ItemHeight' Value='1' /> + <Param Name='CntrType' Value='12' /> + <Param Name='FromCol' Value='2' /> + <Param Name='ToCol' Value='111' /> + </Order> + </Req>*/ + var sb = new StringBuilder(); + sb.Append($"<Req><Order TS='{ts}' Pri='{pri}' No='{taskNo}'>"); + + foreach (var kv in param) { + sb.Append($"<Param Name='{kv.Key}' Value='{kv.Value}'/>"); + } + sb.Append("</Order></Req>"); + return sb.ToString(); + } + public AGVResult AddNewOrderNew(int ts, int pri, string taskNo, Dictionary<string, string> param) { + //< Req >< Order TS = '1' Pri = '1' No = 'TN2302020001' Ext1 = '' Ext2 = '' N_CNTR_COUNT = '' >< Param Name = 'From' Value = '2' />< Param Name = 'To' Value = '1' /></ Order ></ Req > + + var bufin = GetReqStrNew(ts, pri, taskNo, param); + + try { + + var result = callClient.OrderAdd(bufin); + LogHelper.Info($"浠诲姟涓嬪彂缁撴灉 OrderAdd req={bufin} res={result}", "NDC"); + Console.WriteLine($"浠诲姟涓嬪彂缁撴灉 OrderAdd req={bufin} res={result}"); + //LogHelper.Info(result.bufout, "ts"); + return GetResult(result); + } + catch (Exception e) { + LogHelper.Info($"浠诲姟涓嬪彂澶辫触 OrderAdd req={bufin} res={e.Message}", "NDC"); + //Console.WriteLine($"浠诲姟涓嬪彂澶辫触 AddNewOrder req={bufin} res={e.Message}"); + return new AGVResult { Res = new Res { ErrCode = -1, ErrInfo = e.Message } }; + } + + } + private static string GetReqStr(int ts, Dictionary<string, string> param) { + //< Order TS = '60' Pri = '" + mst.CN_N_PRIORITY.ToString() + "' From = '" + start.CN_N_AGV_TN_Location + "' To = '" + end.CN_N_AGV_TN_Location + "' No = '" + mst.S_CODE + "_1' Ext1 = '1' Ext2 = '" + Constants.TN_MID_COMMANDEQ_CALLAGVOrderCommandType + "' N_CNTR_COUNT = '' FRow = '" + sFloor + "' TRow = '" + eFloor + "' /> + var sb = new StringBuilder(); + sb.Append($"<Req><Order "); + if (ts != 0) { + sb.Append($"TS='{ts}'"); + } + foreach (var kv in param) { + sb.Append($" {kv.Key}='{kv.Value}'"); + } + sb.Append("/></Req>"); + return sb.ToString(); + } + public static AGVResult AddNewOrder(int ts, Dictionary<string, string> param) + { + //< Req >< Order TS = '1' Pri = '1' No = 'TN2302020001' Ext1 = '' Ext2 = '' N_CNTR_COUNT = '' >< Param Name = 'From' Value = '2' />< Param Name = 'To' Value = '1' /></ Order ></ Req > + + var bufin = GetReqStr(ts, param); + + try { + + var result = callClient.AddNewOrder(bufin); + LogHelper.Info($"AddNewOrder req={bufin} res={result}", "NDC"); + return GetResult(result); + } + catch (Exception e) { + LogHelper.Info($"AddNewOrder req={bufin} res={e.Message}", "NDC"); + return new AGVResult { Res = new Res { ErrCode = -1, ErrInfo = e.Message } }; + } + + } + public static AGVResult CancelOrder(int ts, Dictionary<string, string> param) { + //< Req >< Order No = 'TN2302020001' >< Param Name = 'IsForce' Value = '1' /></ Order ></ Req > + var bufin = GetReqStr(ts, param); + try { + var result = callClient.CancelOrder(bufin); + LogHelper.Info($"CancelOrder req={bufin} res={result}", "NDC"); + return GetResult(result); + } + catch (Exception e) { + LogHelper.Info($"CancelOrder req={bufin} res={e.Message}", "NDC"); + return new AGVResult { + Res = new Res { + ErrCode = -1, + ErrInfo = e.Message + } + }; + } + + } + public static AGVResult StartNewOrderWithQCmd(int ts, Dictionary<string, string> param) { + //lpn: <Order TS='41' Pri='' ExtDeviceNo='{0}' CtrlVal='{1}' DispInfo='{2}' No='{3}' Ext1='' Ext2='' N_CNTR_COUNT='' /> + //traccif: <Order TS='164' From='2' To='2' ExtDeviceNo='" + lockNo + "' No='" + DateTime.Now.Ticks.ToString() + "' /> + //lock: <Order TS='170' CtrlVal='" + CtrlVal + "' ExtDeviceNo='" + roadway + "' No='" + DateTime.Now.Ticks.ToString() + "' /> + var bufin = GetReqStr(ts, param); + try { + var r = callClient.StartNewOrderWithQCmd(bufin); + LogHelper.Info($"StartNewOrderWithQCmd req={bufin} res={r}", "NDC"); + return GetResult(r); + } + catch (Exception e) { + LogHelper.Info($"StartNewOrderWithQCmd req={bufin} res={e.Message}", "NDC"); + return new AGVResult { + Res = new Res { + ErrCode = -1, + ErrInfo = e.Message + } + }; + } + } + public static AGVResult ChangeOrder(Dictionary<string, string> param) { + //< Req >< Order No = 'TN2302020002' ParamNo = '18' Param1 = '12' /></ Req > + var bufin = GetReqStr(0, param); + try { + var r = callClient.ChangeOrder(bufin); + LogHelper.Info($"ChangeOrder req={bufin} res={r}", "NDC"); + return GetResult(r); + } + catch (Exception e) { + LogHelper.Info($"ChangeOrder req={bufin} res={e.Message}", "NDC"); + return new AGVResult { + Res = new Res { + ErrCode = -1, + ErrInfo = e.Message + } + }; + } + } + private static AGVResult GetResult(string bufout) { + //<Res><ErrCode>0</ErrCode><Result>11</Result></Res> + XmlDocument xml = new XmlDocument(); + xml.LoadXml(bufout); + var json = JsonConvert.SerializeXmlNode(xml); + return JsonConvert.DeserializeObject<AGVResult>(json); + } + public class AGVResult + { + public Res Res { get; set; } + } + public class Res + { + public int ErrCode { get; set; } + public string ErrInfo { get; set; } + } + } +} diff --git a/Helpers/Dispatch/NDCApi.cs b/Helpers/Dispatch/NDCApi.cs new file mode 100644 index 0000000..9ff9326 --- /dev/null +++ b/Helpers/Dispatch/NDCApi.cs @@ -0,0 +1,272 @@ +锘縰sing HH.WCS.Mobox3.DSZSH; +using HH.WCS.Mobox3.DSZSH.AppStart; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +namespace HH.WCS.Mobox3.DSZSH.Dispatch +{ + public class NDCApi + { + public static string NDCApiUrl { set; get; } + static NDCApi() + { + + NDCApiUrl = AppStart.Settings.Config.NdcApiUrl; + } + + + public static AgvApiResult AddOrderNew(int ts, int pri, string taskNo, List<param> param) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + var model = new AddOrderNewModel(); + model.ts_no = ts; + model.pri = pri; + model.task_no = taskNo; + model.param = param; + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{taskNo}涓嬪彂锛寋jsonInfo}", "NDC"); + var result = httpH.WebPost(NDCApiUrl + "Add", jsonInfo); + LogHelper.Info($"浠诲姟涓嬪彂缁撴灉res={result}", "NDC"); + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"浠诲姟涓嬪彂澶辫触 res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult AddOrderNew(AddOrderNewModel model) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}涓嬪彂锛寋jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "Add", jsonInfo); + LogHelper.Info($"浠诲姟涓嬪彂缁撴灉res={result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"浠诲姟涓嬪彂澶辫触 res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult CancelOrder(string tsNo, bool is_force = true) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + var model = new CancelOrderModel(); + model.task_no = tsNo; + model.is_force = is_force; + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷锛寋jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "Cancel", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"CancelOrder res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult CancelOrder(CancelOrderModel model) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷锛寋jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "Cancel", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"CancelOrder res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + + } + + public static AgvApiResult ChangeOrderPri(string taskNo, int newPri) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + var model = new ChangePriModel(); + model.task_no = taskNo; + model.pri = newPri; + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "ChangePri", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"ChangeOrderPri res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult ChangeOrderPri(ChangePriModel model) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "ChangePri", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"ChangeOrderPri res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult ChangeOrderParam(string taskNo, int paramNo, string paramStr) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + var model = new ChangeParamModel(); + model.task_no = taskNo; + model.param_no = paramNo; + model.param = paramStr; + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "ChangeParam", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"ChangeOrderParam res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + + public static AgvApiResult ChangeOrderParam(ChangeParamModel model) + { + var httpH = new HttpHelper(); + var agvApiResult = new AgvApiResult(); + try + { + string jsonInfo = JsonConvert.SerializeObject(model); + LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋jsonInfo}", "NDC"); + + var result = httpH.WebPost(NDCApiUrl + "ChangeParam", jsonInfo); + LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); + + agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); + return agvApiResult; + } + catch (Exception e) + { + LogHelper.Info($"ChangeOrderParam res={e.Message}", "NDC"); + agvApiResult.err_code = -1; + agvApiResult.err_msg = e.Message; + return agvApiResult; + } + } + } + + /// <summary> + /// 杩斿洖淇℃伅Model + /// </summary> + public class AgvApiResult + { + public int err_code { set; get; }//寮傚父鐮侊細0 - 姝e父锛屽叾瀹冨�涓哄紓甯搁敊璇爜 + public string err_msg { set; get; }//杩斿洖鐨勯敊璇弿杩帮紝鍦�err_code <> 0 鏃惰繑鍥�+ public object result { set; get; }//姝g‘杩斿洖鐨勭粨鏋滃唴瀹癸紝鍦�err_code = 0 涓旀湁杩斿洖鍐呭鏃�+ } + + public class AddOrderNewModel + { + public int ts_no { set; get; }//TS 鍙凤紝蹇呴』鏈夊� + public int pri { set; get; }//浼樺厛绾�+ public string task_no { set; get; }//涓婃父浠诲姟缂栫爜锛屽鏋�no_feedback = 1 鏃讹紝鍙互涓虹┖ + public List<param> param { set; get; } = new List<param>();//鍙傛暟鍒楄〃 + } + + + public class param + { + public string name { set; get; }//鍙傛暟鍚�+ public string value { set; get; }//鍙傛暟鍊�+ } + + public class CancelOrderModel + { + public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 + public bool is_force { set; get; } = true;//鏄惁寮哄埗鍙栨秷锛� 鈥�寮哄埗 + } + + public class ChangeParamModel + { + public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 + public int param_no { set; get; }//鍙傛暟鍙�+ public string param { set; get; }//鍙傛暟鍐呭锛屽涓弬鏁颁互鑻辨枃鍒嗗彿(;)鍒嗛殧 + } + + public class ChangePriModel + { + public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 + public int pri { set; get; }//鏂颁紭鍏堢骇 + } +} diff --git a/Helpers/Dispatch/NDCHelper.cs b/Helpers/Dispatch/NDCHelper.cs new file mode 100644 index 0000000..63fe858 --- /dev/null +++ b/Helpers/Dispatch/NDCHelper.cs @@ -0,0 +1,81 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace HH.WCS.Mobox3.DSZSH.Dispatch +{ + public class NDCHelper + { + public static void Test() { + //dic.Add("Ext1", ""); dic.Add("Ext2", ""); dic.Add("N_CNTR_COUNT", ""); + //var r = callClient.AddNewOrderAsync(new AddNewOrderRequest() { bufin = "<Req><Order Pri='1' TS='1' From='1' To='2' No='123471118_1' Ext1='1' Ext2='CALLADDAGV' N_CNTR_COUNT='' /></Req>" }); + //r.Wait(); + + var dic = new Dictionary<string, string>(); + dic.Add("Pri", "1"); dic.Add("From", "1"); dic.Add("To", "1"); dic.Add("No", "12311411718_2");// dic.Add("Ext1", "1"); dic.Add("Ext2", "CALLADDAGV"); dic.Add("N_CNTR_COUNT", ""); + var result = NDC.AddNewOrder(1, dic); + + var dic1 = new Dictionary<string, string>(); + var no = "3454566666"; + dic1.Add("From", "1"); dic1.Add("To", "0"); dic1.Add("No", no); + result = NDC.AddNewOrder(101, dic1); + + var dic2 = new Dictionary<string, string>(); + dic2.Add("ExtDeviceNo", "1"); dic2.Add("From", "2"); dic2.Add("To", "2"); dic2.Add("No", DateTime.Now.Ticks.ToString()); dic2.Add("CtrlVal", "1"); + result = NDC.AddNewOrder(39, dic2); + + var dic3 = new Dictionary<string, string>(); + dic3.Add("From", "1"); dic3.Add("To", "9"); dic3.Add("No", no); + result = NDC.CancelOrder(101, dic3); + + var dic4 = new Dictionary<string, string>(); + dic4.Add("ExtDeviceNo", "1"); dic4.Add("CtrlVal", "1"); dic4.Add("DispInfo", "AAAAAAAA"); dic4.Add("No", DateTime.Now.Ticks.ToString()); + result = NDC.StartNewOrderWithQCmd(41, dic4); + + var dic5 = new Dictionary<string, string>(); + dic5.Add("ExtDeviceNo", "1"); dic5.Add("CtrlVal", "1"); dic5.Add("No", DateTime.Now.Ticks.ToString()); + result = NDC.StartNewOrderWithQCmd(170, dic5); + + var dic6 = new Dictionary<string, string>(); + dic6.Add("ExtDeviceNo", "11"); dic6.Add("From", "2"); dic6.Add("To", "2"); dic6.Add("No", DateTime.Now.Ticks.ToString()); + result = NDC.StartNewOrderWithQCmd(164, dic6); + + var dic7 = new Dictionary<string, string>(); + dic7.Add("Param1", "50"); dic7.Add("No", DateTime.Now.Ticks.ToString()); + result = NDC.ChangeOrder(dic7); + } + + public static bool ChangeParam(string taskNo, int param1, int paramNo = 0) { + bool bResult = false; + var dic = new Dictionary<string, string>(); + dic.Add("No", taskNo); + if (paramNo >= 0) { + dic.Add("ParamNo", paramNo.ToString()); + } + dic.Add("Param1", param1.ToString()); + var result = NDC.ChangeOrder(dic); + return bResult; + } + + public static bool Traffic(string lockNo) { + bool bResult = false; + var dic = new Dictionary<string, string>(); + dic.Add("ExtDeviceNo", lockNo); + dic.Add("From", "2"); + dic.Add("To", "2"); dic.Add("No", DateTime.Now.Ticks.ToString()); + + var result = NDC.StartNewOrderWithQCmd(164, dic); + return bResult; + } + + public static bool Cancel(string taskNo) { + bool bResult = false; + var dic = new Dictionary<string, string>(); + dic.Add("No", taskNo); + dic.Add("IsForce", "1"); + + var result = NDC.CancelOrder(1, dic); + return bResult; + } + } +} diff --git a/Helpers/ExprHelper.cs b/Helpers/ExprHelper.cs new file mode 100644 index 0000000..8918bd9 --- /dev/null +++ b/Helpers/ExprHelper.cs @@ -0,0 +1,175 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +using HH.WCS.Mobox3.DSZSH.AppStart; +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Models; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + /// <summary> + /// ExpressionHelper锛氳〃杈惧紡宸ュ叿 + /// </summary> + /// <remarks> + /// 瀹氫箟浜�鎵╁睍鏂规硶锛屽繀椤诲0鏄庝负 闈欐�绫�+ /// </remarks> + public static class ExprHelper { + /// <summary> + /// 绛涢�鍙敤璐т綅锛氭湭涓婇攣锛堟棤浠诲姟閿佸畾锛夈�宸插惎鐢�+ /// </summary> + public static Expression<Func<TN_Location, bool>> LocIsFree = + l => l.N_LOCK_STATE == LockStateCode.鏃�+ && l.S_LOCK_STATE == LockStateName.鏃�+ && l.C_ENABLE == "Y"; // 榛樿閮芥槸鍚敤 + + /// <summary> + /// 绛涢�绌鸿揣浣嶏細璐т綅褰撳墠瀹瑰櫒鏁伴噺涓�0 + /// </summary> + public static Expression<Func<TN_Location, bool>> LocIsEmpty = + l => l.N_CURRENT_NUM == 0; + + /// <summary> + /// 绛涢�婊¤揣浣嶏細璐т綅褰撳墠瀹瑰櫒鏁伴噺 = 璐т綅瀹瑰櫒瀹归噺 + /// </summary> + public static Expression<Func<TN_Location, bool>> LocIsFull = + l => l.N_CURRENT_NUM == l.N_CAPACITY; + + public static Expression<Func<TN_Location, bool>> LocCode(string locCode) => + l => l.S_CODE == locCode; + + /// <summary> + /// 閫氳繃璐т綅鎵�睘鍖哄煙绛涢�璐т綅 + /// </summary> + /// <remarks> + /// 鍙傛暟 areaName 璇蜂娇鐢�AreaName 涓殑甯搁噺 + /// </remarks> + /// <param name="areaName">鍖哄煙鍚嶇О锛堜笉鏄叿浣撶殑鍖哄煙鍙凤級</param> + /// <returns></returns> + public static Expression<Func<TN_Location, bool>> LocBelongsToArea(string areaName) => + l => AppStart.Settings.AreaMap[areaName].Contains(l.S_AREA_CODE); // SqlSugar 鍙互瑙f瀽绯荤粺鏂规硶 Contains 涓�IN 琛ㄨ揪寮�+ + /// <summary> + /// 绛涢�璐т綅瀹瑰櫒鍏崇郴锛氭煡璇㈡煇涓�璐т綅-瀹瑰櫒 鍏崇郴鏄惁瀛樺湪 + /// </summary> + /// <param name="loc"></param> + /// <param name="cntr"></param> + /// <returns></returns> + public static Expression<Func<TN_Loc_Container, bool>> LocCntrIsBind(string loc, string cntr) => + lc => lc.S_LOC_CODE == loc && lc.S_CNTR_CODE == cntr; + + #region 鎷撳睍鏂规硶 + + /// <summary> + /// 鎷撳睍鏂规硶锛氬悎骞朵袱涓〃杈惧紡 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="expr1"></param> + /// <param name="expr2"></param> + /// <returns></returns> + public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expr1, + Expression<Func<T, bool>> expr2) { + var parameter = expr1.Parameters[0]; // 閲嶇敤绗竴涓〃杈惧紡鐨勫弬鏁�+ + var visitor = new ReplaceExpressionVisitor(expr2.Parameters[0], parameter); + var left = expr1.Body; + var right = visitor.Visit(expr2.Body); + + return Expression.Lambda<Func<T, bool>>( + Expression.AndAlso(left, right), + parameter); + } + + /// <summary> + /// 杈呭姪绫伙細鏇挎崲琛ㄨ揪寮忓弬鏁�+ /// </summary> + class ReplaceExpressionVisitor : ExpressionVisitor { + private readonly Expression _oldValue; + private readonly Expression _newValue; + + public ReplaceExpressionVisitor(Expression oldValue, Expression newValue) { + _oldValue = oldValue; + _newValue = newValue; + } + + public override Expression Visit(Expression node) { + if (node == _oldValue) + return _newValue; + return base.Visit(node); + } + } + + /// <summary> + /// 鎷撳睍鏂规硶锛氬弽杞〃杈惧紡锛堢洿鎺ュ彇鍙嶏級 + /// </summary> + /// <remarks> + /// 涓嶆帹鑽愪娇鐢�| 瀵硅繑鍥炵粨鏋滄暣浣撳彇鍙嶏紝绠�崟鍦烘櫙涓嬪彲浠ヤ娇鐢�+ /// </remarks> + /// <typeparam name="T"></typeparam> + /// <param name="expr"></param> + /// <returns></returns> + static Expression<Func<T, bool>> Not<T>(this Expression<Func<T, bool>> expr) { + var parameter = expr.Parameters[0]; + var body = Expression.Not(expr.Body); + + return Expression.Lambda<Func<T, bool>>(body, parameter); + } + + /// <summary> + /// 鎷撳睍鏂规硶锛氬弽杞〃杈惧紡锛堥拡瀵圭壒瀹氳繍绠楃杩涜鍙嶈浆锛�+ /// </summary> + /// <remarks> + /// 鎺ㄨ崘浣跨敤 | 瀵硅〃杈惧紡涓殑姣忎釜閫昏緫杩愮畻绗﹀彇鍙嶏紝澶嶆潅鍦烘櫙涓嬫洿鍚堥�锛岃兘鐢熸垚鏇翠紭鍖栫殑 SQL + /// </remarks> + /// <typeparam name="T"></typeparam> + /// <param name="expr"></param> + /// <returns></returns> + public static Expression<Func<T, bool>> Negate<T>(this Expression<Func<T, bool>> expr) { + var visitor = new NegateExpressionVisitor(); + var negatedExpr = (Expression<Func<T, bool>>)visitor.Visit(expr); + return negatedExpr; + } + + /// <summary> + /// 杈呭姪绫伙細鍙嶈浆琛ㄨ揪寮忛�杈戣繍绠楃 + /// </summary> + class NegateExpressionVisitor : ExpressionVisitor { + protected override Expression VisitBinary(BinaryExpression node) { + // 鍙嶈浆姣旇緝杩愮畻绗�+ if (node.NodeType == ExpressionType.Equal) + return Expression.NotEqual(node.Left, node.Right); + if (node.NodeType == ExpressionType.NotEqual) + return Expression.Equal(node.Left, node.Right); + if (node.NodeType == ExpressionType.GreaterThan) + return Expression.LessThanOrEqual(node.Left, node.Right); + if (node.NodeType == ExpressionType.GreaterThanOrEqual) + return Expression.LessThan(node.Left, node.Right); + if (node.NodeType == ExpressionType.LessThan) + return Expression.GreaterThanOrEqual(node.Left, node.Right); + if (node.NodeType == ExpressionType.LessThanOrEqual) + return Expression.GreaterThan(node.Left, node.Right); + + // 澶勭悊閫昏緫涓�鎴�+ if (node.NodeType == ExpressionType.AndAlso) + return Expression.OrElse(Visit(node.Left), Visit(node.Right)); + if (node.NodeType == ExpressionType.OrElse) + return Expression.AndAlso(Visit(node.Left), Visit(node.Right)); + + return base.VisitBinary(node); + } + + protected override Expression VisitUnary(UnaryExpression node) { + // 澶勭悊鍙岄噸鍚﹀畾 + if (node.NodeType == ExpressionType.Not) + return node.Operand; + + return base.VisitUnary(node); + } + } + + #endregion + + } +} diff --git a/Helpers/HttpHelper.cs b/Helpers/HttpHelper.cs new file mode 100644 index 0000000..4cb41e4 --- /dev/null +++ b/Helpers/HttpHelper.cs @@ -0,0 +1,286 @@ +锘縰sing System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; + +namespace HH.WCS.Mobox3.DSZSH.AppStart { + public class HttpHelper { + public string WebPost(string url, string postData, string cotentType = "application/json") + { + Console.WriteLine(url); + WebRequest request = WebRequest.Create(url); + request.Method = "POST"; + //string postData = JsonConvert.SerializeObject(data); ; + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + request.ContentType = cotentType; + request.ContentLength = byteArray.Length; + request.Timeout = 3000; + StreamReader reader = null; + Stream dataStream = null; + WebResponse response = null; + + try + { + dataStream = request.GetRequestStream(); + dataStream.Write(byteArray, 0, byteArray.Length); + dataStream.Close(); + response = request.GetResponse(); + //Console.WriteLine(((HttpWebResponse)response).StatusDescription); + dataStream = response.GetResponseStream(); + reader = new StreamReader(dataStream, Encoding.UTF8); + string responseFromServer = reader.ReadToEnd(); + return responseFromServer; + } + catch (Exception e) + { + LogHelper.Info($"WebPost res={e.Message}", "API"); + return ""; + } + finally + { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (dataStream != null) dataStream.Close(); + if (response != null) response.Close(); + } + } + + public string WebGet(string url) { + WebRequest request = WebRequest.Create(url); + request.Timeout = 6000; + request.Method = "GET"; + StreamReader reader = null; + Stream dataStream = null; + WebResponse response = null; + try { + response = request.GetResponse(); + dataStream = response.GetResponseStream(); + reader = new StreamReader(dataStream); + string responseFromServer = reader.ReadToEnd(); + + Console.WriteLine(responseFromServer); + return responseFromServer; + } + catch (Exception e) { + LogHelper.Info($"WebGet res={e.Message}", "API"); + return ""; + } + finally + { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (dataStream != null) dataStream.Close(); + if (response != null) response.Close(); + } + } + + public string Get(string url, string contentType = "application/x-www-form-urlencoded") { + WebRequest request = WebRequest.Create(url); + request.Method = "Get"; + request.ContentType = contentType; + StreamReader reader = null; + Stream stream = null; + WebResponse rsp = null; + try { + + rsp = request.GetResponse(); + stream = rsp.GetResponseStream(); + reader = new StreamReader(stream); + return reader.ReadToEnd(); + } + catch (Exception e) + { + LogHelper.Info($"Get res={e.Message}", "API"); + return ""; + } + finally { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (stream != null) stream.Close(); + if (rsp != null) rsp.Close(); + } + + } + + public string Post(string url, string postData, string contentType = "application/json", string sessionId = "") { + Console.WriteLine(url); + WebRequest request = WebRequest.Create(url); + request.Method = "POST"; + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + request.ContentType = contentType; + request.ContentLength = byteArray.Length; + request.Timeout = 3000; + if (sessionId != "") { + request.Headers.Set("ASP.NET_SessionId", sessionId); + } + StreamReader reader = null; + Stream stream = null; + WebResponse rsp = null; + try { + stream = request.GetRequestStream(); + stream.Write(byteArray, 0, byteArray.Length); + stream.Close(); + rsp = request.GetResponse(); + stream = rsp.GetResponseStream(); + reader = new StreamReader(stream); + return reader.ReadToEnd(); + } + catch (Exception ex) { + LogHelper.Info($"Post res={ex.Message}", "API"); + return ""; + } + finally { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (stream != null) stream.Close(); + if (rsp != null) rsp.Close(); + } + + } + + public string Post(string url, Dictionary<string, string> dic) { + var param = dic.Select(a => { return string.Format("{0}={1}", a.Key, a.Value); }).ToList(); + return Post(url, string.Join("&", param), "application/x-www-form-urlencoded"); + } + + public string PostWithCookie(string url, string sessinId) { + return PostWithCookie(url, "", "", sessinId); + } + + public string PostWithCookie(string url, string postData, string contentType = "application/json", string sessionId = "") { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "POST"; + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + request.ContentType = contentType; + request.ContentLength = byteArray.Length; + if (sessionId != "") { + request.CookieContainer = new CookieContainer(); + request.CookieContainer.SetCookies(new Uri("http://" + request.RequestUri.Authority), "ASP.NET_SessionId=" + sessionId); + } + StreamReader reader = null; + Stream stream = null; + WebResponse rsp = null; + try { + stream = request.GetRequestStream(); + stream.Write(byteArray, 0, byteArray.Length); + stream.Close(); + rsp = request.GetResponse(); + stream = rsp.GetResponseStream(); + reader = new StreamReader(stream); + return reader.ReadToEnd(); + } + catch (Exception e) + { + + LogHelper.Info($"PostWithCookie res={e.Message}", "API"); + return ""; + } + finally { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (stream != null) stream.Close(); + if (rsp != null) rsp.Close(); + } + + } + + public string Put(string url, string postData, string contentType = "application/json", string sessionId = "") + { + WebRequest request = WebRequest.Create(url); + request.Method = "Put"; + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + request.ContentType = contentType; + request.ContentLength = byteArray.Length; + if (sessionId != "") + { + request.Headers.Set("ASP.NET_SessionId", sessionId); + } + StreamReader reader = null; + Stream stream = null; + WebResponse rsp = null; + try + { + stream = request.GetRequestStream(); + stream.Write(byteArray, 0, byteArray.Length); + stream.Close(); + rsp = request.GetResponse(); + stream = rsp.GetResponseStream(); + reader = new StreamReader(stream); + return reader.ReadToEnd(); + } + catch (Exception e) + { + LogHelper.Info($"Put res={e.Message}", "API"); + return ""; + } + finally + { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (stream != null) stream.Close(); + if (rsp != null) rsp.Close(); + } + } + + public string WebPostWithMD5(string url, string postData, string contentType = "application/json") + { + // 鏂板鎺堟潈鍙傛暟 + string appKey = ""; // 鍋囪閰嶇疆绫讳腑鏈堿ppKey鍜孉ppSecret + string appSecret = ""; + string reqTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); + string reqVerify = CalculateMD5Hash($"{appKey}{appSecret}{reqTime}"); + + WebRequest request = WebRequest.Create(url); + request.Method = "POST"; + request.Headers.Add("AppKey", appKey); + request.Headers.Add("ReqTime", reqTime); + request.Headers.Add("ReqVerify", reqVerify); + + byte[] byteArray = Encoding.UTF8.GetBytes(postData); + request.ContentType = contentType; + request.ContentLength = byteArray.Length; + request.Timeout = 3000; + StreamReader reader = null; + Stream dataStream = null; + WebResponse response = null; + + try + { + dataStream = request.GetRequestStream(); + dataStream.Write(byteArray, 0, byteArray.Length); + dataStream.Close(); + response = request.GetResponse(); + //Console.WriteLine(((HttpWebResponse)response).StatusDescription); + dataStream = response.GetResponseStream(); + reader = new StreamReader(dataStream, Encoding.UTF8); + string responseFromServer = reader.ReadToEnd(); + return responseFromServer; + } + catch (Exception e) + { + LogHelper.Info($"WebPost res={e.Message}", "API"); + return ""; + } + finally + { + // 閲婃斁璧勬簮 + if (reader != null) reader.Close(); + if (dataStream != null) dataStream.Close(); + if (response != null) response.Close(); + } + } + + // MD5璁$畻杈呭姪鏂规硶 + private static string CalculateMD5Hash(string input) + { + using (var md5 = System.Security.Cryptography.MD5.Create()) + { + byte[] inputBytes = Encoding.UTF8.GetBytes(input); + byte[] hashBytes = md5.ComputeHash(inputBytes); + return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); + } + } + } +} diff --git a/Helpers/LogHelper.cs b/Helpers/LogHelper.cs new file mode 100644 index 0000000..61b8534 --- /dev/null +++ b/Helpers/LogHelper.cs @@ -0,0 +1,148 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; + +using Newtonsoft.Json; + +using NLog; +using NLog.Config; +using NLog.Targets; + +namespace HH.WCS.Mobox3.DSZSH { + public class LogHelper + { + public static Dictionary<string, ILogger> loggers = new Dictionary<string, ILogger>(); + + #region 鏍囧噯鏂规硶(Debug/Info/Error) + public static void Debug(string message, string name = "") { + ILogger logger = null; + if (loggers.Keys.Contains(name)) { + logger = loggers[name]; + } + else { + logger = LogFactory.CreateLogger(name); + if (logger != null) { + loggers.Add(name, logger); + } + else { + logger = LogFactory.CreateLogger("console"); + } + } + if (logger != null) { + logger.Debug(message); + } + } + + public static void Info(string message, string name = "") { + ILogger logger = null; + if (loggers.Keys.Contains(name)) { + logger = loggers[name]; + } + else { + logger = LogFactory.CreateLogger(name); + if (logger != null) { + loggers.Add(name, logger); + } + else { + logger = LogFactory.CreateLogger("infoFile"); + } + } + if (logger != null) { + logger.Info(message); + } + } + + public static void Error(string message, Exception ex, string name = "") { + ILogger logger = null; + if (loggers.Keys.Contains(name)) { + logger = loggers[name]; + } + else { + logger = LogFactory.CreateLogger(name); + if (logger != null) { + loggers.Add(name, logger); + } + else { + logger = LogFactory.CreateLogger("errorFile"); + } + } + if (logger != null) { + logger.Error($"{message}{ex.StackTrace}"); + } + } + #endregion + + #region 鑷畾涔夋柟娉�+ public static void InfoEx(Exception ex) { + Info($"鍙戠敓浜嗗紓甯革細{ex.Message}"); + } + + public static void InfoApi(string taskType, object model) { + Info($"瑙﹀彂API锛歿taskType} " + JsonConvert.SerializeObject(model), "API"); + } + #endregion + + } + + internal class LogFactory + { + /// <summary> + /// 閫氳繃閰嶇疆鏂囦欢閰嶇疆鏃ュ織 + /// </summary> + static LogFactory() { + var loggerNames = new List<string>() { "HosttoagvTask", "HosttoagvCar", "NDC", "鏉ゥ", "PLC", "API", "OPC" }; + LogManager.Configuration = DefaultConfig(loggerNames); + } + + public static ILogger CreateLogger(string name) { + var logger = LogManager.GetLogger(name); + return logger; + } + + public static LoggingConfiguration DefaultConfig(List<string> loggerNames) { + var config = new LoggingConfiguration(); + loggerNames.ForEach(a => { + var target = new FileTarget(); + target.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M + target.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; + target.ArchiveFileName = @"${basedir}/Logs/" + a + "/{####}.txt"; + target.FileName = @"${basedir}/Logs/" + a + "/${shortdate}.txt";//褰撳墠鏂囦欢璺緞 + target.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; + + config.AddTarget(a, target); + config.AddRuleForOneLevel(LogLevel.Info, target, a); + }); + + // 娣诲姞target-console + var consoleTarget = new ColoredConsoleTarget(); + consoleTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; + + config.AddTarget("console", consoleTarget); + config.AddRule(LogLevel.Debug, LogLevel.Fatal, consoleTarget); + + // 娣诲姞target-info + var infoFileTarget = new FileTarget(); + infoFileTarget.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M + infoFileTarget.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; + infoFileTarget.ArchiveFileName = @"${basedir}/Logs/Info/{####}.txt"; + infoFileTarget.FileName = @"${basedir}/Logs/Info/${shortdate}.txt";//褰撳墠鏂囦欢璺緞 + infoFileTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; + + config.AddTarget("infoFile", infoFileTarget); + config.AddRuleForOneLevel(LogLevel.Info, infoFileTarget);//INFO鍐欏湪Info鏂囦欢 + + // 娣诲姞target-err + var errorFileTarget = new FileTarget(); + errorFileTarget.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M + errorFileTarget.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; + errorFileTarget.ArchiveFileName = @"${basedir}/Logs/Error/{####}.txt"; + errorFileTarget.FileName = @"${basedir}/Logs/Error/${shortdate}.txt"; + errorFileTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; + + config.AddTarget("errorFile", errorFileTarget); + config.AddRule(LogLevel.Error, LogLevel.Fatal, errorFileTarget); + + return config; + } + } +} diff --git a/Helpers/Model/ContainerHelper.cs b/Helpers/Model/ContainerHelper.cs new file mode 100644 index 0000000..d069b0a --- /dev/null +++ b/Helpers/Model/ContainerHelper.cs @@ -0,0 +1,141 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; + +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; + +using Newtonsoft.Json; + +namespace HH.WCS.Mobox3.DSZSH.Helpers.Model { + /// <summary> + /// 瀹瑰櫒甯姪绫伙紙鍖呭惈瀹瑰櫒-璐у搧鍏崇郴鐨勫鐞嗭級 + /// </summary> + internal class ContainerHelper + { + /// <summary> + /// 瀹瑰櫒缁戝畾璐у搧 + /// </summary> + /// <param name="cnt"></param> + /// <param name="cGs"></param> + /// <returns></returns> + public static string BindingCG(string cnt, List<string> cGs) + { + var db = DbHelper.GetDbClient(); + var logs = $"瀹瑰櫒锛歿cnt}锛岃揣鍝侊細{JsonConvert.SerializeObject(cGs)}"; + try + { + var cntCgList = db.Queryable<TN_CG_Detail>().Where(a => cGs.Contains(a.S_CG_ID) && a.S_CNTR_CODE == cnt).ToList(); + + if (cntCgList.Count > 0) + { + cGs = cGs.Except(cntCgList.Select(a => a.S_CNTR_CODE).ToList()).ToList(); + } + + var bindCntCgList = new List<TN_CG_Detail>(); + foreach (var item in cGs) + { + bindCntCgList.Add(new TN_CG_Detail() { S_CNTR_CODE = cnt, S_CG_ID = item }); + } + + var log = JsonConvert.SerializeObject(bindCntCgList); + if (db.Insertable<TN_CG_Detail>(bindCntCgList).ExecuteCommand() > 0) + { + LogHelper.Info($"鎻掑叆瀹瑰櫒璐у搧鍏崇郴琛ㄦ垚鍔燂紝{log}"); + } + else + { + LogHelper.Info($"鎻掑叆瀹瑰櫒璐у搧鍏崇郴琛ㄥけ璐ワ紝{log}"); + return "瀹瑰櫒缁戝畾璐у搧澶辫触锛� + logs; + } + + var cntid = db.Queryable<TN_Container>().First(a => a.S_CODE == cnt); + + if (cntid != null) + { + cntid.T_MODIFY = System.DateTime.Now; + log = JsonConvert.SerializeObject(cntid); + if (db.Updateable(cntid).UpdateColumns(it => new { it.T_MODIFY }).ExecuteCommand() > 0) + { + LogHelper.Info($"鏇存柊瀹瑰櫒琛ㄦ垚鍔燂紝{log}"); + } + else + { + LogHelper.Info($"鏇存柊瀹瑰櫒琛ㄥけ璐ワ紝{log}"); + return "瀹瑰櫒缁戝畾璐у搧澶辫触锛� + logs; + } + } + else + { + LogHelper.Info($"鍦ㄦ暟鎹簱涓湭鎵惧埌璇ュ鍣紝鏃犻渶鏇存柊锛屽鍣細{cnt}"); + } + return "瀹瑰櫒缁戝畾璐у搧鎴愬姛锛� + logs; + } + catch (Exception ex) + { + LogHelper.Info($"鍙戠敓浜嗗紓甯革紝璐т綅缁戝畾瀹瑰櫒澶辫触锛�); + return "瀹瑰櫒缁戝畾璐у搧澶辫触锛� + ex.Message; + } + } + + /// <summary> + /// 瀹瑰櫒瑙g粦璐у搧 + /// </summary> + /// <param name="cnt"></param> + /// <param name="cGs"></param> + /// <returns></returns> + public static string UnBindingCG(string cnt, List<string> cGs) + { + var db = DbHelper.GetDbClient(); + var logs = $"瀹瑰櫒锛歿cnt}锛岃揣鍝侊細{JsonConvert.SerializeObject(cGs)}"; + try + { + var cntCgList = db.Queryable<TN_CG_Detail>().Where(a => cGs.Contains(a.S_CG_ID) && a.S_CNTR_CODE == cnt).ToList(); + if (cntCgList.Count == 0) + { + LogHelper.Info($"瀹瑰櫒鏃犻渶瑙g粦璐у搧锛屽湪鏁版嵁搴撲腑鏈壘鍒皗JsonConvert.SerializeObject(cGs)}鐩稿叧鐨勫鍣ㄨ揣鍝佸叧绯昏〃淇℃伅"); + return "瀹瑰櫒鏃犻渶瑙g粦璐у搧锛岃В缁戞垚鍔� + logs; + } + cGs = cntCgList.Select(a => a.S_CG_ID).ToList(); + + var log = JsonConvert.SerializeObject(cGs); + if (db.Deleteable<TN_CG_Detail>().Where(it => cGs.Contains(it.S_CG_ID) && it.S_CNTR_CODE == cnt).ExecuteCommand() > 0) + { + LogHelper.Info($"鍒犻櫎瀹瑰櫒璐у搧鍏崇郴琛ㄦ垚鍔燂紝{log}"); + } + else + { + LogHelper.Info($"鍒犻櫎瀹瑰櫒璐у搧鍏崇郴琛ㄥけ璐ワ紝{log}"); + return "瀹瑰櫒缁戝畾璐у搧澶辫触锛� + logs; + } + + var CntId = db.Queryable<TN_Container>().First(a => a.S_CODE == cnt); + if (CntId != null) + { + CntId.T_MODIFY = System.DateTime.Now; + log = JsonConvert.SerializeObject(CntId); + if (db.Updateable(CntId).UpdateColumns(it => new { it.T_MODIFY }).ExecuteCommand() > 0) + { + LogHelper.Info($"鏇存柊瀹瑰櫒琛ㄦ垚鍔燂紝{log}"); + } + else + { + LogHelper.Info($"鏇存柊瀹瑰櫒琛ㄥけ璐ワ紝{log}"); + return "瀹瑰櫒缁戝畾璐у搧澶辫触锛� + logs; + } + + } + else + { + LogHelper.Info($"鍦ㄦ暟鎹簱涓湭鎵惧埌璇ュ鍣紝鏃犻渶鏇存柊锛屽鍣細{cnt}"); + } + return "瀹瑰櫒瑙g粦璐у搧鎴愬姛锛� + logs; + } + catch (Exception ex) + { + LogHelper.Info($"鍙戠敓浜嗗紓甯革紝璐т綅瑙g粦瀹瑰櫒澶辫触锛寋ex.Message}"); + return "瀹瑰櫒瑙g粦璐у搧澶辫触锛� + logs; + } + } + } +} diff --git a/Helpers/Model/LocationHelper.cs b/Helpers/Model/LocationHelper.cs new file mode 100644 index 0000000..88bcc10 --- /dev/null +++ b/Helpers/Model/LocationHelper.cs @@ -0,0 +1,338 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; + +using HH.WCS.Mobox3.DSZSH.Models; + +using Newtonsoft.Json; + +using SqlSugar; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; + +namespace HH.WCS.Mobox3.DSZSH.Helpers.Model { + /// <summary> + /// 璐т綅甯姪绫伙紙鍖呭惈璐т綅-瀹瑰櫒鍏崇郴鐨勫鐞嗭級 + /// </summary> + public class LocationHelper + { + private static Dictionary<string, TN_Location> _locationDict = null; + + static LocationHelper() + { + try + { + //鍒濆鍖朙ocation鍔犲叆鍒板瓧鍏哥紦瀛�+ _locationDict = new Dictionary<string, TN_Location>(); + var list = GetAllLocList(); + if (list.Count > 0) + { + list.ForEach(a => + { + if (!_locationDict.ContainsKey(a.S_CODE)) + { + _locationDict.Add(a.S_CODE, a); + } + }); + } + //鍒濆鍖朙ocationExt鍔犲叆鍒伴泦鍚堢紦瀛�+ //LocationExts = new Dictionary<string, LocationExt>(); + //var exts = GetAllLocExtList(); + //if (exts.Count > 0) { + // exts.ForEach(a => { + // LocationExts.Add($"{a.S_LOC_CODE.Trim()}_{a.S_PICKUP_POINT.Trim()}", a); + // }); + //} + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + + /// <summary> + /// 鑾峰彇鎵�湁璐т綅淇℃伅 + /// </summary> + /// <returns></returns> + internal static List<TN_Location> GetAllLocList() + { + var db = DbHelper.GetDbClient(); + return db.Queryable<TN_Location>().ToList(); + } + + + internal static TN_Location GetLocation(string loc) + { + if (_locationDict.Keys.Contains(loc)) + { + return _locationDict[loc.Trim()]; + } + return null; + } + + //public static bool IsStartLocFound(string startLocCode, ref ) + + /// <summary> + /// 鑾峰彇璐т綅绔欑偣淇℃伅 + /// </summary> + /// <param name="loc"></param> + /// <param name="isEmpty">鏄惁灞炰簬浜哄伐绌烘墭鍖哄埌绌烘墭缂撳瓨搴撳尯</param> + /// <returns></returns> + internal static string GetAgvSite(string loc, bool isEmpty = false) + { + var site = "0"; + if (_locationDict.Keys.Contains(loc.Trim()) && !isEmpty) + { + var Location = _locationDict[loc.Trim()]; + site = Location.S_AGV_SITE; + } + else + { + var Location = GetLoc(loc.Trim()); + if (Location != null) + { + site = Location.S_AGV_SITE; + + if (isEmpty) + { + if (Location.N_CURRENT_NUM == 0) + { + site = Location.S_AGV_SITE; + } + //if (Location.N_CURRENT_NUM == 1) + //{ + // site = Location.S_AGV_SITE2; + //} + //if (Location.N_CURRENT_NUM == 2) + //{ + // site = Location.S_AGV_SITE3; + //} + //if (Location.N_CURRENT_NUM == 3) + //{ + // site = Location.S_AGV_SITE4; + //} + //if (Location.N_CURRENT_NUM == 4) + //{ + // site = Location.S_AGV_SITE5; + //} + } + } + } + return site; + } + + internal static TN_Location GetLoc(string code) + { + var db = DbHelper.GetDbClient(); + return db.Queryable<TN_Location>().Where(a => a.S_CODE.Trim() == code).First(); + } + + /// <summary> + /// 鍏ュ簱閿佸畾缁堢偣锛屽嚭搴撻攣瀹氳捣鐐�+ /// </summary> + /// <remarks> + /// 鍒涘缓浠诲姟閿佸畾璐т綅鐨勬椂鍊欙紝鎶婇攣鐨勬潵婧愬氨鏄换鍔″彿涔熷啓涓婂幓锛堝姞閿佺殑鏂规硶鍔犱釜鍙傛暟锛屽彲绌虹殑鍙傛暟锛夛紝瑙i攣鐨勬椂鍊欐妸鏉ユ簮缃┖ + /// </remarks> + /// <param name="loc"></param> + /// <param name="lockState">1:鍏ュ簱閿併�2:鍑哄簱閿併�3:鍏跺畠閿�/param> + /// <param name="lockSource">閿佺殑鏉ユ簮=浠诲姟鍙�/param> + /// <returns></returns> + public static bool LockLoc(string loc, int lockState, string lockSource = "") + { + var res = false; + var db = DbHelper.GetDbClient(); + var model = db.Queryable<TN_Location>().Where(a => a.S_CODE == loc).First(); + LogHelper.Info($"閿佽揣浣峽loc},鐘舵�{lockState},淇℃伅" + JsonConvert.SerializeObject(model)); + if (model != null && model.N_LOCK_STATE == 0) + { + model.N_LOCK_STATE = lockState; + model.S_LOCK_STATE = TN_Location.GetLockStateStr(lockState); + model.S_LOCK_OP = lockSource; + model.T_MODIFY = System.DateTime.Now; + res = db.Updateable<TN_Location>(model).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE, it.S_LOCK_OP, it.T_MODIFY }).ExecuteCommand() > 0; + } + LogHelper.Info($"閿佽揣浣峽loc}杩斿洖{res}"); + + return res; + } + + /// <summary> + /// 鍙栬揣瀹岃В閿佽捣鐐癸紝鍗歌揣瀹岃В閿佺粓鐐癸紝鍙楠岄攣鐨勬潵婧愶紝涔熷彲浠ヤ笉鏍¢獙 + /// </summary> + /// <param name="loc"></param> + /// <returns></returns> + public static bool UnLockLoc(string loc) + { + LogHelper.Info("UnLockLoc:" + loc); + var res = false; + var db = DbHelper.GetDbClient(); + var model = db.Queryable<TN_Location>().Where(a => a.S_CODE == loc).First(); + if (model != null) + { + model.S_LOCK_STATE = "鏃�; + model.N_LOCK_STATE = 0; + model.S_LOCK_OP = ""; + model.T_MODIFY = System.DateTime.Now; + res = db.Updateable(model).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE, it.S_LOCK_OP, it.T_MODIFY }).ExecuteCommand() > 0; + LogHelper.Info("UnLockLoc:瑙i攣缁撴灉" + res); + } + else + { + LogHelper.Info("UnLockLoc 澶辫触" + loc); + } + return res; + } + + /// <summary> + /// 璐т綅瑙g粦瀹瑰櫒 + /// </summary> + /// <param name="loc"></param> + /// <param name="cntrs"></param> + /// <returns></returns> + public static string UnBindingLoc(string loc, List<string> cntrs) + { + var db = DbHelper.GetDbClient(); + var logs = $"璐т綅锛歿loc}锛屽鍣細{JsonConvert.SerializeObject(cntrs)}"; + try + { + var lcrList = db.Queryable<TN_Loc_Container>().Where(a => cntrs.Contains(a.S_CNTR_CODE) && a.S_LOC_CODE == loc).ToList(); + if (lcrList.Count == 0) + { + LogHelper.Info($"璐т綅鏃犻渶瑙g粦瀹瑰櫒锛屽湪鏁版嵁搴撲腑鏈壘鍒皗JsonConvert.SerializeObject(cntrs)}鐩稿叧鐨勮揣浣嶅鍣ㄥ叧绯昏〃淇℃伅"); + } + cntrs = lcrList.Select(a => a.S_CNTR_CODE).ToList(); + + + var log = JsonConvert.SerializeObject(cntrs); + var location = db.Queryable<TN_Location>().First(a => a.S_CODE == loc); + if (location != null) + { + location.N_CURRENT_NUM = 0; + location.S_LOCK_STATE = "鏃�; + location.N_LOCK_STATE = 0; + + using (var tran = db.Ado.UseTran()) + { + if (db.Deleteable<TN_Loc_Container>().Where(it => cntrs.Contains(it.S_CNTR_CODE) && it.S_LOC_CODE == loc).ExecuteCommand() > 0) + { + LogHelper.Info($"鍒犻櫎璐т綅瀹瑰櫒鍏崇郴琛ㄦ垚鍔燂紝{log}"); + } + else + { + tran.RollbackTran(); + + LogHelper.Info($"鍒犻櫎璐т綅瀹瑰櫒鍏崇郴琛ㄥけ璐ワ紝{log}"); + + return "璐т綅瑙g粦瀹瑰櫒澶辫触锛� + logs; + } + + log = JsonConvert.SerializeObject(location); + if (db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand() > 0) + { + tran.CommitTran(); + + LogHelper.Info($"鏇存柊璐т綅琛ㄦ垚鍔燂紝{log}"); + } + else + { + tran.RollbackTran(); + + LogHelper.Info($"鏇存柊璐т綅琛ㄥけ璐ワ紝{log}"); + + return "璐т綅瑙g粦瀹瑰櫒澶辫触锛� + logs; + } + } + } + else + { + LogHelper.Info($"鍦ㄦ暟鎹簱涓湭鎵惧埌璇ヨ揣浣嶏紝鏃犻渶鏇存柊锛岃揣浣嶏細{loc}"); + } + return "璐т綅瑙g粦瀹瑰櫒鎴愬姛锛� + logs; + } + catch (Exception ex) + { + LogHelper.Info($"鍙戠敓浜嗗紓甯革紝璐т綅瑙g粦瀹瑰櫒澶辫触锛寋ex.Message}"); + return "璐т綅缁戝畾瀹瑰櫒澶辫触锛� + logs; + } + } + + /// <summary> + /// 璐т綅缁戝畾瀹瑰櫒 + /// </summary> + /// <param name="loc"></param> + /// <param name="cntrs"></param> + /// <returns></returns> + public static string BindingLoc(string loc, List<string> cntrs) + { + var db = DbHelper.GetDbClient(); + var logs = $"璐т綅锛歿loc}锛屽鍣細{JsonConvert.SerializeObject(cntrs)}"; + try + { + var lcrList = db.Queryable<TN_Loc_Container>().Where(a => cntrs.Contains(a.S_CNTR_CODE) && a.S_LOC_CODE == loc).ToList(); + + if (lcrList.Count > 0) + { + cntrs = cntrs.Except(lcrList.Select(a => a.S_CNTR_CODE).ToList()).ToList(); + } + + var bindLocCntList = new List<TN_Loc_Container>(); + foreach (var item in cntrs) + { + bindLocCntList.Add(new TN_Loc_Container() { S_LOC_CODE = loc, S_CNTR_CODE = item }); + } + + + var log = JsonConvert.SerializeObject(bindLocCntList); + + using (var tran = db.Ado.UseTran()) + { + if (db.Insertable<TN_Loc_Container>(bindLocCntList).ExecuteCommand() > 0) + { + LogHelper.Info($"鎻掑叆璐т綅瀹瑰櫒鍏崇郴琛ㄦ垚鍔燂紝{log}"); + } + else + { + db.RollbackTran(); + LogHelper.Info($"鎻掑叆璐т綅瀹瑰櫒鍏崇郴琛ㄥけ璐ワ紝{log}"); + return "璐т綅缁戝畾瀹瑰櫒澶辫触锛� + logs; + } + + var location = db.Queryable<TN_Location>().First(a => a.S_CODE == loc); + if (location != null) + { + location.N_CURRENT_NUM += cntrs.Count; + location.S_LOCK_STATE = "鏃�; + location.N_LOCK_STATE = 0; + log = JsonConvert.SerializeObject(location); + + if (db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand() > 0) + { + db.CommitTran(); + + LogHelper.Info($"鏇存柊璐т綅琛ㄦ垚鍔燂紝{log}"); + } + else + { + db.RollbackTran(); + + LogHelper.Info($"鏇存柊璐т綅琛ㄥけ璐ワ紝{log}"); + + return "璐т綅缁戝畾瀹瑰櫒澶辫触锛� + logs; + } + } + else + { + db.RollbackTran(); + LogHelper.Info($"鏈壘鍒拌璐т綅{loc}锛屾垨鑰呭凡閿佸畾锛寋log}"); + } + } + return "璐т綅缁戝畾瀹瑰櫒鎴愬姛锛� + logs; + } + catch (Exception ex) + { + LogHelper.Info($"鍙戠敓浜嗗紓甯革紝璐т綅缁戝畾瀹瑰櫒澶辫触锛�); + return "璐т綅缁戝畾瀹瑰櫒澶辫触锛� + ex.Message; + } + } + } +} diff --git a/Helpers/Model/TaskHelper.cs b/Helpers/Model/TaskHelper.cs new file mode 100644 index 0000000..ec1c5d5 --- /dev/null +++ b/Helpers/Model/TaskHelper.cs @@ -0,0 +1,473 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; + +using HH.WCS.Mobox3.DSZSH.Dispatch; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Helper; + +using Newtonsoft.Json; + +using SqlSugar; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; +using static HH.WCS.Mobox3.DSZSH.Helpers.ResultHelper; + +namespace HH.WCS.Mobox3.DSZSH.Helpers.Model { + /// <summary> + /// 浠诲姟甯姪绫�+ /// </summary> + public class TaskHelper { + /// <summary> + /// 鐢熸垚浠诲姟鍙�+ /// </summary> + /// <returns></returns> + private static string GenerateTaskNo() { + var id = SysHelper.GetSerialNumber("浠诲姟鍙�, "TN"); + var date = DateTime.Now.ToString("yyMMdd"); + return $"TN{date}{id.ToString().PadLeft(4, '0')}"; + } + + /// <summary> + /// 鍒涘缓鎼繍浠诲姟锛岃繑鍥炰换鍔℃槸鍚﹀垱寤烘垚鍔�+ /// </summary> + /// <remarks> + /// 涓嶄細妫�煡鍙傛暟鍚堟硶鎬э紝浣跨敤鍓嶈纭繚璐т綅鍙峰拰瀹瑰櫒鍙峰瓨鍦�+ /// </remarks> + /// <param name="from">璧风偣璐т綅鍙�/param> + /// <param name="cnt">瀹瑰櫒鍙�/param> + /// <param name="to">缁堢偣璐т綅鍙�/param> + /// <param name="type">浠诲姟绫诲瀷/鍚嶇О</param> + /// <param name="pri">浼樺厛绾�/param> + /// <returns></returns> + public static bool CreateTask(string from, string cnt, string to, string type, int pri = 3) { + var startLoc = LocationHelper.GetLocation(from); + var endLoc = LocationHelper.GetLocation(to); + + TN_Task TN_Task = new TN_Task() { + S_CODE = GenerateTaskNo(), + S_START_AREA = startLoc?.S_AREA_CODE ?? "", // 濡傛灉涓簄ull杩斿洖绌哄瓧绗︿覆 + S_END_AREA = endLoc?.S_AREA_CODE ?? "", // 濡傛灉涓簄ull杩斿洖绌哄瓧绗︿覆 + S_START_LOC = from, + S_END_LOC = to, + S_TYPE = type, + N_PRIORITY = pri, + N_SCHEDULE_TYPE = 1, + N_B_STATE = 0, + S_CNTR_CODE = cnt, + }; + + var db = DbHelper.GetDbClient(); + var log = JsonConvert.SerializeObject(TN_Task); + try { + // 鍐呴儴涓嶄娇鐢ㄤ簨鍔★紙鍙秹鍙婂崟涓彃鍏ユ搷浣滐級锛岀敱澶栭儴澹版槑浜嬪姟 + var res = db.Insertable(TN_Task).ExecuteCommand() > 0; + if (res) { + LogHelper.Info($"鎻掑叆浠诲姟鎴愬姛锛歿log}"); + } + else { + LogHelper.Info($"鎻掑叆浠诲姟澶辫触锛歿log}"); + } + return res; + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + return false; + } + } + + /// <summary> + /// 鍒涘缓浠诲姟锛屽苟灏�鏄惁鍒涘缓鎴愬姛 鐨勪俊鎭�杩�<see cref="LogHelper.Info(string, string)"/> 鎵撳嵃鏃ュ織 + /// </summary> + /// <param name="from">璧风偣璐т綅鍙�/param> + /// <param name="cnt">瀹瑰櫒鍙�/param> + /// <param name="to">缁堢偣璐т綅鍙�/param> + /// <param name="type">浠诲姟绫诲瀷/鍚嶇О</param> + /// <param name="pri">浼樺厛绾�/param> + /// <returns>鍒涘缓浠诲姟鏄惁鎴愬姛</returns> + public static bool LogCreateTask(string from, string cnt, string to, string type, int pri = 3) { + var db = DbHelper.GetDbClient(); + using (var tran = db.Ado.UseTran()) { + if (TaskHelper.CreateTask(from, cnt, to, type, pri)) { + LocationHelper.LockLoc(from, 2); // 璧风偣鍑哄簱閿侊紝 + LocationHelper.LockLoc(to, 1); // 缁堢偣鍏ュ簱閿�+ tran.CommitTran(); + LogHelper.Info($"鐢熸垚 '{type}' 鎴愬姛锛屽鍣ㄥ彿 '{cnt}'锛岃捣鐐�'{from}'锛岀粓鐐�'{to}'"); + return true; + } + else { + tran.RollbackTran(); + LogHelper.Info($"鐢熸垚 '{type}' 澶辫触锛屽鍣ㄥ彿 '{cnt}'锛岃捣鐐�'{from}'锛岀粓鐐�'{to}'"); + return false; + } + } + } + + /// <summary> + /// 鍒涘缓浠诲姟锛屼娇鐢�<see cref="SimpleResult"/> 杩斿洖缁撴灉 + /// </summary> + /// <param name="from">璧风偣璐т綅鍙�/param> + /// <param name="cnt">瀹瑰櫒鍙�/param> + /// <param name="to">缁堢偣璐т綅鍙�/param> + /// <param name="type">浠诲姟绫诲瀷/鍚嶇О</param> + /// <param name="pri">浼樺厛绾э紙榛樿涓�3锛�/param> + /// <param name="failCode">鍒涘缓澶辫触鏃惰繑鍥炵殑 result code</param> + /// <returns></returns> + public static SimpleResult SimpleCreateTask(string from, string cnt, string to, string type, int pri = 3, int failCode = 5) { + var db = DbHelper.GetDbClient(); + using (var tran = db.Ado.UseTran()) { + if (TaskHelper.CreateTask(from, cnt, to, type, pri)) { + LocationHelper.LockLoc(from, 2); // 璧风偣鍑哄簱閿侊紝 + LocationHelper.LockLoc(to, 1); // 缁堢偣鍏ュ簱閿�+ return BuildSimpleResult(0, $"鐢熸垚 '{type}' 鎴愬姛锛屽鍣ㄥ彿 '{cnt}'锛岃捣鐐�'{from}'锛岀粓鐐�'{to}'"); + } + else { + return BuildSimpleResult(failCode, $"鐢熸垚 '{type}' 澶辫触锛屽鍣ㄥ彿 '{cnt}'锛岃捣鐐�'{from}'锛岀粓鐐�'{to}'"); + } + } + } + + //public static SimpleResult SimpleService(string taskName) { + // var db = DbHelper.GetDbClient(); + + // try { + + + // } + // catch (Exception) { + + // throw; + // } + //} + + /// <summary> + /// 鍙栬揣鍗歌揣瀹屾垚锛岀紦瀛樹綅鐘舵�鏇存柊 + /// </summary> + /// <param name="mst"></param> + /// <param name="load"></param> + internal static void CacheBitUpdate(TN_Task mst, bool load) { + var trayCarryCount = mst.N_CNTR_COUNT > 0 ? mst.N_CNTR_COUNT : 1; + if (load) { + Console.WriteLine($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_START_LOC}鍙栬揣瀹屾垚锛岃捣鐐硅В缁戝鍣▄mst.S_CNTR_CODE}"); + LogHelper.Info($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_START_LOC}鍙栬揣瀹屾垚锛岃捣鐐硅В缁戝鍣▄mst.S_CNTR_CODE}"); + LocationHelper.UnBindingLoc(mst.S_START_LOC, mst.S_CNTR_CODE.Split(',').ToList()); + } + else { + Console.WriteLine($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_END_LOC}鍗歌揣瀹屾垚锛岀粓鐐圭粦瀹氬鍣▄mst.S_CNTR_CODE}"); + LogHelper.Info($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_END_LOC}鍗歌揣瀹屾垚锛岀粓鐐圭粦瀹氬鍣▄mst.S_CNTR_CODE}"); + LocationHelper.BindingLoc(mst.S_END_LOC, mst.S_CNTR_CODE.Split(',').ToList()); + } + } + + /// <summary> + /// 浠诲姟鍙栨秷锛岀紦瀛樹綅鐘舵�鏇存柊 + /// </summary> + /// <param name="mst"></param> + internal static void CacheBitCancelUpdate(TN_Task mst) { + //浠诲姟鍙栨秷锛屽彇璐у畬鎴愬墠鐨勶紝璧风偣鐨刲oadingCount鍜岀粓鐐箄nLoadingCount閮芥竻闄わ紝鍙栬揣瀹屾垚鐨勫彧澶勭悊缁堢偣 + if (CheckActionRecordExist(mst.S_CODE, 4)) { + //鏍规嵁瀹㈡埛鐜板満瑕佹眰锛屽鏋滃彇璐у畬鎴愪换鍔″け璐ヤ汉宸ユ媺鍒扮粓鐐癸紝鎴戜滑灏卞綋鍗歌揣瀹屾垚澶勭悊锛涘鏋滄槸浜哄伐鎷夎蛋鍒板叾瀹冨尯鍩燂紝鎴戜滑灏辫В閿佺粓鐐癸紝鍒犻櫎鎵樼洏銆�+ //缁堢偣缁戝畾 + CacheBitUpdate(mst, false); + LocationHelper.UnLockLoc(mst.S_END_LOC); + } + else { + + //璧风偣缁堢偣瑙i攣 + LocationHelper.UnLockLoc(mst.S_START_LOC); + LocationHelper.UnLockLoc(mst.S_END_LOC); + + } + + } + + + + /// <summary> + /// 浠诲姟鐘舵�鏇存柊澶勭悊 + /// </summary> + /// <param name="mst"></param> + /// <param name="state"></param> + internal static void OperateStatus(TN_Task mst, int state) { + if (state == 4) + { + CacheBitUpdate(mst, true); + } + if (state == 6)//鍗歌揣瀹屾垚 + { + CacheBitUpdate(mst, false); + } + if (state == 7) { + CacheBitCancelUpdate(mst); + } + } + + /// <summary> + /// 瀹夊叏璇锋眰 + /// </summary> + /// <param name="no"></param> + /// <param name="state"></param> + /// <param name="forkliftNo"></param> + /// <param name="extData"></param> + internal static void OperateReq(string no, int state, string forkliftNo, string extData = "") + { + if (state == 1101) + { + //璇锋眰鍙栬揣锛�+ + } + if (state == 1102) + { + //璇锋眰鍗歌揣锛�+ //鏍规嵁缁堢偣鍒ゆ柇锛屾槸cb02鐨勫叆鍙o紝鍒ゆ柇鍐呭瓨涓姸鎬侊紙瑕佺姸鎬佹椂闂达級锛屽厑璁稿嵏璐э紝閫氱煡agv鏀瑰弬鏁�+ var dic = new Dictionary<string, string>(); + //< Req >< Order No = 'TN2302020002' ParamNo = '18' Param1 = '12' /></ Req > + dic.Add("No", no); + dic.Add("ParamNo", "8"); + dic.Add("Param1", "1"); + NDC.ChangeOrder(dic); + //鏀瑰畬鍙傛暟杞﹀瓙灏变細鑷繁鍗歌揣 + } + if (state == 1103) + { + //澶ч搧妗嗗弶璧颁互鍚庨�鐭ワ紝鎴戜滑瑕侀�鐭ヨ緭閫佺嚎 + } + } + + private static object locLocker = new object(); + + + /// <summary> + /// 鎺ㄩ�浠诲姟 + /// </summary> + /// <param name="mst"></param> + internal static bool SendTask(TN_Task mst) + { + var result = false; + var start = "0"; var end = "0"; + var taskType = mst.S_TYPE.Trim(); + if (mst.N_B_STATE == 0) { + if (mst.N_SCHEDULE_TYPE == 1)//閫氳繃NDC锛宧osttoagv璋冨害璁惧 + { + start = LocationHelper.GetAgvSite(mst.S_START_LOC); + end = LocationHelper.GetAgvSite(mst.S_END_LOC); + + if (mst.S_TYPE == "绌烘墭涓嬬嚎鍫嗗彔") + { + end = LocationHelper.GetAgvSite(mst.S_END_LOC,true); + } + + LogHelper.Info($"NDC鎺ㄩ�浠诲姟 {mst.S_CODE};" + "start=" + start + "end= " + end); + var startLoc = LocationHelper.GetLoc(mst.S_START_LOC); + var endLoc = LocationHelper.GetLoc(mst.S_END_LOC); + var dic = new List<param>(); + dic.Add(new param() { name = "IKey", value = "IKey" }); + dic.Add(new param() { name = "From", value = start.ToString() }); + dic.Add(new param() { name = "To", value = end.ToString() }); + dic.Add(new param() { name = "FUNC", value = startLoc.N_LAYER.ToString() }); + + dic.Add(new param() { name = "Ctype", value = "0" }); + + + if (mst.S_TYPE == "浣欐枡涓嬬嚎鍏ュ簱" || mst.S_TYPE == "浜哄伐鎷嗙洏鍏ュ簱") + { + dic.Add(new param() { name = "DATA", value = "1024" }); + } + else + { + dic.Add(new param() { name = "DATA", value = "0" }); + } + + var res = NDCApi.AddOrderNew(1, 1, mst.S_CODE, dic);//娣诲姞鏂板懡浠�+ if (res != null && (res.err_code == 0 || res.err_code == 50009)) + { + //鎺ㄩ�鎴愬姛锛屼慨鏀逛换鍔′紭鍏堢骇 + mst.N_B_STATE = 1; + mst.S_B_STATE = TN_Task.GetStateStr(1); + UpdateStatus(mst);//鏇存柊浠诲姟鐘舵� + result = true; + LogHelper.Info($"NDC鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE}start= {mst.S_START_LOC} + end = {mst.S_END_LOC}"); + } + else + { + LogHelper.Info($"NDC鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};Res:" + JsonConvert.SerializeObject(res)); + } + } + else if (mst.N_SCHEDULE_TYPE == 5)//閫氳繃鏉ゥ璋冨害璁惧 + { + //璋冪涓夋柟鎺ュ彛 + var model = new HanAo.TaskInfoModel + { + requestPk = mst.S_CODE, + frmPos = mst.S_START_LOC, + toPos = mst.S_END_LOC, + trkType = mst.S_OP_NAME == "鍏ュ簱" ? "1" : "2", + contNo = mst.S_CNTR_CODE + }; + if (HanAo.CreateOrder(model)) { + mst.N_B_STATE = 1; + UpdateStatus(mst); + LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + model.frmPos + "end= " + model.toPos); + } + else + { + LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(model)); + } + } + else if (mst.N_SCHEDULE_TYPE == 3) //閫氳繃鍥借嚜璋冨害璁惧 + { + var code = GZRobot.CreateOrder(mst.S_CODE, mst.N_PRIORITY, JsonConvert.SerializeObject(new { src = mst.S_START_LOC, dst = mst.S_END_LOC }), "p2p"); + if (code > 0) { + //鏇存柊浠诲姟鐘舵� + mst.N_B_STATE = 1; + mst.S_EQ_TASK_CODE = code.ToString(); + UpdateStatus(mst); + UpdateEQNo(mst); + LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + mst.S_START_LOC + "end= " + mst.S_END_LOC); + } + else + { + LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(mst)); + } + } + + } + return result; + } + + + internal static bool UpdateStatus(TN_Task task, string status) { + var res = false; + var db = DbHelper.GetDbClient(); + task.S_B_STATE = status; + res = db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE }).ExecuteCommand() > 0; + return res; + } + internal static bool UpdateStatus(TN_Task task) { + var res = false; + var db = DbHelper.GetDbClient(); + task.S_B_STATE = TN_Task.GetStateStr(task.N_B_STATE); + task.T_MODIFY = DateTime.Now; + db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE, it.T_MODIFY }).ExecuteCommand(); + return res; + } + + internal static bool UpdateEQNo(TN_Task task) { + var res = false; + var db = DbHelper.GetDbClient(); + task.T_MODIFY = DateTime.Now; + db.Updateable(task).UpdateColumns(it => new { it.S_EQ_TASK_CODE, it.T_MODIFY }).ExecuteCommand(); + return res; + } + + internal static TN_Task GetTask(string no) { + var db = DbHelper.GetDbClient(); + var task = db.Queryable<TN_Task>().Where(a => a.S_CODE == no).First(); + return task; + } + + public static bool CreateTask(List<CreateTasks> modes) { + if (modes != null && modes.Count > 0) { + List<TN_Task> tN_Tasks = new List<TN_Task>(); + + foreach (var item in modes) { + + var fromLoc = LocationHelper.GetLocation(item.from); + var endLoc = LocationHelper.GetLocation(item.to); + + tN_Tasks.Add(new TN_Task() { + S_CODE = GenerateTaskNo(), + S_START_AREA = fromLoc.S_AREA_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_START_LOC = item.from, + S_END_LOC = item.to, + S_TYPE = item.taskType, + N_PRIORITY = item.pri, + N_SCHEDULE_TYPE = 1, + N_B_STATE = 0, + S_CNTR_CODE = item.cntrInfo, + }); + } + var log = JsonConvert.SerializeObject(tN_Tasks); + var db = DbHelper.GetDbClient(); + var res = db.Insertable<TN_Task>(tN_Tasks).ExecuteCommand() > 0; + if (res) { + LogHelper.Info($"鎻掑叆浠诲姟鎴愬姛锛寋log}"); + } + else { + LogHelper.Info($"鎻掑叆浠诲姟澶辫触锛寋log}"); + } + return res; + } + + return false; + } + + + internal static bool CheckActionRecordExist(string no, int code) { + var db = DbHelper.GetDbClient(); + return db.Queryable<TN_Task_Action>().Count(a => a.S_TASK_CODE == no && a.N_ACTION_CODE == code) > 0; + } + + internal static void Begin(TN_Task task, string forklift_no) { + var db = DbHelper.GetDbClient(); + if (task != null) { + if (task.N_B_STATE == 1) { + task.N_B_STATE = 2; + task.S_B_STATE = TN_Task.GetStateStr(task.N_B_STATE); + task.T_START_TIME = System.DateTime.Now; + task.S_EQ_NO = forklift_no; + db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE, it.T_START_TIME, it.S_EQ_NO }).ExecuteCommand(); + } + + } + } + + internal static void End(TN_Task task) { + var db = DbHelper.GetDbClient(); + if (task != null) { + task.N_B_STATE = 3; + task.S_B_STATE = TN_Task.GetStateStr(task.N_B_STATE); + task.T_END_TIME = DateTime.Now; + db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE, it.T_END_TIME }).ExecuteCommand(); + } + } + + internal static void Fail(TN_Task task) { + var db = DbHelper.GetDbClient(); + if (task != null) { + //鍒ゆ柇鏈夋病鏈夊彇璐у畬鎴愶紝娌℃湁灏卞彉鎴愬け璐ャ�鏈夊彇璐у畬鎴愰粯璁ゅ畬鎴愪簡锛堣窡鎹」鐩�瀹氾紝鏈変簺椤圭洰浜哄伐鎷夎蛋浜嗕篃娌℃湁鏀惧埌缁堢偣锛夈� + task.N_B_STATE = 4; + task.S_B_STATE = TN_Task.GetStateStr(task.N_B_STATE); + db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE }).ExecuteCommand(); + } + } + + internal static bool AddActionRecord(string no, int state, string forkliftNo, string extData) { + var db = DbHelper.GetDbClient(); + var action = new TN_Task_Action() { + N_ACTION_CODE = state, + S_TASK_CODE = no, + S_EQ_CODE = forkliftNo, + S_EQ_TYPE = "agv", + S_DATA = extData + }; + return db.Insertable(action).ExecuteCommand() > 0; + } + + internal static List<TN_Task> GetWaitingTaskList() { + var db = DbHelper.GetDbClient(); + return db.Queryable<TN_Task>().Where(a => a.N_B_STATE == 0 && (a.S_B_STATE == "绛夊緟" || a.S_B_STATE == "寰呮帹閫�)).ToList(); + } + } + + public class CreateTasks { + public string from { set; get; } + public string to { set; get; } + public string taskType { set; get; } + public int pri { set; get; } + public string cntrInfo { set; get; } + } +} + diff --git a/Helpers/PathHelper.cs b/Helpers/PathHelper.cs new file mode 100644 index 0000000..6c975b8 --- /dev/null +++ b/Helpers/PathHelper.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Opc.Ua; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + public class PathHelper { + /// <summary> + /// 椤圭洰鏂囦欢澶逛笌Debug/Release鏂囦欢鐨勭浉瀵硅矾寰勶紙绉佹湁甯搁噺锛�+ /// </summary> + const string RELATIVE_PATH = "../.."; + + /// <summary> + /// GetProjectDirectory锛氳幏鍙栭」鐩枃浠跺す璺緞 + /// </summary> + public static string GetProjDir(string filepath = "./") { + return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RELATIVE_PATH, filepath)); + } + } +} diff --git a/Helpers/ResultHelper.cs b/Helpers/ResultHelper.cs new file mode 100644 index 0000000..524df8f --- /dev/null +++ b/Helpers/ResultHelper.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.BaseResponse; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; + +namespace HH.WCS.Mobox3.DSZSH.Helpers { + public class ResultHelper { + public static Result BuildResult(int code, string message, bool pringLog = true) { + if (pringLog) { + LogHelper.Info(message); + } + return new Result { Code = code, Message = message }; + } + + /// <summary> + /// 鏋勫缓 <see cref="SimpleResult"/> 杩斿洖鍊硷紝閫夋嫨鎵撳嵃鏃ュ織淇℃伅锛堥粯璁ゆ墦鍗帮級 + /// </summary> + /// <param name="code"></param> + /// <param name="message"></param> + /// <param name="pringLog"></param> + /// <returns></returns> + public static SimpleResult BuildSimpleResult(int code, string message, bool pringLog = true) { + if (pringLog) { + LogHelper.Info(message); + } + return new SimpleResult { Code = code, Message = message }; + } + + /// <summary> + /// 鏋勫缓 <see cref="SimpleResult"/> 寮傚父杩斿洖鍊硷紝閫夋嫨鎵撳嵃寮傚父鏃ュ織淇℃伅锛堥粯璁ゆ墦鍗帮級 + /// </summary> + /// <param name="ex"></param> + /// <param name="exCode"></param> + /// <param name="pringLog"></param> + /// <returns></returns> + public static SimpleResult BuildSimpleEx(Exception ex, int exCode = 1, bool pringLog = true) { + if (pringLog) { + LogHelper.InfoEx(ex); + } + return new SimpleResult { Code = exCode, Message = ex.Message }; + } + } +} diff --git a/Helpers/SysHelper.cs b/Helpers/SysHelper.cs new file mode 100644 index 0000000..9d37ae7 --- /dev/null +++ b/Helpers/SysHelper.cs @@ -0,0 +1,38 @@ +锘縰sing HH.WCS.Mobox3.DSZSH.Helpers; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Helper { + internal class SysHelper + { + private static object locker = new object(); + internal static int GetSerialNumber(string snType, string prefix) { + int result = 0; + lock (locker) { + var db = DbHelper.GetDbClient(); + var sId = db.Queryable<OI_SYS_MAXID>().Where(a => a.CN_S_TYPE.Trim() == snType && a.CN_S_PRE.Trim() == prefix).First(); + if (sId != null) { + sId.CN_N_MAX++; + if (db.Ado.ExecuteCommand($"update OI_SYS_MAXID set CN_N_MAX={sId.CN_N_MAX} where CN_S_TYPE='{snType}' and CN_S_PRE='{prefix}' ") > 0) { + result = sId.CN_N_MAX; + } + } + else { + //鎻掑叆琛�+ sId = new OI_SYS_MAXID { CN_S_TYPE = snType, CN_S_PRE = prefix, CN_N_MAX = 1 }; + result = db.Insertable<OI_SYS_MAXID>(sId).ExecuteCommand() > 0 ? 1 : 0; + + } + } + return result; + } + + [SugarTable("dbo.OI_SYS_MAXID")] + public class OI_SYS_MAXID + { + public string CN_S_TYPE { get; set; } + public string CN_S_PRE { get; set; } + public int CN_N_MAX { get; set; } + } + } +} diff --git a/Models/BaseModel.cs b/Models/BaseModel.cs new file mode 100644 index 0000000..c76988f --- /dev/null +++ b/Models/BaseModel.cs @@ -0,0 +1,45 @@ +锘縰sing System; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�妯℃澘鎶借薄绫伙細鍩烘湰琛ㄦ暟鎹ā鍨�+ /// </summary> + public abstract class BaseModel { + + /// <summary> + /// 鍞竴璇嗗埆鐮侊紙搴曞眰涓婚敭锛�+ /// </summary> + [SugarColumn(IsPrimaryKey = true)] + public string S_ID { get; set; } = Guid.NewGuid().ToString("D"); + + /// <summary> + /// 鍒涘缓浜�ID + /// </summary> + public string S_CREATOR_ID { get; set; } = "sa"; + + /// <summary> + /// 鍒涘缓浜哄悕绉�+ /// </summary> + public string S_CREATOR_NAME { get; set; } = "瓒呯骇鐢ㄦ埛"; + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public DateTime T_CREATE { get; set; } = DateTime.Now; + + /// <summary> + /// 淇敼鏃堕棿 + /// </summary> + public DateTime T_MODIFY { get; set; } = DateTime.Now; + + /// <summary> + /// 鏁版嵁鐘舵�锛氱紪杈戙�瀹氱増 + /// </summary> + /// <remarks> + /// 濡傛灉鍏蜂綋琛ㄥ崟涓渶瑕佹寚鏄庣姸鎬侊紝鐢�S_B_STATE 浠f浛 + /// </remarks> + public string S_STATE { get; set; } = "缂栬緫"; + } +} diff --git a/Models/DebugModel.cs b/Models/DebugModel.cs new file mode 100644 index 0000000..9573e0b --- /dev/null +++ b/Models/DebugModel.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// Debug浣跨敤鐨勬暟鎹ā鍨�+ /// </summary> + public class DebugModel { + public class LocCntrCg { + public string LocCode { get; set; } + public string LocArea { get; set; } + public string CntrCode { get; set; } + public string CntrType { get; set; } + public string CgId { get; set; } + public string BatchNo { get; set; } + } + + public class OutboundOrder { + public string No { get; set; } + public string CgId { get; set; } + public string BatchNo { get; set; } + public string EndArea { get; set; } + public int Qty { get; set; } + } + } +} diff --git a/Models/TN_CAR_IN.cs b/Models/TN_CAR_IN.cs new file mode 100644 index 0000000..9a2e55e --- /dev/null +++ b/Models/TN_CAR_IN.cs @@ -0,0 +1,21 @@ +锘縰sing SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�瀹瑰櫒鐢熶骇杞︽暟鍏宠仈瀛愯〃 + /// </summary> + [SugarTable("TN_CAR_IN")] + public class TN_CAR_IN : BaseModel + { + /// <summary> + /// 瀹瑰櫒鍙�+ /// </summary> + public string S_CNTR_CODE { set; get; } + + /// <summary> + /// 鐢熶骇杞︽暟锛岄�鍙峰垎鍓�+ /// </summary> + public string S_CAR_CODE { set; get; } + public string S_B_STATE { set; get; }//鐘舵� + } +} diff --git a/Models/TN_CG_Detail.cs b/Models/TN_CG_Detail.cs new file mode 100644 index 0000000..033b46e --- /dev/null +++ b/Models/TN_CG_Detail.cs @@ -0,0 +1,53 @@ +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�鐗╂枡-瀹瑰櫒 鍏崇郴琛�+ /// </summary> + /// <remarks> + /// CG = Cargo Goods 璐х墿鍟嗗搧 + /// </remarks> + [SugarTable("TN_CG_Detail")] + public class TN_CG_Detail : BaseModel { + /// <summary> + /// 鏂欑鍟嗗搧鏍囪瘑 + /// </summary> + public string S_CG_ID { get; set; } + + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + public string S_ITEM_CODE { get; set; } = ""; + + /// <summary> + /// 瀹瑰櫒缂栫爜 + /// </summary> + public string S_CNTR_CODE { get; set; } + + /// <summary> + /// 璐у搧鐘舵�锛�鍚堟牸 1寰呮 2涓嶅悎鏍�3姝e湪妫�獙锛涗笅绾垮嵆寰呮 + /// </summary> + /// <remarks> + /// 绠楁硶锛氭暟瀛楄秺灏忚秺浼樺厛锛屽悎鏍硷紴寰呮锛炰笉鍚堟牸锛炴鍦ㄦ楠岋紙鐩存帴鍚﹀畾锛�+ /// </remarks> + public string S_ITEM_STATE { get; set; } = "寰呮"; + + /// <summary> + /// 璐у搧鐘舵�_瀛楀吀锛�鍚堟牸 1寰呮 2涓嶅悎鏍�3姝e湪妫�獙锛涗笅绾垮嵆寰呮 + /// </summary> + /// <remarks> + /// 绠楁硶锛氭暟瀛楄秺灏忚秺浼樺厛锛屽悎鏍硷紴寰呮锛炰笉鍚堟牸锛炴鍦ㄦ楠岋紙鐩存帴鍚﹀畾锛�+ /// </remarks> + public int N_ITEM_STATE { get; set; } = 1; + + /// <summary> + /// 鎵规鍙�+ /// </summary> + public string S_BATCH_NO { get; set; } + + ///// <summary> + ///// 璐у搧鏁伴噺 + ///// </summary> + //public float F_QTY { get; set; } + } +} diff --git a/Models/TN_Container.cs b/Models/TN_Container.cs new file mode 100644 index 0000000..e2a5f07 --- /dev/null +++ b/Models/TN_Container.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�瀹瑰櫒琛�+ /// </summary> + [SugarTable("TN_Container")] + public class TN_Container : BaseModel { + public string S_CODE { get; set; } + + public int N_DETAIL_COUNT { get; set; } + + [SugarColumn(IsIgnore = true)] + [Navigate(NavigateType.OneToMany, nameof(TN_CG_Detail.S_CNTR_CODE), nameof(S_CODE))] + public List<TN_CG_Detail> CntrItemRels { get; set; } + + } +} diff --git a/Models/TN_Inbound_Order.cs b/Models/TN_Inbound_Order.cs new file mode 100644 index 0000000..b1db2c2 --- /dev/null +++ b/Models/TN_Inbound_Order.cs @@ -0,0 +1,28 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 鍑哄簱鍗�+ /// </summary> + public class TN_Inbound_Order { + + /// <summary> + /// 鐗╂枡鍙�+ /// </summary> + public string S_CG_CODE { get; set; } + + /// <summary> + /// 瀹瑰櫒缂栫爜 + /// </summary> + public string S_CNTR_CODE { get; set; } + + /// <summary> + /// 鍏ュ簱鍗曠姸鎬侊細0鏈笅绾�1绛夊緟鎵ц 2瀹屾垚 + /// </summary> + public string S_B_STATE { get; set; } + } +} diff --git a/Models/TN_Loc_Container.cs b/Models/TN_Loc_Container.cs new file mode 100644 index 0000000..94902d0 --- /dev/null +++ b/Models/TN_Loc_Container.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�璐т綅-瀹瑰櫒 鍏崇郴琛�+ /// </summary> + [SugarTable("TN_Loc_Container")] + public class TN_Loc_Container : BaseModel { + + #region 鍩烘湰灞炴�鍏崇郴 + /// <summary> + /// 璐т綅鍙�+ /// </summary> + public string S_LOC_CODE { get; set; } + + /// <summary> + /// 瀹瑰櫒鍙�+ /// </summary> + public string S_CNTR_CODE { get; set; } + + + #endregion + + /// <summary> + /// 瀹瑰櫒绫诲瀷 + /// </summary> + public string S_CNTR_TYPE { get; set; } + + + // 瀹瑰櫒-鐗╂枡 1:n + [Navigate(NavigateType.OneToMany, nameof(TN_CG_Detail.S_CNTR_CODE))] + public List<TN_CG_Detail> CntrItemRels { get; set; } + + // 瀹瑰櫒鍏崇郴琛�瀹瑰櫒 1:1 + [Navigate(NavigateType.OneToOne, nameof(S_CNTR_CODE))] + public TN_Container Container { get; set; } + } +} diff --git a/Models/TN_Location.cs b/Models/TN_Location.cs new file mode 100644 index 0000000..f0a2b87 --- /dev/null +++ b/Models/TN_Location.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�璐т綅琛�+ /// </summary> + + [SugarTable("TN_Location")] + public class TN_Location : BaseModel { + + #region 鍩虹灞炴�鍏崇郴 + /// <summary> + /// 璐т綅 ID + /// </summary> + public string S_CODE { get; set; } + + /// <summary> + /// 璐т綅鍚嶇О + /// </summary> + public string S_NAME { get; set; } = ""; + + /// <summary> + /// 璐т綅鎵�湪鍖哄煙 ID + /// </summary> + public string S_AREA_CODE { get; set; } + + /// <summary> + /// 鍥借嚜 AGV 瀵瑰簲鐨勫簱浣嶅悕绉�+ /// </summary> + public string S_AGV_SITE { get; set; } = ""; + + /// <summary> + /// 璐т綅瀹瑰櫒瀹归噺 + /// </summary> + public int N_CAPACITY { get; set; } = 1; + + /// <summary> + /// 璐т綅褰撳墠瀹瑰櫒鏁伴噺 + /// </summary> + public int N_CURRENT_NUM { get; set; } = 0; + + /// <summary> + /// 璐т綅鐨勫眰鏁�+ /// </summary> + public int N_LAYER { get; set; } = 1; + + /// <summary> + /// 涓婇攣鐘舵�鍙凤細0鏃�1鍏ュ簱閿�2鍑哄簱閿�3鍏跺畠閿�+ /// </summary> + public int N_LOCK_STATE { get; set; } = 0; + + /// <summary> + /// 涓婇攣鐘舵�鍚嶇О锛�鏃�1鍏ュ簱閿�2鍑哄簱閿�3鍏跺畠閿�+ /// </summary> + public string S_LOCK_STATE { get; set; } = "鏃�; + + /// <summary> + /// Lock Operator锛氫笂閿佺殑鎿嶄綔鏉ユ簮锛堥�甯告槸浠诲姟鍙凤級 + /// </summary> + public string S_LOCK_OP { get; set; } = ""; + + /// <summary> + /// 璐т綅鏄惁鍚敤锛歒鍚敤 + /// </summary> + public string C_ENABLE { get; set; } = "Y"; + #endregion + + /// <summary> + /// 璐т綅-瀹瑰櫒 鍏崇郴鏄犲皠 + /// </summary> + /// <remarks> + /// 榛樿鏄竴瀵瑰锛岄�甯告儏鍐垫槸涓�涓�+ /// </remarks> + [Navigate(NavigateType.OneToMany, nameof(TN_Loc_Container.S_LOC_CODE))] + public List<TN_Loc_Container> LocCntrRels { get; set; } + + public static string GetLockStateStr(int lockState) { + var str = ""; + switch (lockState) { + case 0: str = "鏃�; break; + case 1: str = "鍏ュ簱閿�; break; + case 2: str = "鍑哄簱閿�; break; + case 3: str = "鍏跺畠閿�; break; + } + return str; + } + } +} diff --git a/Models/TN_Outbound_Detail.cs b/Models/TN_Outbound_Detail.cs new file mode 100644 index 0000000..794282c --- /dev/null +++ b/Models/TN_Outbound_Detail.cs @@ -0,0 +1,54 @@ +锘縰sing SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 鍑哄簱鍗曟槑缁�+ /// </summary> + [SugarTable("TN_Outbound_Detail")] + public class TN_Outbound_Detail : BaseModel { + /// <summary> + /// 鍑哄簱鍗曞彿 + /// </summary> + public string S_NO { get; set; } + + ///// <summary> + ///// 琛屽彿 + ///// </summary> + //public int N_ROW_NO { get; set; } + + /// <summary> + /// 涓氬姟鐘舵�锛�绛夊緟 1姝e湪鎵ц 2宸插畬鎴�+ /// </summary> + public int N_B_STATE { get; set; } = 0; + + /// <summary> + /// 鐗╂枡鍙�+ /// </summary> + public string S_CG_ID { get; set; } + + /// <summary> + /// 鎵规鍙�+ /// </summary> + public string S_BATCH_NO { get; set; } + + /// <summary> + /// 鍑哄簱璐у搧鏁伴噺锛堟暣鏁帮紝鐢ㄤ簬鐢熸垚浠诲姟鏁帮級 + /// </summary> + public int N_QTY { get; set; } + + /// <summary> + /// 宸插嚭搴撶殑璐у搧鏁伴噺 + /// </summary> + public int N_O_QTY { get; set; } = 0; + + /// <summary> + /// 缁堢偣搴撳尯锛堢敱WMS涓嬪彂浠诲姟鏃舵寚瀹氾級 + /// </summary> + public string S_END_AREA { get; set; } + + /// <summary> + /// 鏄惁寮哄埗鍑哄簱锛�涓嶅己鍒�1寮哄埗 + /// </summary> + public int N_FORCE { get; set; } + } +} diff --git a/Models/TN_Outbound_Order.cs b/Models/TN_Outbound_Order.cs new file mode 100644 index 0000000..f883aea --- /dev/null +++ b/Models/TN_Outbound_Order.cs @@ -0,0 +1,30 @@ +锘縰sing System.Collections.Generic; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 鍑哄簱鍗�+ /// </summary> + [SugarTable("TN_Outbound_Order")] + internal class TN_Outbound_Order : BaseModel { + /// <summary> + /// 鍑哄簱鍗曞彿 + /// </summary> + public string S_NO { get; set; } + + /// <summary> + /// 涓氬姟鐘舵�锛�绛夊緟 1姝e湪鎵ц 2宸插畬鎴�+ /// </summary> + public int N_B_STATE { get; set; } = 0; + + /// <summary> + /// 鏄惁寮哄埗鍑哄簱锛�涓嶅己鍒�1寮哄埗 + /// </summary> + public int N_FORCE { get; set; } + + + [Navigate(NavigateType.OneToMany, nameof(TN_Outbound_Detail.S_NO))] + public List<TN_Outbound_Detail> Details { get; set; } + } +} diff --git a/Models/TN_Outbound_Task.cs b/Models/TN_Outbound_Task.cs new file mode 100644 index 0000000..af1cd62 --- /dev/null +++ b/Models/TN_Outbound_Task.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + + [SugarTable("TN_Outbound_Task")] + public class TN_Outbound_Task : BaseModel { + public string S_CG_ID { get; set; } + + public string S_BATCH_NO { get; set; } + public string S_END_AREA { get; set; } + /// <summary> + /// 0绛夊緟鎵ц 1鎵ц涓�2瀹屾垚 + /// </summary> + public int N_STATE { get; set; } + + /// <summary> + /// 鏄惁寮哄埗鍑哄簱锛�涓嶅己鍒�1寮哄埗 + /// </summary> + public int N_FORCE { get; set; } = 0; + } +} diff --git a/Models/TN_Task.cs b/Models/TN_Task.cs new file mode 100644 index 0000000..e977ec5 --- /dev/null +++ b/Models/TN_Task.cs @@ -0,0 +1,98 @@ +using System; + +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�浠诲姟琛�+ /// </summary> + [SugarTable("TN_Task")] + public class TN_Task : BaseModel { + /// <summary> + /// 浠诲姟鍙�+ /// </summary> + public string S_CODE { get; set; } + + /// <summary> + /// 浠诲姟绫诲瀷/鍚嶇О + /// </summary> + public string S_TYPE { get; set; } + + /// <summary> + /// 璧峰璐у尯 + /// </summary> + public string S_START_AREA { get; set; } + + /// <summary> + /// 缁堢偣璐у尯 + /// </summary> + public string S_END_AREA { get; set; } + + /// <summary> + /// 璧峰璐т綅 + /// </summary> + public string S_START_LOC { get; set; } + + /// <summary> + /// 缁堢偣璐т綅 + /// </summary> + public string S_END_LOC { get; set; } + + + public DateTime? T_START_TIME { get; set; } + public DateTime? T_END_TIME { get; set; } + + /// <summary> + /// AGV 杞﹀彿 + /// </summary> + public string S_EQ_NO { get; set; } + + /// <summary> + /// 浠诲姟鐘舵�锛�绛夊緟 1宸叉帹閫�2鎵ц 3瀹屾垚 4閿欒 + /// </summary> + public string S_B_STATE { get; set; } = "绛夊緟"; + + /// <summary> + /// 浠诲姟鐘舵�锛�绛夊緟 1宸叉帹閫�2鎵ц 3瀹屾垚 4閿欒 + /// </summary> + public int N_B_STATE { get; set; } + + /// <summary> + /// 0鏃�1NDC 2澶╃洰 3鍥借嚜 4PLC 5鏉ゥ + /// </summary> + public int N_SCHEDULE_TYPE { get; set; } + + /// <summary> + /// 浠诲姟浼樺厛绾�+ /// </summary> + public int N_PRIORITY { get; set; } + + + public string S_EQ_TASK_CODE { get; set; } + + public string S_CNTR_CODE { get; set; } + public string S_OP_NAME { get; set; } + + public int N_START_LAYER { get; internal set; } + public int N_END_LAYER { get; internal set; } + public int N_CNTR_COUNT { get; internal set; } + + /// <summary> + /// 鏄惁寮哄埗鍑哄簱锛�涓嶅己鍒�1寮哄埗 + /// </summary> + public int N_FORCE { get; set; } = 0; + + internal static string GetStateStr(int state) { + // 0绛夊緟 1宸叉帹閫�2鎵ц 3瀹屾垚 4閿欒 + var status = ""; + switch (state) { + case 0: status = "绛夊緟"; break; + case 1: status = "宸叉帹閫�; break; + case 2: status = "鎵ц"; break; + case 3: status = "瀹屾垚"; break; + case 4: status = "閿欒"; break; + } + return status; + } + } +} diff --git a/Models/TN_Task_Action.cs b/Models/TN_Task_Action.cs new file mode 100644 index 0000000..e0bf19a --- /dev/null +++ b/Models/TN_Task_Action.cs @@ -0,0 +1,22 @@ +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 銆愭鏋躲�浠诲姟鍔ㄤ綔琛�+ /// </summary> + [SugarTable("TN_Task_Action")] + public class TN_Task_Action : BaseModel + { + /// <summary> + /// 灏忚溅绫诲瀷 e.g. "agv" + /// </summary> + public string S_EQ_TYPE { get; set; } + public string S_DATA { get; set; } + + public string S_TASK_CODE { get; set; } + public string S_EQ_CODE { get; set; } + + + public int N_ACTION_CODE { get; set; } + } +} diff --git a/Models/TN_WorkOrder.cs b/Models/TN_WorkOrder.cs new file mode 100644 index 0000000..0e37764 --- /dev/null +++ b/Models/TN_WorkOrder.cs @@ -0,0 +1,17 @@ +using SqlSugar; + +namespace HH.WCS.Mobox3.DSZSH.Models { + /// <summary> + /// 鐢熶骇宸ュ崟 + /// </summary> + [SugarTable("TN_WorkOrder")] + public class TN_WorkOrder : BaseModel + { + public string S_WORK_NO { get; set; }//宸ュ崟鍙凤紝涓婚敭 + public string S_B_STATE { get; set; }//宸ュ崟鐘舵�锛屾柊寤�寮�惎-鏆傚仠-瀹屾垚 + public string S_ITEM_CODE { get; set; }//鐗╂枡缂栫爜 + public string S_BATCH_CODE { get; set; }//鎵规鍙�+ public string S_ITEM_SPEC { get; set; }//瑙勬牸 + public string S_LINE_NO { get; set; }//浜х嚎锛屼笉鑳戒负null + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..21fa639 --- /dev/null +++ b/Program.cs @@ -0,0 +1,168 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Threading; + +using HH.WCS.Mobox3.DSZSH.AppStart; +using HH.WCS.Mobox3.DSZSH.device; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.ServiceCore; + +using Microsoft.Owin.Hosting; + +using Topshelf; + +using Task = System.Threading.Tasks.Task; + +namespace HH.WCS.Mobox3.DSZSH { + internal class Program + { + static void Main(string[] args) { + // 鍩虹璁剧疆淇℃伅鍒濆鍖�+ Settings.Init(); + // 1.0 寮�惎api + Startup(); + // 2.0 寮�惎tcp + StartTcp(); + // 3.0 寮�惎S7 + StartS7(); + // 4.0 寮�惎Modbus + //StartModbus(); + + // 5.0 寮�惎绾跨▼ + var rc = HostFactory.Run(x => { + x.Service<WorkThread>(s => { + s.ConstructUsing(name => new WorkThread()); + s.WhenStarted(tc => tc.Start()); + s.WhenStopped(tc => tc.Stop()); + }); + x.RunAsLocalSystem(); + + x.SetDescription("hh123"); + x.SetDisplayName("hh123.wms"); + x.SetServiceName("hh123.wms"); + }); + + var exitCode = (int)Convert.ChangeType(rc, rc.GetTypeCode()); + Environment.ExitCode = exitCode; + } + + /// <summary> + /// 寮�惎API鍗忚閫氳 + /// </summary> + private static void Startup() + { + Console.WriteLine("Startup ApiController"); + Task.Run(() => + { + var url = AppStart.Settings.Config.WebApiUrl; // 杩愯鏃朵慨鏀�config.json 鏃犳晥 + Console.WriteLine(url); + using (WebApp.Start<Startup>(url)) + { + Console.WriteLine("API,Running on {0}", url); + Console.ReadLine(); + } + }); + } + + /// <summary> + /// 寮�惎TCP鍗忚閫氳锛屾湇鍔$ + /// </summary> + private static void StartTcp() + { + var tcpServerIP = AppStart.Settings.Config.TcpServerIp; // 杩愯鏃朵慨鏀�config.json 鏃犳晥 + var tcpServerPort = AppStart.Settings.Config.TcpServerPort; // 杩愯鏃朵慨鏀�config.json 鏃犳晥 + new TcpServer(tcpServerIP, tcpServerPort); + + } + + /// <summary> + /// 寮�惎S7鍗忚閫氳 + /// </summary> + private static void StartS7() + { + //鎵�湁鐨凷7璁惧 + //var allPLCDevice = Settings.ProductionLines; + + //if (allPLCDevice.Count > 0) + //{ + // foreach (var item in allPLCDevice) + // { + // new S7Helper(item.ProductionLine_IP, (short)item.ProductionLine_Rack, (short)item.ProductionLine_Slot); + // Console.WriteLine("S7ProductionLineHelper," + item.ProductionLine_IP); + // } + //} + + ////绉伴噸鐨凷7璁惧 + //var weightPLCDevice = Settings.WeightDevices; + + //if (weightPLCDevice.Count > 0) + //{ + // foreach (var item in weightPLCDevice) + // { + // new S7Helper(item.WeightDevice_IP, (short)item.WeightDevice_Rack, (short)item.WeightDevice_Slot); + // Console.WriteLine("S7WeightDeviceHelper," + item.WeightDevice_Name); + // } + //} + } + + /// <summary> + /// 寮�惎Modbus鍗忚閫氳 + /// </summary> + private static void StartModbus() + { + // 鎵�湁鐨凪odbus璁惧 + var allPLCDevice = AppStart.Settings.Config.ProductionLines; // 杩愯鏃朵慨鏀�config.json 鏃犳晥 + + if (allPLCDevice.Count > 0) { + foreach (var item in allPLCDevice) { + new ModbusHelper(item.PlcIp, item.PlcPort, (byte)item.SlaveId); + Console.WriteLine("ModbusHelper," + item.PlcIp); + } + } + } + + public class WorkThread + { + public void Start() + { + List<Task> tasks = new List<Task>(); + + tasks.Add(GetTask(OutboundCore.CheckOutboundOrder)); + + tasks.Add(GetTask(OutboundCore.CheckOutboundTask)); + + + // 娣诲姞浠诲姟鎺ㄩ�绾跨▼ + //tasks.Add(GetTask(WCSCore.Dispatch)); + + // 娣诲姞鑷畾涔夌嚎绋�+ //tasks.Add(GetTask(Monitor.CheckEmptyCnt));//妫�祴绌烘墭鐩�+ + // 鏍规嵁S7/Modbus鍗忚鍒ゆ柇杈撻�绾跨殑淇″彿 鍘熸潗鏂欎骇绾垮簱鍖�>婊℃墭缂撳瓨搴撳尯锛岀┖鎵樼紦瀛樺簱鍖�>鍘熸潗鏂欎骇绾垮簱鍖�+ //tasks.Add(GetTask(Monitor.CheckS7Devices)); + + Task.WaitAll(tasks.ToArray()); + } + public void Stop() { Console.WriteLine("work stopped"); } + private Task GetTask(Action action) + { + var task = Task.Run(() => + { + while (true) + { + try + { + action(); + } + catch (Exception ex) + { + LogHelper.Error(ex.Message, ex); + } + Thread.Sleep(3000); + } + }); + return task; + } + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..71b07bb --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 鏈夊叧绋嬪簭闆嗙殑涓�埇淇℃伅鐢变互涓�+// 鎺у埗銆傛洿鏀硅繖浜涚壒鎬у�鍙慨鏀�+// 涓庣▼搴忛泦鍏宠仈鐨勪俊鎭� +[assembly: AssemblyTitle("HH.WCS.Mobox3.DSZSH")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HH.WCS.Mobox3.DSZSH")] +[assembly: AssemblyCopyright("Copyright 漏 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 灏�ComVisible 璁剧疆涓�false 浼氫娇姝ょ▼搴忛泦涓殑绫诲瀷 +//瀵�COM 缁勪欢涓嶅彲瑙併�濡傛灉闇�浠�COM 璁块棶姝ょ▼搴忛泦涓殑绫诲瀷 +//璇峰皢姝ょ被鍨嬬殑 ComVisible 鐗规�璁剧疆涓�true銆�+[assembly: ComVisible(false)] + +// 濡傛灉姝ら」鐩悜 COM 鍏紑锛屽垯涓嬪垪 GUID 鐢ㄤ簬绫诲瀷搴撶殑 ID +[assembly: Guid("8e589c0d-7d65-474d-8ced-e34e087126a1")] + +// 绋嬪簭闆嗙殑鐗堟湰淇℃伅鐢变笅鍒楀洓涓�缁勬垚: +// +// 涓荤増鏈�+// 娆$増鏈�+// 鐢熸垚鍙�+// 淇鍙�+// +//鍙互鎸囧畾鎵�湁杩欎簺鍊硷紝涔熷彲浠ヤ娇鐢ㄢ�鐢熸垚鍙封�鍜屸�淇鍙封�鐨勯粯璁ゅ� +//閫氳繃浣跨敤 "*"锛屽涓嬫墍绀� +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ServiceCore/OfflineCore.cs b/ServiceCore/OfflineCore.cs new file mode 100644 index 0000000..1d053e6 --- /dev/null +++ b/ServiceCore/OfflineCore.cs @@ -0,0 +1,81 @@ +锘縰sing System; + +using HH.WCS.Mobox3.DSZSH.AppStart; +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Helpers.Model; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Helper; +using System.Collections.Generic; + +namespace HH.WCS.Mobox3.DSZSH.ServiceCore { + /// <summary> + /// 瀹氭椂杞浠诲姟锛氭墭鐩樹笅绾夸换鍔℃牳蹇�+ /// </summary> + public class OfflineCore + { + /// <summary> + /// 鑾峰彇杈撻�绾垮彂閫佺殑鎴愬搧鑳朵笅绾胯姹�+ /// </summary> + /// <remarks> + /// 娴佺▼涓�鎴愬搧鑳朵笅绾�br/> + /// 4) AMS鏀跺埌璇锋眰锛岀敓鎴愭垚鍝佷笅绾挎寚浠わ紝骞跺皢鎸囦护鍙戦�鍒癢MS绯荤粺 + /// </remarks> + public static void CheckPlcOfflineRequest() { + try { + foreach (var prodLineInfo in AppStart.Settings.Config.ProductionLines) { + var db = DbHelper.GetDbClient(); + + // TODO 绛夊緟杈撻�绾垮崗璁畬鎴愬悗鍐嶈ˉ鍏呭叿浣撻�杈�+ + // 鍒ゆ柇杈撻�绾垮綋鍓嶆槸鍚︽湁涓嬬嚎淇″彿 + var readFlag = ModbusHelper.ReadHoldingRegisters(15, 1, prodLineInfo.PlcIp, prodLineInfo.PlcPort); + if (readFlag[0] == 0) { + + continue; + } + + // 璇诲彇杈撻�绾夸笅绾胯姹備俊鎭�+ var cgId = ModbusHelper.ReadHoldingRegistersToString(20, 20, prodLineInfo.PlcIp, prodLineInfo.PlcPort); + var cntrId = ModbusHelper.ReadHoldingRegistersToString(40, 20, prodLineInfo.PlcIp, prodLineInfo.PlcPort); + + var cgDetail = db.Queryable<TN_CG_Detail>() + .Where(cd => cd.S_CG_ID == cgId && cd.S_CNTR_CODE == cntrId).First(); + + + // 缁戝畾 鐗╂枡淇℃伅 鍜�瀹瑰櫒淇℃伅 + cgDetail = new TN_CG_Detail { + S_CG_ID = cgId, + S_CNTR_CODE = cntrId, + }; + + if (db.Insertable<TN_CG_Detail>(cgDetail).ExecuteCommand() > 0) { + LogHelper.Info($"缁戝畾鐗╂枡 '{cgId}' 涓庡鍣�'{cntrId}' 鎴愬姛"); + } + else { + LogHelper.Info($"缁戝畾鐗╂枡 '{cgId}' 涓庡鍣�'{cntrId}' 澶辫触"); + } + } + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + + /// <summary> + /// 杞鎵樼洏鍏ュ簱浠诲姟骞舵墽琛�+ /// </summary> + public static void CheckInboundTask() { + //var db = DbHelper.GetDbClient(); + + //var inboundOrder = db.Queryable<TN_Inbound_Order>() + // .Where(i => i.S_B_STATE == "绛夊緟鎵ц").First(); + + //TaskHelper.LogCreateTask() + + } + + + } +} + diff --git a/ServiceCore/OutboundCore.cs b/ServiceCore/OutboundCore.cs new file mode 100644 index 0000000..a42caae --- /dev/null +++ b/ServiceCore/OutboundCore.cs @@ -0,0 +1,172 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; + +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Helpers.Model; +using HH.WCS.Mobox3.DSZSH.Models; + +using Newtonsoft.Json; + +namespace HH.WCS.Mobox3.DSZSH.ServiceCore { + /// <summary> + /// 瀹氭椂杞浠诲姟锛氬嚭搴撲笟鍔℃牳蹇�+ /// </summary> + public class OutboundCore { + /// <summary> + /// 鍚庡彴杞鍑哄簱鍗�鍑哄簱鏄庣粏鍗曪紝鐢熸垚鍑哄簱浠诲姟琛�+ /// </summary> + public static void CheckOutboundOrder() { + var db = DbHelper.GetDbClient(); + + try { + // 鏌ユ壘鎵�湁鐨�绛夊緟鍑哄簱 鐨�鍑哄簱鍗曪紝鎸�鍏堝垱寤哄厛澶勭悊 鎺掑簭 + var orders = db.Queryable<TN_Outbound_Order>() + .Where(o => o.N_B_STATE == 0) + .OrderBy(o => o.T_CREATE) + .Mapper( + o => o.Details, // 灏嗗瓙琛ㄦ暟鎹槧灏勫埌涓昏〃鐨�Details 灞炴� + o => o.S_NO, // 涓昏〃鍏宠仈瀛楁 + d => d.S_NO // 瀛愯〃鍏宠仈瀛楁 + ) + .ToList(); + + if (orders.Count == 0) { + LogHelper.Info("杞 | 褰撳墠娌℃湁绛夊緟鎵ц鐨勫嚭搴撳崟"); + return; + } + + using (var tran = db.Ado.UseTran()) { + + foreach (var o in orders) { + foreach (var d in o.Details) { + for (int i = 0; i < d.N_QTY; i++) { + var task = new TN_Outbound_Task { + S_CG_ID = d.S_CG_ID, + S_END_AREA = d.S_END_AREA, + N_FORCE = o.N_FORCE, + S_BATCH_NO = d.S_BATCH_NO, + N_STATE = 0 + }; + if (db.Insertable<TN_Outbound_Task>(task).ExecuteCommand() <= 0) { + tran.RollbackTran(); + LogHelper.Info("鎻掑叆浠诲姟鍑洪敊"); + return; + } + } + + d.N_B_STATE = 1; + if (db.Updateable<TN_Outbound_Detail>(d).UpdateColumns(c => c.N_B_STATE).ExecuteCommand() > 0) { + LogHelper.Info("鏇存柊 N_B_STATE 鎴愬姛"); + } + else { + tran.RollbackTran(); + + LogHelper.Info("鏇存柊 N_B_STATE 澶辫触"); + return; + } + } + + o.N_B_STATE = 1; + if (db.Updateable<TN_Outbound_Order>(o).UpdateColumns(c => c.N_B_STATE).ExecuteCommand() > 0) { + LogHelper.Info("鏇存柊 N_B_STATE 鎴愬姛"); + } + else { + tran.RollbackTran(); + + LogHelper.Info("鏇存柊 N_B_STATE 澶辫触"); + return; + } + } + + tran.CommitTran(); + } + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + throw; + } + } + + /// <summary> + /// 杞鍑哄簱 + /// </summary> + public static void CheckOutboundTask() { + var db = DbHelper.GetDbClient(); + + try { + var task = db.Queryable<TN_Outbound_Task>() + .Where(t => t.N_STATE == 0).First(); + + if (task == null) { + LogHelper.Info("杞 | 鍑哄簱浠诲姟闃熷垪 鏆傛棤寰呮墽琛岀殑浠诲姟"); + return; + } + + var headTask = task; + if (headTask.N_STATE != 0) { + LogHelper.Info("杞 | 鍑哄簱浠诲姟闃熷垪 闃熷ご浠诲姟灏氭湭瀹屾垚"); + return; + } + + var locCntr = db.Queryable<TN_Location, TN_Loc_Container, TN_CG_Detail> + ((l, c, d) => l.S_CODE == c.S_LOC_CODE && c.S_CNTR_CODE == d.S_CNTR_CODE) + // 绛涢�瑕佹眰鐨勭墿鏂欑紪鐮佸拰鎵规鍙�+ .Where((l, c, d) => d.S_CG_ID == headTask.S_CG_ID && d.S_BATCH_NO == headTask.S_BATCH_NO) + // 濡傛灉涓嶆槸寮哄埗鍑哄簱锛岀墿鏂欑姸鎬佸繀椤诲繀椤诲悎鏍�+ // 鍚﹀垯锛屽彧瑕佷笉鏄鍦ㄦ楠岀殑鐗╂枡鍗冲彲 + .Where((l, c, d) => (headTask.N_FORCE == 0 && d.N_ITEM_STATE == 0 && d.S_ITEM_STATE == "鍚堟牸") + || (headTask.N_FORCE != 0 && d.N_ITEM_STATE != 3 && d.S_ITEM_STATE != "姝e湪妫�獙")) + // 鐗╂枡鐘舵�瀵瑰簲鐨勬暟瀛楋紝瓒婂皬瓒婁紭鍏�+ .OrderBy((l, c, d) => d.N_ITEM_STATE) + .OrderBy(l => l.N_LAYER) + .Select((l, c) => new { Location = l, Container = c }).First(); + + if (locCntr == null) { + LogHelper.Info("杞 | 涓嶅瓨鍦ㄧ鍚堟潯浠剁殑鐗╂枡璐т綅"); + return; + } + + var endLoc = db.Queryable<TN_Location>() + .Where(l => l.S_AREA_CODE == headTask.S_END_AREA) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty) + .OrderBy(l => l.S_CODE) + .First(); + + if (endLoc == null) { + LogHelper.Info("杞 | 涓嶅瓨鍦ㄧ鍚堟潯浠剁殑鍑哄簱缁堢偣搴撲綅"); + return; + } + + using (var tran = db.Ado.UseTran()) { + if (TaskHelper.LogCreateTask(locCntr.Location.S_CODE, locCntr.Container.S_CNTR_CODE, endLoc.S_CODE, TaskName.鎴愬搧鑳跺嚭搴�) { + task.N_STATE = 1; + if (db.Updateable<TN_Outbound_Task>(task).UpdateColumns(c => c.N_STATE).ExecuteCommand() <= 0) { + tran.RollbackTran(); + LogHelper.Info("淇敼鍑哄簱浠诲姟鐘舵�閿欒"); + } + else { + tran.CommitTran(); + LogHelper.Info("淇敼鍑哄簱浠诲姟鐘舵�鎴愬姛"); + } + } + } + + } + catch (Exception ex) { + LogHelper.InfoEx(ex); + } + } + + /// <summary> + /// + /// </summary> + /// <param name="state"></param> + public static void UpdateTaskState(int state = 2) { + + } + + } +} diff --git a/ServiceCore/TaskCore.cs b/ServiceCore/TaskCore.cs new file mode 100644 index 0000000..dbff385 --- /dev/null +++ b/ServiceCore/TaskCore.cs @@ -0,0 +1,33 @@ +锘縰sing System; + +using HH.WCS.Mobox3.DSZSH.Helpers.Model; +using HH.WCS.Mobox3.DSZSH.Helper; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; + +namespace HH.WCS.Mobox3.DSZSH.ServiceCore { + internal class TaskCore { + /// <summary> + /// 浠诲姟鍒嗗彂锛屾牴鎹皟搴︾被鍨嬪彂缁欎笉鍚岀殑璋冨害绯荤粺 + /// </summary> + internal static void Dispatch() { + // 鏌ヨ浠诲姟 + // 鑾峰彇鎵�湁绛夊緟鐨勪换鍔�+ var list = TaskHelper.GetWaitingTaskList(); + LogHelper.Info("绛夊緟浠诲姟淇℃伅" + JsonConvert.SerializeObject(list), "API"); + if (list.Count > 0) { + list.ForEach(task => { + // 浣跨敤鑷畾涔変换鍔℃帹閫�+ TaskHelper.SendTask(task); // 璋冨害NDC鎴栨澀濂ユ垨鍥借嚜璁惧 + //TaskProcess.SendGZTask(task); // 璋冨害鍥借嚜璁惧 + }); + } + else { + LogHelper.Info("鏆傛棤浠诲姟"); + } + } + } +} diff --git a/Services/AgvService.cs b/Services/AgvService.cs new file mode 100644 index 0000000..593c21f --- /dev/null +++ b/Services/AgvService.cs @@ -0,0 +1,148 @@ +锘縰sing System; + +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Devices; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Helpers.Model; +using HH.WCS.Mobox3.DSZSH.Models; +using HH.WCS.Mobox3.DSZSH.Helper; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; + +namespace HH.WCS.Mobox3.DSZSH.Services { + public class AgvService { + public static ReturnResult OperateAgvTaskStatus(AgvTaskState model) { + var result = new ReturnResult(); + try { + switch (model.State) { + case 1023: + case 1025: + + break; + case 1012: + break; + case 1004: + break; + case 1103: + break; + default: + // AGV 鎵ц浠诲姟鐨勯�杈戝鐞�+ if (!AgvTaskProcessOk(model)) { + // 鎵ц涓峅K锛岃鏄庢病鏈夋壘鍒颁换鍔�+ result.ResultCode = 1; + result.ResultMsg = $"鏍规嵁Model.No鏈壘鍒板搴旂殑浠诲姟锛寋model.TaskNo}"; + LogHelper.Info(result.ResultMsg, "API"); + return result; + } + break; + } + + result.ResultCode = 0; + result.ResultMsg = "success"; + LogHelper.Info(result.ResultMsg, "API"); + return result; + } + catch (Exception ex) { + result.ResultCode = -1; + result.ResultMsg = $"鍙戠敓浜嗗紓甯革細+{ex.Message}"; + LogHelper.Info(result.ResultMsg, "Error"); + return result; + } + + } + + /// <summary> + /// 鎵ц AGV 浠诲姟锛屾煡璇笉鍒颁换鍔¤繑鍥�<see langword="false"/>锛堢鏈夋柟娉曪紝鍐呴儴璋冪敤锛�+ /// </summary> + /// <param name="model"></param> + /// <returns></returns> + private static bool AgvTaskProcessOk(AgvTaskState model) { + var TN_Task = TaskHelper.GetTask(model.TaskNo); // 鏍规嵁褰撳墠model缂栧彿鏌ヨ浠诲姟 + if (TN_Task == null) { return false; } + + if (model.State > 7) { + //瀹夊叏璇锋眰绛�+ TaskHelper.OperateReq(model.TaskNo, model.State, model.ForkliftNo, model.ext_data); + return true; + } + + // AGV 浠诲姟 134562(7) 鐘舵�澶勭悊 + switch (model.State) { + case AgvStateCode.鎵ц: + TaskHelper.Begin(TN_Task, model.ForkliftNo); // 宸叉帹閫佺殑浠诲姟鐨勭姸鎬佹敼鎴愭墽琛�+ break; + case AgvStateCode.寮�鍙栬揣: + TaskHelper.UpdateStatus(TN_Task, "寮�鍙栬揣"); // 浠诲姟鐘舵�鏀规垚寮�鍙栬揣 + break; + case AgvStateCode.鍙栬揣瀹屾垚: + TaskHelper.UpdateStatus(TN_Task, "鍙栬揣瀹屾垚"); // 浠诲姟鐘舵�鏀规垚鍙栬揣瀹屾垚 + TaskHelper.OperateStatus(TN_Task, 4); // 璧风偣瀹瑰櫒璐т綅瑙g粦,瑙i攣璧风偣 + + + + break; + case AgvStateCode.寮�鍗歌揣: + TaskHelper.UpdateStatus(TN_Task, "寮�鍗歌揣"); // 浠诲姟鐘舵�鏀规垚寮�鍗歌揣 + break; + case AgvStateCode.鍗歌揣瀹屾垚: + TaskHelper.UpdateStatus(TN_Task, "鍗歌揣瀹屾垚"); // 浠诲姟鐘舵�鏀规垚鍗歌揣瀹屾垚 + TaskHelper.OperateStatus(TN_Task, 6); // 缁堢偣瀹瑰櫒璐т綅缁戝畾,瑙i攣缁堢偣 + break; + case AgvStateCode.瀹屾垚: + TaskHelper.End(TN_Task); // 浠诲姟鐘舵�鏀规垚缁撴潫 + break; + case AgvStateCode.寮傚父: + TaskHelper.OperateStatus(TN_Task, 7); // 寮傚父澶勭悊 + TaskHelper.Fail(TN_Task); // 浠诲姟鐘舵�鏀规垚閿欒 + break; + } + + // 灏咥GV鎵ц鐘舵�锛屽姞鍏N_Task_Action琛ㄤ腑 + TaskHelper.AddActionRecord(model.TaskNo, model.State, model.ForkliftNo, model.ext_data); + //璋冪敤绗笁鏂规帴鍙o紙濡傛灉鏈夛級TaskProcess.ReportStatus锛屾坊鍔犱换鍔″姩浣滃叧绯昏〃 + + return true; + } + + + + public static ReturnResult SafetyInteraction(SafetyInteractionInfo model) { + var gzResult = new ReturnResult(); + var db = DbHelper.GetDbClient(); + ModbusHelper.Relink(); + + try { + var prodLineInfo = AppStart.Settings.Config.ProductionLines[0]; + var prodLineDevice = new ProductionLineDevice(prodLineInfo.PlcIp, prodLineInfo.PlcPort); + if (!prodLineDevice.LoadDeviceStateOk()) { + LogHelper.Info("鍔犺浇璁惧淇℃伅澶辫触"); + } + + var tn_task = db.Queryable<TN_Task>().First(a => a.S_CODE == model.task_no); + if (tn_task == null) { + LogHelper.Info($"浠诲姟鍙�'{model.task_no}' 涓嶅瓨鍦�); + } + + // 寰呬慨鏀癸細琛ュ厖涓嶅悓鍒嗘敮AGV鍒ゆ柇 + if (prodLineDevice.SystemState == 1) { + if (prodLineDevice.FullOffline == 1 && tn_task.S_TYPE == TaskName.鎵樼洏_婊℃墭涓嬬嚎鍏ュ簱) { + prodLineDevice.AgvPicking = 1; + } + if (prodLineDevice.AllowAgvPlacePallet == 1 && tn_task.S_TYPE == TaskName.鎵樼洏_绌烘墭涓婄嚎) { + prodLineDevice.AgvPlacingPallet = 1; + } + } + + LogHelper.Info(JsonConvert.SerializeObject(prodLineDevice, Formatting.Indented)); + return gzResult; + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓浜嗗紓甯革細{ex.Message}"); + return gzResult; + } + } + } +} diff --git a/Services/DebugService.cs b/Services/DebugService.cs new file mode 100644 index 0000000..2d3cd8f --- /dev/null +++ b/Services/DebugService.cs @@ -0,0 +1,253 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; + +using CsvHelper; +using CsvHelper.Configuration; + +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Models; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.DebugRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.DebugResponse; + +namespace HH.WCS.Mobox3.DSZSH.Services { + public class DebugService { + + /// <summary> + /// 妯℃嫙 AGV 澶氭鍥炴姤浠诲姟鐘舵� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static ReturnResults AgvSeriesReports(UpdateTaskState model) { + var returnResults = new ReturnResults(); + returnResults.ResultList = new List<ReturnResult>(); + + //if (!AgvHelper.IsTaskState(model.NextState)) { + // return returnResults; + //} + + var agvCurrentState = 1; // 濡傛灉娌℃湁鎵惧埌鏈�柊鐨�TaskAction锛岄粯璁ゅ綋鍓嶇姸鎬佷负 1(鎵ц) + + // 鏌ヨ TaskAction 琛ㄤ腑涓庡綋鍓嶄换鍔″彿鍖归厤鐨勬渶鏂拌褰�+ var db = DbHelper.GetDbClient(); + var taskAction = db.Queryable<TN_Task_Action>() + .Where(a => a.S_TASK_CODE == model.TaskID) + .OrderBy(a => a.T_CREATE, SqlSugar.OrderByType.Desc).First(); + + if (taskAction != null) { + // 濡傛灉鏈夊尮閰嶏紝灏嗗綋鍓嶄换鍔$姸鎬佽缃负琛ㄥ崟涓殑鏈�柊鐘舵� + agvCurrentState = taskAction.N_ACTION_CODE; + } + + if (!AgvHelper.IsNextStateOk(agvCurrentState, model.NextState)) { + LogHelper.Info($"Debug: AGV 鐘舵� '{model.NextState}' 涓嶆槸 '{agvCurrentState}' 鐨�鍚堟硶涓嬩竴鐘舵�"); + return returnResults; + } + + var agvTaskState = new AgvTaskState() { + TaskNo = model.TaskID, + ForkliftNo = model.ForkliftNo, + }; + + var result = new ReturnResult(); + + // 褰撳墠鐘舵�娌℃湁杈惧埌鏈�粓鐘舵�鏃讹紝寰幆鍔犲叆杩斿洖鍒楄〃 + while (agvCurrentState != model.NextState) { + agvTaskState.State = agvCurrentState; + result = AgvService.OperateAgvTaskStatus(agvTaskState); + returnResults.ResultList.Add(result); + agvCurrentState = AgvHelper.GetNextState(agvCurrentState); + } + + // 灏嗗惊鐜病鏈夊埌杈剧殑鏈�粓鐘舵�锛屼篃鍔犲叆杩斿洖鍒楄〃 + agvTaskState.State = model.NextState; + result = AgvService.OperateAgvTaskStatus(agvTaskState); + returnResults.ResultList.Add(result); + + return returnResults; + } + + + /// <summary> + /// 鍒濆鏁版嵁搴撳缓绔�+ /// </summary> + /// <returns></returns> + public string CreateDatabase() { + try { + var db = DbHelper.GetDbClient(); + + db.CodeFirst.InitTables<TN_CG_Detail>(); + db.CodeFirst.InitTables<TN_WorkOrder>(); + db.CodeFirst.InitTables<TN_CAR_IN>(); + //db.CodeFirst.InitTables<SYSHelper.OI_SYS_MAXID>(); + db.CodeFirst.InitTables<TN_Task_Action>(); + db.CodeFirst.InitTables<TN_Task>(); + db.CodeFirst.InitTables<TN_Location>(); + db.CodeFirst.InitTables<TN_Loc_Container>(); + + db.CodeFirst.InitTables<TN_Outbound_Order>(); + db.CodeFirst.InitTables<TN_Outbound_Detail>(); + db.CodeFirst.InitTables<TN_Outbound_Task>(); + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓浜嗗紓甯�); + return "鍒濆鍖栨暟鎹簱閿欒" + ex.Message; + } + + return "鎴愬姛"; + } + + public static string InsertLocCntrCg() { + string filePath = PathHelper.GetProjDir("./debug/loc_cntr_cg.csv"); + var db = DbHelper.GetDbClient(); + + try { + var configuration = new CsvConfiguration(CultureInfo.InvariantCulture) { + // 閰嶇疆閫夐」 + Delimiter = ",", // 鍒嗛殧绗�+ HasHeaderRecord = true, // 鏈夋爣棰樿 + MissingFieldFound = null, // 蹇界暐缂哄け瀛楁 + HeaderValidated = null, // 璺宠繃鏍囬楠岃瘉 + BadDataFound = context => { } // 澶勭悊閿欒鏁版嵁 + }; + + var locCntrCgList = new List<DebugModel.LocCntrCg>(); + + using (var reader = new StreamReader(filePath)) + using (var csv = new CsvReader(reader, configuration)) { + // 璇诲彇璁板綍 + locCntrCgList = csv.GetRecords<DebugModel.LocCntrCg>().ToList(); + } + + using (var tran = db.UseTran()) { + foreach (var locCntrCg in locCntrCgList) { + LogHelper.Info("LogCntrCg锛� + JsonConvert.SerializeObject(locCntrCg)); + if (string.IsNullOrEmpty(locCntrCg.LocCode)) break; + + var loc = db.Queryable<TN_Location>().First(a => a.S_CODE == locCntrCg.LocCode); + if (loc == null) { + var newLoc = new TN_Location { + S_CODE = locCntrCg.LocCode, + S_AREA_CODE = locCntrCg.LocArea ?? "" + }; + + if (db.Insertable<TN_Location>(newLoc).ExecuteCommand() <= 0) { + tran.RollbackTran(); + LogHelper.Info($"鎻掑叆浣嶇疆{locCntrCg.LocCode}澶辫触"); + return "鎻掑叆澶辫触"; + } + + loc = newLoc; + } + + //if (loc.N_CURRENT_NUM == 0) { + // loc.N_CURRENT_NUM = 1; + // if (db.Updateable<TN_Location>(loc).UpdateColumns( + // it => new { it.N_CURRENT_NUM, it.T_MODIFY }).ExecuteCommand() <= 0) { + // tran.RollbackTran(); + // LogHelper.Info($"淇敼浣嶇疆{locCntrCg.LocCode}澶辫触"); + // continue; + // } + //} + + if (string.IsNullOrEmpty(locCntrCg.CntrCode)) { + LogHelper.Info("瀹瑰櫒鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); + continue; + } + + var locCntrRel = db.Queryable<TN_Loc_Container>().First(a => a.S_LOC_CODE == locCntrCg.LocCode + && a.S_CNTR_CODE == locCntrCg.CntrCode); + + if (locCntrRel == null) { + var newLocCntrRel = new TN_Loc_Container { + S_LOC_CODE = locCntrCg.LocCode, + S_CNTR_CODE = locCntrCg.CntrCode, + S_CNTR_TYPE = locCntrCg.CntrType ?? "" + }; + + loc.N_CURRENT_NUM = 1; + + if (db.Insertable<TN_Loc_Container>(newLocCntrRel).ExecuteCommand() <= 0 + && db.Updateable<TN_Location>(loc).UpdateColumns(c => c.N_CURRENT_NUM).ExecuteCommand() <= 0) { + tran.RollbackTran(); + LogHelper.Info($"鎻掑叆浣嶇疆鎵樼洏鍏崇郴{locCntrCg.LocCode}-{locCntrCg.CntrCode}澶辫触"); + return "鎻掑叆澶辫触"; + } + } + + if (string.IsNullOrEmpty(locCntrCg.CgId)) { + LogHelper.Info("鐗╂枡鍙蜂负绌猴紝涓嶅啀璇诲彇鍚庨潰鐨勬暟鎹�); + continue; + } + + var cgDetail = db.Queryable<TN_CG_Detail>().First(a => a.S_CNTR_CODE == locCntrCg.CntrCode + && a.S_CG_ID == locCntrCg.CgId); + if (cgDetail == null) { + var locList = new List<TN_CG_Detail>(); + locList.Add(new TN_CG_Detail { S_CNTR_CODE = locCntrCg.CntrCode, S_CG_ID = locCntrCg.CgId, S_BATCH_NO = locCntrCg.BatchNo ?? "" }); + if (db.Insertable<TN_CG_Detail>(locList).ExecuteCommand() <= 0) { + tran.RollbackTran(); + LogHelper.Info($"鎻掑叆鎵樼洏鐗╂枡鍏崇郴{locCntrCg.CntrCode}-{locCntrCg}澶辫触"); + return "鎻掑叆澶辫触"; + } + } + } + tran.CommitTran(); + } + + return "鎻掑叆鏁版嵁鎴愬姛"; + + } + catch (FileNotFoundException) { + return $"Error: File not found - {filePath}"; + } + catch (Exception ex) { + return $"Error reading CSV file: {ex.Message}"; + } + } + + /// <summary> + /// + /// </summary> + /// <returns></returns> + //public string InsertOutboundOrder() { + // string filePath = PathHelper.GetProjDir("./debug/outbound_order.csv"); + // var db = DbHelper.GetDbClient(); + + // try { + // var configuration = new CsvConfiguration(CultureInfo.InvariantCulture) { + // // 閰嶇疆閫夐」 + // Delimiter = ",", // 鍒嗛殧绗�+ // HasHeaderRecord = true, // 鏈夋爣棰樿 + // MissingFieldFound = null, // 蹇界暐缂哄け瀛楁 + // HeaderValidated = null, // 璺宠繃鏍囬楠岃瘉 + // BadDataFound = context => { } // 澶勭悊閿欒鏁版嵁 + // }; + + // var locCntrCgList = new List<DebugModel.OutboundOrder>(); + + // using (var reader = new StreamReader(filePath)) + // using (var csv = new CsvReader(reader, configuration)) { + // // 璇诲彇璁板綍 + // locCntrCgList = csv.GetRecords<DebugModel.OutboundOrder>().ToList(); + // } + + // using (var tran = db.Ado.UseTran()) { + + // } + + // } + // catch (Exception) { + + // throw; + // } + //} + } +} diff --git a/Services/MoboxService.cs b/Services/MoboxService.cs new file mode 100644 index 0000000..0fe26c0 --- /dev/null +++ b/Services/MoboxService.cs @@ -0,0 +1,492 @@ +锘縰sing System; + +using HH.WCS.Mobox3.DSZSH.Consts; +using HH.WCS.Mobox3.DSZSH.Helpers; +using HH.WCS.Mobox3.DSZSH.Helpers.Model; +using HH.WCS.Mobox3.DSZSH.Models; + +using Newtonsoft.Json; + +using static HH.WCS.Mobox3.DSZSH.Dtos.Request.MoboxRequest; +using static HH.WCS.Mobox3.DSZSH.Dtos.Response.MoboxResponse; +using static HH.WCS.Mobox3.DSZSH.Helpers.ResultHelper; + +namespace HH.WCS.Mobox3.DSZSH.Services { + public class MoboxService { + + #region 妯℃澘鍔熻兘 + public static SimpleResult BaseBound(StartCntEndInfo model) { + var taskName = ""; // 鐢ㄤ簬鐢熸垚浠诲姟绫诲瀷銆佹墦鍗版棩蹇椾俊鎭�+ var db = DbHelper.GetDbClient(); + + try { + var startLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.StartLoc)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"璧风偣浣嶇疆 '{model.StartLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囧彇璐ц姹�); + } + + var locCntrRel = db.Queryable<TN_Loc_Container>() + .Where(ExprHelper.LocCntrIsBind(startLoc.S_CODE, model.CntId)).First(); + + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{startLoc.S_CODE}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}'"); + } + + var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.EndLoc)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, $"缁堢偣浣嶇疆 '{model.EndLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囨斁璐ц姹�); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + #endregion + + #region PDA 鍔熻兘 + /// <summary> + /// 濂借繍绠�婊℃墭涓嬬嚎鍏ュ簱(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult GoodpackOffline(GoodpackOfflineInfo model) { + var taskName = TaskName.濂借繍绠盻婊$涓嬬嚎鍏ュ簱; // 鐢ㄤ簬鐢熸垚浠诲姟绫诲瀷銆佹墦鍗版棩蹇椾俊鎭�+ + var db = DbHelper.GetDbClient(); + + try { + // TODO 灏哖DA鎻愪緵鐨勭墿鏂欑紪鐮佷笌璐存爣鏈虹殑淇℃伅姣斿 + + var startLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.StartLoc)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"璧风偣浣嶇疆 '{model.StartLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囧彇璐ц姹�); + } + + // 鏌ョ湅瀹瑰櫒涓庤捣鐐硅揣浣嶆槸鍚︾粦瀹�+ var locCntrRel = db.Queryable<TN_Loc_Container>().First( + a => a.S_LOC_CODE == model.StartLoc + && a.S_CNTR_CODE == model.CntId); + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{model.StartLoc}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}' 锛屾棤鍙嚭搴撶殑鐗╂枡"); + } + + // TODO 婊$鍏ュ簱绠楁硶寰呬紭鍖�+ var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocBelongsToArea(AreaName.婊$瀛樻斁鍖�) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsFree) + .OrderBy(l => l.N_LAYER) + .OrderBy(l => l.S_AREA_CODE).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, "婊$鍏ュ簱鏆傛椂娌℃湁鍚堥�鐨勮揣浣嶅彲浠ュ叆搴�); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleResult(1, $"鍙戠敓浜嗗紓甯革細{ex.Message}"); + } + } + + /// <summary> + /// 绌烘墭鐩樼粦瀹�PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult EmptyBindPallet(EmptyBindInfo model) { + var db = DbHelper.GetDbClient(); + + try { + var loc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.LocCode)) + .Where(ExprHelper.LocBelongsToArea(AreaName.绌烘墭鐩樻帴椹冲尯)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty).First(); + + if (loc == null) { + return BuildSimpleResult(2, $"褰撳墠璐т綅 '{model.LocCode}' 鏃犳硶鍐嶇粦瀹氬鍣�); + } + + var locCntrRel = db.Queryable<TN_Loc_Container>() + .Where(lc => lc.S_CNTR_CODE == model.LocCode).First(); + + if (locCntrRel != null) { + return BuildSimpleResult(3, $"褰撳墠瀹瑰櫒 '{model.CntrCode}' 宸茬粡涓�'{locCntrRel.S_LOC_CODE}' 缁戝畾"); + } + + loc.N_CURRENT_NUM = model.PalletCount; + + locCntrRel = new TN_Loc_Container { + S_LOC_CODE = model.LocCode, + S_CNTR_CODE = model.CntrCode + }; + + using (var tran = db.Ado.UseTran()) { + if (db.Insertable<TN_Loc_Container>(locCntrRel).ExecuteCommand() > 0 + && db.Updateable<TN_Location>(loc).UpdateColumns(it => it.N_CURRENT_NUM).ExecuteCommand() > 0) { + tran.CommitTran(); + return BuildSimpleResult(0, $"缁戝畾瀹瑰櫒 '{model.CntrCode}' 涓庤揣浣�'{model.LocCode}' 鎴愬姛"); + } + else { + tran.RollbackTran(); + return BuildSimpleResult(4, $"缁戝畾瀹瑰櫒 '{model.CntrCode}' 涓庤揣浣�'{model.LocCode}' 澶辫触"); + } + } + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 绌虹缁戝畾(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult EmptyBindGoodpack(EmptyBindInfo model) { + var db = DbHelper.GetDbClient(); + + try { + var loc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.LocCode)) + .Where(ExprHelper.LocBelongsToArea(AreaName.绌虹鎺ラ┏鍖�) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty).First(); + + if (loc == null) { + return BuildSimpleResult(2, $"褰撳墠璐т綅 '{model.LocCode}' 鏃犳硶鍐嶇粦瀹氬鍣�); + } + + var locCntrRel = db.Queryable<TN_Loc_Container>() + .Where(lc => lc.S_CNTR_CODE == model.LocCode).First(); + + if (locCntrRel != null) { + return BuildSimpleResult(3, $"褰撳墠瀹瑰櫒 '{model.CntrCode}' 宸茬粡涓�'{locCntrRel.S_LOC_CODE}' 缁戝畾"); + } + + loc.N_CURRENT_NUM = 1; // 绌虹缁戝畾鏃跺鍣ㄦ暟蹇呯劧涓�1 + + locCntrRel = new TN_Loc_Container { + S_LOC_CODE = model.LocCode, + S_CNTR_CODE = model.CntrCode + }; + + using (var tran = db.Ado.UseTran()) { + if (db.Insertable<TN_Loc_Container>(locCntrRel).ExecuteCommand() > 0 + && db.Updateable<TN_Location>(loc).UpdateColumns(it => it.N_CURRENT_NUM).ExecuteCommand() > 0) { + tran.CommitTran(); + return BuildSimpleResult(0, $"缁戝畾瀹瑰櫒 '{model.CntrCode}' 涓庤揣浣�'{model.LocCode}' 鎴愬姛"); + } + else { + tran.RollbackTran(); + return BuildSimpleResult(4, $"缁戝畾瀹瑰櫒 '{model.CntrCode}' 涓庤揣浣�'{model.LocCode}' 澶辫触"); + } + } + + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 鎵樼洏-绌烘墭鍏ュ簱(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult EmptyInboundPallet(EmptyInboundDetailInfo model) { + var taskName = TaskName.鎵樼洏_绌烘墭鍏ュ簱; + var db = DbHelper.GetDbClient(); + + try { + var startLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.StartLoc)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"璧风偣浣嶇疆 '{model.StartLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囧彇璐ц姹�); + } + + // 鏌ョ湅瀹瑰櫒涓庤捣鐐硅揣浣嶆槸鍚︾粦瀹�+ var locCntrRel = db.Queryable<TN_Loc_Container>().First( + a => a.S_LOC_CODE == model.StartLoc + && a.S_CNTR_CODE == model.CntId); + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{model.StartLoc}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}'"); + } + + // TODO 鏆傚畾閫夋嫨鏈�綆灞傛寜鍖轰綅椤哄簭鍏ュ簱锛屽悗闈㈠緟淇敼 + var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocBelongsToArea(AreaName.绌烘墭瀛樻斁鍖�) + .OrderBy(l => l.N_LAYER) + .OrderBy(l => l.S_AREA_CODE).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, $"鏆傛椂娌℃湁绗﹀悎鏉′欢鐨勭粓鐐规斁璐т綅"); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 濂借繍绠�绌虹鍏ュ簱(PDA) + /// </summary> + /// <returns></returns> + public static SimpleResult EmptyInboundGoodpack(EmptyInboundDetailInfo model) { + var taskName = TaskName.濂借繍绠盻绌虹鍏ュ簱; + var db = DbHelper.GetDbClient(); + + try { + var startLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.StartLoc)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"璧风偣浣嶇疆 '{model.StartLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囧彇璐ц姹�); + } + + // 鏌ョ湅瀹瑰櫒涓庤捣鐐硅揣浣嶆槸鍚︾粦瀹�+ var locCntrRel = db.Queryable<TN_Loc_Container>().First( + a => a.S_LOC_CODE == model.StartLoc + && a.S_CNTR_CODE == model.CntId); + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{model.StartLoc}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}'"); + } + + // TODO 鏆傚畾閫夋嫨鏈�綆灞傛寜鍖轰綅椤哄簭鍏ュ簱锛屽悗闈㈠緟淇敼 + var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocBelongsToArea(AreaName.绌虹瀛樻斁鍖�) + .OrderBy(l => l.N_LAYER) + .OrderBy(l => l.S_AREA_CODE).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, $"鏆傛椂娌℃湁绗﹀悎鏉′欢鐨勭粓鐐规斁璐т綅"); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 鎵樼洏-绌烘墭涓婄嚎(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult EmptyOnlinePallet(EmptyOnlinePalletInfo model) { + var taskName = TaskName.鎵樼洏_绌烘墭涓婄嚎; + var db = DbHelper.GetDbClient(); + var taskInfo = AppStart.Settings.TaskMap[taskName]; + + try { + // TODO 绗﹀悎鐗╂枡淇℃伅鐨勮揣浣�+ var startLoc = db.Queryable<TN_Location>() + .Where(l => taskInfo.StartAreas.Contains(l.S_AREA_CODE)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"娌℃湁鍚堥�鐨勮捣鐐逛綅缃�); + } + + var locCntrRel = db.Queryable<TN_Loc_Container>().First( + a => a.S_LOC_CODE == startLoc.S_CODE + && a.S_CNTR_CODE == model.CntId); + + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{startLoc.S_CODE}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}'"); + } + + var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.EndLoc)) + .Where(l => taskInfo.EndAreas.Contains(l.S_AREA_CODE)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, $"缁堢偣浣嶇疆 '{model.EndLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囨斁璐ц姹�); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 濂借繍绠�绌虹涓婄嚎(PDA) + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult EmptyOnlineGoodpack(EmptyOnlineGoodpackInfo model) { + var taskName = TaskName.濂借繍绠盻绌虹涓婄嚎; + var db = DbHelper.GetDbClient(); + var taskInfo = AppStart.Settings.TaskMap[taskName]; + + try { + // TODO 绗﹀悎鐗╂枡淇℃伅鐨勮揣浣�+ var startLoc = db.Queryable<TN_Location>() + .Where(l => taskInfo.StartAreas.Contains(l.S_AREA_CODE)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty.Negate()).First(); + + if (startLoc == null) { + return BuildSimpleResult(2, $"娌℃湁鍚堥�鐨勮捣鐐逛綅缃�); + } + + var locCntrRel = db.Queryable<TN_Loc_Container>().First( + a => a.S_LOC_CODE == startLoc.S_CODE + && a.S_CNTR_CODE == model.CntId); + + if (locCntrRel == null) { + return BuildSimpleResult(3, $"璧风偣浣嶇疆 '{startLoc.S_CODE}' 娌℃湁缁戝畾瀹瑰櫒 '{model.CntId}'"); + } + + var endLoc = db.Queryable<TN_Location>() + .Where(ExprHelper.LocCode(model.EndLoc)) + .Where(l => taskInfo.EndAreas.Contains(l.S_AREA_CODE)) + .Where(ExprHelper.LocIsFree) + .Where(ExprHelper.LocIsEmpty).First(); + + if (endLoc == null) { + return BuildSimpleResult(4, $"缁堢偣浣嶇疆 '{model.EndLoc}' 涓嶅瓨鍦ㄦ垨涓嶅叿澶囨斁璐ц姹�); + } + + return TaskHelper.SimpleCreateTask(startLoc.S_CODE, locCntrRel.S_CNTR_CODE, endLoc.S_CODE, taskName); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + #endregion + + #region Mobox 鍔熻兘 + /// <summary> + /// 鎴愬搧鑳跺嚭搴�WMS) + /// </summary> + /// <remarks> + /// WMS鎻愪緵鍑哄簱鐨勭墿鏂欑被鍨嬩笌鏁伴噺锛岃皟鐢ㄦ帴鍙g敱WCS鐢熸垚鍏蜂綋鐨勫嚭搴撲换鍔★紝鐒跺悗WCS鍚庡彴杞澶勭悊 + /// </remarks> + /// <param name="model"></param> + /// <returns></returns> + public static SimpleResult FinishedOutbound(FinishedOutboundInfo model) { + var db = DbHelper.GetDbClient(); + + try { + if (string.IsNullOrEmpty(model.No)) { + return BuildSimpleResult(2, "鍑哄簱鍗曞彿涓嶈兘涓虹┖"); + } + + if (model.OutboundDetails.Count == 0) { + return BuildSimpleResult(2, "鍑哄簱鍗曟槑缁嗘病鏈夐」鐩�); + } + + using (var tran = db.Ado.UseTran()) { + var order = new TN_Outbound_Order { + S_NO = model.No, + N_FORCE = model.Forced ? 1 : 0 + }; + + if (db.Insertable<TN_Outbound_Order>(order).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return BuildSimpleResult(3, "鐢熸垚鍑哄簱鍗曞け璐ワ細" + JsonConvert.SerializeObject(order)); + } + + foreach (var detail in model.OutboundDetails) { + var newDetail = new TN_Outbound_Detail { + S_NO = order.S_NO, + S_CG_ID = detail.CgCode, + S_BATCH_NO = detail.PatchNo, + N_QTY = detail.Qty, + N_FORCE = order.N_FORCE, + S_END_AREA = detail.EndArea + }; + if (db.Insertable<TN_Outbound_Detail>(newDetail).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return BuildSimpleResult(4, "鐢熸垚鍑哄簱鍗曟槑缁嗗け璐ワ細" + JsonConvert.SerializeObject(detail)); + } + } + + tran.CommitTran(); + } + + return BuildSimpleResult(0, "鐢熸垚鍑哄簱鍗曟垚鍔�); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + /// <summary> + /// 鎴愬搧鑳跺己鍒跺嚭搴�WMS) + /// </summary> + /// <returns></returns> + public static SimpleResult FinishedOutboundForce(FinishedOutboundInfo model) { + var db = DbHelper.GetDbClient(); + + try { + if (string.IsNullOrEmpty(model.No)) { + return BuildSimpleResult(2, "鍑哄簱鍗曞彿涓嶈兘涓虹┖"); + } + + using (var tran = db.Ado.UseTran()) { + var order = new TN_Outbound_Order { + S_NO = model.No, + N_FORCE = model.Forced ? 1 : 0 + }; + + if (db.Insertable<TN_Outbound_Order>(order).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return BuildSimpleResult(3, "鐢熸垚鍑哄簱鍗曞け璐ワ細" + JsonConvert.SerializeObject(order)); + } + + foreach (var detail in model.OutboundDetails) { + var newDetail = new TN_Outbound_Detail { + S_NO = order.S_NO, + S_CG_ID = detail.CgCode, + S_BATCH_NO = detail.PatchNo, + N_QTY = detail.Qty, + N_FORCE = order.N_FORCE + }; + if (db.Insertable<TN_Inbound_Order>(order).ExecuteCommand() <= 0) { + tran.RollbackTran(); + return BuildSimpleResult(4, "鐢熸垚鍑哄簱鍗曟槑缁嗗け璐ワ細" + JsonConvert.SerializeObject(detail)); + } + } + } + + return BuildSimpleResult(0, "鐢熸垚鍑哄簱鍗曟垚鍔�); + } + catch (Exception ex) { + return BuildSimpleEx(ex); + } + } + + #endregion + + } +} diff --git a/config/config.json b/config/config.json new file mode 100644 index 0000000..43f0079 --- /dev/null +++ b/config/config.json @@ -0,0 +1,164 @@ +{ + "WebApiUrl": "http://127.0.0.1:8901/", + "NdcApiUrl": "http://127.0.0.1:5201/api/order/", + "SqlServer": "Data Source=(local);Initial Catalog=DSZSHTest;User ID=sa;Password=123456;", + "TcpServerIp": "127.0.0.1", + "TcpServerPort": 8085, + "Areas": [ + { + "Name": "鍖呰鍖�, + "Codes": [ "BZQ" ] + }, + { + "Name": "鎿嶄綔鍖�, + "Codes": [ "CZQ1", "CZQ2" ] + }, + { + "Name": "璐ф灦鍖�, + "Codes": [ "HJQ1", "HJQ2", "HJQ3", "HJQ4" ] + }, + { + "Name": "绌烘墭瀛樻斁鍖�, + "Codes": [ "KTCFQ" ] + }, + { + "Name": "绌虹瀛樻斁鍖�, + "Codes": [ "HJQ1" ] + }, + { + "Name": "婊℃墭瀛樻斁鍖�, + "Codes": [ "HJQ2" ] + }, + { + "Name": "婊$瀛樻斁鍖�, + "Codes": [ "HJQ3" ] + }, + { + "Name": "鎶芥鍖�, + "Codes": [ "CJQ1" ] + }, + { + "Name": "鎶芥寮傚父鍖�, + "Codes": [ "CJYCQ" ] + }, + { + "Name": "绌虹鎿嶄綔鍖�, + "Codes": [ "CZQ1" ] + }, + { + "Name": "婊$鎿嶄綔鍖�, + "Codes": [ "CZQ2" ] + }, + { + "Name": "绌烘墭鍏ュ簱鎺ラ┏鍖�, + "Codes": [ "KTRKJBQ" ] + }, + { + "Name": "绌虹鍏ュ簱鎺ラ┏鍖�, + "Codes": [ "KXRKJBQ1", "KXRKJBQ2" ] + }, + { + "Name": "姹借溅鍑哄簱澶囪揣鍖�, + "Codes": [ "QCCKBHQ" ] + }, + { + "Name": "鐏溅鍑哄簱澶囪揣鍖�, + "Codes": [ "HCCKBHQ" ] + } + ], + "Tasks": [ + { + "Name": "鎵樼洏-婊℃墭涓嬬嚎鍏ュ簱", + "StartAreas": [ "BZQ" ], + "EndAreas": [ "HJQ2" ] + }, + { + "Name": "濂借繍绠�婊$涓嬬嚎鍏ュ簱", + "StartAreas": [ "CZQ2" ], + "EndAreas": [ "HJQ3" ] + }, + { + "Name": "鎵樼洏-绌烘墭涓婄嚎", + "StartAreas": [ "KTCFQ" ], + "EndAreas": [ "BZQ" ] + }, + { + "Name": "濂借繍绠�绌虹涓婄嚎", + "StartAreas": [ "HJQ1" ], + "EndAreas": [ "CZQ1" ] + }, + { + "Name": "鎵樼洏-绌烘墭鍏ュ簱", + "StartAreas": [ "KTRKJBQ" ], + "EndAreas": [ "KTCFQ" ] + }, + { + "Name": "濂借繍绠�绌虹鍏ュ簱", + "StartAreas": [ "KXRKJBQ1" ], + "EndAreas": [ "HJQ1" ] + }, + { + "Name": "鎴愬搧鑳跺嚭搴� + }, + { + "Name": "鎵樼洏-绌烘墭缁戝畾" + }, + { + "Name": "濂借繍绠�绌虹缁戝畾" + } + ], + "ProductionLines": [ + { + "Id": "1", + "Name": "鎵樼洏浜х嚎1", + "PlcIp": "127.0.0.1", + "PlcPort": 502, + "SlaveId": 1, + "OnLoc": [ + "CX11" + ], + "OffLoc": [ + "CX12" + ] + }, + { + "Id": "2", + "Name": "鎵樼洏浜х嚎2", + "PlcIp": "127.0.0.1", + "PlcPort": 502, + "SlaveId": 2, + "OnLoc": [ + "CX21" + ], + "OffLoc": [ + "CX22" + ] + }, + { + "Id": "3", + "Name": "濂借繍绠变骇绾�", + "PlcIp": "127.0.0.1", + "PlcPort": 502, + "SlaveId": 3, + "OnLoc": [ + "CX31" + ], + "OffLoc": [ + "CX32" + ] + }, + { + "Id": "4", + "Name": "濂借繍绠变骇绾�", + "PlcIp": "127.0.0.1", + "PlcPort": 502, + "SlaveId": 4, + "OnLoc": [ + "CX41" + ], + "OffLoc": [ + "CX42" + ] + } + ] +} \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..a963eb7 --- /dev/null +++ b/packages.config @@ -0,0 +1,55 @@ +锘�?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net462" /> + <package id="CsvHelper" version="33.0.1" targetFramework="net462" /> + <package id="EasyModbusTCP" version="5.6.0" targetFramework="net461" /> + <package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" /> + <package id="Microsoft.AspNet.WebApi.Core" version="5.3.0" targetFramework="net462" /> + <package id="Microsoft.AspNet.WebApi.Owin" version="5.3.0" targetFramework="net462" /> + <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.3.0" targetFramework="net462" /> + <package id="Microsoft.AspNet.WebApi.WebHost" version="5.3.0" targetFramework="net462" /> + <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" /> + <package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net462" /> + <package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" /> + <package id="Microsoft.Extensions.Logging.Abstractions" version="3.1.32" targetFramework="net462" /> + <package id="Microsoft.Owin" version="4.2.2" targetFramework="net461" /> + <package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net461" /> + <package id="Microsoft.Owin.Hosting" version="4.2.2" targetFramework="net461" /> + <package id="Microsoft.Web.Infrastructure" version="2.0.0" targetFramework="net462" /> + <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" /> + <package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net462" /> + <package id="NLog" version="5.3.4" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Client" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Configuration" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Core" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Security.Certificates" version="1.5.374.126" targetFramework="net462" /> + <package id="OPCFoundation.NetStandard.Opc.Ua.Server" version="1.5.374.126" targetFramework="net462" /> + <package id="Owin" version="1.0" targetFramework="net461" /> + <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net462" /> + <package id="S7netplus" version="0.20.0" targetFramework="net461" requireReinstallation="true" /> + <package id="SqlSugar" version="5.1.4.169" targetFramework="net462" /> + <package id="Swashbuckle" version="5.6.0" targetFramework="net461" /> + <package id="Swashbuckle.Core" version="5.6.0" targetFramework="net461" /> + <package id="System.Buffers" version="4.5.1" targetFramework="net461" /> + <package id="System.Diagnostics.DiagnosticSource" version="6.0.1" targetFramework="net462" /> + <package id="System.Formats.Asn1" version="8.0.1" targetFramework="net462" /> + <package id="System.Memory" version="4.5.5" targetFramework="net461" /> + <package id="System.Net.Http" version="4.3.4" targetFramework="net462" /> + <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" /> + <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" /> + <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net452" /> + <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net462" /> + <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net462" /> + <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net462" /> + <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net462" /> + <package id="System.ServiceModel.Primitives" version="4.10.0" targetFramework="net462" /> + <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net48" /> + <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" /> + <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" requireReinstallation="true" /> + <package id="Topshelf" version="4.3.0" targetFramework="net452" /> + <package id="Topshelf.NLog" version="4.3.0" targetFramework="net452" /> + <package id="WebActivatorEx" version="2.2.0" targetFramework="net462" /> +</packages> \ No newline at end of file diff --git a/swagger.js b/swagger.js new file mode 100644 index 0000000..aed0f8c --- /dev/null +++ b/swagger.js @@ -0,0 +1,110 @@ +'use strict'; +window.SwaggerTranslator = { + _words: [], + + translate: function () + { + var $this = this; + $('[data-sw-translate]').each(function () + { + $(this).html($this._tryTranslate($(this).html())); + $(this).val($this._tryTranslate($(this).val())); + $(this).attr('title', $this._tryTranslate($(this).attr('title'))); + }); + }, + + setControllerSummary: function () + { + $.ajax({ + type: "get", + async: true, + url: $("#input_baseUrl").val(), + dataType: "json", + success: function (data) + { + var summaryDict = data.ControllerDesc; + var id, controllerName, strSummary; + $("#resources_container .resource").each(function (i, item) + { + id = $(item).attr("id"); + if (id) + { + controllerName = id.substring(9); + strSummary = summaryDict[controllerName]; + if (strSummary) + { + $(item).children(".heading").children(".options").first().prepend('<li class="controller-summary" title="' + strSummary + '">' + strSummary + '</li>'); + } + } + }); + } + }); + }, + _tryTranslate: function (word) + { + return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; + }, + + learn: function (wordsMap) + { + this._words = wordsMap; + } +}; + + +/* jshint quotmark: float */ +window.SwaggerTranslator.learn({ + "Warning: Deprecated": "警告:已过时", + "Implementation Notes": "实现备注", + "Response Class": "响应类", + "Status": "状态", + "Parameters": "参数", + "Parameter": "参数", + "Value": "值", + "Description": "描述", + "Parameter Type": "参数类型", + "Data Type": "数据类型", + "Response Messages": "响应消息", + "HTTP Status Code": "HTTP 状态码", + "Reason": "原因", + "Response Model": "响应模型", + "Request URL": "请求 URL", + "Response Body": "响应体", + "Response Code": "响应码", + "Response Headers": "响应头", + "Hide Response": "隐藏响应", + "Headers": "头", + "Try it out!": "试一下!", + "Show/Hide": "显示/隐藏", + "List Operations": "显示操作", + "Expand Operations": "展开操作", + "Raw": "原始", + "can't parse JSON. Raw result": "无法解析 JSON。原始结果", + "Model Schema": "模型架构", + "Model": "模型", + "apply": "应用", + "Username": "用户名", + "Password": "密码", + "Terms of service": "服务条款", + "Created by": "创建者", + "See more at": "查看更多:", + "Contact the developer": "联系开发者", + "api version": "api 版本", + "Response Content Type": "响应 Content Type", + "fetching resource": "正在获取资源", + "fetching resource list": "正在获取资源列表", + "Explore": "浏览", + "Show Swagger Petstore Example Apis": "显示 Swagger Petstore 示例 Apis", + "Can't read from server. It may not have the appropriate access-control-origin settings.": "无法从服务器读取。可能没有正确设置 access-control-origin。", + "Please specify the protocol for": "请指定协议:", + "Can't read swagger JSON from": "无法读取 swagger JSON于", + "Finished Loading Resource Information. Rendering Swagger UI": "已加载资源信息。正在渲染 Swagger UI", + "Unable to read api": "无法读取 api", + "from path": "从路径", + "server returned": "服务器返回" +}); +$(function () +{ + window.SwaggerTranslator.translate(); + window.SwaggerTranslator.setControllerSummary(); +}); \ No newline at end of file -- Gitblit v1.9.1