Attached Files | 27304.diff [^] (4,315 bytes) 2014-08-11 13:15 [Show Content] [Hide Content]--- a/src-db/database/model/functions/M_PRODUCTION_RUN.xml 2014-07-30 16:41:47.273460000 +0200
+++ b/src-db/database/model/functions/M_PRODUCTION_RUN.xml 2014-08-01 18:05:24.151441788 +0200
@@ -33,7 +33,11 @@
************************************************************************/
-- Logistice
v_ResultStr VARCHAR2(2000):='';
+ v_ProductOutOfStock VARCHAR2(2000):='';
+ v_ProductMCheckStock VARCHAR2(2000):='';
v_Message VARCHAR2(2000):='';
+ v_IndentTitle varchar(2000):='';
+ v_IndentChange varchar(2000):='';
v_Record_ID VARCHAR2(32);
v_Result NUMBER:=1;
v_is_included NUMBER:=0;
@@ -351,14 +355,17 @@
END IF;
v_Line:=v_Line;
IF (v_QtyAcumulated < CUR_BOM.BOMQTY*CUR_BOM.ProductionQty) AND MustBeStocked='Y' THEN
- v_Message := '@NotEnoughStocked@: ' || CUR_BOM.pname || ' ' || v_QtyAcumulated || ' / '|| CUR_BOM.BOMQTY*CUR_BOM.ProductionQty;
- RAISE_APPLICATION_ERROR(-20000, v_Message);
+ v_ProductOutOfStock:='<i>'||v_ProductOutOfStock||' '|| CUR_BOM.pname ||' - {' || v_QtyAcumulated || ' / '|| CUR_BOM.BOMQTY*CUR_BOM.ProductionQty||'}</i><br>';
END IF;
IF (CUR_BOM.ProductionQty <= 0) THEN
v_Message := '@NegativeBOMProductionQty@';
RAISE_APPLICATION_ERROR(-20000, v_Message);
END IF;
END LOOP;
+ --If the product doesn't have enough materials to be creaed
+ IF v_ProductOutOfStock<>'' THEN
+ RAISE_APPLICATION_ERROR(-20000, '@NotEnoughStocked@ <br>'||v_ProductOutOfStock);
+ END IF;
IF (CUR_STOCK_ISOPEN) THEN
CLOSE CUR_STOCK;
CUR_STOCK_ISOPEN := false;
@@ -531,7 +538,7 @@
-- All Production Lines
FOR CUR_PL_Post IN (
SELECT pl.M_ProductionLine_ID, pl.AD_Client_ID, pl.AD_Org_ID, p.MovementDate,
- pl.M_Product_ID, pl.M_AttributeSetInstance_ID, pl.MovementQty, pl.M_Locator_ID,
+ pl.M_Product_ID, pl.M_AttributeSetInstance_ID, pl.MovementQty,pp.m_product_id as m_productionplan_id, pl.M_Locator_ID,
pl.M_Product_UOM_ID, pl.QuantityOrder, pl.C_UOM_ID, pl.LINE
FROM M_PRODUCTION p, M_PRODUCTIONLINE pl, M_PRODUCTIONPLAN pp
WHERE p.M_Production_ID=pp.M_Production_ID
@@ -544,11 +551,11 @@
-- DBMS_OUTPUT.PUT_LINE(' Qty=' || pl.MovementQty || ', OnHand=' || M_BOM_Qty_OnHand(pl.M_Product_ID, NULL, pl.M_Locator_ID));
-- Check Stock levels for reductions
IF (CUR_PL_Post.MovementQty<0 AND MustBeStocked<>'N' AND M_BOM_Qty_OnHand(CUR_PL_Post.M_Product_ID, NULL, CUR_PL_Post.M_Locator_ID) +CUR_PL_Post.MovementQty<0) THEN
- SELECT '@NotEnoughStocked@: ' || Name INTO v_Message
+ SELECT Name INTO v_Message
FROM M_PRODUCT
WHERE M_Product_ID=CUR_PL_Post.M_Product_ID;
- RAISE_APPLICATION_ERROR(-20000, v_Message);
- END IF;
+ v_ProductOutOfStock:=v_ProductOutOfStock||'<i> @Inline@ ' || CUR_PL_Post.line||': '||v_Message||'</i><br> ';
+ END IF;
-- Create Transaction Entry
v_ResultStr:='CreateTransaction';
INSERT INTO M_TRANSACTION (
@@ -568,10 +575,26 @@
);
M_Check_Stock(CUR_PL_Post.M_Product_ID, v_Client_ID, v_Org_ID, v_Result, v_Message) ;
IF (v_Result = 0) THEN
- v_Message:=v_Message || ' @Inline@ ' || CUR_PL_Post.line;
- RAISE_APPLICATION_ERROR(-20000, v_Message);
+ SELECT Name INTO v_IndentTitle
+ FROM M_PRODUCT
+ WHERE M_Product_ID=CUR_PL_Post.m_productionplan_id;
+ IF v_IndentTitle<>v_IndentChange THEN
+ v_ProductMCheckStock:=v_ProductMCheckStock||' '||v_IndentTitle||'<br>';
+ v_IndentChange:=v_IndentTitle;
+ END IF;
+ SELECT Name INTO v_Message
+ FROM M_PRODUCT
+ WHERE M_Product_ID=CUR_PL_Post.M_Product_ID;
+ v_ProductMCheckStock:=v_ProductMCheckStock||'<i>        @Inline@ ' || CUR_PL_Post.line||': '||v_Message||'</i><br> ';
END IF;
END LOOP;
+ -- If any product is out of stock
+ IF v_ProductOutOfStock<>'' THEN
+ RAISE_APPLICATION_ERROR(-20000, '@NotEnoughStocked@ <br>'||v_ProductOutOfStock);
+ END IF;
+ IF v_ProductMCheckStock<>'' THEN
+ RAISE_APPLICATION_ERROR(-20000, '@NotEnoughStocked@ <br>'||v_ProductMCheckStock);
+ END IF;
-- Indicate that we are done
UPDATE M_PRODUCTION
SET Processed='Y',
|