Q:

Nested subqueries with ROW_NUMBER logic problem

(SQL Server 2008) I am trying to filter out labor records from a factory time keeping system. Here is a sample of the data below.The TCODE column either has a 'O' (on time) or has an 'OF' (off time). So for example CHAVEZ worked on sequence 50, the kitpull, for 1.06 hours.
Problem: When a worker finishes a job sequence with more than 2 swipes, the system automatically adds one last on-off pair of records (0 hours) that I need to remove. In the case of sequence 50 Pull Kit and sequence 400 Countersinking there are only two swipes (on, then off), thus no extra records. However, each of the other sequences has two trailing extra rows. In the case of sequence 100, the last two rows at TTIME=93724 (09:37:24 AM) are the extra rows. You can see that the very last row has a complete code of 1 officially marking the job sequence complete.   
MFGORDNO  SEQUENCE  DESCR                 BADGE  LABOR  TCODE  ENAME   TTIME  CompleteCode
M968460   50        Pull Kit              802    0.00   O      CHAVEZ  82300  NULL
M968460   50        Pull Kit              802    1.06   OF     CHAVEZ  92631  0
M968460   100       Load Parts into AJ    396    0.00   O      CURNEY  150014 NULL
M968460   100       Load Parts into AJ    396    1.00   OF     CURNEY  160022 0
M968460   100       Load Parts into AJ    3169   0.00   O      JONES   84612  NULL
M968460   100       Load Parts into AJ    3169   0.85   OF     JONES   93724  0
M968460   100       Load Parts into AJ    3169   0.00   O      JONES   93724  NULL
M968460   100       Load Parts into AJ    3169   0.00   OF     JONES   93724  1
M968460   200       Transfer Drill Holes  3169   0.00   O      JONES   93737  NULL
M968460   200       Transfer Drill Holes  3169   2.73   OF     JONES   132135 0
M968460   200       Transfer Drill Holes  3169   0.00   O      JONES   132135 NULL
M968460   200       Transfer Drill Holes  3169   0.00   OF     JONES   132135 1
M968460   300       TransDrill Splices    3169   0.00   O      JONES   132153 NULL
M968460   300       TransDrill Splices    3169   3.56   OF     JONES   65539  0
M968460   300       TransDrill Splices    3169   0.00   O      JONES   65539  NULL
M968460   300       TransDrill Splices    3169   0.01   OF     JONES   65539  1
M968460   400       Countersinking        3169   0.00   O      JONES   63102  NULL
M968460   400       Countersinking        3169   2.79   OF     JONES   91716  0
M968460   600       SPLICE STRAPS         3169   0.00   O      JONES   131931 NULL
M968460   600       SPLICE STRAPS         3169   1.17   OF     JONES   143040 0
M968460   600       SPLICE STRAPS         3169   0.00   O      JONES   63456  NULL
M968460   600       SPLICE STRAPS         3169   4.12   OF     JONES   105200 0
M968460   600       SPLICE STRAPS         3169   0.00   O      JONES   105200 NULL
M968460   600       SPLICE STRAPS         3169   0.00   OF     JONES   105200 1

Desired results: In short I'm trying to use a single SQL statement to arrive at this resulting data. 
MFGORDNO  SEQUENCE  DESCR                 BADGE  LABOR  TCODE  ENAME   TTIME  CompleteCode
M968460   50        Pull Kit              802    0.00   O      CHAVEZ  82300  NULL
M968460   50        Pull Kit              802    1.06   OF     CHAVEZ  92631  0
M968460   100       Load Parts into AJ    396    0.00   O      CURNEY  150014 NULL
M968460   100       Load Parts into AJ    396    1.00   OF     CURNEY  160022 0
M968460   100       Load Parts into AJ    3169   0.00   O      JONES   84612  NULL
M968460   100       Load Parts into AJ    3169   0.85   OF     JONES   93724  0
M968460   200       Transfer Drill Holes  3169   0.00   O      JONES   93737  NULL
M968460   200       Transfer Drill Holes  3169   2.73   OF     JONES   132135 0
M968460   300       TransDrill Splices    3169   0.00   O      JONES   132153 NULL
M968460   300       TransDrill Splices    3169   3.56   OF     JONES   65539  0
M968460   400       Countersinking        3169   0.00   O      JONES   63102  NULL
M968460   400       Countersinking        3169   2.79   OF     JONES   91716  0
M968460   600       SPLICE STRAPS         3169   0.00   O      JONES   131931 NULL
M968460   600       SPLICE STRAPS         3169   1.17   OF     JONES   143040 0
M968460   600       SPLICE STRAPS         3169   0.00   O      JONES   63456  NULL
M968460   600       SPLICE STRAPS         3169   4.12   OF     JONES   105200 0

I originally started adding a row number to my inner-most subquery so I could refer to the MAX(rn) later like this:
SELECT
    *, 
    ROW_NUMBER() OVER (ORDER by TTIME) rn 
FROM
    MySmallData

From the subquery above, I was hoping to then select all records from the original data removing "the rows with 1 in CompleteCode and the row right above".
This is more of a strategy problem than a syntax problem. I was hoping for some suggestions.
Thanks,
John
EDIT: Sorry here's some sample data:
CREATE TABLE MySmallData 
(
    [MFGORDNO] NVARCHAR(7),
    [SEQUENCE] INT,
    [DESCR] NVARCHAR(20),
    [BADGE] INT,
    [LABOR] NUMERIC(3, 2),
    [TCODE] NVARCHAR(2),
    [TSTAMP] NVARCHAR(26),
    [ENAME] NVARCHAR(19),
    [TTIME] INT,
    [CompleteCode] INT
);

INSERT INTO MySmallData 
VALUES
    ('M968460',0050,'Pull Kit',802,0,'O','2019-02-26 08:23:00.000004','CHAVEZ',82300,NULL),
    ('M968460',0050,'Pull Kit',802,1.06,'OF','2019-02-26 09:26:30.999995','CHAVEZ',92631,0),
    ('M968460',0100,'Load Parts into AJ',396,0,'O','2019-03-05 15:00:13.999997','CURNEY',150014,NULL),
    ('M968460',0100,'Load Parts into AJ',396,1,'OF','2019-03-05 16:00:22.000001','CURNEY',160022,0),
    ('M968460',0100,'Load Parts into AJ',3169,0,'O','2019-03-06 08:46:12.000003','JONES',84612,NULL),
    ('M968460',0100,'Load Parts into AJ',3169,0.85,'OF','2019-03-06 09:37:23.999998','JONES',93724,0),
    ('M968460',0100,'Load Parts into AJ',3169,0,'O','2019-03-06 09:37:23.999998','JONES',93724,NULL),
    ('M968460',0100,'Load Parts into AJ',3169,0,'OF','2019-03-06 09:37:23.999998','JONES',93724,1),
    ('M968460',0200,'Transfer Drill Holes',3169,0,'O','2019-03-06 09:37:37.000001','JONES',93737,NULL),
    ('M968460',0200,'Transfer Drill Holes',3169,2.73,'OF','2019-03-06 13:21:35.000001','JONES',132135,0),
    ('M968460',0200,'Transfer Drill Holes',3169,0,'O','2019-03-06 13:21:35.000001','JONES',132135,NULL),
    ('M968460',0200,'Transfer Drill Holes',3169,0,'OF','2019-03-06 13:21:35.000001','JONES',132135,1),
    ('M968460',0300,'TransDrill Splices',3169,0,'O','2019-03-06 13:21:52.999998','JONES',132153,NULL),
    ('M968460',0300,'TransDrill Splices',3169,3.56,'OF','2019-03-06 16:55:39','JONES',165539,0),
    ('M968460',0300,'TransDrill Splices',3169,0,'O','2019-03-06 16:55:39','JONES',165539,NULL),
    ('M968460',0300,'TransDrill Splices',3169,0.01,'OF','2019-03-06 16:55:39','JONES',165539,1),
    ('M968460',0400,'Countersinking',3169,0,'O','2019-03-07 06:31:01.999998','JONES',63102,NULL),
    ('M968460',0400,'Countersinking',3169,2.79,'OF','2019-03-07 09:17:15.999996','JONES',91716,0),
    ('M968460',0600,'SPLICE STRAPS',3169,0,'O','2019-03-08 13:19:30.999999','JONES',131931,NULL),
    ('M968460',0600,'SPLICE STRAPS',3169,1.17,'OF','2019-03-08 14:30:39.999997','JONES',143040,0),
    ('M968460',0600,'SPLICE STRAPS',3169,0,'O','2019-03-12 06:34:56.000003','JONES',63456,NULL),
    ('M968460',0600,'SPLICE STRAPS',3169,4.12,'OF','2019-03-12 10:52:00.000002','JONES',105200,0),
    ('M968460',0600,'SPLICE STRAPS',3169,0,'O','2019-03-12 10:52:00.000002','JONES',105200,NULL),
    ('M968460',0600,'SPLICE STRAPS',3169,0,'OF','2019-03-12 10:52:00.000002','JONES',105200,1);

A:

I think you can do this with exists:
select msd.*
from mysmalldata msd
where not ((msd.completecode is null and
            exists (select 1
                    from mysmalldata msd2
                    where msd2.MFGORDNO = msd.MFGORDNO and
                          msd2.sequence = msd.sequence and
                          msd2.badge = msd.badge and
                          msd2.ttime = msd.ttime and
                          msd2.completecode = 1
                   )
            ) or
           (coalesce(msd.completecode, -1) = 1 and
            exists (select 1
                    from mysmalldata msd2
                    where msd2.MFGORDNO = msd.MFGORDNO and
                          msd2.sequence = msd.sequence and
                          msd2.badge = msd.badge and
                          msd2.ttime = msd.ttime and
                          msd2.completecode is null
                   )
            )
           );   

Here is a db<>fiddle.

