protected override void OnStart(string[] args) { WriteLog.WriteServerLogs("Start.."); SendCmd sc = new SendCmd(); sc.Start(); }
/// <summary> /// 更新路权命令 /// </summary> public void UpdateCmd() { SendCmd sc = new SendCmd(); //发送路权令牌 DataSet dsToken = sc.GetRoadRightCMD(); byte[] bufferRight = null; for (int j = 0; j < dsToken.Tables[0].Rows.Count; j++) { bufferRight = Asrv.GetSendData(Asrv.GetTokenCmd(int.Parse(dsToken.Tables[0].Rows[j]["step_num"].ToString())), (byte[])(dsToken.Tables[0].Rows[j]["address"])); string cmdId = dsToken.Tables[0].Rows[j]["cmd_id"].ToString(); sc.InsertCmdBreakdown(cmdId, bufferRight); //if (sc.checktokensendcnt(cmdid, bufferright)) //如果相同的令牌发送次数没有超过最大发送次数则发送路权令牌 //{ // workstream.write(bufferright, 0, bufferright.length); // sc.insertcmdbreakdown(cmdid, bufferright); //} } }
protected override void OnPause() { base.OnPause(); SendCmd sc = new SendCmd(); sc.Start(); }
public void SetRoadRight() { Database db = DatabaseFactory.CreateDatabase(WCSConst.ConnectionName); DbCommand cmd1 = db.GetStoredProcCommand("wcs.SetRoadRight"); db.ExecuteNonQuery(cmd1); SendCmd sc = new SendCmd(); //发送路权令牌 DataSet dsToken = sc.GetRoadRightCMD(); byte[] bufferRight = null; for (int j = 0; j < dsToken.Tables[0].Rows.Count; j++) { bufferRight = Asrv.GetSendData(Asrv.GetTokenCmd(int.Parse(dsToken.Tables[0].Rows[j]["step_num"].ToString())), (byte[])(dsToken.Tables[0].Rows[j]["address"])); string cmdId = dsToken.Tables[0].Rows[j]["cmd_id"].ToString(); sc.InsertCmdBreakdown(cmdId, bufferRight); //if (sc.checktokensendcnt(cmdid, bufferright)) //如果相同的令牌发送次数没有超过最大发送次数则发送路权令牌 //{ // workstream.write(bufferright, 0, bufferright.length); // sc.insertcmdbreakdown(cmdid, bufferright); //} } }