Beispiel #1
0
        protected override void DoInternalThreadProc()
        {
            lock (this)
            {
                while (commandList.Count > 0)
                {
                    TerminatorCommand termiComand = commandList[0];

                    var gidParam = dbCommand.CreateParameter();
                    gidParam.Value         = termiComand.GID;
                    gidParam.ParameterName = "@GID";

                    var didParam = dbCommand.CreateParameter();
                    didParam.Value         = termiComand.DID;
                    didParam.ParameterName = "@DID";

                    var cmdContentParam = dbCommand.CreateParameter();
                    cmdContentParam.Value         = termiComand.CmdContent;
                    cmdContentParam.ParameterName = "@Command";

                    this.dbContext.Database.ExecuteSqlCommand("call MES_Command2Terminator(@GID,@DID,@Command)", gidParam, didParam, cmdContentParam);

                    commandList.RemoveAt(0);
                }
            }
        }
        protected override void DoInternalThreadProc()
        {
            DateTime currentTime = DateTime.Now;

            this.dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
            List <WorkstationSession> sessionList = this.dbContext.Set <WorkstationSession>().Where(x => x.CurrentStep < 255 && x.ExpireTime < currentTime).ToList();

            if (sessionList.Count > 0)
            {
                this.dbContext.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
            }

            foreach (WorkstationSession session in sessionList)
            {
                TerminatorCommand command = new TerminatorCommand();
                command.GID        = session.GID;
                command.DID        = session.DID;
                command.CmdContent = "9|1|1|210|128|129|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|100";
                this._Command2Terminator.RegisterCommand(command);
                session.CurrentStep = 255;
                GlobalConstants.ModifyEntityStatus <WorkstationSession>(session, this.dbContext);
            }

            if (sessionList.Count > 0)
            {
                this.dbContext.SaveChanges();
            }
        }
Beispiel #3
0
 public void RegisterCommand(TerminatorCommand command)
 {
     lock (this)
     {
         commandList.Add(command);
     }
 }