Pārlūkot izejas kodu

web api 测试

样式分支
pry pirms 2 gadiem
vecāks
revīzija
6be2534bb2
10 mainītis faili ar 237 papildinājumiem un 19 dzēšanām
  1. +33
    -6
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  2. +2
    -0
      BPASmartClient.AgvApi/Program.cs
  3. +1
    -3
      BPASmartClient.HubHelper/HubHelper.cs
  4. +0
    -9
      DosingSystem/App.xaml.cs
  5. +24
    -1
      SmartClient.sln
  6. +60
    -0
      TestDemo/Form1.Designer.cs
  7. +23
    -0
      TestDemo/Form1.cs
  8. +60
    -0
      TestDemo/Form1.resx
  9. +17
    -0
      TestDemo/Program.cs
  10. +17
    -0
      TestDemo/TestDemo.csproj

+ 33
- 6
BPASmartClient.AgvApi/Controllers/robotjobController.cs Parādīt failu

@@ -15,13 +15,26 @@ namespace BPASmartClient.AgvApi.Controllers
/// <param name="sign"></param>
/// <returns></returns>
[HttpPost("report")]
public string report(AGVToUpSystem ent)
public string report(string ent)
{
if (ent != null)
{
Factory.GetInstance.SendReport(ent);
try
{
var res = JsonConvert.DeserializeObject<AGVToUpSystem>(ent);
if (res != null)
{
Factory.GetInstance.SendReport(res);
return "SUCCESS";
}
}
catch (Exception ex)
{
return ex.ToString();
}

}
return "SUCCESS";
return "Error";
}

/// <summary>
@@ -30,13 +43,27 @@ namespace BPASmartClient.AgvApi.Controllers
/// <param name="upstreamrequest"></param>
/// <returns></returns>
[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>(upstreamrequest);
if (res != null)
{
Factory.GetInstance.SendUpstreamrequest(upstreamrequest);
return "SUCCESS";
}
}
catch (Exception ex)
{
return ex.ToString();
}

}
return "SUCCESS";
return "Error";
}

}
}

+ 2
- 0
BPASmartClient.AgvApi/Program.cs Parādīt failu

@@ -1,6 +1,8 @@
using BPASmartClient.AgvApi;
using Microsoft.AspNetCore.Cors.Infrastructure;



var builder = WebApplication.CreateBuilder(args);

// Add services to the container.


+ 1
- 3
BPASmartClient.HubHelper/HubHelper.cs Parādīt failu

@@ -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<object>("Report", (s) =>
{
Report?.Invoke(s);


+ 0
- 9
DosingSystem/App.xaml.cs Parādīt failu

@@ -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)


+ 24
- 1
SmartClient.sln Parādīt failu

@@ -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}


+ 60
- 0
TestDemo/Form1.Designer.cs Parādīt failu

@@ -0,0 +1,60 @@
namespace TestDemo
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

+ 23
- 0
TestDemo/Form1.cs Parādīt failu

@@ -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);
}
}
}

+ 60
- 0
TestDemo/Form1.resx Parādīt failu

@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 17
- 0
TestDemo/Program.cs Parādīt failu

@@ -0,0 +1,17 @@
namespace TestDemo
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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());
}
}
}

+ 17
- 0
TestDemo/TestDemo.csproj Parādīt failu

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.AGV\BPASmartClient.AGV.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Http\BPASmartClient.Http.csproj" />
</ItemGroup>

</Project>

Notiek ielāde…
Atcelt
Saglabāt