src-db/database/model/functions/M_INOUT_POST.xml
changeset 29655 e67484476dfd
parent 29654 e6e019dabbbb
child 29706 a8a6d8bd52e5
equal deleted inserted replaced
29654:e6e019dabbbb 29655:e67484476dfd
    93     v_BreakDown VARCHAR2(60) ;
    93     v_BreakDown VARCHAR2(60) ;
    94     v_ActualQty NUMBER;
    94     v_ActualQty NUMBER;
    95     v_QtyAux NUMBER;
    95     v_QtyAux NUMBER;
    96     v_Count NUMBER:=0;
    96     v_Count NUMBER:=0;
    97     v_Line VARCHAR2(10) ;
    97     v_Line VARCHAR2(10) ;
       
    98     v_OrderDocumentNo C_ORDER.DocumentNo%TYPE;
       
    99     v_OrderLineNo C_ORDERLINE.Line%TYPE;
    98     v_OrderID_old VARCHAR2(32);
   100     v_OrderID_old VARCHAR2(32);
    99     Cur_MILines RECORD;
   101     Cur_MILines RECORD;
   100     FINISH_PROCESS BOOLEAN:=false;
   102     FINISH_PROCESS BOOLEAN:=false;
   101     v_Aux NUMBER;
   103     v_Aux NUMBER;
   102     v_isSoTrx CHAR(1);
   104     v_isSoTrx CHAR(1);
   123     v_countRS NUMBER:=0;
   125     v_countRS NUMBER:=0;
   124     v_R_Quantity NUMBER;
   126     v_R_Quantity NUMBER;
   125     v_R_Reservedqty NUMBER;
   127     v_R_Reservedqty NUMBER;
   126     v_RS_Quantity NUMBER;
   128     v_RS_Quantity NUMBER;
   127     v_RS_Releasedqty NUMBER;
   129     v_RS_Releasedqty NUMBER;
   128 
       
   129     v_orderlineno VARCHAR2(40) ;
       
   130     v_orderDocumentNo VARCHAR2(40) ;
       
   131 
   130 
   132   BEGIN
   131   BEGIN
   133   
   132   
   134     IF(p_PInstance_ID IS NOT NULL) THEN
   133     IF(p_PInstance_ID IS NOT NULL) THEN
   135       --  Update AD_PInstance
   134       --  Update AD_PInstance
   354       AND AD_ISORGINCLUDED(m.AD_Org_ID,C_DocType.AD_Org_ID, m.AD_Client_ID) <> -1
   353       AND AD_ISORGINCLUDED(m.AD_Org_ID,C_DocType.AD_Org_ID, m.AD_Client_ID) <> -1
   355        AND M.C_DOCTYPE_ID=C_DocType.C_DOCTYPE_ID;
   354        AND M.C_DOCTYPE_ID=C_DocType.C_DOCTYPE_ID;
   356         IF (v_Count=0) THEN
   355         IF (v_Count=0) THEN
   357           RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgDoctypeShipment@') ;
   356           RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgDoctypeShipment@') ;
   358         END IF;
   357         END IF;
   359         SELECT COUNT(*), MAX(M.line),MAX(O.documentno),Max(OL.line)
   358         SELECT COUNT(*), MAX(M.line), MAX(O.documentno), Max(OL.line)
   360         INTO v_Count, v_line,v_orderDocumentNo, v_orderlineno
   359         INTO v_Count, v_line, v_OrderDocumentNo, v_OrderLineNo
   361         FROM M_InOutLine M
   360         FROM M_InOutLine M
   362         left join C_orderLine OL on OL.c_orderline_id=M.c_orderline_id
   361         JOIN M_Product P
   363         left join C_Order O on OL.C_Order_id=O.C_Order_id
   362         ON M.m_product_id = P.m_product_id
   364         join m_product P on P.m_product_id = M.m_product_id
   363         LEFT JOIN C_OrderLine OL
       
   364         ON M.c_orderline_id = OL.c_orderline_id
       
   365         LEFT JOIN C_Order O
       
   366         ON OL.c_order_id = O.c_order_id
   365         WHERE P.M_ATTRIBUTESET_ID IS NOT NULL
   367         WHERE P.M_ATTRIBUTESET_ID IS NOT NULL
   366           AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
   368           AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
   367           AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
   369           AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
   368           AND COALESCE(M.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
   370           AND COALESCE(M.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
   369           AND M.M_INOUT_ID=v_Record_ID;
   371           AND M.M_INOUT_ID=v_Record_ID;
   370         IF v_Count<>0 THEN
   372         IF (v_Count <> 0) THEN
   371           RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@'||': '||'@INS_POREFERENCE@'||' '||v_orderDocumentNo ||' '||'@OrderLine@' ||' ' || v_orderlineno);
   373           IF (v_orderDocumentNo IS NULL) THEN
       
   374             RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@');
       
   375           ELSE
       
   376             RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@'||'. '||'@INS_POREFERENCE@'||' '||v_OrderDocumentNo||' '||'@line@'||' '||v_OrderLineNo);
       
   377           END IF;
   372         END IF;
   378         END IF;
   373         SELECT COUNT(*), MAX(M.line)
   379         SELECT COUNT(*), MAX(M.line)
   374         INTO v_Count, v_Line
   380         INTO v_Count, v_Line
   375         FROM M_InOut I,
   381         FROM M_InOut I,
   376           M_InOutLine M,
   382           M_InOutLine M,