IDEMPIERE-1250 Multiple BOM (formulas) support for mfg-light (#906)

* IDEMPIERE-1250 Multiple BOM (formulas) support for mfg-light

* IDEMPIERE-1250 Multiple BOM (formulas) support for mfg-light

Fix deprecation warnings

* Update 202109291600_IDEMPIERE-1250.sql

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
hengsin 2021-10-06 23:06:26 +08:00 committed by GitHub
parent 398333e645
commit 8fbac60b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 3186 additions and 566 deletions

View File

@ -0,0 +1,956 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 23, 2021 5:21:44 PM MYT
UPDATE AD_Process SET Name='Copy BOM Lines From',Updated=TO_DATE('2021-09-23 17:21:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53004
;
-- Sep 23, 2021 5:22:14 PM MYT
UPDATE AD_Process_Para SET AD_Reference_ID=30,Updated=TO_DATE('2021-09-23 17:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53027
;
-- Sep 23, 2021 5:23:00 PM MYT
UPDATE AD_Column SET DefaultValue='A',Updated=TO_DATE('2021-09-23 17:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53343
;
-- Sep 23, 2021 5:27:12 PM MYT
UPDATE AD_Window SET Name='Bill of Materials & Formula', Description='Maintain Product Bill of Materials & Formula',Updated=TO_DATE('2021-09-23 17:27:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=53006
;
-- Sep 23, 2021 5:28:01 PM MYT
UPDATE AD_Field SET IsDisplayed='N', IsDisplayedGrid='N',Updated=TO_DATE('2021-09-23 17:28:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 23, 2021 5:35:38 PM MYT
UPDATE AD_Menu SET IsActive='Y', AD_Window_ID=53006,Updated=TO_TIMESTAMP('2021-09-23 17:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53298
;
-- Sep 23, 2021 5:36:52 PM MYT
UPDATE AD_Table SET IsDeleteable='N', IsView='Y',Updated=TO_DATE('2021-09-23 17:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
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, revision, copyfrom,
m_changenotice_id, processing, validfrom, validto,
m_attributesetinstance_id, bomuse, c_uom_id, pp_product_bom_uu)
SELECT Nextidfunc (53015, 'N'), ad_client_id, ad_org_id, isactive, created,
createdby, updated, updatedby, m_product_id, 'A', VALUE,
cast(NAME as character varying(60)), description, help,
NULL, NULL, NULL, NULL, created, NULL, NULL, 'A', c_uom_id, generate_uuid()
FROM M_PRODUCT
WHERE isbom = 'Y' AND m_product_id > 999999
AND NOT EXISTS
( SELECT x.m_product_id FROM pp_product_bom x WHERE x.m_product_id=m_product.m_product_id AND x.value=m_product.value)
;
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, pp_product_bomline_uu)
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, mpb.M_PRODUCT_BOM_UU
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp, M_Product pp
WHERE mpb.m_product_id = ppb.m_product_id
AND ppb.m_product_id = pp.m_product_id
AND ppb.value = pp.value
AND mpb.m_productbom_id = mp.m_product_id
AND mpb.m_product_bom_id > 999999
;
UPDATE PP_PRODUCT_BOMLINE SET PP_PRODUCT_BOMLINE_UU = generate_uuid() WHERE pp_product_bomline_uu IS NULL
;
ALTER TABLE m_product_bom RENAME TO m_product_bom_old
;
CREATE OR REPLACE VIEW m_product_bom
(
m_product_bom_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, line, m_product_id, m_productbom_id,
bomqty, description, bomtype, m_product_bom_uu
) AS
SELECT l.pp_product_bomline_id, l.ad_client_id, l.ad_org_id, l.isactive, l.created, l.createdby, l.updated, l.updatedby, l.line, b.m_product_id, l.m_product_id,
l.qtybom, b.description,
CASE l.componenttype WHEN 'OP' THEN 'O' WHEN 'CO' THEN 'P' WHEN 'PH' THEN 'P' WHEN 'PK' THEN 'P' WHEN 'VA' THEN
CASE WHEN l.feature in ('1','2','3','4','5','6','7','8','9') THEN l.feature ELSE 'O' END
ELSE 'P'
END AS bomtype, l.pp_product_bomline_uu
FROM pp_product_bom b
JOIN pp_product_bomline l ON b.pp_product_bom_id=l.pp_product_bom_id
WHERE b.bomtype='A' AND b.bomuse='A' AND b.isactive='Y'
;
-- Sep 24, 2021 2:59:59 PM MYT
UPDATE AD_Table SET IsChangeLog='N',Updated=TO_TIMESTAMP('2021-09-24 14:59:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
-- Sep 24, 2021 3:00:26 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:00:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723
;
-- Sep 24, 2021 3:00:42 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:00:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8555
;
-- Sep 24, 2021 3:01:05 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4724
;
-- Sep 24, 2021 3:01:15 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4716
;
-- Sep 24, 2021 3:01:38 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N', DefaultValue=NULL,Updated=TO_TIMESTAMP('2021-09-24 15:01:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4770
;
-- Sep 24, 2021 3:01:57 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4722
;
-- Sep 24, 2021 3:02:04 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N',Updated=TO_TIMESTAMP('2021-09-24 15:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60923
;
-- Sep 24, 2021 3:02:15 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:02:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4721
;
-- Sep 24, 2021 2:22:50 PM MYT
UPDATE AD_Field SET IsDisplayed='N', IsDisplayedGrid='N', IsActive='N',Updated=TO_TIMESTAMP('2021-09-24 14:22:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 24, 2021 2:23:20 PM MYT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2021-09-24 14:23:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53323
;
-- Sep 24, 2021 2:30:22 PM MYT
INSERT INTO AD_Message (AD_Message_ID,AD_Client_ID,Updated,AD_Org_ID,MsgText,MsgType,Created,EntityType,CreatedBy,UpdatedBy,Value,AD_Message_UU,IsActive) VALUES (200402,0,TO_TIMESTAMP('2021-09-24 14:30:15','YYYY-MM-DD HH24:MI:SS'),0,'You can only set one default BOM ( BOM Type is Current Active and BOM Use is Master ) for a product.','E',TO_TIMESTAMP('2021-09-24 14:30:15','YYYY-MM-DD HH24:MI:SS'),'D',100,100,'OnlyOneCurrentActiveMasterBOM','56bbf336-47fb-4bf1-94fb-9cc643db733c','Y')
;
-- Sep 24, 2021 3:04:31 PM MYT
UPDATE AD_Tab SET IsReadOnly='Y', IsInsertRecord='N',Updated=TO_TIMESTAMP('2021-09-24 15:04:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
-- Sep 25, 2021 5:57:35 PM MYT
UPDATE AD_Field SET DisplayLogic='@ComponentType@=''VA''|@ComponentType@=''OP''',Updated=TO_DATE('2021-09-25 17:57:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 25, 2021 5:58:55 PM MYT
UPDATE AD_Field SET DisplayLogic='@ComponentType@=''VA''|@ComponentType@=''OP''',Updated=TO_DATE('2021-09-25 17:58:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 26, 2021 3:58:50 PM MYT
UPDATE AD_Column SET DefaultValue='-1',Updated=TO_DATE('2021-09-26 15:58:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53364
;
-- Sep 26, 2021 3:59:41 PM MYT
UPDATE AD_Tab SET IsActive='N',Updated=TO_DATE('2021-09-26 15:59:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=317
;
-- Sep 26, 2021 4:00:07 PM MYT
UPDATE AD_Tab SET DisplayLogic='@IsBOM@=''Y''',IsActive='Y',Updated=TO_DATE('2021-09-26 16:00:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53286
;
-- Sep 26, 2021 4:01:23 PM MYT
UPDATE AD_Tab SET DisplayLogic='@IsBOM@=''Y''',IsActive='Y',Updated=TO_DATE('2021-09-26 16:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53287
;
-- Sep 26, 2021 4:02:54 PM MYT
UPDATE AD_Tab SET IsSingleRow='Y',Updated=TO_DATE('2021-09-26 16:02:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53287
;
-- Sep 27, 2021 11:36:52 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2021-09-27 11:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53338
;
-- Sep 27, 2021 11:36:59 AM MYT
ALTER TABLE PP_Product_BOM MODIFY ValidFrom DATE DEFAULT NULL
;
-- Sep 27, 2021 11:36:59 AM MYT
ALTER TABLE PP_Product_BOM MODIFY ValidFrom NULL
;
-- Sep 27, 2021 11:38:02 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53359
;
-- Sep 27, 2021 11:38:08 AM MYT
ALTER TABLE PP_Product_BOMLine MODIFY IssueMethod CHAR(1) DEFAULT '1'
;
-- Sep 27, 2021 11:38:10 AM MYT
ALTER TABLE PP_Product_BOMLine MODIFY IssueMethod NULL
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53473
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53472
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53469
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53476
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53465
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53466
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53467
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53468
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53471
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53477
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53478
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53480
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53473
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53472
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53469
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53476
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53462
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53463
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53474
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53475
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53464
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53465
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53466
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53467
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53468
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53471
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53477
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53478
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53480
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58081
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53504
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53505
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53503
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53502
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53501
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53499
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53497
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53496
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53491
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53490
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53489
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53500
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53493
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:46:36 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53504
;
-- Sep 27, 2021 11:46:36 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53505
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53503
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53501
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53502
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58081
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53499
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53497
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53496
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53491
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53490
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53489
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53500
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53493
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=30, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53492
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53494
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=60,Updated=TO_DATE('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=90,Updated=TO_DATE('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=100, ColumnSpan=2,Updated=TO_DATE('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:48:50 AM MYT
UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2021-09-27 11:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:50:02 AM MYT
UPDATE AD_Table SET AD_Window_ID=140,Updated=TO_DATE('2021-09-27 11:50:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53018
;
-- Sep 27, 2021 11:50:27 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53372
;
-- Sep 27, 2021 11:50:33 AM MYT
ALTER TABLE PP_Product_BOMLine MODIFY ValidFrom DATE DEFAULT NULL
;
-- Sep 27, 2021 11:50:33 AM MYT
ALTER TABLE PP_Product_BOMLine MODIFY ValidFrom NULL
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58100
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58097
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58096
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58094
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58093
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58088
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58089
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58090
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58091
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58092
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58095
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58098
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58099
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58101
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58100
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58097
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58096
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58094
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58093
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58088
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58083
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58084
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58085
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58086
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58087
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58089
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58090
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58091
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58092
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58095
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58098
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58099
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58101
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58124
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58123
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58122
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58121
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58120
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58118
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58117
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58116
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58115
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58114
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58113
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58108
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58109
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58124
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58123
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58122
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58121
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58120
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58118
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58117
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58116
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58115
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58114
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58113
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58108
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58109
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 11:54:21 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_DATE('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:55:01 AM MYT
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:55:01 AM MYT
UPDATE AD_Field SET SeqNo=30,Updated=TO_DATE('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58106
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58107
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=60,Updated=TO_DATE('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=90,Updated=TO_DATE('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:55:03 AM MYT
UPDATE AD_Field SET SeqNo=100, ColumnSpan=2,Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:55:03 AM MYT
UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:12:50 PM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 12:13:05 PM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 12:13:05 PM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 12:13:48 PM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:13:55 PM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:13:55 PM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_DATE('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 28, 2021 6:30:10 PM MYT
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,Name,Updated,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,Created,EntityType,AD_Org_ID) VALUES ('PP_Product_BOM.IsActive=''Y'' AND PP_Product_BOM.M_Product_ID=@M_Product_ID@ AND PP_Product_BOM.AD_Org_ID IN (0,@AD_Org_ID@)',200136,'PP_Product_BOM of M_Product',TO_DATE('2021-09-28 18:30:09','YYYY-MM-DD HH24:MI:SS'),'S','de413613-585d-40b9-a801-82a9f725d442',100,100,'Y',0,TO_DATE('2021-09-28 18:30:09','YYYY-MM-DD HH24:MI:SS'),'D',0)
;
-- Sep 28, 2021 6:33:43 PM MYT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,IsRange,AD_Process_Para_UU,AD_Reference_ID,AD_Val_Rule_ID,IsMandatory,EntityType,CreatedBy,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,Updated,UpdatedBy,IsEncrypted,Created,AD_Client_ID,AD_Element_ID,AD_Process_ID,AD_Org_ID) VALUES (200278,'N','95eb329b-9484-4cdb-aa83-534166ba8288',19,200136,'Y','D',100,'BOM & Formula','PP_Product_BOM_ID','BOM & Formula',10,'Y',30,'@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc LIMIT 1','Y',TO_DATE('2021-09-28 18:33:42','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_DATE('2021-09-28 18:33:42','YYYY-MM-DD HH24:MI:SS'),0,53245,53226,0)
;
-- Sep 28, 2021 8:57:21 PM MYT
UPDATE AD_Process_Para SET DefaultValue='@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc',Updated=TO_DATE('2021-09-28 20:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
-- Sep 28, 2021 8:57:44 PM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200056, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200056)
;
-- Sep 28, 2021 9:04:59 PM MYT
UPDATE AD_Process_Para SET DefaultValue='@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE M_Product_ID=@M_Product_ID@ AND BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc',Updated=TO_DATE('2021-09-28 21:04:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
-- Sep 28, 2021 9:05:15 PM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200057, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200057)
;
-- Sep 29, 2021 10:45:24 AM MYT
INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,DefaultValue,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Val_Rule_ID,AD_Table_ID,IsToolbarButton,AD_Reference_ID,AD_Org_ID) VALUES (213948,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','3abf2f17-51e0-448d-b6f8-42564b7d5f70',TO_DATE('2021-09-29 10:45:22','YYYY-MM-DD HH24:MI:SS'),'Y','PP_Product_BOM_ID','BOM & Formula','@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE M_Product_ID=@M_Product_ID@ AND BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc','BOM & Formula','N','Y',100,100,'N',0,TO_DATE('2021-09-29 10:45:22','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',53245,200136,325,'N',19,0)
;
-- Sep 29, 2021 10:45:39 AM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200058, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200058)
;
-- Sep 29, 2021 10:45:41 AM MYT
UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PPProductBOM_MProduction',Updated=TO_DATE('2021-09-29 10:45:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213948
;
-- Sep 29, 2021 10:45:41 AM MYT
ALTER TABLE M_Production ADD PP_Product_BOM_ID NUMBER(10) DEFAULT NULL
;
-- Sep 29, 2021 10:45:42 AM MYT
ALTER TABLE M_Production ADD CONSTRAINT PPProductBOM_MProduction FOREIGN KEY (PP_Product_BOM_ID) REFERENCES pp_product_bom(pp_product_bom_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 29, 2021 10:51:33 AM MYT
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID,AD_Org_ID) VALUES (0,206081,'N',0,'N','N',95,'Y','Y',TO_DATE('2021-09-29 10:51:32','YYYY-MM-DD HH24:MI:SS'),'BOM & Formula','BOM & Formula','390e17df-7857-4cfa-82e4-64e6d29b2a73','Y','N',100,100,'Y','Y',105,1,'N',0,TO_DATE('2021-09-29 10:51:32','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',213948,'D',53344,0)
;
-- Sep 29, 2021 11:29:46 AM MYT
UPDATE AD_Process_Para SET DisplayLogic='@IsUseProductionPlan@=N',Updated=TO_DATE('2021-09-29 11:29:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
UPDATE PP_Product_BOM SET BOMUSE='A' WHERE AD_Client_ID=11 AND BOMType='A' AND IsActive='Y' AND M_Product_ID < 1000000
;
SELECT Register_Migration_Script ('202109291600_IDEMPIERE-1250.sql') FROM DUAL
;

View File

@ -0,0 +1,953 @@
-- Sep 23, 2021 5:21:44 PM MYT
UPDATE AD_Process SET Name='Copy BOM Lines From',Updated=TO_TIMESTAMP('2021-09-23 17:21:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=53004
;
-- Sep 23, 2021 5:22:14 PM MYT
UPDATE AD_Process_Para SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2021-09-23 17:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53027
;
-- Sep 23, 2021 5:23:00 PM MYT
UPDATE AD_Column SET DefaultValue='A',Updated=TO_TIMESTAMP('2021-09-23 17:23:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53343
;
-- Sep 23, 2021 5:27:12 PM MYT
UPDATE AD_Window SET Name='Bill of Materials & Formula', Description='Maintain Product Bill of Materials & Formula',Updated=TO_TIMESTAMP('2021-09-23 17:27:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Window_ID=53006
;
-- Sep 23, 2021 5:28:01 PM MYT
UPDATE AD_Field SET IsDisplayed='N', IsDisplayedGrid='N',Updated=TO_TIMESTAMP('2021-09-23 17:28:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 23, 2021 5:35:38 PM MYT
UPDATE AD_Menu SET IsActive='Y', AD_Window_ID=53006,Updated=TO_TIMESTAMP('2021-09-23 17:35:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53298
;
-- Sep 23, 2021 5:36:52 PM MYT
UPDATE AD_Table SET IsDeleteable='N', IsView='Y',Updated=TO_TIMESTAMP('2021-09-23 17:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
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, revision, copyfrom,
m_changenotice_id, processing, validfrom, validto,
m_attributesetinstance_id, bomuse, c_uom_id, pp_product_bom_uu)
SELECT Nextid (53015, 'N'), ad_client_id, ad_org_id, isactive, created,
createdby, updated, updatedby, m_product_id, 'A', VALUE,
cast(NAME as character varying(60)), description, help,
NULL, NULL, NULL, NULL, created, NULL, NULL, 'A', c_uom_id, generate_uuid()
FROM M_PRODUCT
WHERE isbom = 'Y' AND m_product_id > 999999
AND NOT EXISTS
( SELECT x.m_product_id FROM pp_product_bom x WHERE x.m_product_id=m_product.m_product_id AND x.value=m_product.value)
;
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, pp_product_bomline_uu)
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, mpb.M_PRODUCT_BOM_UU
FROM M_PRODUCT_BOM mpb, PP_PRODUCT_BOM ppb, M_PRODUCT mp, M_Product pp
WHERE mpb.m_product_id = ppb.m_product_id
AND ppb.m_product_id = pp.m_product_id
AND ppb.value = pp.value
AND mpb.m_productbom_id = mp.m_product_id
AND mpb.m_product_bom_id > 999999
;
UPDATE PP_PRODUCT_BOMLINE SET PP_PRODUCT_BOMLINE_UU = generate_uuid() WHERE pp_product_bomline_uu IS NULL
;
ALTER TABLE m_product_bom RENAME TO m_product_bom_old
;
CREATE OR REPLACE VIEW m_product_bom
(
m_product_bom_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, line, m_product_id, m_productbom_id,
bomqty, description, bomtype, m_product_bom_uu
) AS
SELECT l.pp_product_bomline_id, l.ad_client_id, l.ad_org_id, l.isactive, l.created, l.createdby, l.updated, l.updatedby, l.line, b.m_product_id, l.m_product_id,
l.qtybom, b.description,
CASE l.componenttype WHEN 'OP' THEN 'O' WHEN 'CO' THEN 'P' WHEN 'PH' THEN 'P' WHEN 'PK' THEN 'P' WHEN 'VA' THEN
CASE WHEN l.feature in ('1','2','3','4','5','6','7','8','9') THEN l.feature ELSE 'O' END
ELSE 'P'
END AS bomtype, l.pp_product_bomline_uu
FROM pp_product_bom b
JOIN pp_product_bomline l ON b.pp_product_bom_id=l.pp_product_bom_id
WHERE b.bomtype='A' AND b.bomuse='A' AND b.isactive='Y'
;
-- Sep 24, 2021 2:59:59 PM MYT
UPDATE AD_Table SET IsChangeLog='N',Updated=TO_TIMESTAMP('2021-09-24 14:59:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
-- Sep 24, 2021 3:00:26 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:00:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4723
;
-- Sep 24, 2021 3:00:42 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:00:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=8555
;
-- Sep 24, 2021 3:01:05 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4724
;
-- Sep 24, 2021 3:01:15 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4716
;
-- Sep 24, 2021 3:01:38 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N', DefaultValue=NULL,Updated=TO_TIMESTAMP('2021-09-24 15:01:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4770
;
-- Sep 24, 2021 3:01:57 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:01:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4722
;
-- Sep 24, 2021 3:02:04 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N',Updated=TO_TIMESTAMP('2021-09-24 15:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=60923
;
-- Sep 24, 2021 3:02:15 PM MYT
UPDATE AD_Column SET IsUpdateable='N', IsAllowLogging='N', IsAllowCopy='N',Updated=TO_TIMESTAMP('2021-09-24 15:02:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4721
;
-- Sep 24, 2021 2:22:50 PM MYT
UPDATE AD_Field SET IsDisplayed='N', IsDisplayedGrid='N', IsActive='N',Updated=TO_TIMESTAMP('2021-09-24 14:22:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 24, 2021 2:23:20 PM MYT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2021-09-24 14:23:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53323
;
-- Sep 24, 2021 2:30:22 PM MYT
INSERT INTO AD_Message (AD_Message_ID,AD_Client_ID,Updated,AD_Org_ID,MsgText,MsgType,Created,EntityType,CreatedBy,UpdatedBy,Value,AD_Message_UU,IsActive) VALUES (200402,0,TO_TIMESTAMP('2021-09-24 14:30:15','YYYY-MM-DD HH24:MI:SS'),0,'You can only set one default BOM ( BOM Type is Current Active and BOM Use is Master ) for a product.','E',TO_TIMESTAMP('2021-09-24 14:30:15','YYYY-MM-DD HH24:MI:SS'),'D',100,100,'OnlyOneCurrentActiveMasterBOM','56bbf336-47fb-4bf1-94fb-9cc643db733c','Y')
;
-- Sep 24, 2021 3:04:31 PM MYT
UPDATE AD_Tab SET IsReadOnly='Y', IsInsertRecord='N',Updated=TO_TIMESTAMP('2021-09-24 15:04:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=383
;
-- Sep 25, 2021 5:57:35 PM MYT
UPDATE AD_Field SET DisplayLogic='@ComponentType@=''VA''|@ComponentType@=''OP''',Updated=TO_TIMESTAMP('2021-09-25 17:57:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 25, 2021 5:58:55 PM MYT
UPDATE AD_Field SET DisplayLogic='@ComponentType@=''VA''|@ComponentType@=''OP''',Updated=TO_TIMESTAMP('2021-09-25 17:58:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 26, 2021 3:58:50 PM MYT
UPDATE AD_Column SET DefaultValue='-1',Updated=TO_TIMESTAMP('2021-09-26 15:58:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53364
;
-- Sep 26, 2021 3:59:41 PM MYT
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2021-09-26 15:59:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=317
;
-- Sep 26, 2021 4:00:07 PM MYT
UPDATE AD_Tab SET DisplayLogic='@IsBOM@=''Y''',IsActive='Y',Updated=TO_TIMESTAMP('2021-09-26 16:00:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53286
;
-- Sep 26, 2021 4:01:23 PM MYT
UPDATE AD_Tab SET DisplayLogic='@IsBOM@=''Y''',IsActive='Y',Updated=TO_TIMESTAMP('2021-09-26 16:01:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53287
;
-- Sep 26, 2021 4:02:54 PM MYT
UPDATE AD_Tab SET IsSingleRow='Y',Updated=TO_TIMESTAMP('2021-09-26 16:02:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53287
;
-- Sep 27, 2021 11:36:52 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2021-09-27 11:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53338
;
-- Sep 27, 2021 11:36:59 AM MYT
INSERT INTO t_alter_column values('pp_product_bom','ValidFrom','TIMESTAMP',null,'NULL')
;
-- Sep 27, 2021 11:36:59 AM MYT
INSERT INTO t_alter_column values('pp_product_bom','ValidFrom',null,'NULL',null)
;
-- Sep 27, 2021 11:38:02 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2021-09-27 11:38:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53359
;
-- Sep 27, 2021 11:38:08 AM MYT
INSERT INTO t_alter_column values('pp_product_bomline','IssueMethod','CHAR(1)',null,'1')
;
-- Sep 27, 2021 11:38:10 AM MYT
INSERT INTO t_alter_column values('pp_product_bomline','IssueMethod',null,'NULL',null)
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53473
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53472
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53469
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53476
;
-- Sep 27, 2021 11:42:48 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53465
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53466
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53467
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53468
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53471
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53477
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53478
;
-- Sep 27, 2021 11:42:49 AM MYT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53480
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53473
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53472
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53469
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53476
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53479
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53470
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53462
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53463
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53474
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53475
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53464
;
-- Sep 27, 2021 11:43:11 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53465
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53466
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53467
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53468
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53471
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53477
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53478
;
-- Sep 27, 2021 11:43:12 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53480
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58081
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53504
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53505
;
-- Sep 27, 2021 11:45:58 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53503
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53502
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53501
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53499
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53497
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53496
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53491
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53490
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53489
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53500
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53493
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:45:59 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:46:36 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53504
;
-- Sep 27, 2021 11:46:36 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53505
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53503
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53501
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53502
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58081
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53499
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53497
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53496
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53491
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53490
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53489
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53500
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53493
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:46:37 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=30, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53492
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53494
;
-- Sep 27, 2021 11:48:48 AM MYT
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2021-09-27 11:48:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53486
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53487
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53488
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53498
;
-- Sep 27, 2021 11:48:49 AM MYT
UPDATE AD_Field SET SeqNo=100, ColumnSpan=2,Updated=TO_TIMESTAMP('2021-09-27 11:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53495
;
-- Sep 27, 2021 11:48:50 AM MYT
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2021-09-27 11:48:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 11:50:02 AM MYT
UPDATE AD_Table SET AD_Window_ID=140,Updated=TO_TIMESTAMP('2021-09-27 11:50:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53018
;
-- Sep 27, 2021 11:50:27 AM MYT
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2021-09-27 11:50:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=53372
;
-- Sep 27, 2021 11:50:33 AM MYT
INSERT INTO t_alter_column values('pp_product_bomline','ValidFrom','TIMESTAMP',null,'NULL')
;
-- Sep 27, 2021 11:50:33 AM MYT
INSERT INTO t_alter_column values('pp_product_bomline','ValidFrom',null,'NULL',null)
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58100
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58097
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58096
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58094
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58093
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58088
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58089
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58090
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58091
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58092
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58095
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58098
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58099
;
-- Sep 27, 2021 11:52:25 AM MYT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58101
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58100
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58097
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58096
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58094
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58093
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58088
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58083
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58084
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58085
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58086
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58087
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58089
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58090
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58091
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58092
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58095
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58098
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58099
;
-- Sep 27, 2021 11:52:47 AM MYT
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58101
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58124
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58123
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58122
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58121
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58120
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58118
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58117
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58116
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58115
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58114
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58113
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58108
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58109
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:53:52 AM MYT
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 11:53:53 AM MYT
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58124
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58123
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58122
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58121
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58120
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58118
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58117
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58116
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58115
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58114
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58113
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58108
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58109
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:54:20 AM MYT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 11:54:21 AM MYT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:55:01 AM MYT
UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 27, 2021 11:55:01 AM MYT
UPDATE AD_Field SET SeqNo=30,Updated=TO_TIMESTAMP('2021-09-27 11:55:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58106
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58107
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58110
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58111
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58112
;
-- Sep 27, 2021 11:55:02 AM MYT
UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2021-09-27 11:55:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58119
;
-- Sep 27, 2021 11:55:03 AM MYT
UPDATE AD_Field SET SeqNo=100, ColumnSpan=2,Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58125
;
-- Sep 27, 2021 11:55:03 AM MYT
UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:12:50 PM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 12:13:05 PM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53506
;
-- Sep 27, 2021 12:13:05 PM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=53481
;
-- Sep 27, 2021 12:13:48 PM MYT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:13:55 PM MYT
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58126
;
-- Sep 27, 2021 12:13:55 PM MYT
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y', Updated=TO_TIMESTAMP('2021-09-27 11:55:03','YYYY-MM-DD HH24:MI:SS'), UpdatedBy=100 WHERE AD_Field_ID=58127
;
-- Sep 28, 2021 6:30:10 PM MYT
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,Name,Updated,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,Created,EntityType,AD_Org_ID) VALUES ('PP_Product_BOM.IsActive=''Y'' AND PP_Product_BOM.M_Product_ID=@M_Product_ID@ AND PP_Product_BOM.AD_Org_ID IN (0,@AD_Org_ID@)',200136,'PP_Product_BOM of M_Product',TO_TIMESTAMP('2021-09-28 18:30:09','YYYY-MM-DD HH24:MI:SS'),'S','de413613-585d-40b9-a801-82a9f725d442',100,100,'Y',0,TO_TIMESTAMP('2021-09-28 18:30:09','YYYY-MM-DD HH24:MI:SS'),'D',0)
;
-- Sep 28, 2021 6:33:43 PM MYT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,IsRange,AD_Process_Para_UU,AD_Reference_ID,AD_Val_Rule_ID,IsMandatory,EntityType,CreatedBy,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,Updated,UpdatedBy,IsEncrypted,Created,AD_Client_ID,AD_Element_ID,AD_Process_ID,AD_Org_ID) VALUES (200278,'N','95eb329b-9484-4cdb-aa83-534166ba8288',19,200136,'Y','D',100,'BOM & Formula','PP_Product_BOM_ID','BOM & Formula',10,'Y',30,'@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc LIMIT 1','Y',TO_TIMESTAMP('2021-09-28 18:33:42','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2021-09-28 18:33:42','YYYY-MM-DD HH24:MI:SS'),0,53245,53226,0)
;
-- Sep 28, 2021 8:57:21 PM MYT
UPDATE AD_Process_Para SET DefaultValue='@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc',Updated=TO_TIMESTAMP('2021-09-28 20:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
-- Sep 28, 2021 8:57:44 PM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200056, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200056)
;
-- Sep 28, 2021 9:04:59 PM MYT
UPDATE AD_Process_Para SET DefaultValue='@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE M_Product_ID=@M_Product_ID@ AND BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc',Updated=TO_TIMESTAMP('2021-09-28 21:04:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
-- Sep 28, 2021 9:05:15 PM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200057, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200057)
;
-- Sep 29, 2021 10:45:24 AM MYT
INSERT INTO AD_Column (AD_Column_ID,SeqNoSelection,IsSyncDatabase,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,Updated,IsUpdateable,ColumnName,Description,DefaultValue,Name,IsAllowCopy,IsActive,CreatedBy,UpdatedBy,IsAlwaysUpdateable,AD_Client_ID,Created,EntityType,IsEncrypted,IsSecure,FKConstraintType,AD_Element_ID,AD_Val_Rule_ID,AD_Table_ID,IsToolbarButton,AD_Reference_ID,AD_Org_ID) VALUES (213948,0,'N',0,'N','N','N',0,'N',22,'N','N','N','Y','3abf2f17-51e0-448d-b6f8-42564b7d5f70',TO_TIMESTAMP('2021-09-29 10:45:22','YYYY-MM-DD HH24:MI:SS'),'Y','PP_Product_BOM_ID','BOM & Formula','@SQL=SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE M_Product_ID=@M_Product_ID@ AND BOMUse=''A'' AND BOMType=''A'' AND IsActive=''Y'' AND AD_Client_ID=@#AD_Client_ID@ AND AD_Org_ID IN (0,@AD_Org_ID@) ORDER BY AD_Org_ID Desc','BOM & Formula','N','Y',100,100,'N',0,TO_TIMESTAMP('2021-09-29 10:45:22','YYYY-MM-DD HH24:MI:SS'),'D','N','N','N',53245,200136,325,'N',19,0)
;
-- Sep 29, 2021 10:45:39 AM MYT
INSERT INTO AD_TreeNode (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNode_UU) SELECT t.AD_Client_ID, 0, 'Y', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200058, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='TL' AND t.AD_Table_ID=282 AND NOT EXISTS (SELECT * FROM AD_TreeNode e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200058)
;
-- Sep 29, 2021 10:45:41 AM MYT
UPDATE AD_Column SET FKConstraintType='N', FKConstraintName='PPProductBOM_MProduction',Updated=TO_TIMESTAMP('2021-09-29 10:45:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213948
;
-- Sep 29, 2021 10:45:41 AM MYT
ALTER TABLE M_Production ADD COLUMN PP_Product_BOM_ID NUMERIC(10) DEFAULT NULL
;
-- Sep 29, 2021 10:45:42 AM MYT
ALTER TABLE M_Production ADD CONSTRAINT PPProductBOM_MProduction FOREIGN KEY (PP_Product_BOM_ID) REFERENCES pp_product_bom(pp_product_bom_id) DEFERRABLE INITIALLY DEFERRED
;
-- Sep 29, 2021 10:51:33 AM MYT
INSERT INTO AD_Field (SortNo,AD_Field_ID,IsEncrypted,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,IsReadOnly,Updated,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,CreatedBy,UpdatedBy,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,Created,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,AD_Tab_ID,AD_Org_ID) VALUES (0,206081,'N',0,'N','N',95,'Y','Y',TO_TIMESTAMP('2021-09-29 10:51:32','YYYY-MM-DD HH24:MI:SS'),'BOM & Formula','BOM & Formula','390e17df-7857-4cfa-82e4-64e6d29b2a73','Y','N',100,100,'Y','Y',105,1,'N',0,TO_TIMESTAMP('2021-09-29 10:51:32','YYYY-MM-DD HH24:MI:SS'),2,1,'N','N',213948,'D',53344,0)
;
-- Sep 29, 2021 11:29:46 AM MYT
UPDATE AD_Process_Para SET DisplayLogic='@IsUseProductionPlan@=N',Updated=TO_TIMESTAMP('2021-09-29 11:29:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200278
;
UPDATE PP_Product_BOM SET BOMUSE='A' WHERE AD_Client_ID=11 AND BOMType='A' AND IsActive='Y' AND M_Product_ID < 1000000
;
SELECT Register_Migration_Script ('202109291600_IDEMPIERE-1250.sql') FROM DUAL
;

View File

@ -38,12 +38,12 @@ public class BOMFlagValidate extends SvrProcess {
return "@OK@";
}
private void flagNonBOMs() throws SQLException
private void flagNonBOMs() throws Exception
{
//Select Products where there's a BOM, and there are no lines
StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'Y' AND ")
.append("M_Product_ID NOT IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
.append("M_Product_ID NOT IN (SELECT M_Product_ID FROM PP_Product_BOM ) AND ");
if (p_M_Product_Category_ID == 0)
sql.append("AD_Client_ID= ?");
@ -61,7 +61,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next())
{
StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" BOM without BOM lines");
StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" Has Been Flagged as NonBOM as it has no lines");
addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
}
} catch (SQLException e) {
@ -73,8 +73,8 @@ public class BOMFlagValidate extends SvrProcess {
PreparedStatement upstmt = null;
try {
StringBuilder update = new StringBuilder("UPDATE M_Product SET IsBOM = 'N' WHERE IsBOM = 'Y' AND M_Product_ID NOT IN ")
.append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
StringBuilder update = new StringBuilder("UPDATE M_Product SET ISBOM = 'N' WHERE ISBOM = 'Y' AND M_PRODUCT_ID NOT IN ")
.append("(SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b JOIN PP_PRODUCT_BOMLINE bl ON bl.PP_PRODUCT_BOM_ID = b.PP_PRODUCT_BOM_ID ) AND ");
if (p_M_Product_Category_ID == 0)
update.append("AD_Client_ID= ?");
else
@ -99,7 +99,7 @@ public class BOMFlagValidate extends SvrProcess {
//Select Products where there's a BOM, and there are no lines
StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'N' AND ")
.append("M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
.append("M_PRODUCT_ID IN (SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b JOIN PP_PRODUCT_BOMLINE bl ON b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID ) AND ");
if (p_M_Product_Category_ID == 0)
sql.append("AD_Client_ID= ?");
@ -117,7 +117,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next())
{
StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" not BOM with BOM lines");
StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" Has Been Flagged as BOM as it has BOM lines");
addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
}
} catch (SQLException e) {
@ -128,7 +128,7 @@ public class BOMFlagValidate extends SvrProcess {
}
StringBuilder update = new StringBuilder("UPDATE M_Product SET ISBOM = 'Y' WHERE IsBOM = 'N' AND M_Product_ID IN ")
.append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
.append("(SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b JOIN PP_PRODUCT_BOMLINE bl ON b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID ) AND ");
if (p_M_Product_Category_ID == 0)
update.append("AD_Client_ID= ?");
else

View File

@ -31,6 +31,8 @@ import org.compiere.util.Env;
/**
* Validate BOM
*
* Never leave beta and drop
* @deprecated
* @author Jorg Janke
* @version $Id: BOMValidate.java,v 1.3 2006/07/30 00:51:01 jjanke Exp $
*/

View File

@ -21,6 +21,8 @@ import java.util.*;
import java.util.logging.*;
import org.compiere.model.*;
import org.compiere.util.*;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
/**
* Validate BOM
@ -147,60 +149,82 @@ public class BOMVerify extends SvrProcess
if (!product.isBOM())
return false;
if (validproducts.contains(product))
return true;
// Check Old Product BOM Structure
if (log.isLoggable(Level.CONFIG)) log.config(product.getName());
foundproducts.add(product);
MProductBOM[] productsBOMs = MProductBOM.getBOMLines(product);
boolean containsinvalid = false;
boolean invalid = false;
int lines = 0;
for (MProductBOM productsBOM : productsBOMs)
foundproducts.add(product);
List<MPPProductBOM> boms = MPPProductBOM.getProductBOMs(product);
for(MPPProductBOM bom : boms)
{
if (! productsBOM.isActive())
continue;
lines++;
MProduct pp = new MProduct(getCtx(), productsBOM.getM_ProductBOM_ID(), get_TrxName());
if (!pp.isBOM()) {
if (log.isLoggable(Level.FINER)) log.finer(pp.getName());
} else {
if (validproducts.contains(pp))
{
//Do nothing, no need to recheck
}
if (invalidproducts.contains(pp))
{
containsinvalid = true;
}
else if (foundproducts.contains(pp))
{
invalid = true;
if (p_fromButton)
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue());
else
addBufferLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID());
}
else
{
if (!validateProduct(pp))
MPPProductBOMLine[] bomLines = bom.getLines();
int lines = 0;
for (MPPProductBOMLine bomLine : bomLines)
{
if (!bomLine.isActive())
continue;
lines++;
MProduct pp = new MProduct(getCtx(), bomLine.getM_Product_ID(), get_TrxName());
if (!pp.isBOM()) {
if (log.isLoggable(Level.FINER)) log.finer(pp.getName());
} else {
if (validproducts.contains(pp))
{
//Do nothing, no need to recheck
continue;
}
if (invalidproducts.contains(pp))
{
containsinvalid = true;
}
else if (foundproducts.contains(pp))
{
invalid = true;
if (p_fromButton)
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue());
else
addBufferLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID());
}
else
{
if (!validateProduct(pp))
{
containsinvalid = true;
}
}
}
}
if (lines == 0) {
invalid = true;
if (p_fromButton)
addLog(0, null, null, "BOM " + bom.getValue() + " for product " + product.getValue() + " does not have lines");
else
addBufferLog(0, null, null, "BOM " + bom.getValue() + " for product " + product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID());
}
if (invalid || containsinvalid)
break;
}
if (lines == 0) {
if (boms.isEmpty()) {
invalid = true;
if (p_fromButton)
addLog(0, null, null, product.getValue() + " does not have lines");
addLog(0, null, null, "BOM missing for product " + product.getValue());
else
addBufferLog(0, null, null, product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID());
addBufferLog(0, null, null, "BOM missing for product " + product.getValue(), MProduct.Table_ID, product.getM_Product_ID());
} else if (MPPProductBOM.getDefault(product, get_TrxName()) == null) {
invalid = true;
if (p_fromButton)
addLog(0, null, null, "No default BOM for product " + product.getValue());
else
addBufferLog(0, null, null, "No default BOM for product " + product.getValue(), MProduct.Table_ID, product.getM_Product_ID());
}
checkedproducts.add(product);
foundproducts.remove(product);
if (invalid)

View File

@ -17,18 +17,15 @@
package org.compiere.process;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.exceptions.FillMandatoryException;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MCost;
import org.compiere.model.MProduct;
import org.compiere.model.MProductBOM;
import org.compiere.model.Query;
import org.compiere.model.X_T_BOM_Indented;
import org.compiere.util.Env;
import org.eevolution.model.MPPProductBOMLine;
/**
* Cost Multi-Level BOM & Formula Review
@ -129,18 +126,18 @@ public class IndentedBOM extends SvrProcess
BigDecimal llCost = Env.ZERO;
BigDecimal llFutureCost = Env.ZERO;
List<MProductBOM> list = getBOMs(product);
for (MProductBOM bom : list)
MPPProductBOMLine[] list = getBOMs(product);
for (MPPProductBOMLine bom : list)
{
m_LevelNo++;
llCost ll = explodeProduct(bom.getM_ProductBOM_ID(), bom.getBOMQty(), accumQty.multiply(bom.getBOMQty()));
llCost = llCost.add(ll.currentCost.multiply(accumQty.multiply(bom.getBOMQty())));
llFutureCost = llFutureCost.add(ll.futureCost.multiply(accumQty.multiply(bom.getBOMQty())));
llCost ll = explodeProduct(bom.getM_Product_ID(), bom.getQtyBOM(), accumQty.multiply(bom.getQtyBOM()));
llCost = llCost.add(ll.currentCost.multiply(accumQty.multiply(bom.getQtyBOM())));
llFutureCost = llFutureCost.add(ll.futureCost.multiply(accumQty.multiply(bom.getQtyBOM())));
m_LevelNo--;
}
llCost retVal = new llCost();
if (list.size() == 0 )
if (list.length == 0 )
{
tboml.setCurrentCostPriceLL(cost.getCurrentCostPrice());
tboml.setFutureCostPriceLL(cost.getFutureCostPrice());
@ -168,21 +165,14 @@ public class IndentedBOM extends SvrProcess
* Get BOMs for given product
* @param product
* @param isComponent
* @return list of MProductBOM
* @return list of MPPProductBOMLine
*/
private List<MProductBOM> getBOMs(MProduct product)
private MPPProductBOMLine[] getBOMs(MProduct product)
{
ArrayList<Object> params = new ArrayList<Object>();
StringBuilder whereClause = new StringBuilder();
whereClause.append(MProductBOM.COLUMNNAME_M_Product_ID).append("=?");
params.add(product.get_ID());
List<MProductBOM> list = new Query(getCtx(), MProductBOM.Table_Name, whereClause.toString(), get_TrxName())
.setParameters(params)
.setOnlyActiveRecords(true)
.setOrderBy(MProductBOM.COLUMNNAME_Line)
.list();
return list;
if (log.isLoggable(Level.FINE)) log.fine(" PRODUCT NAME = " + product.getName() ) ;
return MPPProductBOMLine.getBOMLines(product);
}
private static class llCost {

View File

@ -193,9 +193,14 @@ public class OrgOwnership extends SvrProcess
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "C_AcctSchema_ID"));
// BOM
sql = new StringBuilder("UPDATE M_Product_BOM x ").append(set);
sql = new StringBuilder("UPDATE PP_Product_BOM x ").append(set);
no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "M_Product_BOM_ID"));
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "PP_Product_BOM_ID"));
//BOM Line
sql = new StringBuilder("UPDATE PP_Product_BOMLine x ").append(set);
no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "PP_Product_BOMLine_ID"));
// PO
sql = new StringBuilder("UPDATE M_Product_PO x ").append(set);

View File

@ -7,12 +7,10 @@ import java.util.logging.Level;
import org.compiere.model.I_M_ProductionPlan;
import org.compiere.model.MProduction;
import org.compiere.model.MProductionPlan;
import org.compiere.model.MSysConfig;
import org.compiere.model.Query;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Util;
/**
*
@ -28,7 +26,7 @@ public class ProductionCreate extends SvrProcess {
private boolean mustBeStocked = false; //not used
private boolean recreate = false;
private BigDecimal newQty = null;
//private int p_M_Locator_ID=0;
private int p_PP_Product_BOM_ID=0;
protected void prepare() {
@ -41,8 +39,10 @@ public class ProductionCreate extends SvrProcess {
recreate = "Y".equals(para[i].getParameter());
else if ("ProductionQty".equals(name))
newQty = (BigDecimal) para[i].getParameter();
else if ("PP_Product_BOM_ID".equals(name))
p_PP_Product_BOM_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
log.log(Level.WARNING, "Unknown Parameter: " + name);
}
p_M_Production_ID = getRecord_ID();
@ -63,44 +63,13 @@ public class ProductionCreate extends SvrProcess {
}
private boolean costsOK(int M_Product_ID) throws AdempiereUserError {
// Warning will not work if non-standard costing is used
String sql = "SELECT ABS(((cc.currentcostprice-(SELECT SUM(c.currentcostprice*bom.bomqty)"
+ " FROM m_cost c"
+ " INNER JOIN m_product_bom bom ON (c.m_product_id=bom.m_productbom_id)"
+ " INNER JOIN m_costelement ce ON (c.m_costelement_id = ce.m_costelement_id AND ce.costingmethod = 'S')"
+ " WHERE bom.m_product_id = pp.m_product_id)"
+ " )/cc.currentcostprice))"
+ " FROM m_product pp"
+ " INNER JOIN m_cost cc on (cc.m_product_id=pp.m_product_id)"
+ " INNER JOIN m_costelement ce ON (cc.m_costelement_id=ce.m_costelement_id)"
+ " WHERE cc.currentcostprice > 0 AND pp.M_Product_ID = ?"
+ " AND ce.costingmethod='S'";
BigDecimal costPercentageDiff = DB.getSQLValueBD(get_TrxName(), sql, M_Product_ID);
if (costPercentageDiff == null)
{
costPercentageDiff = Env.ZERO;
String msg = "Could not retrieve costs";
if (MSysConfig.getBooleanValue(MSysConfig.MFG_ValidateCostsOnCreate, false, getAD_Client_ID())) {
throw new AdempiereUserError(msg);
} else {
log.warning(msg);
}
}
if ( (costPercentageDiff.compareTo(new BigDecimal("0.005")))< 0 )
return true;
return false;
}
protected String createLines() throws Exception {
int created = 0;
if (!m_production.isUseProductionPlan()) {
validateEndProduct(m_production.getM_Product_ID());
String msg = validateEndProduct(m_production.getM_Product_ID());
if (!Util.isEmpty(msg))
throw new AdempiereUserError(msg);
if (!recreate && "Y".equalsIgnoreCase(m_production.getIsCreated()))
throw new AdempiereUserError("Production already created.");
@ -109,7 +78,7 @@ public class ProductionCreate extends SvrProcess {
m_production.setProductionQty(newQty);
m_production.deleteLines(get_TrxName());
created = m_production.createLines(mustBeStocked);
created = m_production.createLines(mustBeStocked, p_PP_Product_BOM_ID);
} else {
Query planQuery = new Query(getCtx(), I_M_ProductionPlan.Table_Name, "M_ProductionPlan.M_Production_ID=?", get_TrxName());
List<MProductionPlan> plans = planQuery.setParameters(m_production.getM_Production_ID()).list();
@ -136,30 +105,8 @@ public class ProductionCreate extends SvrProcess {
return msgreturn.toString();
}
private void validateEndProduct(int M_Product_ID) throws Exception {
isBom(M_Product_ID);
if (!costsOK(M_Product_ID)) {
String msg = "Excessive difference in standard costs";
if (MSysConfig.getBooleanValue(MSysConfig.MFG_ValidateCostsDifferenceOnCreate, false, getAD_Client_ID())) {
throw new AdempiereUserError("Excessive difference in standard costs");
} else {
log.warning(msg);
}
}
}
protected void isBom(int M_Product_ID) throws Exception
{
String bom = DB.getSQLValueString(get_TrxName(), "SELECT isbom FROM M_Product WHERE M_Product_ID = ?", M_Product_ID);
if ("N".compareTo(bom) == 0)
{
throw new AdempiereUserError ("Attempt to create product line for Non Bill Of Materials");
}
int materials = DB.getSQLValue(get_TrxName(), "SELECT count(M_Product_BOM_ID) FROM M_Product_BOM WHERE M_Product_ID = ?", M_Product_ID);
if (materials == 0)
{
throw new AdempiereUserError ("Attempt to create product line for Bill Of Materials with no BOM Products");
}
}
private String validateEndProduct(int M_Product_ID) throws Exception {
MProduction production = new MProduction(Env.getCtx(), 0, get_TrxName());
return production.validateEndProduct(M_Product_ID);
}
}

View File

@ -1,20 +1,71 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.compiere.process;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Savepoint;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.logging.Level;
import javax.sql.RowSet;
import org.compiere.model.MClient;
import org.compiere.model.MCost;
import org.compiere.model.MCostElement;
import org.compiere.model.MDocType;
import org.compiere.model.MInventory;
import org.compiere.model.MInventoryLine;
import org.compiere.model.MProduct;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.compiere.util.Util;
import org.compiere.wf.MWorkflow;
/**
*
* @author hengsin
*
*/
public class RollUpCosts extends SvrProcess {
int category = 0;
int product_id = 0;
int client_id = 0;
int costelement_id = 0;
private int category = 0;
private int product_id = 0;
private int costelement_id = 0;
private int charge_id = 0;
private HashSet<Integer> processed;
private Map<Integer, MInventory> inventoryDocs = new HashMap<>();
private Map<String, MInventoryLine> inventoryLines = new HashMap<>();
private MDocType adjustmentDocType = null;
@Override
protected void prepare()
{
@ -24,7 +75,6 @@ public class RollUpCosts extends SvrProcess {
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
// log.fine("prepare - " + para[i]);
if (para[i].getParameter() == null)
;
else if (name.equals("M_Product_Category_ID"))
@ -33,93 +83,276 @@ public class RollUpCosts extends SvrProcess {
chosen_id = para[i].getParameterAsInt();
else if (name.equals("M_CostElement_ID"))
costelement_id = para[i].getParameterAsInt();
else if (name.equals("C_Charge_ID"))
charge_id = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
log.log(Level.WARNING, "Unknown Parameter: " + name);
}
product_id = getRecord_ID();
if (product_id == 0)
if (getTable_ID() == MProduct.Table_ID)
{
product_id = getRecord_ID();
if (product_id == 0)
{
product_id = chosen_id;
}
}
else
{
product_id = chosen_id;
}
}
@Override
protected String doIt() throws Exception
{
client_id = Env.getAD_Client_ID(getCtx());
createArray();
processed = new HashSet<Integer>();
MDocType[] doctypes = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialPhysicalInventory);
for(MDocType dt : doctypes)
{
if (MDocType.DOCSUBTYPEINV_CostAdjustment.equals(dt.getDocSubTypeInv()))
{
adjustmentDocType = dt;
break;
}
}
if (adjustmentDocType == null)
throw new IllegalStateException("Failed to find cost adjustment document type");
String result = rollUp();
if (inventoryDocs.size() > 0) {
for(MInventory costingDoc : inventoryDocs.values())
{
ProcessInfo info = MWorkflow.runDocumentActionWorkflow(costingDoc, DocAction.ACTION_Complete);
if (info.isError())
{
StringBuilder msg = new StringBuilder();
msg.append(Msg.getMsg(getCtx(), "ProcessFailed")).append(": ");
msg.append(info.getSummary());
addLog(getAD_PInstance_ID(), null, null, msg.toString());
}
else
{
costingDoc.saveEx();
addBufferLog(getAD_PInstance_ID(), null, null, costingDoc.toString(), MInventory.Table_ID, costingDoc.get_ID());
}
}
}
return result;
}
protected String rollUp() throws Exception {
/**
* do rollup
* @return number of records updated
* @throws Exception
*/
protected String rollUp() throws Exception {
int count = 0;
if (product_id != 0) //only for the product
{
rollUpCosts(product_id);
String error = rollUpCosts(product_id);
if (!Util.isEmpty(error))
{
addLog(getAD_PInstance_ID(), null, null, "Rollup BOM Cost is not applicable for the product " + MProduct.get(getCtx(), product_id).getName()
+ ". Details: " + error, MProduct.Table_ID, product_id);
}
else
{
count++;
}
}
else if (category != 0) //roll up for all categories
{
String sql = "SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID = ? AND AD_Client_ID = ? " +
" AND M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM)";
int[] prodids = DB.getIDsEx(get_TrxName(), sql, category, client_id);
for (int prodid : prodids) {
rollUpCosts(prodid);
String sql = "SELECT M_PRODUCT_ID FROM M_PRODUCT WHERE M_PRODUCT_CATEGORY_ID = " +
category + " AND AD_CLIENT_ID = " + getAD_Client_ID() +
" AND M_PRODUCT_ID IN (SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b " +
" JOIN PP_PRODUCT_BOMLINE bl ON b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID" +
" WHERE b.AD_Client_ID=" + getAD_Client_ID() +" AND b.IsActive='Y' AND bl.IsActive='Y' AND b.BOMType='A' AND b.BOMUse='A')";
Trx trx = Trx.get(get_TrxName(), false);
RowSet results = DB.getRowSet(sql);
while (results.next())
{
Savepoint savepoint = trx.setSavepoint(null);
int id= results.getInt(1);
String error = rollUpCosts(id);
if (!Util.isEmpty(error))
{
addLog(getAD_PInstance_ID(), null, null, "Rollup BOM Cost is not applicable for the product " + MProduct.get(getCtx(), id).getName()
+ ". Details: " + error, MProduct.Table_ID, product_id);
trx.rollback(savepoint);
}
else
{
trx.releaseSavepoint(savepoint);
count++;
}
}
}
else //do it for all products
{
String sql = "SELECT M_Product_ID FROM M_Product WHERE AD_Client_ID = ? " +
" AND M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM)";
int[] prodids = DB.getIDsEx(get_TrxName(), sql, client_id);
for (int prodid : prodids) {
rollUpCosts(prodid);
}
String sql = "SELECT M_PRODUCT_ID FROM M_PRODUCT WHERE AD_CLIENT_ID = " + getAD_Client_ID() +
" AND M_PRODUCT_ID IN (SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b " +
" JOIN PP_PRODUCT_BOMLINE bl ON b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID" +
" WHERE b.AD_Client_ID=" + getAD_Client_ID() +" AND b.IsActive='Y' AND bl.IsActive='Y' AND b.BOMType='A' AND b.BOMUse='A')";
Trx trx = Trx.get(get_TrxName(), false);
RowSet results = DB.getRowSet(sql);
while (results.next())
{
Savepoint savepoint = trx.setSavepoint(null);
int id= results.getInt(1);
String error = rollUpCosts(id);
if (!Util.isEmpty(error))
{
addLog(getAD_PInstance_ID(), null, null, "Rollup BOM Cost is not applicable for the product " + MProduct.get(getCtx(), id).getName()
+ ". Details: " + error, MProduct.Table_ID, product_id);
trx.rollback(savepoint);
}
else
{
trx.releaseSavepoint(savepoint);
count++;
}
}
}
return "Roll Up Complete";
return count + " Product Cost Updated.";
}
protected void createArray() throws Exception
/**
*
* @param productId
* @return error message (if any)
* @throws Exception
*/
protected String rollUpCosts(int productId) throws Exception
{
processed = new HashSet<Integer>();
}
protected void rollUpCosts(int p_id) throws Exception
{
StringBuilder sql = new StringBuilder("SELECT M_ProductBOM_ID FROM M_Product_BOM WHERE M_Product_ID = ? ")
.append(" AND AD_Client_ID = ").append(client_id);
int[] prodbomids = DB.getIDsEx(get_TrxName(), sql.toString(), p_id);
String sql = "SELECT bl.M_Product_ID FROM PP_Product_BOMLine bl "
+ " JOIN PP_PRODUCT_BOM b "
+ " ON ( b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID ) WHERE b.M_Product_ID = ?"
+ " AND b.AD_Client_ID = " + getAD_Client_ID()
+ " AND b.BOMUse='A' AND b.BOMType='A' AND b.IsActive='Y' AND bl.IsActive='Y' ";
int[] prodbomids = DB.getIDsEx(get_TrxName(), sql.toString(), productId);
for (int prodbomid : prodbomids) {
if ( !processed.contains(p_id)) {
rollUpCosts(prodbomid);
if ( !processed.contains(prodbomid)) {
String error = rollUpCosts(prodbomid);
if (!Util.isEmpty(error))
return error;
}
}
//once the subproducts costs are accurate, calculate the costs for this product
StringBuilder update = new StringBuilder("UPDATE M_Cost set CurrentCostPrice = COALESCE((select Sum (b.BOMQty * c.currentcostprice)")
.append(" FROM M_Product_BOM b INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) ")
.append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0),")
.append(" FutureCostPrice = COALESCE((select Sum (b.BOMQty * c.futurecostprice) FROM M_Product_BOM b ")
.append(" INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) ")
.append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0)")
.append(" WHERE M_Product_ID = ").append(p_id).append(" AND AD_Client_ID = ").append(client_id)
.append(" AND M_CostElement_ID = ").append(costelement_id)
.append(" AND M_PRODUCT_ID IN (SELECT M_PRODUCT_ID FROM M_PRODUCT_BOM)");
DB.executeUpdate(update.toString(), get_TrxName());
processed.add(p_id);
}
MProduct product = new MProduct(getCtx(), productId, get_TrxName());
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
//once the subproducts costs are accurate, calculate the costs for this product
StringBuilder productCostSql = new StringBuilder("SELECT * FROM M_Cost ")
.append(" WHERE M_Product_ID = ").append(productId).append(" AND AD_Client_ID = ").append(getAD_Client_ID())
.append(" AND M_CostElement_ID = ").append(costelement_id)
.append(" AND C_AcctSchema_ID = ").append(MClient.get(getAD_Client_ID()).getAcctSchema().getC_AcctSchema_ID())
.append(" AND M_PRODUCT_ID IN (SELECT b.M_PRODUCT_ID FROM PP_PRODUCT_BOM b ")
.append(" JOIN PP_PRODUCT_BOMLINE bl ON b.PP_PRODUCT_BOM_ID = bl.PP_PRODUCT_BOM_ID")
.append(" WHERE b.BOMType='A' AND b.BOMUse='A' AND b.IsActive='Y' ")
.append(" AND b.AD_Client_ID=").append(getAD_Client_ID()).append(")");
pstmt = DB.prepareStatement(productCostSql.toString(), get_TrxName());
rs = pstmt.executeQuery();
while (rs.next()) {
MCost cost = new MCost(getCtx(), rs, get_TrxName());
StringBuilder newCurrentCostPriceSql = new StringBuilder("SELECT SUM(b.QtyBOM * c.CurrentCostPrice)")
.append(" FROM PP_Product_BOMLine b ")
.append(" INNER JOIN M_Cost c ON (b.M_PRODUCT_ID = c.M_Product_ID) ")
.append(" JOIN PP_Product_BOM bom ON (bom.PP_PRODUCT_BOM_ID = b.PP_PRODUCT_BOM_ID AND bom.IsActive='Y') ")
.append(" WHERE bom.M_Product_ID = ").append(productId).append(" AND bom.BOMType='A' AND bom.BOMUse='A' AND M_CostElement_ID = ").append(costelement_id)
.append(" AND c.C_AcctSchema_ID = ").append(cost.getC_AcctSchema_ID());
BigDecimal newCurrentCostPrice = DB.getSQLValueBD(get_TrxName(), newCurrentCostPriceSql.toString());
if (newCurrentCostPrice == null)
newCurrentCostPrice = BigDecimal.ZERO;
StringBuilder newFutureCostPriceSql = new StringBuilder("SELECT SUM(b.QtyBOM * c.FutureCostPrice)")
.append(" FROM PP_Product_BOMLine b ")
.append(" INNER JOIN M_Cost c ON (b.M_PRODUCT_ID = c.M_Product_ID) ")
.append(" JOIN PP_Product_BOM bom ON (bom.PP_PRODUCT_BOM_ID = b.PP_PRODUCT_BOM_ID AND bom.IsActive='Y') ")
.append(" WHERE bom.M_Product_ID = ").append(productId).append(" AND M_CostElement_ID = ").append(costelement_id)
.append(" AND c.C_AcctSchema_ID = ").append(cost.getC_AcctSchema_ID());
BigDecimal newFutureCostPrice = DB.getSQLValueBD(get_TrxName(), newFutureCostPriceSql.toString());
if (newFutureCostPrice == null)
newFutureCostPrice = BigDecimal.ZERO;
StringBuilder qtyOnHandSql = new StringBuilder("SELECT SUM(QtyOnHand)")
.append(" FROM M_StorageOnHand oh ")
.append(" JOIN M_Locator loc ON (oh.M_Locator_ID=loc.M_Locator_ID)")
.append(" JOIN M_Warehouse w ON (w.M_Warehouse_ID=loc.M_Warehouse_ID)")
.append(" WHERE oh.M_Product_ID=").append(productId)
.append(" AND w.IsActive='Y'")
.append(" AND w.AD_Client_ID=").append(getAD_Client_ID());
if (cost.getM_AttributeSetInstance_ID() != 0)
qtyOnHandSql.append(" AND oh.M_AttributeSetInstance_ID=").append(cost.getM_AttributeSetInstance_ID());
BigDecimal qtyOnHand = DB.getSQLValueBD(get_TrxName(), qtyOnHandSql.toString());
if (qtyOnHand == null)
qtyOnHand = BigDecimal.ZERO;
if (cost.getCurrentCostPrice().compareTo(newCurrentCostPrice) != 0)
{
MInventory costingDoc = createCostingDoc(product);
String key = costingDoc.getM_Inventory_ID() + "_" + cost.getM_Product_ID() + "_" + cost.getM_AttributeSetInstance_ID();
MInventoryLine costingLine = inventoryLines.get(key);
if (costingLine == null) {
costingLine = new MInventoryLine(getCtx(), 0, get_TrxName());
costingLine.setAD_Org_ID(costingDoc.getAD_Org_ID());
costingLine.setM_Inventory_ID(costingDoc.getM_Inventory_ID());
costingLine.setM_Product_ID(cost.getM_Product_ID());
costingLine.setM_AttributeSetInstance_ID(cost.getM_AttributeSetInstance_ID());
costingLine.setC_Charge_ID(charge_id);
costingLine.setCurrentCostPrice(cost.getCurrentCostPrice());
costingLine.setM_Locator_ID(0);
}
costingLine.setNewCostPrice(newCurrentCostPrice);
costingLine.saveEx();
inventoryLines.put(key, costingLine);
}
if (cost.getFutureCostPrice().compareTo(newFutureCostPrice) != 0) {
cost.setFutureCostPrice(newFutureCostPrice);
}
if (cost.is_Changed())
cost.saveEx();
}
}
finally {
DB.close(rs, pstmt);
}
processed.add(productId);
return null;
}
private MInventory createCostingDoc(MProduct product) {
int AD_Org_ID = product.getAD_Org_ID() > 0 ? product.getAD_Org_ID() : Env.getAD_Org_ID(getCtx());
MInventory costingDoc = inventoryDocs.get(AD_Org_ID);
if (costingDoc == null)
{
costingDoc = new MInventory(getCtx(), 0, get_TrxName());
costingDoc.setAD_Org_ID(AD_Org_ID);
costingDoc.setDescription("Created due to rollup BOM cost process ID " + getAD_PInstance_ID());
costingDoc.setC_DocType_ID(adjustmentDocType.getC_DocType_ID());
costingDoc.setCostingMethod(MCostElement.get(getCtx(), costelement_id).getCostingMethod());
costingDoc.setDocAction(DocAction.ACTION_Complete);
costingDoc.saveEx();
inventoryDocs.put(AD_Org_ID, costingDoc);
}
return costingDoc;
}
}

View File

@ -1,3 +1,27 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.compiere.process;
import java.sql.SQLException;
@ -5,9 +29,14 @@ import java.util.List;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MProductBOM;
import org.compiere.model.Query;
import org.compiere.model.MProduct;
import org.eevolution.model.MPPProductBOMLine;
/**
*
* @author hengsin
*
*/
public class UniversalSubstitution extends SvrProcess {
int productId = 0;
@ -34,18 +63,17 @@ public class UniversalSubstitution extends SvrProcess {
if ( productId == 0 || replacementId == 0 )
throw new AdempiereException("Product and replacement product required");
List<MProductBOM> boms = new Query(getCtx(), MProductBOM.Table_Name, "M_ProductBOM_ID=?", get_TrxName())
.setParameters(productId)
.list();
MProduct product = new MProduct(getCtx(), productId, get_TrxName());
List<MPPProductBOMLine> boms = MPPProductBOMLine.getByProduct(product);
int count = 0;
// Use model class to invalidate the product
for (MProductBOM bom : boms) {
bom.setM_ProductBOM_ID(replacementId);
for (MPPProductBOMLine bom : boms) {
bom.setM_Product_ID(replacementId);
bom.saveEx();
count++;
}
StringBuilder msgreturn = new StringBuilder().append(count).append(" BOM products updated");
StringBuilder msgreturn = new StringBuilder().append(count).append(" BOM Line products updated");
return msgreturn.toString();
}

View File

@ -215,6 +215,7 @@ public class Doc_Production extends Doc
MProductionLineMA mas[] = MProductionLineMA.get(getCtx(), prodline.get_ID(), getTrxName());
MProduct product = (MProduct) prodline.getM_Product();
String CostingLevel = product.getCostingLevel(as);
String costingMethod = product.getCostingMethod(as);
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel) )
{
@ -277,16 +278,16 @@ public class Doc_Production extends Doc
if (line.isProductionBOM())
{
X_M_ProductionLine endProLine = (X_M_ProductionLine)line.getPO();
Object parentEndPro = prod.isUseProductionPlan()?endProLine.getM_ProductionPlan_ID():endProLine.getM_Production_ID();
int parentEndPro = prod.isUseProductionPlan()?endProLine.getM_ProductionPlan_ID():endProLine.getM_Production_ID();
// Get BOM Cost - Sum of individual lines
for (int ii = 0; ii < p_lines.length; ii++)
{
DocLine line0 = p_lines[ii];
X_M_ProductionLine bomProLine = (X_M_ProductionLine)line0.getPO();
Object parentBomPro = prod.isUseProductionPlan()?bomProLine.getM_ProductionPlan_ID():bomProLine.getM_Production_ID();
int parentBomPro = prod.isUseProductionPlan()?bomProLine.getM_ProductionPlan_ID():bomProLine.getM_Production_ID();
if (!parentBomPro.equals(parentEndPro))
if (parentBomPro != parentEndPro)
continue;
if (!line0.isProductionBOM()) {
MProduct product0 = (MProduct) bomProLine.getM_Product();
@ -384,8 +385,8 @@ public class Doc_Production extends Doc
}
fl.setQty(qtyProduced);
}
else
{
else if (MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
int precision = as.getStdPrecision();
BigDecimal variance = (costs.setScale(precision, RoundingMode.HALF_UP)).subtract(bomCost.negate());
// only post variance if it's not zero
@ -409,9 +410,14 @@ public class Doc_Production extends Doc
// Inventory DR CR
if (!(line.isProductionBOM() && MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)))
{
BigDecimal factLineAmt = costs;
if (line.isProductionBOM() && !(MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod)))
{
factLineAmt = bomCost.negate();
}
fl = fact.createLine(line,
line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
as.getC_Currency_ID(), costs);
as.getC_Currency_ID(), factLineAmt);
if (fl == null)
{
p_Error = "No Costs for Line " + line.getLine() + " - " + line;
@ -473,15 +479,30 @@ public class Doc_Production extends Doc
}
}
else
{
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
description, getTrxName()))
{
if (line.isProductionBOM() && !(MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod)))
{
p_Error = "Failed to create cost detail record";
return null;
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
bomCost.negate(), line.getQty(),
description, getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
else
{
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
line.get_ID(), 0,
costs, line.getQty(),
description, getTrxName()))
{
p_Error = "Failed to create cost detail record";
return null;
}
}
}
}

View File

@ -409,6 +409,21 @@ public interface I_M_Production
*/
public boolean isPosted();
/** Column name PP_Product_BOM_ID */
public static final String COLUMNNAME_PP_Product_BOM_ID = "PP_Product_BOM_ID";
/** Set BOM & Formula.
* BOM & Formula
*/
public void setPP_Product_BOM_ID (int PP_Product_BOM_ID);
/** Get BOM & Formula.
* BOM & Formula
*/
public int getPP_Product_BOM_ID();
public org.eevolution.model.I_PP_Product_BOM getPP_Product_BOM() throws RuntimeException;
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";

View File

@ -28,6 +28,9 @@ import org.idempiere.cache.ImmutablePOSupport;
/**
* BOM Model
*
* Never leave beta and drop
* @deprecated
* @author Jorg Janke
* @version $Id: MBOM.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
*/

View File

@ -28,6 +28,8 @@ import org.compiere.util.Msg;
/**
* BOM Product/Component Model
*
* Never leave beta and drop
* @deprecated
* @author Jorg Janke
* @version $Id: MBOMProduct.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $
*/

View File

@ -62,6 +62,21 @@ public class MCost extends X_M_Cost
*/
private static final long serialVersionUID = -9054858267574839079L;
/**
*
* @param product
* @param M_AttributeSetInstance_ID
* @param trxName
* @return current product cost
*/
public static BigDecimal getCurrentCost(MProduct product, int M_AttributeSetInstance_ID, String trxName)
{
int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx());
MAcctSchema as = MClient.get(Env.getAD_Client_ID(Env.getCtx())).getAcctSchema();
String costingMethod = product.getCostingMethod(as);
return getCurrentCost(product, M_AttributeSetInstance_ID, as, AD_Org_ID, costingMethod, new BigDecimal("1"), 0, true, trxName);
}
/**
* Retrieve/Calculate Current Cost Price
* @param product product

View File

@ -47,6 +47,8 @@ import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
/**
@ -1647,14 +1649,17 @@ public class MInvoice extends X_C_Invoice implements DocAction
// New Lines
int lineNo = line.getLine ();
for (MProductBOM bom : MProductBOM.getBOMLines(product))
MPPProductBOM bom = MPPProductBOM.getDefault(product, get_TrxName());
if (bom == null)
continue;
for (MPPProductBOMLine bomLine : bom.getLines())
{
MInvoiceLine newLine = new MInvoiceLine(this);
newLine.setLine(++lineNo);
newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true);
newLine.setQty(line.getQtyInvoiced().multiply(bom.getBOMQty()));
if (bom.getDescription() != null)
newLine.setDescription(bom.getDescription());
newLine.setM_Product_ID(bomLine.getM_Product_ID(), true);
newLine.setQty(line.getQtyInvoiced().multiply(bomLine.getQtyBOM()));
if (bomLine.getDescription() != null)
newLine.setDescription(bomLine.getDescription());
newLine.setPrice();
newLine.saveEx(get_TrxName());
}

View File

@ -49,6 +49,8 @@ import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.TimeUtil;
import org.compiere.util.Util;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
/**
@ -1634,14 +1636,17 @@ public class MOrder extends X_C_Order implements DocAction
if (log.isLoggable(Level.FINE)) log.fine(product.getName());
// New Lines
int lineNo = line.getLine ();
for (MProductBOM bom : MProductBOM.getBOMLines(product))
MPPProductBOM bom = MPPProductBOM.getDefault(product, get_TrxName());
if (bom == null)
continue;
for (MPPProductBOMLine bomLine : bom.getLines())
{
MOrderLine newLine = new MOrderLine(this);
newLine.setLine(++lineNo);
newLine.setM_Product_ID(bom.getM_ProductBOM_ID(), true);
newLine.setQty(line.getQtyOrdered().multiply(bom.getBOMQty()));
if (bom.getDescription() != null)
newLine.setDescription(bom.getDescription());
newLine.setM_Product_ID(bomLine.getM_Product_ID(), true);
newLine.setQty(line.getQtyOrdered().multiply(bomLine.getQtyBOM()));
if (bomLine.getDescription() != null)
newLine.setDescription(bomLine.getDescription());
newLine.setPrice();
newLine.saveEx(get_TrxName());
}

View File

@ -27,6 +27,8 @@ import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
/**
@ -70,13 +72,14 @@ public class MPackage extends X_M_Package
MProduct product = new MProduct(shipment.getCtx(), sLine.getM_Product_ID(), shipment.get_TrxName());
if(product.isBOM() && product.isVerified() && product.isPickListPrintDetails())
{
MProductBOM[] bomLines = MProductBOM.getBOMLines(product);
for(MProductBOM bomLine : bomLines)
MPPProductBOM bom = MPPProductBOM.getDefault(product, shipment.get_TrxName());
MPPProductBOMLine[] bomLines = bom.getLines();
for(MPPProductBOMLine bomLine : bomLines)
{
MPackageLine pLine = new MPackageLine(retValue);
pLine.setInOutLine(sLine);
pLine.setM_Product_ID(bomLine.getM_ProductBOM_ID());
pLine.setQty(sLine.getQtyEntered().multiply(bomLine.getBOMQty()));
pLine.setM_Product_ID(bomLine.getM_Product_ID());
pLine.setQty(sLine.getQtyEntered().multiply(bomLine.getQtyBOM()));
pLine.setM_PackageMPS_ID(packageMPS.getM_PackageMPS_ID());
pLine.saveEx();
}

View File

@ -30,6 +30,8 @@ import org.compiere.util.Env;
* M_Product_BOM_ID = the BOM line
* M_ProductBOM_ID = the BOM line product
*
* Replace by MPPProductBOM and MPPProductBOMLine since version 9
* @deprecated
* @author Jorg Janke
* @version $Id: MProductBOM.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
*/

View File

@ -222,6 +222,10 @@ public class MProduction extends X_M_Production implements DocAction {
}// deleteLines
public int createLines(boolean mustBeStocked) {
return createLines(mustBeStocked, 0);
}
public int createLines(boolean mustBeStocked, int PP_Product_BOM_ID) {
lineno = 100;
@ -241,12 +245,16 @@ public class MProduction extends X_M_Production implements DocAction {
line.saveEx();
count++;
createLines(mustBeStocked, finishedProduct, getProductionQty());
if (PP_Product_BOM_ID > 0) {
setPP_Product_BOM_ID(PP_Product_BOM_ID);
saveEx();
}
createLines(mustBeStocked, finishedProduct, getProductionQty(), PP_Product_BOM_ID);
return count;
}
protected int createLines(boolean mustBeStocked, MProduct finishedProduct, BigDecimal requiredQty) {
protected int createLines(boolean mustBeStocked, MProduct finishedProduct, BigDecimal requiredQty, int PP_Product_BOM_ID) {
int defaultLocator = 0;
@ -255,8 +263,15 @@ public class MProduction extends X_M_Production implements DocAction {
int M_Warehouse_ID = finishedLocator.getM_Warehouse_ID();
// products used in production
String sql = "SELECT M_ProductBom_ID, BOMQty" + " FROM M_Product_BOM"
+ " WHERE M_Product_ID=" + finishedProduct.getM_Product_ID() + " ORDER BY Line";
String sql = " SELECT bl.M_Product_ID, bl.QtyBOM" + " FROM PP_Product_BOMLine bl"
+ " JOIN PP_Product_BOM b ON b.PP_Product_BOM_ID = bl.PP_Product_BOM_ID "
+ " WHERE b.M_Product_ID=" + finishedProduct.getM_Product_ID() + " AND b.IsActive='Y' AND bl.IsActive='Y' ";
if (PP_Product_BOM_ID > 0) {
sql += " AND b.PP_Product_BOM_ID=" + PP_Product_BOM_ID;
} else {
sql += " AND b.BOMType='A' AND b.BOMUse='A' ";
}
sql += " ORDER BY bl.Line";
try (PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());) {
@ -273,7 +288,7 @@ public class MProduction extends X_M_Production implements DocAction {
if ( bomproduct.isBOM() && bomproduct.isPhantom() )
{
createLines(mustBeStocked, bomproduct, BOMMovementQty);
createLines(mustBeStocked, bomproduct, BOMMovementQty, 0);
}
else
{
@ -505,7 +520,12 @@ public class MProduction extends X_M_Production implements DocAction {
return DocAction.STATUS_InProgress;
}
protected String validateEndProduct(int M_Product_ID) {
/**
*
* @param M_Product_ID
* @return error message (if any)
*/
public String validateEndProduct(int M_Product_ID) {
String msg = isBom(M_Product_ID);
if (!Util.isEmpty(msg))
return msg;
@ -529,25 +549,26 @@ public class MProduction extends X_M_Production implements DocAction {
{
return "Attempt to create product line for Non Bill Of Materials";
}
int materials = DB.getSQLValue(get_TrxName(), "SELECT count(M_Product_BOM_ID) FROM M_Product_BOM WHERE M_Product_ID = ?", M_Product_ID);
int materials = DB.getSQLValue(get_TrxName(), "SELECT count(bl.PP_Product_BOMLine_ID) FROM PP_Product_BOMLine bl JOIN PP_Product_BOM b ON b.PP_Product_BOM_ID = bl.PP_Product_BOM_ID WHERE b.M_Product_ID = ? " +
" AND bl.IsActive='Y' AND b.IsActive='Y' AND b.BOMType='A' AND b.BOMUse='A' ", M_Product_ID );
if (materials == 0)
{
return "Attempt to create product line for Bill Of Materials with no BOM Products";
return "Attempt to create product line for Bill Of Materials with no BOM Components";
}
return null;
}
protected boolean costsOK(int M_Product_ID) throws AdempiereUserError {
MProduct product = MProduct.get(getCtx(), M_Product_ID);
MProduct product = MProduct.get(getCtx(), M_Product_ID, get_TrxName());
String costingMethod=product.getCostingMethod(MClient.get(getCtx()).getAcctSchema());
// will not work if non-standard costing is used
if (MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
String sql = "SELECT ABS(((cc.currentcostprice-(SELECT SUM(c.currentcostprice*bom.bomqty)"
{
String sql = "SELECT ABS(((cc.currentcostprice-(SELECT SUM(c.currentcostprice*bom.qtybom)"
+ " FROM m_cost c"
+ " INNER JOIN m_product_bom bom ON (c.m_product_id=bom.m_productbom_id)"
+ " INNER JOIN m_costelement ce ON (c.m_costelement_id = ce.m_costelement_id AND ce.costingmethod = 'S')"
+ " WHERE bom.m_product_id = pp.m_product_id)"
+ " INNER JOIN pp_product_bomline bom ON (c.m_product_id=bom.m_product_id AND bom.IsActive='Y')"
+ " JOIN pp_product_bom b ON (b.pp_product_bom_id = bom.pp_product_bom_id)"
+ " WHERE b.m_product_id = pp.m_product_id and b.bomuse='A' and b.bomtype='A' AND b.IsActive='Y')"
+ " )/cc.currentcostprice))"
+ " FROM m_product pp"
+ " INNER JOIN m_cost cc on (cc.m_product_id=pp.m_product_id)"

View File

@ -124,8 +124,11 @@ public class MProductionPlan extends X_M_ProductionPlan {
int asi = 0;
// products used in production
String sql = "SELECT M_ProductBom_ID, BOMQty" + " FROM M_Product_BOM"
+ " WHERE M_Product_ID=" + finishedProduct.getM_Product_ID() + " ORDER BY Line";
String sql = " SELECT bl.M_Product_ID, bl.QtyBOM" + " FROM PP_Product_BOMLine bl"
+ " JOIN PP_Product_BOM b ON b.PP_Product_BOM_ID = bl.PP_Product_BOM_ID "
+ " WHERE b.M_Product_ID=" + finishedProduct.getM_Product_ID() + " AND b.IsActive='Y' AND bl.IsActive='Y' "
+ " AND b.BOMType='A' AND b.BOMUse='A' "
+ " ORDER BY bl.Line";
try (PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());) {

View File

@ -210,7 +210,7 @@ public class ProductCost
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt = DB.prepareStatement(sql, m_trxName);
pstmt.setInt(1, m_M_Product_ID);
pstmt.setInt(2, as.getC_AcctSchema_ID());
rs = pstmt.executeQuery();
@ -268,7 +268,7 @@ public class ProductCost
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt = DB.prepareStatement(sql, m_trxName);
pstmt.setInt(1, as.getC_AcctSchema_ID());
rs = pstmt.executeQuery();
if (rs.next())

View File

@ -34,7 +34,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20210917L;
private static final long serialVersionUID = 20211005L;
/** Standard Constructor */
public X_M_Production (Properties ctx, int M_Production_ID, String trxName)
@ -698,6 +698,34 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
return false;
}
public org.eevolution.model.I_PP_Product_BOM getPP_Product_BOM() throws RuntimeException
{
return (org.eevolution.model.I_PP_Product_BOM)MTable.get(getCtx(), org.eevolution.model.I_PP_Product_BOM.Table_Name)
.getPO(getPP_Product_BOM_ID(), get_TrxName()); }
/** Set BOM & Formula.
@param PP_Product_BOM_ID
BOM & Formula
*/
public void setPP_Product_BOM_ID (int PP_Product_BOM_ID)
{
if (PP_Product_BOM_ID < 1)
set_Value (COLUMNNAME_PP_Product_BOM_ID, null);
else
set_Value (COLUMNNAME_PP_Product_BOM_ID, Integer.valueOf(PP_Product_BOM_ID));
}
/** Get BOM & Formula.
@return BOM & Formula
*/
public int getPP_Product_BOM_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_PP_Product_BOM_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Processed.
@param Processed
The document has been processed

View File

@ -54,6 +54,29 @@ public class ServerProcessCtl implements Runnable {
* @return worker started ProcessCtl instance or null for workflow
*/
public static ServerProcessCtl process (ProcessInfo pi, Trx trx)
{
return process(pi, trx, true);
}
/**
* Process Control
* <code>
* - Get Instance ID
* - Get Parameters
* - execute (lock - start process - unlock)
* </code>
* Creates a ProcessCtl instance, which calls
* lockUI and unlockUI if parent is a ASyncProcess
* <br>
* Called from APanel.cmd_print, APanel.actionButton and
* VPaySelect.cmd_generate
*
* @param pi ProcessInfo process info
* @param trx Transaction
* @param managedTrxForJavaProcess
* @return worker started ProcessCtl instance or null for workflow
*/
public static ServerProcessCtl process (ProcessInfo pi, Trx trx, boolean managedTrxForJavaProcess)
{
if (log.isLoggable(Level.FINE)) log.fine("ServerProcess - " + pi);
@ -93,6 +116,7 @@ public class ServerProcessCtl implements Runnable {
// execute
ServerProcessCtl worker = new ServerProcessCtl(pi, trx);
worker.setManagedTrxForJavaProcess(managedTrxForJavaProcess);
worker.run();
return worker;

View File

@ -26,6 +26,7 @@ import java.util.stream.Collectors;
import org.compiere.model.MProduct;
import org.compiere.model.Query;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.idempiere.cache.ImmutableIntPOCache;
@ -47,7 +48,28 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
private static ImmutableIntPOCache<Integer,MPPProductBOM> s_cache = new ImmutableIntPOCache<Integer,MPPProductBOM>(Table_Name, 40, 5);
/** BOM Lines */
private List<MPPProductBOMLine> m_lines = null;
/**
* Is Product Make to Order
* @param ctx
* @param productId
* @param trxName
* @return
*/
public static boolean isProductMakeToOrder(Properties ctx,int productId , String trxName) {
final String whereClause = MPPProductBOM.COLUMNNAME_BOMType+" IN (?,?)"
+" AND "+MPPProductBOM.COLUMNNAME_BOMUse+"=?"
+" AND "+MPPProductBOM.COLUMNNAME_M_Product_ID+"=?";
return new Query(ctx, MPPProductBOM.Table_Name, whereClause,trxName)
.setClient_ID()
.setParameters(
MPPProductBOM.BOMTYPE_Make_To_Order,
MPPProductBOM.BOMTYPE_Make_To_Kit,
MPPProductBOM.BOMUSE_Manufacturing,
productId)
.match();
}
/**
* get the Product BOM for a product
* @param product
@ -55,10 +77,11 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
*/
public static List<MPPProductBOM> getProductBOMs(MProduct product)
{
String whereClause = MPPProductBOM.COLUMNNAME_Value+"=? AND M_Product_ID=?";
String whereClause = "M_Product_ID=?";
return new Query (product.getCtx(), X_PP_Product_BOM.Table_Name, whereClause, product.get_TrxName())
.setClient_ID()
.setParameters(product.getValue(), product.getM_Product_ID())
.setParameters(product.getM_Product_ID())
.setOnlyActiveRecords(true)
.list();
}
@ -131,10 +154,28 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
*/
public static MPPProductBOM getDefault(MProduct product, String trxName)
{
MPPProductBOM bom = new Query(Env.getCtx(), Table_Name, "M_Product_ID=? AND Value=?", trxName)
.setParameters(new Object[]{product.getM_Product_ID(), product.getValue()})
.setClient_ID()
.firstOnly();
MPPProductBOM bom = null;
int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx());
String filter = "M_Product_ID=? AND "+COLUMNNAME_BOMUse+"=? AND "+COLUMNNAME_BOMType+"=? ";
if (AD_Org_ID > 0)
{
filter += "AND AD_Org_ID IN (0, "+AD_Org_ID+") ";
}
Query query = new Query(product.getCtx(), Table_Name, filter, trxName)
.setParameters(new Object[]{product.getM_Product_ID(), BOMUSE_Master, BOMTYPE_CurrentActive})
.setOnlyActiveRecords(true)
.setClient_ID();
if (AD_Org_ID > 0)
query.setOrderBy("AD_Org_ID Desc");
List<MPPProductBOM> list = query.list();
if (!list.isEmpty())
{
if (AD_Org_ID > 0 || list.size() == 1)
{
bom = list.get(0);
}
}
// If outside trx, then cache it
if (bom != null && trxName == null)
{
@ -166,7 +207,7 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
}
if (bom == null)
{
//Find BOM with Default Logic where product = bom product and bom value = value
//Find BOM with Default Logic where product = bom product, BOMUse=A and BOMType=A
bom = getDefault(product, trxName);
}
@ -274,6 +315,7 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
final String whereClause = MPPProductBOMLine.COLUMNNAME_PP_Product_BOM_ID+"=?";
this.m_lines = new Query(getCtx(), MPPProductBOMLine.Table_Name, whereClause, get_TrxName())
.setParameters(new Object[]{getPP_Product_BOM_ID()})
.setClient_ID()
.setOnlyActiveRecords(true)
.setOrderBy(MPPProductBOMLine.COLUMNNAME_Line)
.list();
@ -305,6 +347,28 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
return true;
}
/* (non-Javadoc)
* @see org.compiere.model.PO#beforeSave(boolean)
*/
@Override
protected boolean beforeSave(boolean newRecord) {
boolean b = super.beforeSave(newRecord);
if (b) {
if (BOMTYPE_CurrentActive.equals(getBOMType()) && BOMUSE_Master.equals(getBOMUse()) && isActive()) {
if (newRecord || is_ValueChanged(COLUMNNAME_BOMType) || is_ValueChanged(COLUMNNAME_BOMUse)
|| is_ValueChanged(COLUMNNAME_IsActive) || is_ValueChanged(COLUMNNAME_M_Product_ID)) {
int id = DB.getSQLValue(get_TrxName(), "SELECT PP_Product_BOM_ID FROM PP_Product_BOM WHERE M_Product_ID=? AND BOMType='A' AND BOMUse='A' AND IsActive='Y' AND PP_Product_BOM_ID != ? AND AD_Org_ID=?",
getM_Product_ID(), getPP_Product_BOM_ID(), getAD_Org_ID());
if (id > 0) {
b = false;
CLogger.getCLogger(getClass()).saveError("OnlyOneCurrentActiveMasterBOM", "");
}
}
}
}
return b;
}
@Override
protected boolean afterSave(boolean newRecord, boolean success)
{
@ -315,6 +379,20 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
{
updateProduct();
}
MProduct product = new MProduct(getCtx(), getM_Product_ID(), get_TrxName());
if (product.isBOM() && product.isVerified())
{
if ((BOMTYPE_CurrentActive.equals(getBOMType()) && BOMUSE_Master.equals(getBOMUse()))
|| (BOMTYPE_CurrentActive.equals(get_ValueOld(COLUMNNAME_BOMType)) && BOMUSE_Master.equals(get_ValueOld(COLUMNNAME_BOMUse))))
{
if (is_ValueChanged(COLUMNNAME_IsActive) || is_ValueChanged(COLUMNNAME_BOMType) || is_ValueChanged(COLUMNNAME_BOMUse) || newRecord)
{
product.setIsVerified(false);
product.saveEx();
}
}
}
return true;
}
@ -322,6 +400,7 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
{
int count = new Query(getCtx(), Table_Name, COLUMNNAME_M_Product_ID+"=?", get_TrxName())
.setParameters(new Object[]{getM_Product_ID()})
.setClient_ID()
.setOnlyActiveRecords(true)
.count();
MProduct product = new MProduct(getCtx(), getM_Product_ID(), get_TrxName());
@ -345,9 +424,8 @@ public class MPPProductBOM extends X_PP_Product_BOM implements ImmutablePOSuppor
@Override
public String toString ()
{
StringBuilder sb = new StringBuilder ("MPPProductBOM[")
.append(get_ID()).append("-").append(getDocumentNo())
.append(", Value=").append(getValue())
StringBuffer sb = new StringBuffer ("MPPProductBOM[")
.append(get_ID()).append("-").append(getValue())
.append ("]");
return sb.toString ();
}

View File

@ -18,18 +18,13 @@ package org.eevolution.model;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import javax.swing.tree.DefaultMutableTreeNode;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.model.I_M_Product;
import org.compiere.model.MProduct;
import org.compiere.model.MUOM;
import org.compiere.model.Query;
@ -68,9 +63,31 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
final String whereClause = MPPProductBOMLine.COLUMNNAME_M_Product_ID+"=?";
return new Query(product.getCtx(), MPPProductBOMLine.Table_Name, whereClause, product.get_TrxName())
.setParameters(product.getM_Product_ID())
.setOnlyActiveRecords(true)
.setClient_ID()
.list();
}
/**
* Get all the BOM lines for a Product
* @param product Product
* @return list of MPPProductBOMLine
*/
public static MPPProductBOMLine[] getBOMLines(MProduct product)
{
final String whereClause = MPPProductBOMLine.COLUMNNAME_PP_Product_BOM_ID
+ " IN ( SELECT PP_PRODUCT_BOM_ID FROM PP_PRODUCT_BOM WHERE M_PRODUCT_ID = " + product.getM_Product_ID() + " AND IsActive='Y' AND BOMType='A' AND BOMUse='A' "
+ " AND AD_Client_ID=" + product.getAD_Client_ID() + ")";
List <MPPProductBOMLine> list = new Query(product.getCtx(), MPPProductBOMLine.Table_Name, whereClause, product.get_TrxName())
.setClient_ID()
.setOnlyActiveRecords(true)
.setOrderBy(MPPProductBOMLine.COLUMNNAME_Line)
.list();
MPPProductBOMLine[] retValue = new MPPProductBOMLine[list.size()];
list.toArray(retValue);
return retValue;
}
/**
* Default Constructor
* @param ctx context
@ -88,7 +105,7 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
*/
public MPPProductBOMLine(MPPProductBOM bom)
{
super(bom.getCtx(), 0, bom.get_TableName());
super(bom.getCtx(), 0, bom.get_TrxName());
if (bom.get_ID() <= 0)
throw new IllegalArgumentException("Header not saved");
setPP_Product_BOM_ID(bom.getPP_Product_BOM_ID()); // parent
@ -137,13 +154,17 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
}
/**
* Calculate Low Level of a Product
* Get Low Level of a Product
* @param ID Product
* @return int low level
*/
public int getLowLevel()
{
return new ProductLowLevelCalculator(getCtx(), get_TrxName()).getLowLevel(getM_Product_ID());
I_M_Product parent = getPP_Product_BOM().getM_Product();
if (parent.getLowLevel() > 0)
return parent.getLowLevel()+1;
else
return 1;
}
/**
@ -171,7 +192,7 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
*/
public static int getLowLevel(Properties ctx, int M_Product_ID, String trxName)
{
return new ProductLowLevelCalculator(ctx, trxName).getLowLevel(M_Product_ID);
return MProduct.get(ctx, M_Product_ID, trxName).getLowLevel();
}
@ -205,8 +226,46 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
int lowlevel = getLowLevel();
MProduct product = new MProduct(getCtx(), getM_Product_ID(), get_TrxName());
product.setLowLevel(lowlevel); //update lowlevel
product.saveEx();
if (lowlevel > product.getLowLevel())
{
product.setLowLevel(lowlevel); //update lowlevel
product.saveEx();
}
MPPProductBOM bom = getParent();
MProduct parentProduct = (MProduct) bom.getM_Product();
if (parentProduct.isVerified())
{
MPPProductBOM defaultBOM = MPPProductBOM.getDefault(parentProduct, get_TrxName());
if (defaultBOM != null && defaultBOM.getPP_Product_BOM_ID()==bom.getPP_Product_BOM_ID())
{
if ( newRecord
|| is_ValueChanged("M_Product_ID") // Product Line was changed
|| (is_ValueChanged("IsActive") && isActive())) // line was activated
{
// Invalidate BOM
parentProduct.setIsVerified(false);
parentProduct.saveEx(get_TrxName());
}
if (parentProduct.isVerified() && is_ValueChanged("IsActive") && !isActive()) // line was inactivated
{
MPPProductBOMLine[] lines = bom.getLines(true);
int count = 0;
for (MPPProductBOMLine line : lines)
{
if (line.getPP_Product_BOMLine_ID() == getPP_Product_BOMLine_ID())
continue;
if (line.isActive())
count++;
}
if (count == 0)
{
parentProduct.setIsVerified(false);
parentProduct.saveEx(get_TrxName());
}
}
}
}
return true;
}
@ -318,154 +377,3 @@ public class MPPProductBOMLine extends X_PP_Product_BOMLine implements Immutable
}
}
class ProductLowLevelCalculator
{
private Hashtable<Integer, Integer> tableproduct = new Hashtable<Integer, Integer>();
private Properties m_ctx = null;
private String m_trxName = null;
public ProductLowLevelCalculator(Properties ctx, String trxName)
{
m_ctx = ctx;
m_trxName = trxName;
}
/**
* get low level of a Product
* @param ID Product
* @return int low level
*/
public int getLowLevel(int M_Product_ID)
{
int AD_Client_ID = Env.getAD_Client_ID(m_ctx);
tableproduct.clear(); //reset tableproduct cache
DefaultMutableTreeNode ibom = null;
tableproduct.put(M_Product_ID, 0); //insert parent into cache
ibom = iparent(AD_Client_ID, M_Product_ID, 0); //start traversing tree
return ibom.getDepth();
}
/**
* get an implotion the product
* @param ID Product
* @param ID BOM
* @return DefaultMutableTreeNode Tree with all parent product
*/
private DefaultMutableTreeNode iparent(int AD_Client_ID, int M_Product_ID, int PP_Product_BOM_ID)
{
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(Integer.toString(M_Product_ID) + "|" + Integer.toString(PP_Product_BOM_ID));
String sql = "SELECT PP_Product_BOMLine_ID FROM PP_Product_BOMLine"
+ " WHERE IsActive=? AND AD_Client_ID=? AND M_Product_ID=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, m_trxName);
DB.setParameters(pstmt, new Object[]{true, AD_Client_ID, M_Product_ID});
rs = pstmt.executeQuery();
while (rs.next())
{
// If not the first bom line at this level
if (rs.getRow() > 1)
{
//need to reset tableproduct cache
tableproduct.clear();
tableproduct.put(M_Product_ID, PP_Product_BOM_ID); //insert parent into cache
}
DefaultMutableTreeNode bom = icomponent(AD_Client_ID, rs.getInt(1), M_Product_ID, parent);
if (bom != null)
{
parent.add(bom);
}
}
}
catch (SQLException e)
{
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return parent;
}
/**
* get an implotion the product
* @param ID Product
* @param ID BOM
* @return DefaultMutableTreeNode Tree with all parent product
*/
private DefaultMutableTreeNode icomponent(int AD_Client_ID, int PP_Product_BOMLine_ID, int M_Product_ID, DefaultMutableTreeNode bom)
{
final String sql =
"SELECT pbom.M_Product_ID , pbom.Value , pbom.PP_Product_BOM_ID FROM PP_Product_BOMLine pboml"
+ " INNER JOIN PP_Product_BOM pbom ON (pbom.PP_Product_BOM_ID = pboml.PP_Product_BOM_ID)"
+ " WHERE pbom.IsActive=? AND pboml.IsActive=? AND pboml.AD_Client_ID=? AND pboml.PP_Product_BOMLine_ID=? ";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, m_trxName);
DB.setParameters(pstmt, new Object[]{true, true, AD_Client_ID, PP_Product_BOMLine_ID});
rs = pstmt.executeQuery();
while (rs.next())
{
if (M_Product_ID != rs.getInt(1))
{
//BOM Loop Error
if (!tableproduct(rs.getInt(1), rs.getInt(3)))
{
bom.add(iparent(AD_Client_ID, rs.getInt(1), rs.getInt(3)));
}
else
{
throw new AdempiereException("Cycle BOM & Formula:" + rs.getString(2) + "(" + rs.getString(3) + ")");
}
}
else
{
//Child = Parent error
MProduct product = MProduct.get(m_ctx, M_Product_ID);
throw new AdempiereException("Cycle BOM & Formula:" + rs.getString(2) + "(" + rs.getString(3) +")"
+ " - Component: " + product.getValue() + "(" + product.getM_Product_ID() + ")");
}
}
}
catch (SQLException e)
{
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return null;
}
/**
* find a product in cache
* @param ID Product
* @param ID BOM
* @return true if product is found
*/
private boolean tableproduct(int M_Product_ID, int PP_Product_BOM_ID)
{
if (tableproduct.containsKey(M_Product_ID))
{
return true;
}
tableproduct.put(M_Product_ID, PP_Product_BOM_ID);
return false;
}
}

View File

@ -123,4 +123,4 @@ public class PP_Product_BOM_Check extends SvrProcess
throw new AdempiereUserError(msg);
}
} // M_Product_BOM_Check
} // PP_Product_BOM_Check

View File

@ -39,25 +39,33 @@ import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.MColumn;
import org.compiere.model.MInvoice;
import org.compiere.model.MInvoiceLine;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MProduct;
import org.compiere.model.MProductBOM;
import org.compiere.model.MProject;
import org.compiere.model.MProjectLine;
import org.compiere.model.MRole;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
@ -77,7 +85,7 @@ import org.zkoss.zul.Vlayout;
public class WBOMDrop extends ADForm implements EventListener<Event>
public class WBOMDrop extends ADForm implements EventListener<Event>, ValueChangeListener
{
/**
*
@ -119,7 +127,6 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Grid selectionPanel = GridFactory.newGridLayout();
private Listbox productField = new Listbox();
private Decimalbox productQty = new Decimalbox();
private Listbox orderField = new Listbox();
private Listbox invoiceField = new Listbox();
@ -129,6 +136,8 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
private Groupbox grpSelectProd = new Groupbox();
private int indend = 20;
private WSearchEditor fieldProduct;
public WBOMDrop()
{}
@ -208,41 +217,39 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
* @param order
* @param invoice
* @param project
* @throws Exception
*/
private void createSelectionPanel (boolean order, boolean invoice, boolean project)
private void createSelectionPanel (boolean order, boolean invoice, boolean project) throws Exception
{
Caption caption = new Caption(Msg.translate(Env.getCtx(), "Selection"));
// grpSelectionPanel.setWidth("100%");
grpSelectionPanel.appendChild(caption);
grpSelectionPanel.appendChild(selectionPanel);
productField.setRows(1);
productField.setMold("select");
KeyNamePair[] keyNamePair = getProducts();
for (int i = 0; i < keyNamePair.length; i++)
{
productField.addItem(keyNamePair[i]);
}
MLookup productLookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
MColumn.getColumn_ID(MProduct.Table_Name, "M_Product_ID"),
DisplayType.Search, Env.getLanguage(Env.getCtx()), MProduct.COLUMNNAME_M_Product_ID, 0, false,
"M_Product.IsBOM='Y' AND M_Product.IsVerified='Y' AND M_Product.IsActive='Y' ");
fieldProduct = new WSearchEditor("M_Product_ID", true, false, true, productLookup);
fieldProduct.addValueChangeListener(this);
Rows rows = selectionPanel.newRows();
Row boxProductQty = rows.newRow();
Label lblProduct = new Label(Msg.translate(Env.getCtx(), "M_Product_ID"));
Label lblQty = new Label(Msg.translate(Env.getCtx(), "Qty"));
productQty.setValue(Env.ONE);
productField.addEventListener(Events.ON_SELECT, this);
productQty.addEventListener(Events.ON_CHANGE, this);
ZKUpdateUtil.setWidth(productField, "99%");
fieldProduct.fillHorizontal();
boxProductQty.appendChild(lblProduct.rightAlign());
boxProductQty.appendChild(productField);
boxProductQty.appendChild(fieldProduct.getComponent());
boxProductQty.appendChild(lblQty.rightAlign());
boxProductQty.appendChild(productQty);
KeyNamePair[] keyNamePair = null;
if (order)
{
keyNamePair = getOrders();
@ -322,22 +329,6 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
confirmPanel.setEnabled("Ok", false);
} // createSelectionPanel
/**
* Get Array of BOM Products
* @return products
*/
private KeyNamePair[] getProducts()
{
String sql = "SELECT M_Product_ID, Name "
+ "FROM M_Product "
+ "WHERE IsBOM='Y' AND IsVerified='Y' AND IsActive='Y' "
+ "ORDER BY Name";
return DB.getKeyNamePairs(MRole.getDefault().addAccessSQL(
sql, "M_Product", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO), true);
} // getProducts
/**
* Get Array of open Orders
* @return orders
@ -440,11 +431,13 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
private int getDeepBom (MProduct product, int curentBomDeep) {
int bomDeep = curentBomDeep;
if (product.isBOM()) {
MProductBOM[] bomLines = MProductBOM.getBOMLines(product);
for (MProductBOM bomLine : bomLines) {
int testBomDeep = getDeepBom(bomLine.getProduct(), curentBomDeep + 1);
if (testBomDeep > bomDeep) {
bomDeep = testBomDeep;
MPPProductBOM bom = MPPProductBOM.getDefault(product, (String)null);
if (bom != null) {
for (MPPProductBOMLine bomLine : bom.getLines()) {
int testBomDeep = getDeepBom(bomLine.getProduct(), curentBomDeep + 1);
if (testBomDeep > bomDeep) {
bomDeep = testBomDeep;
}
}
}
}
@ -460,26 +453,26 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
private void addBOMLines (MProduct product, BigDecimal qty, Component parentPanel, int bomLevel)
{
MProductBOM[] bomLines = MProductBOM.getBOMLines(product);
MPPProductBOM bom = MPPProductBOM.getDefault(product, (String)null);
MPPProductBOMLine[] bomLines = bom.getLines();
//sort, gourp alter product with together
Arrays.sort(bomLines, new Comparator<MProductBOM>() {
Arrays.sort(bomLines, new Comparator<MPPProductBOMLine>() {
@Override
public int compare(MProductBOM arg0, MProductBOM arg1) {
return arg0.getBOMType().compareTo(arg1.getBOMType());
public int compare(MPPProductBOMLine arg0, MPPProductBOMLine arg1) {
return arg0.getComponentType().compareTo(arg1.getComponentType());
}
});
// 2nd sort by Line Number in order to correspond with BOM Structure, patch 2015-03-31
Arrays.sort(bomLines, new Comparator<MProductBOM>() {
@Override
public int compare(MProductBOM arg0, MProductBOM arg1) {
String t1 = String.valueOf(arg0.getLine()+100000);
String t2 = String.valueOf(arg1.getLine()+100000);
return t1.compareTo(t2);
}
});
// 2nd sort by Line Number in order to correspond with BOM Structure, patch 2015-03-31
Arrays.sort(bomLines, new Comparator<MPPProductBOMLine>() {
@Override
public int compare(MPPProductBOMLine arg0, MPPProductBOMLine arg1) {
String t1 = String.valueOf(arg0.getLine()+100000);
String t2 = String.valueOf(arg1.getLine()+100000);
return t1.compareTo(t2);
}
});
for (int i = 0; i < bomLines.length; i++)
{
addBOMLine (bomLines[i], qty, parentPanel, bomLevel);
@ -495,15 +488,14 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
* @param qty quantity
*/
private void addBOMLine (MProductBOM line, BigDecimal qty, Component parentPanel, int bomLevel)
private void addBOMLine (MPPProductBOMLine line, BigDecimal qty, Component parentPanel, int bomLevel)
{
if (log.isLoggable(Level.FINE)) log.fine(line.toString());
String bomType = line.getBOMType();
String bomType = line.getComponentType();
if (bomType == null)
bomType = MProductBOM.BOMTYPE_StandardPart;
//
BigDecimal lineQty = line.getBOMQty().multiply(qty);
bomType = MPPProductBOMLine.COMPONENTTYPE_Component; //
BigDecimal lineQty = line.getQtyBOM().multiply(qty);
MProduct product = line.getProduct();
if (product == null)
@ -552,9 +544,9 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
// checkbox or radio button for select product
Div selectPanel = createDivPanel(25);
org.zkoss.zul.Checkbox rd = null;
boolean isStandard = MProductBOM.BOMTYPE_StandardPart.equals(bomType);
boolean isStandard = MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType);
if (MProductBOM.BOMTYPE_StandardPart.equals(bomType) || MProductBOM.BOMTYPE_OptionalPart.equals(bomType))
if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType) || MPPProductBOMLine.COMPONENTTYPE_Option.equals(bomType))
{
rd = new Checkbox();
rd.setChecked(isStandard);
@ -602,7 +594,7 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
}
// add product panel to parent, with radio, add to radio group
if (MProductBOM.BOMTYPE_StandardPart.equals(bomType) || MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) {
if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType) || MPPProductBOMLine.COMPONENTTYPE_Option.equals(bomType)) {
outerContainer.appendChild(outerProductPanel);
} else {
// String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType;
@ -684,19 +676,11 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
updateBomList();
} // JCheckBox or JRadioButton
// Product / Qty
else if (source == productField || source == productQty)
else if (source == productQty)
{
m_qty = productQty.getValue();
ListItem listitem = productField.getSelectedItem();
KeyNamePair pp = null;
if (listitem != null)
pp = listitem.toKeyNamePair();
m_product = pp!= null ? MProduct.get (Env.getCtx(), pp.getKey()) : null;
createMainPanel();
if (m_product != null && m_product.get_ID() > 0)
createMainPanel();
//sizeIt();
}
@ -801,6 +785,13 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
confirmPanel.setEnabled("Ok", OK);
} // actionPerformed
private void onProductChanged(Object productFieldValue) {
int id = (productFieldValue != null && productFieldValue instanceof Integer) ? (Integer)productFieldValue : 0;
if (m_product == null || m_product.get_ID() != id)
m_product = id > 0 ? MProduct.get (Env.getCtx(), id) : null;
createMainPanel();
}
/**
* update display of bom tree
* for item is not selected, hidden child of it.
@ -1069,4 +1060,9 @@ public class WBOMDrop extends ADForm implements EventListener<Event>
if (log.isLoggable(Level.CONFIG)) log.config("#" + lineCount);
return true;
} // cmd_saveProject
@Override
public void valueChange(ValueChangeEvent evt) {
onProductChanged(evt.getNewValue());
}
}

View File

@ -46,14 +46,14 @@ import org.compiere.model.MColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MProduct;
import org.compiere.model.MProductBOM;
import org.compiere.model.MUOM;
import org.compiere.model.Query;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.Msg;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
@ -112,9 +112,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
private void loadTableBOM()
{
// Header Info
// Header Info
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), "IsActive")); // 0
@ -351,11 +349,11 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
m_tree.getTreefoot().detach();
if (m_tree.getTreechildren() != null)
m_tree.getTreechildren().detach();
for (MProductBOM bomline : getParentBOMs(M_Product_ID))
for (MPPProductBOMLine bomline : MPPProductBOMLine.getByProduct(product))
{
addParent(bomline, m_root);
}
}
Treecols treeCols = new Treecols();
m_tree.appendChild(treeCols);
@ -380,10 +378,11 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
m_tree.getTreefoot().detach();
if (m_tree.getTreechildren() != null)
m_tree.getTreechildren().detach();
for (MProductBOM bom : getChildBOMs(M_Product_ID, true))
for (MPPProductBOM bom : MPPProductBOM.getProductBOMs(product))
{
addChild(bom, m_root);
}
addChild(bom, m_root);
}
Treecols treeCols = new Treecols();
m_tree.appendChild(treeCols);
@ -417,7 +416,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
if (isImplosion())
{
for (MProductBOM bomline : getParentBOMs(M_Product_ID))
for (MPPProductBOMLine bomline : MPPProductBOMLine.getByProduct(MProduct.get(M_Product_ID)))
{
addParent(bomline, m_selectedNode);
}
@ -426,7 +425,7 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
else
{
for (MProductBOM bom : getChildBOMs(M_Product_ID, true))
for (MPPProductBOM bom : MPPProductBOM.getProductBOMs(MProduct.get(M_Product_ID)))
{
addChild(bom, m_selectedNode);
}
@ -437,51 +436,54 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
}
public void addChild(MProductBOM bomline, mySimpleTreeNode parent) throws Exception
public void addChild(MPPProductBOM bom, mySimpleTreeNode parent) throws Exception
{
for (MPPProductBOMLine bomline : bom.getLines())
{
MProduct M_Product = MProduct.get(getCtx(), bomline.getM_Product_ID());
MProduct M_Product = MProduct.get(getCtx(), bomline.getM_ProductBOM_ID());
Vector<Object> line = new Vector<Object>(10);
line.add( Boolean.valueOf(bomline.isActive())); // 0 IsActive
line.add( Integer.valueOf(bomline.getLine()).toString()); // 1 Line
KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(),M_Product.getValue().concat("_").concat(M_Product.getName()));
line.add(pp); // 2 M_Product_ID
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
line.add(uom); // 3 C_UOM_ID
line.add((BigDecimal) ((bomline.getQtyBOM()!=null) ? bomline.getQtyBOM() : Env.ZERO).setScale(4, RoundingMode.HALF_UP).stripTrailingZeros()); // 4 QtyBOM
mySimpleTreeNode child = new mySimpleTreeNode(line,new ArrayList<TreeNode<Object>>());
if (!reload)
parent.getChildren().add(child);
if (m_selected_id == bomline.getM_Product_ID() || getM_Product_ID() == bomline.getM_Product_ID())
dataBOM.add(line);
if (reload) return;
for (MPPProductBOMLine bl : MPPProductBOMLine.getByProduct(M_Product))
{
addParent(bl, child);
}
}
}
public void addParent(MPPProductBOMLine bomline, mySimpleTreeNode parent) throws Exception
{
MPPProductBOM bom = new MPPProductBOM(getCtx(), bomline.getPP_Product_BOM_ID(), null);
MProduct M_Product = MProduct.get(getCtx(), bom.getM_Product_ID());
Vector<Object> line = new Vector<Object>(10);
line.add( Boolean.valueOf(bomline.isActive())); // 0 IsActive
line.add( Boolean.valueOf(M_Product.isActive())); // 0 IsActive
line.add( Integer.valueOf(bomline.getLine()).toString()); // 1 Line
KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(),M_Product.getValue().concat("_").concat(M_Product.getName()));
line.add(pp); // 2 M_Product_ID
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
line.add(uom); // 3 C_UOM_ID
line.add((BigDecimal) ((bomline.getBOMQty()!=null) ? bomline.getBOMQty() : Env.ZERO).setScale(4, RoundingMode.HALF_UP).stripTrailingZeros()); // 4 QtyBOM
line.add((BigDecimal) ((bomline.getQtyBOM()!=null) ? bomline.getQtyBOM() : Env.ZERO).setScale(4, RoundingMode.HALF_UP).stripTrailingZeros()); // 4 QtyBOM
mySimpleTreeNode child = new mySimpleTreeNode(line,new ArrayList<TreeNode<Object>>());
if (!reload)
parent.getChildren().add(child);
if (m_selected_id == bomline.getM_Product_ID() || getM_Product_ID() == bomline.getM_Product_ID())
dataBOM.add(line);
if (reload) return;
for (MProductBOM bom : getChildBOMs(bomline.getM_ProductBOM_ID(), false))
{
addChild(bom, child);
}
}
public void addParent(MProductBOM bom, mySimpleTreeNode parent) throws Exception
{
MProduct M_Product = MProduct.get(getCtx(), bom.getM_Product_ID());
Vector<Object> line = new Vector<Object>(10);
line.add( Boolean.valueOf(M_Product.isActive())); // 0 IsActive
line.add( Integer.valueOf(bom.getLine()).toString()); // 1 Line
KeyNamePair pp = new KeyNamePair(M_Product.getM_Product_ID(),M_Product.getValue().concat("_").concat(M_Product.getName()));
line.add(pp); // 2 M_Product_ID
MUOM u = new MUOM(M_Product.getCtx(), M_Product.getC_UOM_ID(), M_Product.get_TrxName());
KeyNamePair uom = new KeyNamePair(u.get_ID(),u.getUOMSymbol());
line.add(uom); // 3 C_UOM_ID
line.add((BigDecimal) ((bom.getBOMQty()!=null) ? bom.getBOMQty() : Env.ZERO).setScale(4, RoundingMode.HALF_UP).stripTrailingZeros()); // 4 QtyBOM
if(m_selected_id == bom.getM_ProductBOM_ID() || getM_Product_ID() == bom.getM_ProductBOM_ID())
if(m_selected_id == bom.getM_Product_ID() || getM_Product_ID() == bomline.getM_Product_ID())
dataBOM.add(line);
mySimpleTreeNode child = new mySimpleTreeNode(line,new ArrayList<TreeNode<Object>>());
@ -490,11 +492,10 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
if (reload) return;
for (MProductBOM bomline : getParentBOMs(bom.getM_Product_ID()))
for (MPPProductBOMLine bl : MPPProductBOMLine.getByProduct(M_Product))
{
addParent(bomline, child);
addParent(bl, child);
}
}
private int getM_Product_ID() {
@ -504,26 +505,6 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener<
return Product.intValue();
}
private List<MProductBOM> getChildBOMs(int M_Product_ID, boolean onlyActiveRecords)
{
String filter = MProductBOM.COLUMNNAME_M_Product_ID+"=?"
+(onlyActiveRecords ? " AND IsActive='Y'" : "");
return new Query(getCtx(), MProductBOM.Table_Name, filter, null)
.setParameters(new Object[]{M_Product_ID})
.setOrderBy(MProductBOM.COLUMNNAME_Line)
.list();
}
private List<MProductBOM> getParentBOMs(int M_Product_ID)
{
String filter = MProductBOM.COLUMNNAME_M_ProductBOM_ID+"=?";
return new Query(getCtx(), MProductBOM.Table_Name, filter, null)
.setParameters(new Object[]{M_Product_ID})
.setOrderBy(MProductBOM.COLUMNNAME_M_Product_ID+","+MProductBOM.COLUMNNAME_Line)
.list()
;
}
private boolean isImplosion() {
return implosion.isSelected();
}

View File

@ -0,0 +1,372 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.idempiere.test.model;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.math.BigDecimal;
import java.util.List;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MClient;
import org.compiere.model.MCost;
import org.compiere.model.MCostElement;
import org.compiere.model.MFactAcct;
import org.compiere.model.MInventory;
import org.compiere.model.MInventoryLine;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess;
import org.compiere.model.MProduct;
import org.compiere.model.MProductCategory;
import org.compiere.model.MProductCategoryAcct;
import org.compiere.model.MProduction;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.ProductCost;
import org.compiere.model.Query;
import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl;
import org.compiere.util.Env;
import org.compiere.wf.MWorkflow;
import org.eevolution.model.MPPProductBOM;
import org.eevolution.model.MPPProductBOMLine;
import org.idempiere.test.AbstractTestCase;
import org.junit.jupiter.api.Test;
/**
*
* @author hengsin
*
*/
public class ProductionTest extends AbstractTestCase {
@Test
public void testAverageCostingProduction() {
int mulchId = 137;
int hqLocator = 101;
MProduct mulch = MProduct.get(mulchId);
BigDecimal componentOnHand1 = MStorageOnHand.getQtyOnHand(mulchId, getM_Warehouse_ID(), 0, getTrxName());
BigDecimal componentCost = MCost.getCurrentCost(mulch, 0, getTrxName());
MProduct mulchX = new MProduct(Env.getCtx(), 0, getTrxName());
mulchX.setName("Mulch X");
mulchX.setIsBOM(true);
mulchX.setIsStocked(true);
mulchX.setC_UOM_ID(mulch.getC_UOM_ID());
mulchX.setM_Product_Category_ID(mulch.getM_Product_Category_ID());
mulchX.setProductType(mulch.getProductType());
mulchX.setM_AttributeSet_ID(mulch.getM_AttributeSet_ID());
mulchX.setC_TaxCategory_ID(mulch.getC_TaxCategory_ID());
mulchX.saveEx();
BigDecimal endProductOnHand1 = MStorageOnHand.getQtyOnHand(mulchX.get_ID(), getM_Warehouse_ID(), 0, getTrxName());
MPPProductBOM bom = new MPPProductBOM(Env.getCtx(), 0, getTrxName());
bom.setM_Product_ID(mulchX.get_ID());
bom.setBOMType(MPPProductBOM.BOMTYPE_CurrentActive);
bom.setBOMUse(MPPProductBOM.BOMUSE_Master);
bom.setName(mulchX.getName());
bom.saveEx();
MPPProductBOMLine line = new MPPProductBOMLine(bom);
line.setM_Product_ID(mulchId);
line.setQtyBOM(new BigDecimal("1"));
line.saveEx();
mulchX.load(getTrxName());
mulchX.setIsVerified(true);
mulchX.saveEx();
MProduction production = new MProduction(Env.getCtx(), 0, getTrxName());
production.setM_Product_ID(mulchX.get_ID());
production.setM_Locator_ID(hqLocator);
production.setIsUseProductionPlan(false);
production.setMovementDate(getLoginDate());
production.setDocAction(DocAction.ACTION_Complete);
production.setDocStatus(DocAction.STATUS_Drafted);
production.setIsComplete(false);
production.setProductionQty(new BigDecimal("1"));
production.setPP_Product_BOM_ID(bom.getPP_Product_BOM_ID());
production.saveEx();
int productionCreate = 53226;
MProcess process = MProcess.get(Env.getCtx(), productionCreate);
ProcessInfo pi = new ProcessInfo(process.getName(), process.get_ID());
pi.setAD_Client_ID(getAD_Client_ID());
pi.setAD_User_ID(getAD_User_ID());
pi.setRecord_ID(production.get_ID());
pi.setTransactionName(getTrxName());
ServerProcessCtl.process(pi, getTrx(), false);
assertFalse(pi.isError(), pi.getSummary());
production.load(getTrxName());
assertEquals("Y", production.getIsCreated(), "MProduction.IsCreated != Y");
assertTrue(production.getLines().length > 0, "No Production Lines");
ProcessInfo info = MWorkflow.runDocumentActionWorkflow(production, DocAction.ACTION_Complete);
production.load(getTrxName());
assertFalse(info.isError(), info.getSummary());
assertEquals(DocAction.STATUS_Completed, production.getDocStatus(), "Production Status="+production.getDocStatus());
BigDecimal componentOnHand2 = MStorageOnHand.getQtyOnHand(mulchId, getM_Warehouse_ID(), 0, getTrxName());
BigDecimal endProductOnHand2 = MStorageOnHand.getQtyOnHand(mulchX.get_ID(), getM_Warehouse_ID(), 0, getTrxName());
assertTrue(componentOnHand2.compareTo(componentOnHand1) < 0, "On hand of component doesn't reduce as expected");
assertTrue(endProductOnHand2.compareTo(endProductOnHand1) > 0, "On hand of end product doesn't increase as expected");
if (!production.isPosted()) {
String msg = DocumentEngine.postImmediate(Env.getCtx(), getAD_Client_ID(), MProduction.Table_ID, production.get_ID(), false, getTrxName());
assertNull(msg, msg);
}
BigDecimal endProductCost = MCost.getCurrentCost(mulchX, 0, getTrxName());
assertTrue(endProductCost.equals(componentCost), "Cost not roll up correctly");
}
@Test
public void testStandardCostingProduction() {
MProductCategory category = new MProductCategory(Env.getCtx(), 0, null);
category.setName("Standard Costing");
category.saveEx();
String whereClause = "M_Product_Category_ID=?";
List<MProductCategoryAcct> categoryAccts = new Query(Env.getCtx(), MProductCategoryAcct.Table_Name, whereClause, null)
.setParameters(category.get_ID())
.list();
for (MProductCategoryAcct categoryAcct : categoryAccts) {
categoryAcct.setCostingMethod(MAcctSchema.COSTINGMETHOD_StandardCosting);
categoryAcct.saveEx();
}
try {
int mulchId = 137;
int hqLocator = 101;
MProduct mulch = MProduct.get(mulchId);
BigDecimal componentOnHand1 = MStorageOnHand.getQtyOnHand(mulchId, getM_Warehouse_ID(), 0, getTrxName());
BigDecimal componentCost = MCost.getCurrentCost(mulch, 0, getTrxName());
MProduct mulchX = new MProduct(Env.getCtx(), 0, getTrxName());
mulchX.setName("Mulch X");
mulchX.setIsBOM(true);
mulchX.setIsStocked(true);
mulchX.setC_UOM_ID(mulch.getC_UOM_ID());
mulchX.setM_Product_Category_ID(category.getM_Product_Category_ID());
mulchX.setProductType(mulch.getProductType());
mulchX.setM_AttributeSet_ID(mulch.getM_AttributeSet_ID());
mulchX.setC_TaxCategory_ID(mulch.getC_TaxCategory_ID());
mulchX.saveEx();
BigDecimal endProductOnHand1 = MStorageOnHand.getQtyOnHand(mulchX.get_ID(), getM_Warehouse_ID(), 0, getTrxName());
int costAdjustmentDocTypeId = 200004;
MInventory inventory = new MInventory(Env.getCtx(), 0, getTrxName());
inventory.setCostingMethod(MAcctSchema.COSTINGMETHOD_StandardCosting);
inventory.setC_DocType_ID(costAdjustmentDocTypeId);
inventory.setM_Warehouse_ID(getM_Warehouse_ID());
inventory.setMovementDate(getLoginDate());
inventory.setDocAction(DocAction.ACTION_Complete);
inventory.saveEx();
BigDecimal endProductCost = new BigDecimal("2.50");
MInventoryLine il = new MInventoryLine(Env.getCtx(), 0, getTrxName());
il.setM_Inventory_ID(inventory.get_ID());
il.setM_Locator_ID(hqLocator);
il.setM_Product_ID(mulchX.getM_Product_ID());
il.setCurrentCostPrice(new BigDecimal("0"));
il.setNewCostPrice(endProductCost);
il.saveEx();
ProcessInfo info = MWorkflow.runDocumentActionWorkflow(inventory, DocAction.ACTION_Complete);
inventory.load(getTrxName());
assertFalse(info.isError(), info.getSummary());
assertEquals(DocAction.STATUS_Completed, inventory.getDocStatus(), "Cost Adjustment Status="+inventory.getDocStatus());
if (!inventory.isPosted()) {
String msg = DocumentEngine.postImmediate(Env.getCtx(), getAD_Client_ID(), MInventory.Table_ID, inventory.get_ID(), false, getTrxName());
assertNull(msg, msg);
}
BigDecimal adjusted = MCost.getCurrentCost(mulchX, 0, getTrxName());
assertTrue(adjusted.equals(endProductCost), "Cost not adjusted: " + adjusted.toPlainString());
MPPProductBOM bom = new MPPProductBOM(Env.getCtx(), 0, getTrxName());
bom.setM_Product_ID(mulchX.get_ID());
bom.setBOMType(MPPProductBOM.BOMTYPE_CurrentActive);
bom.setBOMUse(MPPProductBOM.BOMUSE_Master);
bom.setName(mulchX.getName());
bom.saveEx();
MPPProductBOMLine line = new MPPProductBOMLine(bom);
line.setM_Product_ID(mulchId);
line.setQtyBOM(new BigDecimal("1"));
line.saveEx();
mulchX.load(getTrxName());
mulchX.setIsVerified(true);
mulchX.saveEx();
MProduction production = new MProduction(Env.getCtx(), 0, getTrxName());
production.setM_Product_ID(mulchX.get_ID());
production.setM_Locator_ID(hqLocator);
production.setIsUseProductionPlan(false);
production.setMovementDate(getLoginDate());
production.setDocAction(DocAction.ACTION_Complete);
production.setDocStatus(DocAction.STATUS_Drafted);
production.setIsComplete(false);
production.setProductionQty(new BigDecimal("1"));
production.setPP_Product_BOM_ID(bom.getPP_Product_BOM_ID());
production.saveEx();
int productionCreate = 53226;
MProcess process = MProcess.get(Env.getCtx(), productionCreate);
ProcessInfo pi = new ProcessInfo(process.getName(), process.get_ID());
pi.setAD_Client_ID(getAD_Client_ID());
pi.setAD_User_ID(getAD_User_ID());
pi.setRecord_ID(production.get_ID());
pi.setTransactionName(getTrxName());
ServerProcessCtl.process(pi, getTrx(), false);
assertFalse(pi.isError(), pi.getSummary());
production.load(getTrxName());
assertEquals("Y", production.getIsCreated(), "MProduction.IsCreated != Y");
assertTrue(production.getLines().length > 0, "No Production Lines");
info = MWorkflow.runDocumentActionWorkflow(production, DocAction.ACTION_Complete);
production.load(getTrxName());
assertFalse(info.isError(), info.getSummary());
assertEquals(DocAction.STATUS_Completed, production.getDocStatus(), "Production Status="+production.getDocStatus());
BigDecimal componentOnHand2 = MStorageOnHand.getQtyOnHand(mulchId, getM_Warehouse_ID(), 0, getTrxName());
BigDecimal endProductOnHand2 = MStorageOnHand.getQtyOnHand(mulchX.get_ID(), getM_Warehouse_ID(), 0, getTrxName());
assertTrue(componentOnHand2.compareTo(componentOnHand1) < 0, "On hand of component doesn't reduce as expected");
assertTrue(endProductOnHand2.compareTo(endProductOnHand1) > 0, "On hand of end product doesn't increase as expected");
if (!production.isPosted()) {
String msg = DocumentEngine.postImmediate(Env.getCtx(), getAD_Client_ID(), MProduction.Table_ID, production.get_ID(), false, getTrxName());
assertNull(msg, msg);
}
BigDecimal endProductCost1 = MCost.getCurrentCost(mulchX, 0, getTrxName());
assertTrue(endProductCost1.equals(endProductCost), "Standard Cost Changed");
ProductCost pc = new ProductCost (Env.getCtx(), mulchX.getM_Product_ID(), 0, getTrxName());
MAccount acctVariance = pc.getAccount(ProductCost.ACCTTYPE_P_RateVariance, MClient.get(getAD_Client_ID()).getAcctSchema());
whereClause = MFactAcct.COLUMNNAME_AD_Table_ID + "=" + MProduction.Table_ID
+ " AND " + MFactAcct.COLUMNNAME_Record_ID + "=" + production.get_ID()
+ " AND " + MFactAcct.COLUMNNAME_C_AcctSchema_ID + "=" + MClient.get(getAD_Client_ID()).getAcctSchema().getC_AcctSchema_ID()
+ " AND " + MFactAcct.COLUMNNAME_Account_ID + "=" + acctVariance.getAccount_ID();
int[] ids = MFactAcct.getAllIDs(MFactAcct.Table_Name, whereClause, getTrxName());
BigDecimal variance = BigDecimal.ZERO;
for (int id : ids) {
MFactAcct fa = new MFactAcct(Env.getCtx(), id, getTrxName());
variance = fa.getAmtAcctDr().subtract(fa.getAmtAcctCr());
break;
}
assertEquals(variance.doubleValue(), componentCost.subtract(endProductCost).doubleValue(), "Variance not posted correctly.");
} finally {
getTrx().rollback();
category.deleteEx(true);
}
}
@Test
public void testRollUp() {
MProductCategory category = new MProductCategory(Env.getCtx(), 0, null);
category.setName("Standard Costing");
category.saveEx();
String whereClause = "M_Product_Category_ID=?";
List<MProductCategoryAcct> categoryAccts = new Query(Env.getCtx(), MProductCategoryAcct.Table_Name, whereClause, null)
.setParameters(category.get_ID())
.list();
for (MProductCategoryAcct categoryAcct : categoryAccts) {
categoryAcct.setCostingMethod(MAcctSchema.COSTINGMETHOD_StandardCosting);
categoryAcct.saveEx();
}
try {
int rollUpProcessId = 53230;
int mulchId = 137;
MProduct mulch = MProduct.get(mulchId);
BigDecimal componentCost = MCost.getCurrentCost(mulch, 0, getTrxName());
MProduct mulchX = new MProduct(Env.getCtx(), 0, getTrxName());
mulchX.setName("Mulch X");
mulchX.setIsBOM(true);
mulchX.setIsStocked(true);
mulchX.setC_UOM_ID(mulch.getC_UOM_ID());
mulchX.setM_Product_Category_ID(category.getM_Product_Category_ID());
mulchX.setProductType(mulch.getProductType());
mulchX.setM_AttributeSet_ID(mulch.getM_AttributeSet_ID());
mulchX.setC_TaxCategory_ID(mulch.getC_TaxCategory_ID());
mulchX.saveEx();
MPPProductBOM bom = new MPPProductBOM(Env.getCtx(), 0, getTrxName());
bom.setM_Product_ID(mulchX.get_ID());
bom.setBOMType(MPPProductBOM.BOMTYPE_CurrentActive);
bom.setBOMUse(MPPProductBOM.BOMUSE_Master);
bom.setName(mulchX.getName());
bom.saveEx();
MPPProductBOMLine line = new MPPProductBOMLine(bom);
line.setM_Product_ID(mulchId);
line.setQtyBOM(new BigDecimal("1"));
line.saveEx();
mulchX.load(getTrxName());
mulchX.setIsVerified(true);
mulchX.saveEx();
MPInstance instance = new MPInstance(Env.getCtx(), rollUpProcessId, 0);
instance.saveEx();
MPInstancePara para = new MPInstancePara(instance, 10);
para.setParameterName("M_Product_ID");
para.setP_Number(mulchX.get_ID());
para.saveEx();
para = new MPInstancePara(instance, 20);
para.setParameterName("M_CostElement_ID");
para.setP_Number(MCostElement.getMaterialCostElement(Env.getCtx(), MAcctSchema.COSTINGMETHOD_StandardCosting).get_ID());
para.saveEx();
ProcessInfo info = new ProcessInfo(MProcess.get(rollUpProcessId).getName(), rollUpProcessId);
info.setAD_PInstance_ID(instance.getAD_PInstance_ID());
info.setTransactionName(getTrxName());
ServerProcessCtl.process(info, getTrx(), false);
assertFalse(info.isError(), info.getSummary());
BigDecimal endProductCost = MCost.getCurrentCost(mulchX, 0, getTrxName());
assertEquals(componentCost.doubleValue(), endProductCost.doubleValue(), "BOM Cost not roll up.");
} finally {
getTrx().rollback();
category.deleteEx(true);
}
}
}