-- JXPLTCM.V_PLTCM_PDO_QUALITY source

CREATE OR REPLACE FORCE VIEW "JXPLTCM"."V_PLTCM_PDO_QUALITY" ("EXCOILID", "ENCOILID", "HOT_COILID", "SHIFT", "CREW", "QUALITY", "GRADE", "ENTRY_THICK", "ENTRY_WIDTH", "ENTRY_WEIGHT", "NEXT_UNIT", "EXIT_THICK", "EXIT_WIDTH", "MEAS_EXIT_WEIGHT", "EXIT_LENGTH", "OUTER_DIAMETER", "PARK_TYPE", "SIDE_TRIM", "EXIT_POS_DEV", "EXIT_NEG_DEV", "TOTAL_LENGTH", "STATIC_LENGTH", "TOLERANCE", "STD_GUARANT", "TARGET_DSC", "ABS_QUALITY", "QUALITY_DSC", "OVER_LENGTH", "ENTRY_THICK_AVG", "CUT_SPEED", "MAX_ROLL_SPEED", "EXIT_THICK_AVG", "EXIT_THICK_MAX", "EXIT_THICK_MIN", "ONLINE_DATE", "START_DATE", "END_DATE", "STATUS", "INSDATE") AS 
  SELECT A.EXCOILID,
            A.ENCOILID,
            A.HOT_COILID,
            A.SHIFT,
            A.CREW,
            A.QUALITY,
            A.GRADE,
            A.ENTRY_THICK,
            A.ENTRY_WIDTH,
            A.ENTRY_WEIGHT,
            A.PRODUCT_TYPE AS NEXT_UNIT,
            A.EXIT_THICK,
            A.EXIT_WIDTH,
            A.MEAS_EXIT_WEIGHT,
            A.EXIT_LENGTH,
            A.OUTER_DIAMETER,
            A.PARK_TYPE,
            A.SIDE_TRIM,
            A.EXIT_POS_DEV,
            A.EXIT_NEG_DEV,
            B.TOTAL_LENGTH AS total_LENGTH,
            b.static_length AS static_length,
            B.TOLERANCE,
            C.STD_GUARANT,
            C.TARGET_DSC,
            C.ABS_QUALITY AS ABS_QUALITY,
            C.QUALITY_DSC,
            B.OVER_LENGTH,
            B.ENTRY_THICK_AVG,
            B.CUT_SPEED,
            B.MAX_ROLL_SPEED,
            B.EXIT_THICK_AVG,
            B.EXIT_THICK_MAX,
            B.EXIT_THICK_MIN,
            A.ONLINE_DATE,
            A.START_DATE,
            A.END_DATE,
            A.STATUS,
            A.INSDATE
       FROM PLTCM_PDO_EXCOIL A
            LEFT JOIN pltcm_pdo_quality B ON A.EXCOILID = B.EXCOILID
            LEFT JOIN SAP_PDO_COIL C ON A.EXCOILID = C.COILID
   ORDER BY A.END_DATE DESC;


-- JXPLTCM.V_VBDA_GAUGE source

CREATE OR REPLACE FORCE VIEW "JXPLTCM"."V_VBDA_GAUGE" ("MATID", "XTIME", "XLOCATION", "THICK0", "THICK1", "THICK4", "THICK5", "EXIT_SPEED", "THICK0REF", "THICK1REF", "THICK4REF", "THICK5REF", "TOPLIMIT", "BOTLIMIT") AS 
  SELECT a.matid,
            b.reltime,
            b.location,
            b.v0,
            b.v1,
            b.v2,
            b.v3,
            b.v4,
            b.v5,
            b.v6,
            b.v7,
            b.v8,
            NVL (b.v22, 3),
            NVL (b.v23, -3)
       FROM VBDA_HISTORYREF a, VBDA_HISTORY b
      WHERE a.BLOCKID = 100 AND a.refid = b.refid
   ORDER BY b.reltime ASC;


-- JXPLTCM.V_VBDA_SHAPE source

CREATE OR REPLACE FORCE VIEW "JXPLTCM"."V_VBDA_SHAPE" ("MATID", "XTIME", "XLOCATION", "HIGHZONEID", "LOWZONEID", "VALUES01", "VALUES02", "VALUES03", "VALUES04", "VALUES05", "VALUES06", "VALUES07", "VALUES08", "VALUES09", "VALUES10", "VALUES11", "VALUES12", "VALUES13", "VALUES14", "VALUES15", "VALUES16", "VALUES17", "VALUES18", "VALUES19", "VALUES20", "VALUES21", "VALUES22", "VALUES23", "VALUES24", "VALUES25", "VALUES26", "EXIT_SPEED", "SPOT_COOL1", "SPOT_COOL2", "ROLLFORCE", "ABSDEVIATION", "TILT", "WRBEND", "IRBEND", "TILTCORR", "WRBENDCORR", "IRBENDCORR", "ENTRYTENSTRESS", "EXITTENSTRESS") AS 
  SELECT a.matid,
            b.reltime,
            b.location,
 
            b.l0,
            b.l1,
 
            b.v0,
            b.v1,
            b.v2,
            b.v3,
            b.v4,
            b.v5,
            b.v6,
            b.v7,
            b.v8,
            b.v9,
            b.v10,
            b.v11,
            b.v12,
            b.v13,
            b.v14,
            b.v15,
            b.v16,
            b.v17,
            b.v18,
            b.v19,
            b.v20,
            b.v21,
            b.v22,
            b.v23,
            b.v24,
            b.v25,
            b.v26,
            b.l3,
            b.l4,
            b.v27,
            b.v28,
            b.v29,
            b.v30,
            b.v31,
            b.v32,
            b.v33,
            b.v34,
            b.v35,
            b.v36

       FROM VBDA_HISTORYREF a,  VBDA_HISTORY b
      WHERE a.BLOCKID = 200 and a.refid = b.refid
   ORDER BY b.reltime ASC
 
 
 ;