|
|
@@ -411,45 +411,45 @@ namespace UAS_PLCDataReader
|
|
|
Command = dt1.Rows[0]["dc_value"].ToString();
|
|
|
SendCommandByteSize = Encoding.Default.GetBytes(Command.ToCharArray()).Length;
|
|
|
}
|
|
|
- //mbt.Send(IP, SendCoding, ReceiveCoding, Command);
|
|
|
- ////处理2秒之内返回的指令
|
|
|
- ////Thread.Sleep(1000);
|
|
|
- //if (mbt.Returnvalue.ContainsKey(IP))
|
|
|
- //{
|
|
|
- // int ReceiveCommandByteSize = Encoding.Default.GetBytes(mbt.Returnvalue[IP].ToCharArray()).Length;
|
|
|
- // mbt.Returnvalue.Remove(IP);
|
|
|
- // SQL.Clear();
|
|
|
- // //更新轮询状态
|
|
|
- // sql.Clear();
|
|
|
- // sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Running' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
|
|
|
- // dh.ExecuteSql(sql.ToString(), "update");
|
|
|
- // //SQL.Add(sql.ToString());
|
|
|
- // //更新轮询日志状态
|
|
|
- // sql.Clear();
|
|
|
- // sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+" + SendCommandByteSize);
|
|
|
- // sql.Append(",dpg_receivedatasize=nvl(dpg_receivedatasize,0)+" + ReceiveCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
|
|
|
- // sql.Append(" where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
|
|
|
- // //SQL.Add(sql.ToString());
|
|
|
- // dh.ExecuteSql(sql.ToString(), "update");
|
|
|
- // //dh.ExecuteSQLTran(SQL.ToArray());
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // SQL.Clear();
|
|
|
- // //更新轮询状态
|
|
|
- // sql.Clear();
|
|
|
- // sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Stop' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
|
|
|
- // //SQL.Add(sql.ToString());
|
|
|
- // dh.ExecuteSql(sql.ToString(), "update");
|
|
|
- // //更新轮询日志状态
|
|
|
- // sql.Clear();
|
|
|
- // sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+");
|
|
|
- // sql.Append(SendCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
|
|
|
- // sql.Append("where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
|
|
|
- // //SQL.Add(sql.ToString());
|
|
|
- // dh.ExecuteSql(sql.ToString(), "update");
|
|
|
- // //dh.ExecuteSQLTran(SQL.ToArray());
|
|
|
- //}
|
|
|
+ mbt.Send(IP, SendCoding, ReceiveCoding, Command);
|
|
|
+ //处理2秒之内返回的指令
|
|
|
+ //Thread.Sleep(1000);
|
|
|
+ if (mbt.Returnvalue.ContainsKey(IP))
|
|
|
+ {
|
|
|
+ int ReceiveCommandByteSize = Encoding.Default.GetBytes(mbt.Returnvalue[IP].ToCharArray()).Length;
|
|
|
+ mbt.Returnvalue.Remove(IP);
|
|
|
+ SQL.Clear();
|
|
|
+ //更新轮询状态
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Running' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
|
|
|
+ dh.ExecuteSql(sql.ToString(), "update");
|
|
|
+ //SQL.Add(sql.ToString());
|
|
|
+ //更新轮询日志状态
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+" + SendCommandByteSize);
|
|
|
+ sql.Append(",dpg_receivedatasize=nvl(dpg_receivedatasize,0)+" + ReceiveCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
|
|
|
+ sql.Append(" where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
|
|
|
+ //SQL.Add(sql.ToString());
|
|
|
+ dh.ExecuteSql(sql.ToString(), "update");
|
|
|
+ //dh.ExecuteSQLTran(SQL.ToArray());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SQL.Clear();
|
|
|
+ //更新轮询状态
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Stop' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
|
|
|
+ //SQL.Add(sql.ToString());
|
|
|
+ dh.ExecuteSql(sql.ToString(), "update");
|
|
|
+ //更新轮询日志状态
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+");
|
|
|
+ sql.Append(SendCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
|
|
|
+ sql.Append("where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
|
|
|
+ //SQL.Add(sql.ToString());
|
|
|
+ dh.ExecuteSql(sql.ToString(), "update");
|
|
|
+ //dh.ExecuteSQLTran(SQL.ToArray());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|