终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

94 行
3.5 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. SiemensHelper siemensHelper = new SiemensHelper();
  13. public Form1()
  14. {
  15. InitializeComponent();
  16. //ActionManage.GetInstance.Register(new Action(() =>
  17. //{
  18. // label1.Text = (count++).ToString();
  19. //}), \"加数值\");
  20. SiemensHelper siemensHelper = new SiemensHelper();
  21. siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
  22. var res = siemensHelper.ReadClass<ReadClass>(1);
  23. siemensHelper.WriteClass(new ReadClass() { temp1 = "我", temp2 = "你" }, 1);
  24. ActionManage.GetInstance.Register(new Action(() =>
  25. {
  26. label1.Text = (count++).ToString();
  27. }), "加数值");
  28. //ActionManage.GetInstance.Register(new Action(() =>
  29. //{
  30. // Console.WriteLine(\"开始执行阻塞方法\");
  31. // Thread.Sleep(20000);
  32. // Console.WriteLine(\"阻塞方法执行完成\");
  33. //}), \"阻塞方法\");
  34. }
  35. private void button1_Click(object sender, EventArgs e)
  36. {
  37. //AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
  38. //string value = JsonConvert.SerializeObject(aGVToUpSystem);
  39. ////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report?sign={value}\";
  40. //string url = \"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report\";
  41. //var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
  42. }
  43. private void button2_Click(object sender, EventArgs e)
  44. {
  45. //Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode=\"ZT11\" };
  46. //string value = JsonConvert.SerializeObject(aGVToUpSystem);
  47. ////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}\";
  48. //string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest\";
  49. //var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
  50. Upstreamrequest aGVToUpSystem = new Upstreamrequest() {};
  51. // string value = JsonConvert.SerializeObject(aGVToUpSystem);
  52. // string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
  53. string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest";
  54. var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
  55. }
  56. private void button3_Click(object sender, EventArgs e)
  57. {
  58. //ActionManage.GetInstance.Send(\"加数值\");
  59. }
  60. private void button4_Click(object sender, EventArgs e)
  61. {
  62. Task.Run(new Action(() =>
  63. {
  64. // ActionManage.GetInstance.Send(\"阻塞方法\");
  65. }));
  66. }
  67. private void button5_Click(object sender, EventArgs e)
  68. {
  69. //var res = siemensHelper.ReadClass<PlcToComputer>(3);
  70. PlcToComputer tt = new PlcToComputer();
  71. for (int i = 0; i < tt.LocationFeedback.Length; i++)
  72. {
  73. tt.LocationFeedback[i] = (short)i;
  74. }
  75. siemensHelper.WriteClass(tt, 3);
  76. }
  77. }
  78. }