//strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
strSql.AppendLine("AND boi.CFM_MILL_PLT='C3' ");
strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))");
strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))");
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
@ -355,24 +356,25 @@ namespace SlabHandle
strSql.AppendLine("WHERE 1 = 1 ");
strSql.AppendLine(" AND BOI.ORD_NO || '-' || BOI.ORD_ITEM IN ('OMK24040013-005')");
//strSql.AppendLine("AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
strSql.AppendLine("AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
strSql.AppendLine("AND boi.CFM_MILL_PLT='C3' ");
strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))");
strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))");
strSql.AppendLine("SELECT QQC.*, rank() over(partition by QQC.ord_no, QQC.ord_item order by knd desc) rk from NISCO.QP_QLTY_CHEM QQC where (QQC.ORD_NO || '-' || QQC.ORD_ITEM) IN(");
//strSql.AppendLine("AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
//strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))");
//strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))");
strSql.AppendLine("SELECT QQC.*, rank() over(partition by QQC.ord_no, QQC.ord_item order by knd desc) rk from NISCO.QP_QLTY_CHEM QQC where (QQC.ORD_NO , QQC.ORD_ITEM) IN(");
strSql.AppendLine("AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
strSql.AppendLine("AND boi.CFM_MILL_PLT='C3' ");
strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))");
strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))");
strSql.AppendLine(") ");
strSql.AppendLine(" AND QQC.KND IN ('1','2') ) T WHERE T.rk = 1 ");
@ -1285,7 +1287,7 @@ namespace SlabHandle
strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD");
strSql.AppendLine("WHERE 1 = 1 ");
strSql.AppendLine(" AND A.SLAB_NO = '2310768931 '");
strSql.AppendLine(" AND A.SLAB_NO = '2430408334 '");
//strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " +