|
- using BPASmartClient.Helper;
- using BPASmartClient.Modbus;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPASmartClient.S7Net;
- using System.Threading;
-
- namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
- {
- public class SiemensDeviceStatus
- {
- public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
- public bool IsConnected => Siemens_PLC_S7.IsConnected;
-
- public void Init()
- {
- if (IsConnected)
- {
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201);
- var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231);
- var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261);
- var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
- if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe)
- {
- Start.Order_Request = true;
- this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
- }
- if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK))
- {
- ActionManage.GetInstance.Send("SiemensRecipeRecive", Start);
- Start.Order_Request_ACK = false;
- this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
- }
-
- if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
- {
- ActionManage.GetInstance.Send("AGV放货架到位",Status);
- Status.AgvRequestPut = false;
- this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
- }
- if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet))
- {
- ActionManage.GetInstance.Send("AGV取货架到位", Status);
- Status.AgvRequestGet = false;
- this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
- }
-
- Thread.Sleep(10);
- }),"监听服务数据");
- }
- }
- }
- }
|