|
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.Helper;
- using BPASmartClient.Http;
- using BPASmartClient.HubHelper;
- using Newtonsoft.Json;
- using BPASmartClient.S7Net;
-
- namespace TestDemo
- {
- public partial class Form1 : Form
- {
-
- int count = 0;
- SiemensHelper siemensHelper = new SiemensHelper();
- public Form1()
- {
- InitializeComponent();
-
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // label1.Text = (count++).ToString();
- //}), \"加数值\");
- SiemensHelper siemensHelper = new SiemensHelper();
- siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
- var res = siemensHelper.ReadClass<ReadClass>(1);
-
- siemensHelper.WriteClass(new ReadClass() { temp1 = "我", temp2 = "你" }, 1);
-
- ActionManage.GetInstance.Register(new Action(() =>
- {
- label1.Text = (count++).ToString();
- }), "加数值");
-
- //ActionManage.GetInstance.Register(new Action(() =>
- //{
- // Console.WriteLine(\"开始执行阻塞方法\");
- // Thread.Sleep(20000);
- // Console.WriteLine(\"阻塞方法执行完成\");
- //}), \"阻塞方法\");
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- //AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
- //string value = JsonConvert.SerializeObject(aGVToUpSystem);
- ////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report?sign={value}\";
- //string url = \"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report\";
- //var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- //Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode=\"ZT11\" };
- //string value = JsonConvert.SerializeObject(aGVToUpSystem);
- ////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}\";
- //string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest\";
- //var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
- Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode = "123" };
- // string value = JsonConvert.SerializeObject(aGVToUpSystem);
- // string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
- string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest";
- var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
-
- }
-
- private void button3_Click(object sender, EventArgs e)
- {
- //ActionManage.GetInstance.Send(\"加数值\");
- }
-
- private void button4_Click(object sender, EventArgs e)
- {
- Task.Run(new Action(() =>
- {
- // ActionManage.GetInstance.Send(\"阻塞方法\");
- }));
-
- }
-
- private void button5_Click(object sender, EventArgs e)
- {
- //var res = siemensHelper.ReadClass<PlcToComputer>(3);
-
- PlcToComputer tt = new PlcToComputer();
- for (int i = 0; i < tt.LocationFeedback.Length; i++)
- {
- tt.LocationFeedback[i] = (short)i;
- }
- siemensHelper.WriteClass(tt, 3);
- }
-
- private void button5_Click(object sender, EventArgs e)
- {
- //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\\"} }\";
-
- 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\"} }";
-
- var res = JsonConvert.DeserializeObject<TaskData>(body);
- var r = res.body.@event;
-
-
-
- }
- }
- }
|