Commit de8826297410f361f2d0e66e6ae4523739d76e24

Authored by toan
1 parent 867826ac50
Exists in master

RM2077: Edit source

Showing 11 changed files with 138 additions and 30 deletions Side-by-side Diff

sources/RoboforkApp.AWS/App.config
... ... @@ -3,6 +3,8 @@
3 3 <appSettings>
4 4 <add key="AWSProfileName" value="Development"/>
5 5 <add key="AWSRegion" value="ap-northeast-1" />
  6 + <add key="AWSAccessKey" value="AKIAI3CHRBBEA5I4WOMA"/>
  7 + <add key="AWSSecretKey" value="9udi7P4qPx06sKDvT35w700iKq7gHjGjV09cFo5A"/>
6 8 </appSettings>
7 9 <startup>
8 10 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
sources/RoboforkApp.AWS/DynamoDb/DynamoService.cs
... ... @@ -2,17 +2,21 @@
2 2 using Amazon.DynamoDBv2;
3 3 using Amazon.DynamoDBv2.DataModel;
4 4 using RoboforkApp.AWS.Contracts;
  5 +using Amazon;
5 6  
6 7 namespace RoboforkApp.AWS.DynamoDb
7 8 {
8 9 public class DynamoService : ITableDataService
9 10 {
  11 + const string AWS_ACCESS_KEY = "AKIAI3CHRBBEA5I4WOMA";
  12 + const string AWS_SECRET_KEY = "9udi7P4qPx06sKDvT35w700iKq7gHjGjV09cFo5A";
  13 +
10 14 public readonly DynamoDBContext DbContext;
11 15 public AmazonDynamoDBClient DynamoClient;
12 16  
13 17 public DynamoService()
14 18 {
15   - DynamoClient = new AmazonDynamoDBClient();
  19 + DynamoClient = new AmazonDynamoDBClient(AWS_ACCESS_KEY, AWS_SECRET_KEY, RegionEndpoint.APNortheast1);
16 20  
17 21 DbContext = new DynamoDBContext(DynamoClient, new DynamoDBContextConfig
18 22 {
sources/RoboforkApp.sln
... ... @@ -5,6 +5,8 @@
5 5 MinimumVisualStudioVersion = 10.0.40219.1
6 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoboforkApp", "RoboforkApp\RoboforkApp.csproj", "{4946722F-CFFF-4FC6-B1C1-A6107316A58C}"
7 7 EndProject
  8 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoboforkApp.AWS", "RoboforkApp.AWS\RoboforkApp.AWS.csproj", "{A4DB3A6A-7959-4517-844B-4D00AE09436C}"
  9 +EndProject
8 10 Global
9 11 GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 12 Debug|Any CPU = Debug|Any CPU
... ... @@ -15,6 +17,10 @@
15 17 {4946722F-CFFF-4FC6-B1C1-A6107316A58C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 18 {4946722F-CFFF-4FC6-B1C1-A6107316A58C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 19 {4946722F-CFFF-4FC6-B1C1-A6107316A58C}.Release|Any CPU.Build.0 = Release|Any CPU
  20 + {A4DB3A6A-7959-4517-844B-4D00AE09436C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
  21 + {A4DB3A6A-7959-4517-844B-4D00AE09436C}.Debug|Any CPU.Build.0 = Debug|Any CPU
  22 + {A4DB3A6A-7959-4517-844B-4D00AE09436C}.Release|Any CPU.ActiveCfg = Release|Any CPU
  23 + {A4DB3A6A-7959-4517-844B-4D00AE09436C}.Release|Any CPU.Build.0 = Release|Any CPU
18 24 EndGlobalSection
19 25 GlobalSection(SolutionProperties) = preSolution
20 26 HideSolutionNode = FALSE
sources/RoboforkApp.v12.suo
No preview for this file type
sources/RoboforkApp/Controls/DesignerCanvas.cs
1 1 using RoboforkApp.DataModel;
  2 +using RoboforkApp.Entities;
  3 +using RoboforkApp.Services;
2 4 using System;
3 5 using System.Collections.Generic;
4 6 using System.Linq;
... ... @@ -3152,6 +3154,65 @@
3152 3154 }
3153 3155 #endregion
3154 3156  
  3157 + #region Get data from AWS
  3158 + // Get info fork
  3159 + public void GetInfoFork()
  3160 + {
  3161 + var service = new Fork2PCTableService();
  3162 + /*Read*/
  3163 + IEnumerable<Fork2PC> fork2PCs = service.GetAllFork2PCs().Where(x => x.ForkID == 1);
  3164 + if (fork2PCs.Count() == 0)
  3165 + return;
  3166 + var fork2PC = fork2PCs.ElementAt(0);
  3167 +
  3168 + //Clear Route Info Table
  3169 + ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear();
  3170 +
  3171 + int _RowIdx = 0;
  3172 + AddLabeltoGrid(_RowIdx, 0, "ID");
  3173 + AddLabeltoGrid(_RowIdx, 1, fork2PC.ForkID.ToString());
  3174 + _RowIdx++;
  3175 + AddLabeltoGrid(_RowIdx, 0, "LAT");
  3176 + AddLabeltoGrid(_RowIdx, 1, fork2PC.ForkPos_x.ToString());
  3177 + _RowIdx++;
  3178 + AddLabeltoGrid(_RowIdx, 0, "LOC");
  3179 + AddLabeltoGrid(_RowIdx, 1, fork2PC.ForkPos_y.ToString());
  3180 + _RowIdx++;
  3181 + AddLabeltoGrid(_RowIdx, 0, "SPD");
  3182 + AddLabeltoGrid(_RowIdx, 1, fork2PC.spd_veh.ToString() + "Km/h");
  3183 + _RowIdx++;
  3184 + AddLabeltoGrid(_RowIdx, 0, "GPS");
  3185 + AddLabeltoGrid(_RowIdx, 1, fork2PC.GPS_data);
  3186 + }
  3187 +
  3188 + /// <summary>
  3189 + /// Get infor node
  3190 + /// </summary>
  3191 + public void GetInfoNode()
  3192 + {
  3193 + var service = new Robofork15DemoService();
  3194 + /*Read*/
  3195 + IEnumerable<Robofork15Demo> fork2PCs = service.GetAllRobofork15Demos().Where(x => x.ForkNo == 1).OrderBy(x => x.NodeID);
  3196 +
  3197 + //Clear Route Info Table
  3198 + ((RoboforkMenu)System.Windows.Application.Current.MainWindow).grdRouteInfo.Children.Clear();
  3199 +
  3200 + int _RowIdx = 0;
  3201 + foreach (var fork2PC in fork2PCs)
  3202 + {
  3203 + //Column 1 : node index
  3204 + AddLabeltoGrid(_RowIdx, 0, fork2PC.NodeID.ToString());
  3205 +
  3206 + //Column 2 : Pos_X, Pos_Y, Speed
  3207 + AddLabeltoGrid(_RowIdx, 1, "LAT: " + fork2PC.NodePos_x.ToString());
  3208 + _RowIdx++;
  3209 + AddLabeltoGrid(_RowIdx, 1, "LOC: " + fork2PC.NodePos_y.ToString());
  3210 + _RowIdx++;
  3211 + AddLabeltoGrid(_RowIdx, 1, "SPD: " + fork2PC.NodeVehSpd.ToString() + "Km/h" );
  3212 + _RowIdx++;
  3213 + }
  3214 + }
  3215 + #endregion
3155 3216 }
3156 3217 }
sources/RoboforkApp/Entities/Robofork15Demo.cs
... ... @@ -7,11 +7,11 @@
7 7 public class Robofork15Demo
8 8 {
9 9 // フォークリフト毎の ID(No.)今回は"1"固定
10   - [DynamoDBHashKey]
11   - public int ForkID { get; set; }
  10 + public int ForkNo { get; set; }
12 11 // ラストノードフラグ 最後のノードでは”1”
13 12 public byte LastNodeFlag { get; set; }
14 13 // スタート位置からのノードの ID
  14 + [DynamoDBHashKey]
15 15 public int NodeID { get; set; }
16 16 // ノードの目標リフト高さ ※10 進数 LSB 0.001 m
17 17 public double NodeLftHeight { get; set; }
sources/RoboforkApp/RoboforkApp.csproj
... ... @@ -63,6 +63,10 @@
63 63 <StartupObject>RoboforkApp.App</StartupObject>
64 64 </PropertyGroup>
65 65 <ItemGroup>
  66 + <Reference Include="AWSSDK, Version=2.3.55.2, Culture=neutral, PublicKeyToken=9f476d3089b52be3, processorArchitecture=MSIL">
  67 + <SpecificVersion>False</SpecificVersion>
  68 + <HintPath>C:\Program Files (x86)\AWS SDK for .NET\past-releases\Version-2\Net45\AWSSDK.dll</HintPath>
  69 + </Reference>
66 70 <Reference Include="System" />
67 71 <Reference Include="System.Core">
68 72 <RequiredTargetFramework>3.5</RequiredTargetFramework>
... ... @@ -114,6 +118,10 @@
114 118 <Compile Include="DataModel\Node_tmp.cs" />
115 119 <Compile Include="DataModel\VehicleModel.cs" />
116 120 <Compile Include="DataModel\VehicleModelList.cs" />
  121 + <Compile Include="Entities\Fork2PC.cs" />
  122 + <Compile Include="Entities\Robofork15Demo.cs" />
  123 + <Compile Include="Services\Fork2PCTableService.cs" />
  124 + <Compile Include="Services\Robofork15DemoService.cs" />
117 125 <Compile Include="UserControls\simulationRobo.xaml.cs">
118 126 <DependentUpon>simulationRobo.xaml</DependentUpon>
119 127 </Compile>
... ... @@ -341,6 +349,12 @@
341 349 <Folder Include="bin\Debug\" />
342 350 <Folder Include="bin\Release\" />
343 351 <Folder Include="Style\" />
  352 + </ItemGroup>
  353 + <ItemGroup>
  354 + <ProjectReference Include="..\RoboforkApp.AWS\RoboforkApp.AWS.csproj">
  355 + <Project>{a4db3a6a-7959-4517-844b-4d00ae09436c}</Project>
  356 + <Name>RoboforkApp.AWS</Name>
  357 + </ProjectReference>
344 358 </ItemGroup>
345 359 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
346 360 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
sources/RoboforkApp/RoboforkApp.csproj.user
... ... @@ -9,7 +9,7 @@
9 9 <ErrorReportUrlHistory />
10 10 <FallbackCulture>en-US</FallbackCulture>
11 11 <VerifyUploadedFiles>false</VerifyUploadedFiles>
12   - <ProjectView>ShowAllFiles</ProjectView>
  12 + <ProjectView>ProjectFiles</ProjectView>
13 13 </PropertyGroup>
14 14 </Project>
sources/RoboforkApp/RoboforkMenuView.xaml
... ... @@ -53,6 +53,11 @@
53 53 </TreeViewItem>
54 54 </TreeViewItem>
55 55  
  56 + <TreeViewItem Name="LoadDB" Header="Load DB" FontSize="17">
  57 + <TreeViewItem Name="FORK_FK15" Header="FORK_FK15" FontSize="17" Selected="btnMenu_Selected" Tag="InfoFork" ></TreeViewItem>
  58 + <TreeViewItem Name="NODE_FK15" Header="NODE_FK15" FontSize="17" Selected="btnMenu_Selected" Tag="InfoNode"></TreeViewItem>
  59 + </TreeViewItem>
  60 +
56 61 <TreeViewItem Name="Vehicle" Header="Vehicle" FontSize="17">
57 62 <TreeViewItem Name="FK_15" Header="FK15_#1" FontSize="17" Selected="btnVehicleItem_Selected" Tag="VehicleItem" ></TreeViewItem>
58 63 <TreeViewItem Name="VehicleAdd" Header="[+]" FontSize="17" Selected="btnVehicleItem_Selected" Tag="VehicleAddTree"></TreeViewItem>
sources/RoboforkApp/RoboforkMenuView.xaml.cs
... ... @@ -92,6 +92,13 @@
92 92 case "TaskpattermTree":
93 93 DoBeginTask();
94 94 break;
  95 + case "InfoFork":
  96 + LoadInfoFork();
  97 + break;
  98 + case "InfoNode":
  99 + LoadInfoNode();
  100 + break;
  101 +
95 102 default:
96 103 break;
97 104 }
98 105  
... ... @@ -108,7 +115,16 @@
108 115 MyDesignerCanvas.Init();
109 116 MyDesignerCanvas.Operation = DesignerCanvas.OperationState.NewDrawSetFreeNode;
110 117 MyDesignerCanvas.scheduleCanvas = MyScheduleCanvas;
  118 + }
111 119  
  120 + private void LoadInfoFork()
  121 + {
  122 + MyDesignerCanvas.GetInfoFork();
  123 + }
  124 +
  125 + private void LoadInfoNode()
  126 + {
  127 + MyDesignerCanvas.GetInfoNode();
112 128 }
113 129  
114 130 private void btnMenu_UnselectedSet(object sender, RoutedEventArgs e)
sources/RoboforkApp/bin/Release/RboforkApp.vshost.exe
No preview for this file type