8 Haziran 2022 Çarşamba

IFS İş Emri Kapatma / IFS Shop Order Close Code

 DECLARE
   attr_ VARCHAR2(32000);
   dummy varchar2(2000);
   dummy2 varchar2(2000);
   a_ VARCHAR2(32000) := ''; --p0
   b_ VARCHAR2(32000) := 'AAASX0AAFAABDyXAAE'; --p1
   c_ VARCHAR2(32000) := '20190905140741'; --p2
   d_ VARCHAR2(32000) := 'CLOSE_TOLERANCE'||chr(31)||'0'||chr(30)||'CLOSE_OPER'||chr(31)||'Evet'||chr(30)||'CLOSE_CODE'||chr(31)||'Manual Kapat'||chr(30)||'SIMPLIFIED_MATERIAL'||chr(31)||'Hayır'||chr(30)||'CLOSED_BY_SERVER'||chr(31)||'TRUE'||chr(30); --p3
BEGIN

 FOR rec_ IN 
  ( SELECT a.objid,a.objversion,a.contract,a.order_no,a.release_no,a.sequence_no,a.qty_on_order,a.qty_released,a.qty_complete
     FROM SHOP_ORD A
      WHERE
       a.contract='XXX'
       and a.state in ('Başlatıldı','Planlandı','Yayımlandı') 
       and to_date(a.earliest_start_date,'dd.mm.yyyy')<=to_date('01.01.2022','dd.mm.yyyy')
       AND a.qty_complete=0
       --A.QTY_COMPLETE>A.REVISED_QTY_DUE*0.97 
			 --AND a.order_no='1029'
        and a.order_no||'-'||a.release_no||'-'||a.sequence_no NOT IN  
               ( SELECT s.order_no||'-'||s.release_no||'-'||s.sequence_no
                         FROM Shop_Material_Assign s
                         WHERE s.qty_assigned>0) 
   )  LOOP  
     
	  BEGIN
      Client_SYS.Clear_Attr(attr_);  
      client_sys.Set_Item_Value('CLOSE_TOLERANCE','0',attr_);
      client_sys.Set_Item_Value('CLOSE_OPER','Evet',attr_);
      client_sys.Set_Item_Value('CLOSE_CODE','Manual Kapat',attr_);
      client_sys.Set_Item_Value('SIMPLIFIED_MATERIAL','Hayır',attr_);
      client_sys.Set_Item_Value('CLOSED_BY_SERVER','TRUE',attr_);
      b_:=rec_.objid;
      c_:=rec_.objversion;
          
      DBMS_OUTPUT.put_line(rec_.order_no||'-'||rec_.release_no||'-'||rec_.sequence_no); 
                    
      IFSAPP.Shop_Ord_API.Close__( a_ , b_ , c_ , attr_ , 'DO' );                
      --shop_ord_api.Close(dummy,dummy2,rec_.order_no,rec_.release_no,rec_.sequence_no,91,'Y');
     EXCEPTION
      WHEN OTHERS THEN NULL;
       DBMS_OUTPUT.put_line('Alınan Hata:' || sqlerrm);  
     END;
          
  END LOOP;
  
  
END;


Share:

0 yorum:

Yorum Gönder

Blog Arşivi