diff --git a/BPASmartClient.AgvApi/Controllers/robotjobController.cs b/BPASmartClient.AgvApi/Controllers/robotjobController.cs index eb93958d..686278d0 100644 --- a/BPASmartClient.AgvApi/Controllers/robotjobController.cs +++ b/BPASmartClient.AgvApi/Controllers/robotjobController.cs @@ -15,13 +15,26 @@ namespace BPASmartClient.AgvApi.Controllers /// /// [HttpPost("report")] - public string report(AGVToUpSystem ent) + public string report(string ent) { if (ent != null) { - Factory.GetInstance.SendReport(ent); + try + { + var res = JsonConvert.DeserializeObject(ent); + if (res != null) + { + Factory.GetInstance.SendReport(res); + return "SUCCESS"; + } + } + catch (Exception ex) + { + return ex.ToString(); + } + } - return "SUCCESS"; + return "Error"; } /// @@ -30,13 +43,27 @@ namespace BPASmartClient.AgvApi.Controllers /// /// [HttpPost("upstreamrequest")] - public string upstreamrequest(Upstreamrequest upstreamrequest) + public string upstreamrequest(string upstreamrequest) { if (upstreamrequest != null) { - Factory.GetInstance.SendUpstreamrequest(upstreamrequest); + try + { + var res = JsonConvert.DeserializeObject(upstreamrequest); + if (res != null) + { + Factory.GetInstance.SendUpstreamrequest(upstreamrequest); + return "SUCCESS"; + } + } + catch (Exception ex) + { + return ex.ToString(); + } + } - return "SUCCESS"; + return "Error"; } + } } diff --git a/BPASmartClient.AgvApi/Program.cs b/BPASmartClient.AgvApi/Program.cs index 14bbd05e..353c3635 100644 --- a/BPASmartClient.AgvApi/Program.cs +++ b/BPASmartClient.AgvApi/Program.cs @@ -1,6 +1,8 @@ using BPASmartClient.AgvApi; using Microsoft.AspNetCore.Cors.Infrastructure; + + var builder = WebApplication.CreateBuilder(args); // Add services to the container. diff --git a/BPASmartClient.HubHelper/HubHelper.cs b/BPASmartClient.HubHelper/HubHelper.cs index 4ac3c138..eac1b90b 100644 --- a/BPASmartClient.HubHelper/HubHelper.cs +++ b/BPASmartClient.HubHelper/HubHelper.cs @@ -15,9 +15,7 @@ namespace BPASmartClient.HubHelper public void Connect() { - hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl("http://localhost:5175/personhub").Build();//连接 - - + hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl("http://localhost:8089/personhub").Build();//连接 hubConnection.On("Report", (s) => { Report?.Invoke(s); diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs index e590be97..fef2370b 100644 --- a/DosingSystem/App.xaml.cs +++ b/DosingSystem/App.xaml.cs @@ -34,15 +34,6 @@ namespace BPASmartClient.DosingSystem else mv.Close(); - - - //MainWindow mw = new MainWindow(); - //LoginView lv = new LoginView(); - //var res = lv.ShowDialog(); - //if (res != null && res == true) - // mw.Show(); - //else - // mw.Close(); } protected override void OnExit(ExitEventArgs e) diff --git a/SmartClient.sln b/SmartClient.sln index 15e73270..053032be 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -112,7 +112,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FryPot_DosingSystem", "FryP EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ZhuoDian", "BPASmartClient.ZhuoDian\BPASmartClient.ZhuoDian.csproj", "{D3705A39-9875-4BB1-B592-C551A6DC6D87}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{67A46DBB-5984-4287-942F-5C392C0CBFAA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{67A46DBB-5984-4287-942F-5C392C0CBFAA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestDemo", "TestDemo\TestDemo.csproj", "{BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1068,6 +1070,26 @@ Global {67A46DBB-5984-4287-942F-5C392C0CBFAA}.Release|x64.Build.0 = Release|Any CPU {67A46DBB-5984-4287-942F-5C392C0CBFAA}.Release|x86.ActiveCfg = Release|Any CPU {67A46DBB-5984-4287-942F-5C392C0CBFAA}.Release|x86.Build.0 = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|ARM.ActiveCfg = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|ARM.Build.0 = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|ARM64.Build.0 = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|x64.ActiveCfg = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|x64.Build.0 = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|x86.ActiveCfg = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Debug|x86.Build.0 = Debug|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|Any CPU.Build.0 = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|ARM.ActiveCfg = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|ARM.Build.0 = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|ARM64.ActiveCfg = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|ARM64.Build.0 = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|x64.ActiveCfg = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|x64.Build.0 = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|x86.ActiveCfg = Release|Any CPU + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1120,6 +1142,7 @@ Global {6C0485D5-5840-405D-9A2E-292ADA2D3A8B} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} {D3705A39-9875-4BB1-B592-C551A6DC6D87} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} {67A46DBB-5984-4287-942F-5C392C0CBFAA} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625} + {BB0015E4-7F01-49BC-AC26-1F9FCCB24FE3} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} diff --git a/TestDemo/Form1.Designer.cs b/TestDemo/Form1.Designer.cs new file mode 100644 index 00000000..e9511821 --- /dev/null +++ b/TestDemo/Form1.Designer.cs @@ -0,0 +1,60 @@ +namespace TestDemo +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(97, 43); + this.button1.TabIndex = 0; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(641, 298); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + + #endregion + + private Button button1; + } +} \ No newline at end of file diff --git a/TestDemo/Form1.cs b/TestDemo/Form1.cs new file mode 100644 index 00000000..6a70c030 --- /dev/null +++ b/TestDemo/Form1.cs @@ -0,0 +1,23 @@ +using BPASmartClient.AGV.Feedback; +using BPASmartClient.Helper; +using BPASmartClient.Http; +using Newtonsoft.Json; + +namespace TestDemo +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + string url = "http://192.168.1.56:8089"; + AGVToUpSystem aGVToUpSystem = new AGVToUpSystem(); + string value = JsonConvert.SerializeObject(aGVToUpSystem); + var res = APIHelper.GetInstance.HttpRequest(url, "", value, RequestType.POST); + } + } +} \ No newline at end of file diff --git a/TestDemo/Form1.resx b/TestDemo/Form1.resx new file mode 100644 index 00000000..f298a7be --- /dev/null +++ b/TestDemo/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestDemo/Program.cs b/TestDemo/Program.cs new file mode 100644 index 00000000..7b502c42 --- /dev/null +++ b/TestDemo/Program.cs @@ -0,0 +1,17 @@ +namespace TestDemo +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/TestDemo/TestDemo.csproj b/TestDemo/TestDemo.csproj new file mode 100644 index 00000000..78ae5a43 --- /dev/null +++ b/TestDemo/TestDemo.csproj @@ -0,0 +1,17 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + \ No newline at end of file