终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

70 rader
2.4 KiB

  1. using BPASmartClient.AGV.Feedback;
  2. using BPASmartClient.Helper;
  3. using BPASmartClient.Http;
  4. using BPASmartClient.HubHelper;
  5. using Newtonsoft.Json;
  6. using BPASmartClient.S7Net;
  7. namespace TestDemo
  8. {
  9. public partial class Form1 : Form
  10. {
  11. int count = 0;
  12. public Form1()
  13. {
  14. InitializeComponent();
  15. SiemensHelper siemensHelper = new SiemensHelper();
  16. siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
  17. var res = siemensHelper.ReadClass<ReadClass>(1);
  18. siemensHelper.WriteClass(new ReadClass() { temp1 = "我", temp2 = "你" }, 1);
  19. ActionManage.GetInstance.Register(new Action(() =>
  20. {
  21. label1.Text = (count++).ToString();
  22. }), "加数值");
  23. ActionManage.GetInstance.Register(new Action(() =>
  24. {
  25. Console.WriteLine("开始执行阻塞方法");
  26. Thread.Sleep(20000);
  27. Console.WriteLine("阻塞方法执行完成");
  28. }), "阻塞方法");
  29. }
  30. private void button1_Click(object sender, EventArgs e)
  31. {
  32. AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
  33. //string value = JsonConvert.SerializeObject(aGVToUpSystem);
  34. //string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/report?sign={value}";
  35. string url = "http://192.168.1.40:8089/apicallback/quicktron/robotjob/report";
  36. var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
  37. }
  38. private void button2_Click(object sender, EventArgs e)
  39. {
  40. Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode = "123" };
  41. // string value = JsonConvert.SerializeObject(aGVToUpSystem);
  42. // string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
  43. string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest";
  44. var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
  45. }
  46. private void button3_Click(object sender, EventArgs e)
  47. {
  48. ActionManage.GetInstance.Send("加数值");
  49. }
  50. private void button4_Click(object sender, EventArgs e)
  51. {
  52. Task.Run(new Action(() =>
  53. {
  54. ActionManage.GetInstance.Send("阻塞方法");
  55. }));
  56. }
  57. }
  58. }