Integrate [ 1936311 ] Migration of existing BOM to Libero BOM
Contribution from Tony tspc
This commit is contained in:
parent
a1c7ef4d84
commit
9d8cf4ff4c
|
@ -0,0 +1,14 @@
|
|||
CREATE OR REPLACE FUNCTION nextidfunc (
|
||||
p_ad_sequence_id IN NUMBER,
|
||||
p_system IN CHAR
|
||||
)
|
||||
RETURN NUMBER
|
||||
IS
|
||||
PRAGMA AUTONOMOUS_TRANSACTION;
|
||||
tmpvar NUMBER;
|
||||
BEGIN
|
||||
Nextid (p_ad_sequence_id, p_system, tmpvar);
|
||||
COMMIT;
|
||||
RETURN tmpvar;
|
||||
END nextidfunc;
|
||||
/
|
|
@ -0,0 +1,14 @@
|
|||
CREATE OR REPLACE FUNCTION nextidfunc (
|
||||
p_ad_sequence_id IN NUMBER,
|
||||
p_system IN CHAR
|
||||
)
|
||||
RETURN NUMBER
|
||||
IS
|
||||
PRAGMA AUTONOMOUS_TRANSACTION;
|
||||
tmpvar NUMBER;
|
||||
BEGIN
|
||||
Nextid (p_ad_sequence_id, p_system, tmpvar);
|
||||
COMMIT;
|
||||
RETURN tmpvar;
|
||||
END nextidfunc;
|
||||
/
|
|
@ -0,0 +1,73 @@
|
|||
INSERT INTO PP_PRODUCT_BOM
|
||||
(pp_product_bom_id, ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, bomtype, VALUE,
|
||||
NAME, description, help, documentno, revision, copyfrom,
|
||||
m_changenotice_id, processing, validfrom, validto,
|
||||
m_attributesetinstance_id, bomuse, c_uom_id)
|
||||
SELECT m_product_id, ad_client_id, ad_org_id, isactive, created, createdby,
|
||||
updated, updatedby, m_product_id, 'A', VALUE, NAME, description,
|
||||
help,
|
||||
nextidfunc ((SELECT ad_sequence_id
|
||||
FROM AD_SEQUENCE
|
||||
WHERE ad_client_id = mp.ad_client_id
|
||||
AND NAME = 'DocumentNo_PP_Product_BOM'),
|
||||
'N'
|
||||
),
|
||||
NULL, NULL, NULL, NULL, created, NULL, NULL, 'M', c_uom_id
|
||||
FROM M_PRODUCT mp
|
||||
WHERE isbom = 'Y' AND m_product_id < 1000000;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOM
|
||||
(pp_product_bom_id, ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, bomtype, VALUE,
|
||||
NAME, description, help, documentno, revision, copyfrom,
|
||||
m_changenotice_id, processing, validfrom, validto,
|
||||
m_attributesetinstance_id, bomuse, c_uom_id)
|
||||
SELECT nextidfunc (53015, 'N'), ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, 'A', VALUE, NAME,
|
||||
description, help,
|
||||
nextidfunc ((SELECT ad_sequence_id
|
||||
FROM AD_SEQUENCE
|
||||
WHERE ad_client_id = mp.ad_client_id
|
||||
AND NAME = 'DocumentNo_PP_Product_BOM'),
|
||||
'N'
|
||||
),
|
||||
NULL, NULL, NULL, NULL, created, NULL, NULL, 'M', c_uom_id
|
||||
FROM M_PRODUCT mp
|
||||
WHERE isbom = 'Y' AND m_product_id > 999999;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOMLINE
|
||||
(pp_product_bomline_id, ad_client_id, ad_org_id, isactive,
|
||||
created, createdby, updated, updatedby, line, m_product_id,
|
||||
pp_product_bom_id, qtybom, description, help, feature, assay,
|
||||
backflushgroup, c_uom_id, componenttype, forecast, iscritical,
|
||||
isqtypercentage, issuemethod, leadtimeoffset,
|
||||
m_attributesetinstance_id, m_changenotice_id, qtybatch, scrap,
|
||||
validfrom, validto)
|
||||
SELECT mpb.m_product_bom_id, mpb.ad_client_id, mpb.ad_org_id, mpb.isactive,
|
||||
mpb.created, mpb.createdby, mpb.updated, mpb.updatedby, mpb.line,
|
||||
mpb.m_productbom_id, ppb.pp_product_bom_id, mpb.bomqty,
|
||||
mpb.description, NULL, NULL, 0, NULL, mp.c_uom_id, 'CO', 0, 'N',
|
||||
'N', '0', 0, NULL, NULL, 0, 0, mpb.created, NULL
|
||||
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp
|
||||
WHERE mpb.m_product_id = ppb.m_product_id
|
||||
AND mpb.m_productbom_id = mp.m_product_id
|
||||
AND mpb.m_product_bom_id < 1000000;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOMLINE
|
||||
(pp_product_bomline_id, ad_client_id, ad_org_id, isactive,
|
||||
created, createdby, updated, updatedby, line, m_product_id,
|
||||
pp_product_bom_id, qtybom, description, help, feature, assay,
|
||||
backflushgroup, c_uom_id, componenttype, forecast, iscritical,
|
||||
isqtypercentage, issuemethod, leadtimeoffset,
|
||||
m_attributesetinstance_id, m_changenotice_id, qtybatch, scrap,
|
||||
validfrom, validto)
|
||||
SELECT nextidfunc (53016, 'N'), mpb.ad_client_id, mpb.ad_org_id,
|
||||
mpb.isactive, mpb.created, mpb.createdby, mpb.updated,
|
||||
mpb.updatedby, mpb.line, mpb.m_productbom_id, ppb.pp_product_bom_id,
|
||||
mpb.bomqty, mpb.description, NULL, NULL, 0, NULL, mp.c_uom_id, 'CO',
|
||||
0, 'N', 'N', '0', 0, NULL, NULL, 0, 0, mpb.created, NULL
|
||||
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp
|
||||
WHERE mpb.m_product_id = ppb.m_product_id
|
||||
AND mpb.m_productbom_id = mp.m_product_id
|
||||
AND mpb.m_product_bom_id > 999999;
|
|
@ -0,0 +1,2 @@
|
|||
-- placeholder
|
||||
-- migration script just for oracle
|
|
@ -0,0 +1,73 @@
|
|||
INSERT INTO PP_PRODUCT_BOM
|
||||
(pp_product_bom_id, ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, bomtype, VALUE,
|
||||
NAME, description, help, documentno, revision, copyfrom,
|
||||
m_changenotice_id, processing, validfrom, validto,
|
||||
m_attributesetinstance_id, bomuse, c_uom_id)
|
||||
SELECT m_product_id, ad_client_id, ad_org_id, isactive, created, createdby,
|
||||
updated, updatedby, m_product_id, 'A', VALUE, NAME, description,
|
||||
help,
|
||||
Nextid ((SELECT ad_sequence_id
|
||||
FROM AD_SEQUENCE
|
||||
WHERE ad_client_id = mp.ad_client_id
|
||||
AND NAME = 'DocumentNo_PP_Product_BOM')::integer,
|
||||
'N'
|
||||
),
|
||||
NULL, NULL, NULL, NULL, created, NULL, NULL, 'M', c_uom_id
|
||||
FROM M_PRODUCT mp
|
||||
WHERE isbom = 'Y' AND m_product_id < 1000000;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOM
|
||||
(pp_product_bom_id, ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, bomtype, VALUE,
|
||||
NAME, description, help, documentno, revision, copyfrom,
|
||||
m_changenotice_id, processing, validfrom, validto,
|
||||
m_attributesetinstance_id, bomuse, c_uom_id)
|
||||
SELECT Nextid (53015, 'N'), ad_client_id, ad_org_id, isactive, created,
|
||||
createdby, updated, updatedby, m_product_id, 'A', VALUE, NAME,
|
||||
description, help,
|
||||
Nextid ((SELECT ad_sequence_id
|
||||
FROM AD_SEQUENCE
|
||||
WHERE ad_client_id = mp.ad_client_id
|
||||
AND NAME = 'DocumentNo_PP_Product_BOM')::integer,
|
||||
'N'
|
||||
),
|
||||
NULL, NULL, NULL, NULL, created, NULL, NULL, 'M', c_uom_id
|
||||
FROM M_PRODUCT mp
|
||||
WHERE isbom = 'Y' AND m_product_id > 999999;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOMLINE
|
||||
(pp_product_bomline_id, ad_client_id, ad_org_id, isactive,
|
||||
created, createdby, updated, updatedby, line, m_product_id,
|
||||
pp_product_bom_id, qtybom, description, help, feature, assay,
|
||||
backflushgroup, c_uom_id, componenttype, forecast, iscritical,
|
||||
isqtypercentage, issuemethod, leadtimeoffset,
|
||||
m_attributesetinstance_id, m_changenotice_id, qtybatch, scrap,
|
||||
validfrom, validto)
|
||||
SELECT mpb.m_product_bom_id, mpb.ad_client_id, mpb.ad_org_id, mpb.isactive,
|
||||
mpb.created, mpb.createdby, mpb.updated, mpb.updatedby, mpb.line,
|
||||
mpb.m_productbom_id, ppb.pp_product_bom_id, mpb.bomqty,
|
||||
mpb.description, NULL, NULL, 0, NULL, mp.c_uom_id, 'CO', 0, 'N',
|
||||
'N', '0', 0, NULL, NULL, 0, 0, mpb.created, NULL
|
||||
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp
|
||||
WHERE mpb.m_product_id = ppb.m_product_id
|
||||
AND mpb.m_productbom_id = mp.m_product_id
|
||||
AND mpb.m_product_bom_id < 1000000;
|
||||
|
||||
INSERT INTO PP_PRODUCT_BOMLINE
|
||||
(pp_product_bomline_id, ad_client_id, ad_org_id, isactive,
|
||||
created, createdby, updated, updatedby, line, m_product_id,
|
||||
pp_product_bom_id, qtybom, description, help, feature, assay,
|
||||
backflushgroup, c_uom_id, componenttype, forecast, iscritical,
|
||||
isqtypercentage, issuemethod, leadtimeoffset,
|
||||
m_attributesetinstance_id, m_changenotice_id, qtybatch, scrap,
|
||||
validfrom, validto)
|
||||
SELECT Nextid (53016, 'N'), mpb.ad_client_id, mpb.ad_org_id, mpb.isactive,
|
||||
mpb.created, mpb.createdby, mpb.updated, mpb.updatedby, mpb.line,
|
||||
mpb.m_productbom_id, ppb.pp_product_bom_id, mpb.bomqty,
|
||||
mpb.description, NULL, NULL, 0, NULL, mp.c_uom_id, 'CO', 0, 'N',
|
||||
'N', '0', 0, NULL, NULL, 0, 0, mpb.created, NULL
|
||||
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp
|
||||
WHERE mpb.m_product_id = ppb.m_product_id
|
||||
AND mpb.m_productbom_id = mp.m_product_id
|
||||
AND mpb.m_product_bom_id > 999999;
|
|
@ -22,6 +22,10 @@ SQLActions[ ] = {
|
|||
AS 'org.compiere.sqlj.Adempiere.nextID(int,java.lang.String)'
|
||||
LANGUAGE java VOLATILE;
|
||||
|
||||
CREATE OR REPLACE FUNCTION nextIDfunc(AD_Sequence_ID INTEGER, System VARCHAR)
|
||||
RETURNS INTEGER
|
||||
AS 'org.compiere.sqlj.Adempiere.nextIDfunc(int,java.lang.String)'
|
||||
LANGUAGE java VOLATILE;
|
||||
|
||||
/** Product **/
|
||||
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMERIC)
|
||||
|
|
|
@ -516,6 +516,18 @@ public class Adempiere implements Serializable
|
|||
return retValue;
|
||||
} // nextID
|
||||
|
||||
/**
|
||||
* Next ID Function
|
||||
* @param AD_Sequence_ID sequence
|
||||
* @param System system
|
||||
* @return ID or -1
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static int nextIDfunc (int AD_Sequence_ID, String System)
|
||||
throws SQLException
|
||||
{
|
||||
return nextID(AD_Sequence_ID, System);
|
||||
} // nextIDfunc
|
||||
|
||||
/**
|
||||
* get current Date (Timestamp)
|
||||
|
|
Loading…
Reference in New Issue