|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using BPASmartClient.AGV.Feedback;
- using BPA.Helper;
-
- using BPASmartClient.HubHelper;
- using Newtonsoft.Json;
- using BPASmartClient.S7Net;
- using BPASmartClient.Modbus;
-
- namespace TestDemo
- {
- public partial class Form1 : Form
- {
- ModbusTcp modbus;
- 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(\"ִ\");
- //}), \"\");
- modbus = new ModbusTcp();
- modbus.ModbusTcpConnect("192.168.0.100", 8001);
- MessageBox.Show("ջӳɹ");
-
- }
-
- private void ReadData()
- {
- textBox1.Text= modbus.ReadCoils(4201).ToString(); //ʼλ
- //textBox1.Text = modbus.ReadInputs(0000).ToString();
-
- }
-
- 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() {};
- // 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);
- }
- /// <summary>
- /// д
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- modbus.WriteSingleCoil(2000,true);
- //modbus.WriteSingleRegister(0000,1);
- }
- /// <summary>
- /// ն
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- ReadData();
- }
- }
- }
|