终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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