终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

105 satır
4.9 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() { agvCode = "123" };
  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. private void button5_Click(object sender, EventArgs e)
  78. {
  79. //string body =\" { \\"header\\":{ \\"requestId\\":\\"05c1124b4ec443329bbf8da7d2aba5f2\\",\\"timestamp\\":\\"2022-10-19 12:27:27\\",\\"version\\":\\"2.7\\"},\\"body\\":{ \\"event\\":{ \\"agvCode\\":\\"ZT11-21\\",\\"command\\":\\"LOAD\\",\\"containerCode\\":\\"24fefca64b65f2a\\",\\"equipmentId\\":0,\\"jobId\\":\\"SIRoller_166615364143003483\\",\\"msgId\\":\\"1666153642429\\"},\\"ts\\":1666153642429,\\"type\\":\\"REQUEST_DEVICE\\",\\"warehouseId\\":1,\\"zoneCode\\":\\"zone\\"} }\";
  80. string body =" { \"header\":{ \"requestId\":\"471d848e19ed4696858f72c25415f0e8\",\"timestamp\":\"2022-10-19 17:29:27\",\"version\":\"2.7\"},\"body\":{ \"event\":{ \"jobData\":{ \"agvCode\":\"ZT11-24\",\"containerCode\":\"24ff16fcb707a86\",\"pointCode\":\"sxSX88\",\"startPointCode\":\"sxSX88\",\"targetPointCode\":\"naFssQ\"},\"jobId\":\"SIBucket_166617173650007811\",\"jobType\":\"POINT_ROLLER_MOVE\",\"robotJobId\":\"c981a984-91bc-4f94-9685-3a8a36629457\",\"state\":\"ROLLER_LOAD_DOING\",\"warehouseId\":1},\"id\":\"18717ed5-9e79-4f73-a6ea-176e50792696\",\"ts\":1666171767233,\"type\":\"JobReportEvent\",\"warehouseId\":1,\"zoneCode\":\"kckq\"} }";
  81. var res = JsonConvert.DeserializeObject<TaskData>(body);
  82. var r = res.body.@event;
  83. }
  84. }
  85. }