Ejemplo n.º 1
0
        /// <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);
                //}
            }
        }
Ejemplo n.º 2
0
    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);
            //}
        }
    }