if (readType.Equals("5")) //string { resultt = SiemensS7Net.Write(ob.ToString(), ob1.ToString()); } else if (readType.Equals("3")) //int { resultt = SiemensS7Net.Write(ob.ToString(), (int)ob1); } else if (readType.Equals("6")) //byte { resultt = SiemensS7Net.Write(ob.ToString(), (byte)ob1); } else if (readType.Equals("1")) //short { if (short.TryParse(ob1.ToString(), out short value)) { resultt = SiemensS7Net.Write(ob.ToString(), (short)value); } } else if (readType.Equals("2")) //bool { resultt = SiemensS7Net.Write(ob.ToString(), (bool)ob1); } <机床1 Title="机床1" Key="192.168.170.206:4840" Address="192.168.170.206:4840" Value="machine1" nodeClass="Object"> <读组 Title="读组" Key="read" Address="read" Value="read" nodeClass="Object"> <_程序执行 Title="程序执行" Key="execProgram" Address="/Plc/I2.1" CheckAddress="/Plc/M1500.4" Value="True" ReadType="2" TargetValue="True" nodeClass="Object"> <_上传程序 Title="上传程序" Key="uploadProgram" Address="/Plc/M1500.0" CheckAddress="/Plc/M1500.4" Value="True" ReadType="2" TargetValue="True" nodeClass="Object"> <机床2 Title="机床2" Key="192.168.170.205:4840" Address="192.168.170.205:4840" Value="machine1" nodeClass="Object"> <读组 Title="读组" Key="read" Address="read" Value="read" nodeClass="Object"> <_程序执行 Title="程序执行" Key="execProgram" Address="/Plc/I2.1" CheckAddress="/Plc/M1999.1" Value="True" ReadType="2" TargetValue="True" nodeClass="Object"> <_上传程序 Title="上传程序" Key="uploadProgram" Address="/Plc/M1500.0" CheckAddress="/Plc/M1500.0" Value="True" ReadType="2" TargetValue="True" nodeClass="Object"> <智能单元PLC1 Title="智能单元PLC1" Key="192.168.170.81:120" Address="192.168.170.81:120" Value="智能单元PLC" nodeClass="Object"> <读组 Title="读组" Key="read" Address="read" Value="read" nodeClass="Object"> <_progStatus Key="RunState" Address="DB3.10" Title="执行状态" ReadType="1" nodeClass="Variable" /> <_progStatus Key="AllowFetchMaterial" Address="DB2.2.1" Title="机床允许取料" ReadType="2" nodeClass="Variable" /> <_progStatus Key="AllowPutMaterial" Address="DB2.2" Title="机床允许放料" ReadType="2" nodeClass="Variable" /> <_progStatus Key="AGVState" Address="DB2.4.7" Title="机床允许放料" ReadType="2" nodeClass="Variable" /> <_progStatus Key="MachineAlarm" Address="DB2.3.1" Title="PLC是否正常" ReadType="2" nodeClass="Variable" /> <取物料 Title="智能单元取物料" Key="fetchMaterial" Address="DB3.10" CheckAddress="DB3.10" Value="1" ReadType="1" TargetValue="2" nodeClass="Object"> <放物料 Title="智能单元放物料" Key="putMaterial" Address="DB3.10" CheckAddress="DB3.10" Value="3" ReadType="1" TargetValue="4" nodeClass="Object"> <柔性线PLC Title="柔性线PLC" Key="192.168.170.71:120" Address="192.168.170.71:120" Value="柔性线PLC" nodeClass="Object"> <读组 Title="读组" Key="read" Address="read" Value="read" nodeClass="Object"> <_progStatus Key="RunState" Address="DB200.50" Title="执行状态" ReadType="1" nodeClass="Variable" /> <_progStatus Key="MachineAlarm" Address="DB200.10" Title="PLC是否正常" ReadType="1" nodeClass="Variable" /> <_progStatus Key="CleanAlarm" Address="DB300.0.2" Title="清洗机故障" ReadType="1" nodeClass="Variable" /> <_progStatus Key="PrintComplete" Address="DB200.24" Title="打标机打标完成" ReadType="1" nodeClass="Variable" /> <_progStatus Key="AllowPrint" Address="DB200.26" Title="打标条件满足,mes可以启动打标" ReadType="1" nodeClass="Variable" /> <_progStatus Key="RobotState" Address="DB200.50" Title="机器人状态" ReadType="1" nodeClass="Variable" /> <_progStatus Key="AGVState" Address="DB200.42" Title="AGV有料,111为都有料,100为都没料,101为其中一个有料" ReadType="1" nodeClass="Variable" /> <清洗机清洗 Title="清洗机清洗" Key="clean" Address="DB300.0.4" CheckAddress="DB300.0.4" Value="1" ReadType="2" TargetValue="True" nodeClass="Object"> <打标机打标 Title="打标机打标" Key="print" Address="DB200.28" CheckAddress="DB200.24" Value="1" ReadType="1" TargetValue="1" nodeClass="Object"> <取物料 Title="柔性线" Key="fetchMaterial" Address="DB200.50" CheckAddress="DB200.50" Value="1" ReadType="1" TargetValue="3" nodeClass="Object"> <放物料 Title="柔性线" Key="putMaterial" Address="DB200.50" CheckAddress="DB200.50" Value="4" ReadType="1" TargetValue="6" nodeClass="Object"> <移动 Title="柔性线" Key="MoveMaterial" Address="DB200.50" CheckAddress="DB200.50" Value="7" ReadType="1" TargetValue="8" nodeClass="Object"> <质量中心PLC Title="质量中心PLC" Key="192.168.170.61:120" Address="192.168.170.61:120" Value="质量中心PLC" nodeClass="Object"> <读组 Title="读组" Key="read" Address="read" Value="read" nodeClass="Object"> <_progStatus Key="RunState" Address="DB200.50" Title="执行状态" ReadType="1" nodeClass="Variable" /> <_progStatus Key="ExplorerState" Address="DB200.36" Title="三坐标状态" ReadType="2" nodeClass="Variable" /> <_progStatus Key="AGVState" Address="DB200.22" Title="AGV有料,111为都有料,100为都没料,101为其中一个有料" ReadType="1" nodeClass="Variable" /> <_progStatus Key="MachineAlarm" Address="DB200.36" Title="PLC是否正常" ReadType="1" nodeClass="Variable" /> <三坐标 Title="质量中心" Key="testWork" Address="DB200.34" CheckAddress="DB200.38" Value="1" ReadType="1" TargetValue="-0" nodeClass="Object"> <取物料 Title="质量中心" Key="fetchMaterial" Address="DB200.50" CheckAddress="DB200.50" Value="1" ReadType="1" TargetValue="3" nodeClass="Object"> <放物料 Title="质量中心" Key="putMaterial" Address="DB200.50" CheckAddress="DB200.50" Value="4" ReadType="1" TargetValue="6" nodeClass="Object">