hg merge release-4.1 (merge release4.1 into development)
This commit is contained in:
commit
9cce160aff
|
@ -0,0 +1,118 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Add IsAutoGenerateLot to M_AttributeSet.
|
||||
-- Apr 20, 2017 3:34:42 PM SGT
|
||||
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203078,0,0,'Y',TO_DATE('2017-04-20 15:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 15:34:41','YYYY-MM-DD HH24:MI:SS'),100,'IsAutoGenerateLot','IsAutoGenerateLot','Auto Generate Lot','D','01487993-345a-4ddf-8da7-50d88581686b')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:18 PM SGT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213024,0,'IsAutoGenerateLot',560,'IsAutoGenerateLot',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2017-04-20 15:37:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 15:37:17','YYYY-MM-DD HH24:MI:SS'),100,203078,'Y','N','U','N','N','N','Y','ac7ab79e-7b73-48ac-ae20-bec945663a19','Y',0,'N','N')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:27 PM SGT
|
||||
ALTER TABLE M_AttributeSet ADD IsAutoGenerateLot CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerateLot IN ('Y','N'))
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:50 PM SGT
|
||||
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2017-04-20 15:37:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213024
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:45:39 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (204432,'IsAutoGenerateLot',461,213024,'Y',0,220,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 15:45:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 15:45:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','9e9451eb-37c7-4766-9546-97bab80a2478','Y',210,2,2,1,'N','N','N')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:02:13 PM SGT
|
||||
UPDATE AD_Field SET DisplayLogic='@IsLot@=Y& @M_LotCtl_ID@ > 0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 16:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204432
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:06:48 PM SGT
|
||||
INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200224,'Attributes',53127,40,'Y',765,0,0,'Y',TO_DATE('2017-04-20 16:06:47','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:06:47','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','N','N',0,'N','U','Y','N','9eced926-7d62-4fb8-9820-75039a2e9856','B')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:04 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (204433,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200224,13286,'Y',22,10,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:03','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','b69238c1-336d-48fb-977e-9a9191a1f849','N',2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:04 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (204434,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200224,13285,'Y',22,20,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','24234f73-569c-499c-8209-f910b6f69050','Y','Y',10,4,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:05 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204435,'Attribute Set Instance','Product Attribute Set Instance','The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.',200224,13287,'Y',22,30,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','e328aac8-688c-4229-8a7d-181ebf0e8a38','Y',20,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:06 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204436,'Production Line','Document Line representing a production','The Production Line indicates the production document line (if applicable) for this transaction',200224,13288,'Y',22,40,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:05','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:05','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','9d166382-f494-4a29-a01d-160b4621bd6e','Y',30,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:06 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204437,'Movement Quantity','Quantity of a product moved.','The Movement Quantity indicates the quantity of a product that has been moved.',200224,13289,'Y',22,50,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','50884b2d-9f35-4711-b80e-af2fe5bbe00a','Y',40,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:07 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (204438,'M_ProductionLineMA_UU',200224,60930,'N',36,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','5b9195b5-cb16-4e93-bbf5-b0631871e425','N',2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:08 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204439,'Date Material Policy','Time used for LIFO and FIFO Material Policy','This field is used to record time used for LIFO and FIFO material policy',200224,210658,'Y',7,60,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','698b6efa-db36-4eb4-bc9d-411d34557bfb','Y',50,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:09 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (204440,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
|
||||
There are two reasons for de-activating and not deleting records:
|
||||
(1) The system requires the record for audit purposes.
|
||||
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200224,13284,'Y',1,70,'N','N','N','N',0,0,'Y',TO_DATE('2017-04-20 16:07:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-04-20 16:07:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','3dc9c715-7866-4b2c-ac0b-62cdd3620097','Y',60,2,2)
|
||||
;
|
||||
|
||||
|
||||
-- Apr 20, 2017 8:17:51 PM SGT
|
||||
UPDATE AD_Tab SET DisplayLogic='@IsEndProduct@ =''N''',Updated=TO_DATE('2017-04-20 20:17:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:16 PM SGT
|
||||
UPDATE AD_Tab SET EntityType='D',Updated=TO_DATE('2017-04-20 20:18:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:29 PM SGT
|
||||
UPDATE AD_Tab SET TabLevel=2,Updated=TO_DATE('2017-04-20 20:18:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:47 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:18:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204433
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:50 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:18:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204434
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:54 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:18:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204435
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:56 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:18:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204436
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:59 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:18:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204437
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:19:03 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:19:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204439
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:19:06 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:19:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204440
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:20:05 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-04-20 20:20:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204432
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:20:21 PM SGT
|
||||
UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2017-04-20 20:20:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213024
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201704201534_IDEMPIERE-3352.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,39 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- IDEMPIERE-3394 Allow defining web service type in System and extend in Tenant
|
||||
-- Jun 13, 2017 4:19:26 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@#AD_Client_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 16:19:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56766
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 4:19:38 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@#AD_Org_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 16:19:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56767
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:54:59 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:54:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56734
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:04 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:55:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56735
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:21 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:55:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56746
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:28 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56747
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:44 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:55:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56756
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:51 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_DATE('2017-06-13 17:55:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56758
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201706131623_IDEMPIERE-3394.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
-- Add IsAutoGenerateLot to M_AttributeSet.
|
||||
-- Apr 20, 2017 3:34:42 PM SGT
|
||||
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203078,0,0,'Y',TO_TIMESTAMP('2017-04-20 15:34:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 15:34:41','YYYY-MM-DD HH24:MI:SS'),100,'IsAutoGenerateLot','IsAutoGenerateLot','Auto Generate Lot','D','01487993-345a-4ddf-8da7-50d88581686b')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:18 PM SGT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213024,0,'IsAutoGenerateLot',560,'IsAutoGenerateLot',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2017-04-20 15:37:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 15:37:17','YYYY-MM-DD HH24:MI:SS'),100,203078,'Y','N','U','N','N','N','Y','ac7ab79e-7b73-48ac-ae20-bec945663a19','Y',0,'N','N')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:27 PM SGT
|
||||
ALTER TABLE M_AttributeSet ADD COLUMN IsAutoGenerateLot CHAR(1) DEFAULT 'N' CHECK (IsAutoGenerateLot IN ('Y','N'))
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 3:37:50 PM SGT
|
||||
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2017-04-20 15:37:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213024
|
||||
;
|
||||
|
||||
|
||||
-- Apr 20, 2017 3:45:39 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (204432,'IsAutoGenerateLot',461,213024,'Y',0,220,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 15:45:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 15:45:38','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','9e9451eb-37c7-4766-9546-97bab80a2478','Y',210,2,2,1,'N','N','N')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:02:13 PM SGT
|
||||
UPDATE AD_Field SET DisplayLogic='@IsLot@=Y& @M_LotCtl_ID@ > 0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 16:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204432
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:06:48 PM SGT
|
||||
INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200224,'Attributes',53127,40,'Y',765,0,0,'Y',TO_TIMESTAMP('2017-04-20 16:06:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:06:47','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','N','N',0,'N','U','Y','N','9eced926-7d62-4fb8-9820-75039a2e9856','B')
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:04 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (204433,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200224,13286,'Y',22,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:03','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','b69238c1-336d-48fb-977e-9a9191a1f849','N',2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:04 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (204434,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200224,13285,'Y',22,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','24234f73-569c-499c-8209-f910b6f69050','Y','Y',10,4,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:05 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204435,'Attribute Set Instance','Product Attribute Set Instance','The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.',200224,13287,'Y',22,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','e328aac8-688c-4229-8a7d-181ebf0e8a38','Y',20,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:06 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204436,'Production Line','Document Line representing a production','The Production Line indicates the production document line (if applicable) for this transaction',200224,13288,'Y',22,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:05','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','9d166382-f494-4a29-a01d-160b4621bd6e','Y',30,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:06 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204437,'Movement Quantity','Quantity of a product moved.','The Movement Quantity indicates the quantity of a product that has been moved.',200224,13289,'Y',22,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','50884b2d-9f35-4711-b80e-af2fe5bbe00a','Y',40,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:07 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,ColumnSpan) VALUES (204438,'M_ProductionLineMA_UU',200224,60930,'N',36,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','5b9195b5-cb16-4e93-bbf5-b0631871e425','N',2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:08 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (204439,'Date Material Policy','Time used for LIFO and FIFO Material Policy','This field is used to record time used for LIFO and FIFO material policy',200224,210658,'Y',7,60,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:07','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','698b6efa-db36-4eb4-bc9d-411d34557bfb','Y',50,2)
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 4:07:09 PM SGT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (204440,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports.
|
||||
There are two reasons for de-activating and not deleting records:
|
||||
(1) The system requires the record for audit purposes.
|
||||
(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200224,13284,'Y',1,70,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-04-20 16:07:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-04-20 16:07:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','3dc9c715-7866-4b2c-ac0b-62cdd3620097','Y',60,2,2)
|
||||
;
|
||||
|
||||
|
||||
-- Apr 20, 2017 8:17:51 PM SGT
|
||||
UPDATE AD_Tab SET DisplayLogic='@IsEndProduct@ =''N''',Updated=TO_TIMESTAMP('2017-04-20 20:17:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:16 PM SGT
|
||||
UPDATE AD_Tab SET EntityType='D',Updated=TO_TIMESTAMP('2017-04-20 20:18:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:29 PM SGT
|
||||
UPDATE AD_Tab SET TabLevel=2,Updated=TO_TIMESTAMP('2017-04-20 20:18:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200224
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:47 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:18:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204433
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:50 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:18:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204434
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:54 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:18:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204435
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:56 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:18:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204436
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:18:59 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:18:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204437
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:19:03 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:19:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204439
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:19:06 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:19:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204440
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:20:05 PM SGT
|
||||
UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-04-20 20:20:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204432
|
||||
;
|
||||
|
||||
-- Apr 20, 2017 8:20:21 PM SGT
|
||||
UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2017-04-20 20:20:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213024
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201704201534_IDEMPIERE-3352.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
-- IDEMPIERE-3394 Allow defining web service type in System and extend in Tenant
|
||||
-- Jun 13, 2017 4:19:26 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@#AD_Client_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 16:19:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56766
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 4:19:38 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@#AD_Org_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 16:19:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56767
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:54:59 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:54:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56734
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:04 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:55:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56735
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:21 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:55:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56746
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:28 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:55:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56747
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:44 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Client_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:55:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56756
|
||||
;
|
||||
|
||||
-- Jun 13, 2017 5:55:51 PM CEST
|
||||
UPDATE AD_Column SET DefaultValue='@AD_Org_ID@', IsToolbarButton='N',Updated=TO_TIMESTAMP('2017-06-13 17:55:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56758
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201706131623_IDEMPIERE-3394.sql') FROM dual
|
||||
;
|
||||
|
|
@ -296,7 +296,7 @@ public class InventoryCountCreate extends SvrProcess
|
|||
return 0;
|
||||
}
|
||||
// Save Old Line info
|
||||
else if (m_line.getM_AttributeSetInstance_ID() != 0 || oldDateMPolicy != null)
|
||||
else if (m_line.getM_AttributeSetInstance_ID() != 0 )
|
||||
{
|
||||
MInventoryLineMA ma = new MInventoryLineMA (m_line,
|
||||
m_line.getM_AttributeSetInstance_ID(), m_line.getQtyBook(),oldDateMPolicy,true);
|
||||
|
@ -317,7 +317,7 @@ public class InventoryCountCreate extends SvrProcess
|
|||
}
|
||||
// new line
|
||||
m_line = new MInventoryLine (m_inventory, M_Locator_ID,
|
||||
M_Product_ID, 0,
|
||||
M_Product_ID, M_AttributeSetInstance_ID,
|
||||
QtyOnHand, QtyOnHand); // book/count
|
||||
|
||||
oldDateMPolicy = dateMPolicy;
|
||||
|
|
|
@ -137,12 +137,12 @@ public class SequenceCheck extends SvrProcess
|
|||
// Sync Table Name case
|
||||
sql = "UPDATE AD_Sequence s "
|
||||
+ "SET Name = (SELECT TableName FROM AD_Table t "
|
||||
+ "WHERE t.IsView='N' AND UPPER(s.Name)=UPPER(t.TableName)) "
|
||||
+ "WHERE t.IsView='N' AND t.IsActive='Y' AND UPPER(s.Name)=UPPER(t.TableName)) "
|
||||
+ "WHERE s.IsTableID='Y'"
|
||||
+ " AND EXISTS (SELECT * FROM AD_Table t "
|
||||
+ "WHERE t.IsActive='Y' AND t.IsView='N'"
|
||||
+ " AND UPPER(s.Name)=UPPER(t.TableName) AND s.Name<>t.TableName)";
|
||||
int no = DB.executeUpdate(sql, trxName);
|
||||
int no = DB.executeUpdateEx(sql, trxName);
|
||||
if (no > 0)
|
||||
{
|
||||
if (sp != null){
|
||||
|
|
|
@ -39,6 +39,10 @@ import org.compiere.model.MAccount;
|
|||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MConversionRate;
|
||||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MMatchInv;
|
||||
import org.compiere.model.MMatchPO;
|
||||
import org.compiere.model.MNote;
|
||||
import org.compiere.model.MPeriod;
|
||||
import org.compiere.model.ModelValidationEngine;
|
||||
|
@ -51,6 +55,7 @@ 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;
|
||||
|
||||
/**
|
||||
* Posting Document Root.
|
||||
|
@ -238,6 +243,77 @@ public abstract class Doc
|
|||
return DocManager.postDocument(ass, AD_Table_ID, Record_ID, force, true, trxName);
|
||||
} // post
|
||||
|
||||
/**
|
||||
* Manual posting by user
|
||||
* @param WindowNo
|
||||
* @param AD_Client_ID
|
||||
* @param AD_Table_ID
|
||||
* @param Record_ID
|
||||
* @param force
|
||||
* @return error message ( if any )
|
||||
*/
|
||||
public static String manualPosting (int WindowNo, int AD_Client_ID,
|
||||
int AD_Table_ID, int Record_ID, boolean force)
|
||||
{
|
||||
String error = null;
|
||||
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(Env.getCtx(), AD_Client_ID);
|
||||
Trx trx = Trx.get(Trx.createTrxName("ManulPosting"), true);
|
||||
try
|
||||
{
|
||||
error = postImmediate(ass, AD_Table_ID, Record_ID, force, trx.getTrxName());
|
||||
//Average Costing: Post MatchPO and MatchInv together with MR and Invoice
|
||||
if (Util.isEmpty(error))
|
||||
{
|
||||
if (AD_Table_ID == MInvoice.Table_ID)
|
||||
{
|
||||
MMatchInv[] matchInvs = MMatchInv.getInvoice(Env.getCtx(), Record_ID, trx.getTrxName());
|
||||
for (MMatchInv matchInv : matchInvs)
|
||||
{
|
||||
if (!matchInv.isPosted())
|
||||
{
|
||||
error = postImmediate(ass, matchInv.get_Table_ID(), matchInv.get_ID(), force, matchInv.get_TrxName());
|
||||
if (!Util.isEmpty(error))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (AD_Table_ID == MInOut.Table_ID)
|
||||
{
|
||||
MMatchPO[] matchPos = MMatchPO.getInOut(Env.getCtx(), Record_ID, trx.getTrxName());
|
||||
for (MMatchPO matchPo : matchPos)
|
||||
{
|
||||
if (!matchPo.isPosted())
|
||||
{
|
||||
error = postImmediate(ass, matchPo.get_Table_ID(), matchPo.get_ID(), force, matchPo.get_TrxName());
|
||||
if (!Util.isEmpty(error))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Util.isEmpty(error))
|
||||
{
|
||||
trx.commit(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
trx.rollback();
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
trx.rollback();
|
||||
return "@Error@ " + t.getLocalizedMessage();
|
||||
}
|
||||
finally
|
||||
{
|
||||
trx.close();
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/** Static Log */
|
||||
protected static CLogger s_log = CLogger.getCLogger(Doc.class);
|
||||
/** Log per Document */
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.compiere.model.MAcctSchema;
|
|||
import org.compiere.model.MCostDetail;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInOutLine;
|
||||
import org.compiere.model.MInOutLineMA;
|
||||
import org.compiere.model.MOrderLine;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.ProductCost;
|
||||
|
@ -175,10 +176,40 @@ public class Doc_InOut extends Doc
|
|||
BigDecimal costs = null;
|
||||
if (!isReversal(line))
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Shipment CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInOutLine ioLine = (MInOutLine) line.getPO();
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), ioLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
costs = BigDecimal.ZERO;
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
BigDecimal QtyMA = ma.getMovementQty();
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(QtyMA);
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
|
||||
costs = costs.add(maCosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Shipment CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
}
|
||||
|
||||
// end MZ
|
||||
if (costs == null || costs.signum() == 0) // zero costs OK
|
||||
{
|
||||
|
@ -264,17 +295,60 @@ public class Doc_InOut extends Doc
|
|||
}
|
||||
costs = cr.getAcctBalance(); //get original cost
|
||||
}
|
||||
//
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
MInOutLine ioLine = (MInOutLine) line.getPO();
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), ioLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, ma.getMovementQty().negate(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // for all lines
|
||||
|
@ -303,11 +377,40 @@ public class Doc_InOut extends Doc
|
|||
BigDecimal costs = null;
|
||||
if (!isReversal(line))
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Shipment CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
// end MZ
|
||||
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInOutLine ioLine = (MInOutLine) line.getPO();
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), ioLine.get_ID(), getTrxName());
|
||||
costs = BigDecimal.ZERO;
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
BigDecimal QtyMA = ma.getMovementQty();
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(QtyMA);
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
|
||||
costs = costs.add(maCosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Shipment CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
// end MZ
|
||||
}
|
||||
if (costs == null || costs.signum() == 0) // zero costs OK
|
||||
{
|
||||
if (product.isStocked())
|
||||
|
@ -353,16 +456,57 @@ public class Doc_InOut extends Doc
|
|||
costs = dr.getAcctBalance(); //get original cost
|
||||
}
|
||||
//
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
MInOutLine ioLine = (MInOutLine) line.getPO();
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), ioLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, ma.getMovementQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
//
|
||||
if (line.getM_Product_ID() != 0)
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costs, line.getQty(),
|
||||
line.getDescription(), true, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +571,8 @@ public class Doc_InOut extends Doc
|
|||
//get costing method for product
|
||||
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
|
||||
MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod) ||
|
||||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) )
|
||||
MAcctSchema.COSTINGMETHOD_LastPOPrice.equals(costingMethod) ||
|
||||
( MAcctSchema.COSTINGMETHOD_StandardCosting.equals(costingMethod) && MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as))))
|
||||
{
|
||||
// Low - check if c_orderline_id is valid
|
||||
if (orderLine != null)
|
||||
|
@ -639,13 +784,43 @@ public class Doc_InOut extends Doc
|
|||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
||||
}
|
||||
if (costs == null || costs.signum() == 0)
|
||||
{
|
||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), ioLine.get_ID(), getTrxName());
|
||||
costs = BigDecimal.ZERO;
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
BigDecimal QtyMA = ma.getMovementQty();
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(QtyMA);
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InOutLine_ID=?");
|
||||
|
||||
costs = costs.add(maCosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
||||
}
|
||||
|
||||
if (costs == null || costs.signum() == 0)
|
||||
{
|
||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -749,11 +924,38 @@ public class Doc_InOut extends Doc
|
|||
{
|
||||
tAmt = tAmt.negate();
|
||||
}
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(), line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, tAmt, tQty,
|
||||
line.getDescription(), false, getTrxName()))
|
||||
MProduct product = line.getProduct();
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), line.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInOutLineMA ma = mas[j];
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(), line.getM_Product_ID(),
|
||||
ma.getM_AttributeSetInstance_ID(), line.get_ID(), 0, tAmt, ma.getMovementQty().negate(),
|
||||
line.getDescription(), false, getTrxName()))
|
||||
return "SaveError";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(), line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, tAmt, tQty,
|
||||
line.getDescription(), false, getTrxName()))
|
||||
return "SaveError";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "SaveError";
|
||||
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(), line.getM_Product_ID(),
|
||||
line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, tAmt, tQty,
|
||||
line.getDescription(), false, getTrxName()))
|
||||
return "SaveError";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.acct;
|
|||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.model.MAccount;
|
||||
|
@ -30,6 +31,7 @@ import org.compiere.model.MCostElement;
|
|||
import org.compiere.model.MDocType;
|
||||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInventoryLine;
|
||||
import org.compiere.model.MInventoryLineMA;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -182,7 +184,7 @@ public class Doc_Inventory extends Doc
|
|||
MInventory inventory = (MInventory) getPO();
|
||||
boolean costAdjustment = MDocType.DOCSUBTYPEINV_CostAdjustment.equals(parentDocSubTypeInv);
|
||||
String docCostingMethod = inventory.getCostingMethod();
|
||||
|
||||
HashMap<String, BigDecimal> costMap = new HashMap<String, BigDecimal>();
|
||||
for (int i = 0; i < p_lines.length; i++)
|
||||
{
|
||||
DocLine line = p_lines[i];
|
||||
|
@ -213,6 +215,7 @@ public class Doc_Inventory extends Doc
|
|||
if (costAdjustment)
|
||||
{
|
||||
costs = line.getAmtSource();
|
||||
product = line.getProduct();
|
||||
int orgId = line.getAD_Org_ID();
|
||||
int asiId = line.getM_AttributeSetInstance_ID();
|
||||
if (MAcctSchema.COSTINGLEVEL_Client.equals(costingLevel))
|
||||
|
@ -236,10 +239,42 @@ public class Doc_Inventory extends Doc
|
|||
{
|
||||
if (!isReversal(line))
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Physical Inventory CostDetail is exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
|
||||
// end MZ
|
||||
product = line.getProduct();
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInventoryLine invLine = (MInventoryLine) line.getPO();
|
||||
MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), invLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
costs = BigDecimal.ZERO;
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInventoryLineMA ma = mas[j];
|
||||
BigDecimal QtyMA = ma.getMovementQty();
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(QtyMA.negate());
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
|
||||
costMap.put(line.get_ID()+ "_"+ ma.getM_AttributeSetInstance_ID(), maCosts);
|
||||
|
||||
costs = costs.add(maCosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Physical Inventory CostDetail is exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_InventoryLine_ID=?");
|
||||
// end MZ
|
||||
}
|
||||
if (costs == null || costs.signum() == 0)
|
||||
{
|
||||
p_Error = "No Costs for " + line.getProduct().getName();
|
||||
|
@ -322,6 +357,7 @@ public class Doc_Inventory extends Doc
|
|||
|
||||
if (doPosting || costAdjustment)
|
||||
{
|
||||
product = line.getProduct();
|
||||
BigDecimal costDetailAmt = costAdjustment ? adjustmentDiff : costs;
|
||||
if (costAdjustment && getC_Currency_ID() > 0 && getC_Currency_ID() != as.getC_Currency_ID())
|
||||
{
|
||||
|
@ -329,15 +365,57 @@ public class Doc_Inventory extends Doc
|
|||
costDetailAmt, getC_Currency_ID(), as.getC_Currency_ID(),
|
||||
getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID(), true);
|
||||
}
|
||||
// Cost Detail
|
||||
if (!MCostDetail.createInventory(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costDetailAmt, line.getQty(),
|
||||
line.getDescription(), getTrxName()))
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(as)) )
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MInventoryLine invLine = (MInventoryLine) line.getPO();
|
||||
MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), invLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
costs = BigDecimal.ZERO;
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MInventoryLineMA ma = mas[j];
|
||||
BigDecimal maCost = costMap.get(line.get_ID()+ "_"+ ma.getM_AttributeSetInstance_ID());
|
||||
|
||||
if (!MCostDetail.createInventory(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
maCost, ma.getMovementQty().negate(),
|
||||
line.getDescription(), getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!MCostDetail.createInventory(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costDetailAmt, line.getQty(),
|
||||
line.getDescription(), getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cost Detail
|
||||
if (!MCostDetail.createInventory(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
costDetailAmt, line.getQty(),
|
||||
line.getDescription(), getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ import org.compiere.model.MAcctSchema;
|
|||
import org.compiere.model.MCostDetail;
|
||||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MMovementLine;
|
||||
import org.compiere.model.MMovementLineMA;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
|
@ -137,10 +139,42 @@ public class Doc_Movement extends Doc
|
|||
|
||||
if (!isReversal(line))
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Inventory Move CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
|
||||
// end MZ
|
||||
MProduct product = (MProduct) line.getProduct();
|
||||
String costingLevel = product.getCostingLevel(as);
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(costingLevel) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MMovementLine mLine = (MMovementLine) line.getPO();
|
||||
MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), mLine.get_ID(), getTrxName());
|
||||
if (mas != null && mas.length > 0 )
|
||||
{
|
||||
costs = BigDecimal.ZERO;
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MMovementLineMA ma = mas[j];
|
||||
BigDecimal QtyMA = ma.getMovementQty();
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(QtyMA);
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
BigDecimal maCosts = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
|
||||
|
||||
costs = costs.add(maCosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// MZ Goodwill
|
||||
// if Inventory Move CostDetail exist then get Cost from Cost Detail
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), true, "M_MovementLine_ID=? AND IsSOTrx='N'");
|
||||
// end MZ
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.util.logging.Level;
|
|||
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MCostDetail;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MProductionLineMA;
|
||||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.model.X_M_Production;
|
||||
import org.compiere.model.X_M_ProductionLine;
|
||||
|
@ -200,28 +202,83 @@ public class Doc_Production extends Doc
|
|||
// Line pointer
|
||||
FactLine fl = null;
|
||||
X_M_Production prod = (X_M_Production)getPO();
|
||||
HashMap<String, BigDecimal> costMap = new HashMap<String, BigDecimal>();
|
||||
|
||||
for (int i = 0; i < p_lines.length; i++)
|
||||
{
|
||||
DocLine line = p_lines[i];
|
||||
// Calculate Costs
|
||||
BigDecimal costs = null;
|
||||
BigDecimal costs = BigDecimal.ZERO;
|
||||
|
||||
X_M_ProductionLine prodline = (X_M_ProductionLine)line.getPO();
|
||||
MProductionLineMA mas[] = MProductionLineMA.get(getCtx(), prodline.get_ID(), getTrxName());
|
||||
MProduct product = (MProduct) prodline.getM_Product();
|
||||
String CostingLevel = product.getCostingLevel(as);
|
||||
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel) )
|
||||
{
|
||||
if (line.getM_AttributeSetInstance_ID() == 0 && (mas!=null && mas.length> 0 ))
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MProductionLineMA ma = mas[j];
|
||||
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line.get_ID(), ma.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd != null)
|
||||
costs = costs.add(cd.getAmt());
|
||||
else
|
||||
{
|
||||
ProductCost pc = line.getProductCost();
|
||||
pc.setQty(ma.getMovementQty());
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
costs = costs.add(line.getProductCosts(as, line.getAD_Org_ID(), false));
|
||||
}
|
||||
costMap.put(line.get_ID()+ "_"+ ma.getM_AttributeSetInstance_ID(), costs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line.get_ID(), line.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd != null)
|
||||
{
|
||||
costs = cd.getAmt();
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
|
||||
}
|
||||
costMap.put(line.get_ID()+ "_"+ line.getM_AttributeSetInstance_ID(), costs);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// MZ Goodwill
|
||||
// if Production CostDetail exist then get Cost from Cost Detail
|
||||
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line.get_ID(), line.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd != null)
|
||||
{
|
||||
costs = cd.getAmt();
|
||||
}
|
||||
else
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
|
||||
}
|
||||
costMap.put(line.get_ID()+ "_"+ line.getM_AttributeSetInstance_ID(), costs);
|
||||
|
||||
// MZ Goodwill
|
||||
// if Production CostDetail exist then get Cost from Cost Detail
|
||||
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line.get_ID(), line.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd != null) {
|
||||
costs = cd.getAmt();
|
||||
} else {
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
|
||||
}
|
||||
|
||||
BigDecimal bomCost = Env.ZERO;
|
||||
BigDecimal qtyProduced = null;
|
||||
if (line.isProductionBOM())
|
||||
{
|
||||
X_M_ProductionLine endProLine = (X_M_ProductionLine)line.getPO();
|
||||
Object parentEndPro = prod.isUseProductionPlan()?endProLine.getM_ProductionPlan_ID():endProLine.getM_Production_ID();
|
||||
|
||||
// Get BOM Cost - Sum of individual lines
|
||||
BigDecimal bomCost = Env.ZERO;
|
||||
// Get BOM Cost - Sum of individual lines
|
||||
for (int ii = 0; ii < p_lines.length; ii++)
|
||||
{
|
||||
DocLine line0 = p_lines[ii];
|
||||
|
@ -231,55 +288,137 @@ public class Doc_Production extends Doc
|
|||
if (!parentBomPro.equals(parentEndPro))
|
||||
continue;
|
||||
if (!line0.isProductionBOM()) {
|
||||
MProduct product0 = (MProduct) bomProLine.getM_Product();
|
||||
String CostingLevel0 = product0.getCostingLevel(as);
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel0) )
|
||||
{
|
||||
if (bomProLine.getM_AttributeSetInstance_ID() == 0 )
|
||||
{
|
||||
MProductionLineMA bomLineMA[] = MProductionLineMA.get(getCtx(), line0.get_ID(), getTrxName());
|
||||
if (bomLineMA!=null && bomLineMA.length> 0 )
|
||||
{
|
||||
// get cost of children for batch costing level (auto generate)
|
||||
BigDecimal costs0 = BigDecimal.ZERO ;
|
||||
for (int j = 0; j < bomLineMA.length; j++)
|
||||
{
|
||||
BigDecimal maCost = BigDecimal.ZERO ;
|
||||
MProductionLineMA ma = bomLineMA[j];
|
||||
// get cost of children
|
||||
MCostDetail cd0 = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line0.get_ID(), ma.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
if (cd0 != null)
|
||||
maCost = cd0.getAmt();
|
||||
else
|
||||
{
|
||||
ProductCost pc = line0.getProductCost();
|
||||
pc.setQty(ma.getMovementQty());
|
||||
pc.setM_M_AttributeSetInstance_ID(ma.getM_AttributeSetInstance_ID());
|
||||
maCost = line0.getProductCosts(as, line0.getAD_Org_ID(), false);
|
||||
}
|
||||
costMap.put(line0.get_ID()+ "_"+ ma.getM_AttributeSetInstance_ID(),maCost);
|
||||
costs0 = costs0.add(maCost);
|
||||
}
|
||||
bomCost = bomCost.add(costs0.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
else
|
||||
p_Error = "Failed to post - No Attribute Set for line";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// get cost of children for batch costing level
|
||||
MCostDetail cd0 = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line0.get_ID(), line0.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
BigDecimal costs0;
|
||||
if (cd0 != null)
|
||||
{
|
||||
costs0 = cd0.getAmt();
|
||||
}
|
||||
else
|
||||
{
|
||||
costs0 = line0.getProductCosts(as, line0.getAD_Org_ID(), false);
|
||||
}
|
||||
costMap.put(line0.get_ID()+ "_"+ line0.getM_AttributeSetInstance_ID(),costs0);
|
||||
bomCost = bomCost.add(costs0.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// get cost of children
|
||||
MCostDetail cd0 = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line0.get_ID(), line0.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
BigDecimal costs0;
|
||||
if (cd0 != null) {
|
||||
costs0 = cd0.getAmt();
|
||||
} else {
|
||||
costs0 = line0.getProductCosts(as, line0.getAD_Org_ID(), false);
|
||||
MCostDetail cd0 = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
|
||||
line0.get_ID(), line0.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
|
||||
BigDecimal costs0;
|
||||
if (cd0 != null)
|
||||
{
|
||||
costs0 = cd0.getAmt();
|
||||
}
|
||||
else
|
||||
{
|
||||
costs0 = line0.getProductCosts(as, line0.getAD_Org_ID(), false);
|
||||
}
|
||||
costMap.put(line0.get_ID()+ "_"+ line0.getM_AttributeSetInstance_ID(),costs0);
|
||||
bomCost = bomCost.add(costs0.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
bomCost = bomCost.add(costs0.setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
BigDecimal qtyProduced = manipulateQtyProduced (mQtyProduced, endProLine, prod.isUseProductionPlan(), null);
|
||||
if (line.getQty().compareTo(qtyProduced) != 0) {
|
||||
qtyProduced = manipulateQtyProduced (mQtyProduced, endProLine, prod.isUseProductionPlan(), null);
|
||||
if (line.getQty().compareTo(qtyProduced) != 0)
|
||||
{
|
||||
BigDecimal factor = line.getQty().divide(qtyProduced, 12, BigDecimal.ROUND_HALF_UP);
|
||||
bomCost = bomCost.multiply(factor).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
int precision = as.getStdPrecision();
|
||||
BigDecimal variance = (costs.setScale(precision, BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
|
||||
// only post variance if it's not zero
|
||||
if (variance.signum() != 0)
|
||||
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel))
|
||||
{
|
||||
//post variance
|
||||
//post roll-up
|
||||
fl = fact.createLine(line,
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_RateVariance, as),
|
||||
as.getC_Currency_ID(), variance.negate());
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
|
||||
as.getC_Currency_ID(), bomCost.negate());
|
||||
if (fl == null)
|
||||
{
|
||||
p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
|
||||
p_Error = "Couldn't post roll-up " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
}
|
||||
fl.setQty(Env.ZERO);
|
||||
fl.setQty(qtyProduced);
|
||||
}
|
||||
else
|
||||
{
|
||||
int precision = as.getStdPrecision();
|
||||
BigDecimal variance = (costs.setScale(precision, BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
|
||||
// only post variance if it's not zero
|
||||
if (variance.signum() != 0)
|
||||
{
|
||||
//post variance
|
||||
fl = fact.createLine(line,
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_RateVariance, as),
|
||||
as.getC_Currency_ID(), variance.negate());
|
||||
if (fl == null)
|
||||
{
|
||||
p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
}
|
||||
fl.setQty(Env.ZERO);
|
||||
}
|
||||
}
|
||||
// costs = bomCost.negate();
|
||||
}
|
||||
// end MZ
|
||||
|
||||
// Inventory DR CR
|
||||
fl = fact.createLine(line,
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
|
||||
as.getC_Currency_ID(), costs);
|
||||
if (fl == null)
|
||||
if (!(line.isProductionBOM() && MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)))
|
||||
{
|
||||
p_Error = "No Costs for Line " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
fl = fact.createLine(line,
|
||||
line.getAccount(ProductCost.ACCTTYPE_P_Asset, as),
|
||||
as.getC_Currency_ID(), costs);
|
||||
if (fl == null)
|
||||
{
|
||||
p_Error = "No Costs for Line " + line.getLine() + " - " + line;
|
||||
return null;
|
||||
}
|
||||
fl.setM_Locator_ID(line.getM_Locator_ID());
|
||||
fl.setQty(line.getQty());
|
||||
}
|
||||
fl.setM_Locator_ID(line.getM_Locator_ID());
|
||||
fl.setQty(line.getQty());
|
||||
|
||||
// Cost Detail
|
||||
String description = line.getDescription();
|
||||
|
@ -287,14 +426,62 @@ public class Doc_Production extends Doc
|
|||
description = "";
|
||||
if (line.isProductionBOM())
|
||||
description += "(*)";
|
||||
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 (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
if (line.isProductionBOM())
|
||||
{
|
||||
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
bomCost.negate(), qtyProduced,
|
||||
description, getTrxName()))
|
||||
{
|
||||
p_Error = "Failed to create cost detail record";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (line.getM_AttributeSetInstance_ID() == 0 && (mas!=null && mas.length> 0 ))
|
||||
{
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MProductionLineMA ma = mas[j];
|
||||
BigDecimal maCost = costMap.get(line.get_ID()+ "_"+ ma.getM_AttributeSetInstance_ID());
|
||||
if (!MCostDetail.createProduction(as, line.getAD_Org_ID(),
|
||||
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),
|
||||
line.get_ID(), 0,
|
||||
maCost, ma.getMovementQty(),
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
|
|
|
@ -362,4 +362,14 @@ public interface I_M_AttributeSet
|
|||
|
||||
/** Get Use Guarantee Date for Material Policy */
|
||||
public boolean isUseGuaranteeDateForMPolicy();
|
||||
|
||||
/** Column name IsAutoGenerateLot */
|
||||
public static final String COLUMNNAME_IsAutoGenerateLot = "IsAutoGenerateLot";
|
||||
|
||||
/** Set Auto Generate Lot */
|
||||
public void setIsAutoGenerateLot (boolean IsAutoGenerateLot);
|
||||
|
||||
/** Get Auto Generate Lot */
|
||||
public boolean isAutoGenerateLot();
|
||||
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class MAcctSchema extends X_C_AcctSchema
|
|||
* @param trxName optional trx
|
||||
* @return Array of AcctSchema of Client
|
||||
*/
|
||||
public static MAcctSchema[] getClientAcctSchema (Properties ctx, int AD_Client_ID, String trxName)
|
||||
public static synchronized MAcctSchema[] getClientAcctSchema (Properties ctx, int AD_Client_ID, String trxName)
|
||||
{
|
||||
// Check Cache
|
||||
Integer key = new Integer(AD_Client_ID);
|
||||
|
@ -392,13 +392,12 @@ public class MAcctSchema extends X_C_AcctSchema
|
|||
* Get Only Org Children
|
||||
* @return array of AD_Org_ID
|
||||
*/
|
||||
public Integer[] getOnlyOrgs()
|
||||
public synchronized Integer[] getOnlyOrgs()
|
||||
{
|
||||
if (m_onlyOrgs == null)
|
||||
{
|
||||
m_onlyOrgs = MReportTree.getChildIDs(getCtx(),
|
||||
0, MAcctSchemaElement.ELEMENTTYPE_Organization,
|
||||
getAD_OrgOnly_ID());
|
||||
MReportTree tree = new MReportTree (getCtx(), 0, true, MAcctSchemaElement.ELEMENTTYPE_Organization);
|
||||
m_onlyOrgs = tree.getChildIDs(getAD_OrgOnly_ID());
|
||||
}
|
||||
return m_onlyOrgs;
|
||||
} // getOnlyOrgs
|
||||
|
@ -408,7 +407,7 @@ public class MAcctSchema extends X_C_AcctSchema
|
|||
* @param AD_Org_ID
|
||||
* @return true if to skip
|
||||
*/
|
||||
public boolean isSkipOrg (int AD_Org_ID)
|
||||
public synchronized boolean isSkipOrg (int AD_Org_ID)
|
||||
{
|
||||
if (getAD_OrgOnly_ID() == 0)
|
||||
return false;
|
||||
|
|
|
@ -407,4 +407,28 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance
|
|||
asi.saveEx();
|
||||
return asi;
|
||||
}
|
||||
|
||||
/**
|
||||
* AutoGerate & save a new ASI for given product.
|
||||
* Automatically creates Lot#
|
||||
* @param ctx
|
||||
* @param product
|
||||
* @param trxName
|
||||
* @return newly created ASI
|
||||
*/
|
||||
public static MAttributeSetInstance generateLot(Properties ctx, MProduct product, String trxName)
|
||||
{
|
||||
MAttributeSetInstance asi = new MAttributeSetInstance(ctx, 0, trxName);
|
||||
asi.setClientOrg(product.getAD_Client_ID(), 0);
|
||||
asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID());
|
||||
// Create new Lot
|
||||
if (asi.getM_AttributeSet_ID() > 0)
|
||||
{
|
||||
asi.getLot(true, product.get_ID());
|
||||
}
|
||||
//
|
||||
asi.setDescription();
|
||||
asi.saveEx();
|
||||
return asi;
|
||||
}
|
||||
} // MAttributeSetInstance
|
||||
|
|
|
@ -85,6 +85,8 @@ public class MBPartner extends X_C_BPartner
|
|||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
template.set_ValueNoCheck("Created", ts);
|
||||
template.set_ValueNoCheck("Updated", ts);
|
||||
template.set_ValueNoCheck("CreatedBy", Env.getAD_User_ID(ctx));
|
||||
template.set_ValueNoCheck("UpdatedBy", Env.getAD_User_ID(ctx));
|
||||
}
|
||||
return template;
|
||||
} // getTemplate
|
||||
|
|
|
@ -1263,7 +1263,11 @@ public class MCostDetail extends X_M_CostDetail
|
|||
}
|
||||
else if (addition)
|
||||
{
|
||||
cost.add(amt, qty);
|
||||
if (getM_ProductionLine().getM_Production().getReversal_ID() < 0)
|
||||
cost.add(amt, qty);
|
||||
else
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
|
||||
// Initial
|
||||
if (cost.getCurrentCostPrice().signum() == 0
|
||||
&& cost.getCurrentCostPriceLL().signum() == 0
|
||||
|
@ -1292,6 +1296,11 @@ public class MCostDetail extends X_M_CostDetail
|
|||
{
|
||||
//Should not happen
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - ?none? - " + cost);
|
||||
}
|
||||
else if (ce.isStandardCosting() && isVendorRMA)
|
||||
{
|
||||
cost.add(amt, qty);
|
||||
|
||||
}
|
||||
else
|
||||
log.warning("QtyAdjust - " + ce + " - " + cost);
|
||||
|
|
|
@ -1848,9 +1848,9 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
MInOutLineMA shipmentMAS[] = MInOutLineMA.getNonReturned(getCtx(), rmaLine.getM_InOutLine_ID(), get_TrxName());
|
||||
|
||||
for(MInOutLineMA sMA : shipmentMAS){
|
||||
BigDecimal lineMAQty = qtyToReturn;
|
||||
if(lineMAQty.compareTo(Env.ZERO)>0){
|
||||
lineMAQty = Env.ZERO;
|
||||
BigDecimal lineMAQty = sMA.getMovementQty();
|
||||
if(lineMAQty.compareTo(qtyToReturn)>0){
|
||||
lineMAQty = qtyToReturn;
|
||||
}
|
||||
|
||||
MInOutLineMA ma = MInOutLineMA.addOrCreate(line, sMA.getM_AttributeSetInstance_ID(), lineMAQty, sMA.getDateMaterialPolicy(),true);
|
||||
|
|
|
@ -578,7 +578,16 @@ public class MInOutLine extends X_M_InOutLine
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
I_M_AttributeSet attributeset = getM_Product().getM_AttributeSet();
|
||||
boolean isAutoGenerateLot = false;
|
||||
if (attributeset != null)
|
||||
isAutoGenerateLot = attributeset.isAutoGenerateLot();
|
||||
if (getReversalLine_ID() == 0 && !getParent().isSOTrx() && !getParent().getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns) && isAutoGenerateLot
|
||||
&& getM_AttributeSetInstance_ID() == 0)
|
||||
{
|
||||
MAttributeSetInstance asi = MAttributeSetInstance.generateLot(getCtx(), (MProduct)getM_Product(), get_TrxName());
|
||||
setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
||||
}
|
||||
// if (getC_Charge_ID() == 0 && getM_Product_ID() == 0)
|
||||
// ;
|
||||
|
||||
|
|
|
@ -696,8 +696,74 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
|
||||
if(qtyDiff.compareTo(Env.ZERO)>0)
|
||||
{
|
||||
MInventoryLineMA lineMA = MInventoryLineMA.addOrCreate(line, 0, qtyDiff.negate(), getMovementDate(),true);
|
||||
lineMA.saveEx();
|
||||
//AttributeSetInstance enable
|
||||
I_M_AttributeSet as = line.getM_Product().getM_AttributeSet();
|
||||
if (as != null && as.isInstanceAttribute())
|
||||
{
|
||||
//add quantity to last attributesetinstance
|
||||
storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0, null,
|
||||
false, true, 0, get_TrxName());
|
||||
for (MStorageOnHand storage : storages)
|
||||
{
|
||||
BigDecimal maQty = qtyDiff;
|
||||
//backward compatibility: -ve in MA is incoming trx, +ve in MA is outgoing trx
|
||||
MInventoryLineMA lineMA = new MInventoryLineMA(line, storage.getM_AttributeSetInstance_ID(), maQty.negate(), storage.getDateMaterialPolicy(),true);
|
||||
lineMA.saveEx();
|
||||
qtyDiff = qtyDiff.subtract(maQty);
|
||||
storage.addQtyOnHand(maQty.negate());
|
||||
|
||||
if (qtyDiff.compareTo(Env.ZERO)==0)
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if(qtyDiff.compareTo(Env.ZERO)>0)
|
||||
{
|
||||
MClientInfo m_clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||
MAcctSchema acctSchema = new MAcctSchema(getCtx(), m_clientInfo.getC_AcctSchema1_ID(), get_TrxName());
|
||||
if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(product.getCostingLevel(acctSchema)) )
|
||||
{
|
||||
String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND QtyOnHand = 0 AND M_AttributeSetInstance_ID > 0 ";
|
||||
MStorageOnHand storage = new Query(getCtx(), MStorageOnHand.Table_Name, sqlWhere, get_TrxName())
|
||||
.setParameters(line.getM_Product_ID(), line.getM_Locator_ID())
|
||||
.setOrderBy(MStorageOnHand.COLUMNNAME_DateMaterialPolicy+","+ MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID)
|
||||
.first();
|
||||
|
||||
if (storage != null )
|
||||
{
|
||||
MInventoryLineMA lineMA = MInventoryLineMA.addOrCreate(line, storage.getM_AttributeSetInstance_ID(), qtyDiff.negate(), getMovementDate(),true);
|
||||
lineMA.saveEx();
|
||||
}
|
||||
else
|
||||
{
|
||||
String costingMethod = product.getCostingMethod(acctSchema);
|
||||
StringBuilder localWhereClause = new StringBuilder("M_Product_ID =?" )
|
||||
.append(" AND C_AcctSchema_ID=?")
|
||||
.append(" AND ce.CostingMethod = ? ")
|
||||
.append(" AND CurrentCostPrice <> 0 ");
|
||||
MCost cost = new Query(getCtx(),I_M_Cost.Table_Name,localWhereClause.toString(),get_TrxName())
|
||||
.setParameters(line.getM_Product_ID(), acctSchema.get_ID(), costingMethod)
|
||||
.addJoinClause(" INNER JOIN M_CostElement ce ON (M_Cost.M_CostElement_ID =ce.M_CostElement_ID ) ")
|
||||
.setOrderBy("Updated DESC")
|
||||
.first();
|
||||
if (cost != null)
|
||||
{
|
||||
MInventoryLineMA lineMA = MInventoryLineMA.addOrCreate(line, cost.getM_AttributeSetInstance_ID(), qtyDiff.negate(), getMovementDate(),true);
|
||||
lineMA.saveEx();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_processMsg = "Cannot retrieve cost of Inventory " ;
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
MInventoryLineMA lineMA = MInventoryLineMA.addOrCreate(line, 0, qtyDiff.negate(), getMovementDate(),true);
|
||||
lineMA.saveEx();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Outgoing Trx
|
||||
|
|
|
@ -220,7 +220,7 @@ public class MPInstance extends X_AD_PInstance
|
|||
MRole role = MRole.get(getCtx(), AD_Role_ID);
|
||||
Boolean access = role.getProcessAccess(AD_Process_ID);
|
||||
if (access == null || !access.booleanValue())
|
||||
throw new IllegalAccessError(Msg.getMsg(getCtx(), "CannotAccessProcess", new Object[] {AD_Process_ID, role.getName()}));
|
||||
throw new IllegalStateException(Msg.getMsg(getCtx(), "CannotAccessProcess", new Object[] {AD_Process_ID, role.getName()}));
|
||||
}
|
||||
super.setAD_Process_ID (AD_Process_ID);
|
||||
} // setAD_Process_ID
|
||||
|
|
|
@ -711,6 +711,25 @@ public class MProduction extends X_M_Production implements DocAction {
|
|||
reversal.addDescription(msgadd.toString());
|
||||
reversal.setReversal_ID(getM_Production_ID());
|
||||
reversal.saveEx(get_TrxName());
|
||||
|
||||
// Reverse Line Qty
|
||||
MProductionLine[] sLines = getLines();
|
||||
MProductionLine[] tLines = reversal.getLines();
|
||||
for (int i = 0; i < sLines.length; i++)
|
||||
{
|
||||
// We need to copy MA
|
||||
if (sLines[i].getM_AttributeSetInstance_ID() == 0)
|
||||
{
|
||||
MProductionLineMA mas[] = MProductionLineMA.get(getCtx(), sLines[i].get_ID(), get_TrxName());
|
||||
for (int j = 0; j < mas.length; j++)
|
||||
{
|
||||
MProductionLineMA ma = new MProductionLineMA (tLines[i],
|
||||
mas[j].getM_AttributeSetInstance_ID(),
|
||||
mas[j].getMovementQty().negate(),mas[j].getDateMaterialPolicy());
|
||||
ma.saveEx(get_TrxName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!reversal.processIt(DocAction.ACTION_Complete))
|
||||
{
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
|
@ -74,10 +78,12 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
* @return "" for success, error string if failed
|
||||
*/
|
||||
public String createTransactions(Timestamp date, boolean mustBeStocked) {
|
||||
// delete existing ASI records
|
||||
int deleted = deleteMA();
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Deleted " + deleted + " attribute records ");
|
||||
|
||||
if (getParent().getReversal_ID() <= 0 )
|
||||
{
|
||||
// delete existing ASI records
|
||||
int deleted = deleteMA();
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Deleted " + deleted + " attribute records ");
|
||||
}
|
||||
MProduct prod = new MProduct(getCtx(), getM_Product_ID(), get_TrxName());
|
||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE,"Loaded Product " + prod.toString());
|
||||
|
||||
|
@ -89,6 +95,10 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
StringBuilder errorString = new StringBuilder();
|
||||
|
||||
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
I_M_AttributeSet attributeset = prod.getM_AttributeSet();
|
||||
boolean isAutoGenerateLot = false;
|
||||
if (attributeset != null)
|
||||
isAutoGenerateLot = attributeset.isAutoGenerateLot();
|
||||
String asiString = asi.getDescription();
|
||||
if ( asiString == null )
|
||||
asiString = "";
|
||||
|
@ -96,7 +106,11 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
if (log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "asi Description is: " + asiString);
|
||||
// create transactions for finished goods
|
||||
if ( getM_Product_ID() == getEndProduct_ID()) {
|
||||
|
||||
if (getParent().getReversal_ID() <= 0 && isAutoGenerateLot && getM_AttributeSetInstance_ID() == 0)
|
||||
{
|
||||
asi = MAttributeSetInstance.generateLot(getCtx(), (MProduct)getM_Product(), get_TrxName());
|
||||
setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
||||
}
|
||||
Timestamp dateMPolicy = date;
|
||||
if(getM_AttributeSetInstance_ID()>0){
|
||||
Timestamp t = MStorageOnHand.getDateMaterialPolicy(getM_Product_ID(), getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
|
@ -170,7 +184,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
}
|
||||
matTrx = new MTransaction (getCtx(), getAD_Org_ID(),
|
||||
"P-",
|
||||
getM_Locator_ID(), getM_Product_ID(), asi.get_ID(),
|
||||
getM_Locator_ID(), getM_Product_ID(), lineMA.getM_AttributeSetInstance_ID(),
|
||||
lineQty.negate(), date, get_TrxName());
|
||||
matTrx.setM_ProductionLine_ID(get_ID());
|
||||
if ( !matTrx.save(get_TrxName()) ) {
|
||||
|
@ -191,6 +205,55 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
|
||||
} // for available storages
|
||||
}
|
||||
else if (qtyToMove.signum() < 0 )
|
||||
{
|
||||
|
||||
MClientInfo m_clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||
MAcctSchema acctSchema = new MAcctSchema(getCtx(), m_clientInfo.getC_AcctSchema1_ID(), get_TrxName());
|
||||
if (asi.get_ID() == 0 && MAcctSchema.COSTINGLEVEL_BatchLot.equals(prod.getCostingLevel(acctSchema)) )
|
||||
{
|
||||
//add quantity to last attributesetinstance
|
||||
String sqlWhere = "M_Product_ID=? AND M_Locator_ID=? AND M_AttributeSetInstance_ID > 0 ";
|
||||
MStorageOnHand storage = new Query(getCtx(), MStorageOnHand.Table_Name, sqlWhere, get_TrxName())
|
||||
.setParameters(getM_Product_ID(), getM_Locator_ID())
|
||||
.setOrderBy(MStorageOnHand.COLUMNNAME_DateMaterialPolicy+" DESC,"+ MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID +" DESC")
|
||||
.first();
|
||||
|
||||
if (storage != null)
|
||||
{
|
||||
setM_AttributeSetInstance_ID(storage.getM_AttributeSetInstance_ID());
|
||||
asi = new MAttributeSetInstance(getCtx(), storage.getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
asiString = asi.getDescription();
|
||||
}
|
||||
else
|
||||
{
|
||||
String costingMethod = prod.getCostingMethod(acctSchema);
|
||||
StringBuilder localWhereClause = new StringBuilder("M_Product_ID =?" )
|
||||
.append(" AND C_AcctSchema_ID=?")
|
||||
.append(" AND ce.CostingMethod = ? ")
|
||||
.append(" AND CurrentCostPrice <> 0 ");
|
||||
MCost cost = new Query(getCtx(),I_M_Cost.Table_Name,localWhereClause.toString(),get_TrxName())
|
||||
.setParameters(getM_Product_ID(), acctSchema.get_ID(), costingMethod)
|
||||
.addJoinClause(" INNER JOIN M_CostElement ce ON (M_Cost.M_CostElement_ID =ce.M_CostElement_ID ) ")
|
||||
.setOrderBy("Updated DESC")
|
||||
.first();
|
||||
if (cost != null)
|
||||
{
|
||||
setM_AttributeSetInstance_ID(cost.getM_AttributeSetInstance_ID());
|
||||
asi = new MAttributeSetInstance(getCtx(), cost.getM_AttributeSetInstance_ID(), get_TrxName());
|
||||
asiString = asi.getDescription();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
log.log(Level.SEVERE, "Cannot retrieve cost of Product r " + prod.toString());
|
||||
errorString.append( "Cannot retrieve cost of Product " +prod.toString() ) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !( qtyToMove.signum() == 0) ) {
|
||||
|
@ -330,5 +393,52 @@ public class MProductionLine extends X_M_ProductionLine {
|
|||
deleteMA();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get Parent
|
||||
* @return parent
|
||||
*/
|
||||
public MProduction getParent() {
|
||||
if (productionParent == null)
|
||||
productionParent = new MProduction (getCtx(), getM_Production_ID(), get_TrxName());
|
||||
return productionParent;
|
||||
} // getParent
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MProductionLineMA[] getLineMAs() {
|
||||
ArrayList<MProductionLineMA> list = new ArrayList<MProductionLineMA>();
|
||||
|
||||
String sql = "SELECT pl.M_ProductionLine_ID, pl,M_AttributeSetInstance_ID , pl.MovementQty, pl.DateMaterialPolicy "
|
||||
+ "FROM M_ProductionLineMA pl "
|
||||
+ "WHERE pl.M_ProductionLine_ID = ?";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, get_ID());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add( new MProductionLineMA( this, rs.getInt(2), rs.getBigDecimal(3), rs.getTimestamp(4) ) );
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
throw new AdempiereException("Unable to load production lines", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
MProductionLineMA[] retValue = new MProductionLineMA[list.size()];
|
||||
list.toArray(retValue);
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.X_M_ProductionLineMA;
|
||||
|
@ -77,4 +78,23 @@ public class MProductionLineMA extends X_M_ProductionLineMA {
|
|||
Env.ZERO,dateMPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Material Allocations for Line
|
||||
* @param ctx context
|
||||
* @param M_ProductionLine_ID line
|
||||
* @param trxName trx
|
||||
* @return allocations
|
||||
*/
|
||||
public static MProductionLineMA[] get (Properties ctx, int M_ProductionLine_ID, String trxName)
|
||||
{
|
||||
|
||||
Query query = MTable.get(ctx, MProductionLineMA.Table_Name)
|
||||
.createQuery(I_M_ProductionLineMA.COLUMNNAME_M_ProductionLine_ID+"=?", trxName);
|
||||
query.setParameters(M_ProductionLine_ID);
|
||||
List<MProductionLineMA> list = query.list();
|
||||
MProductionLineMA[] retValue = list.toArray (new MProductionLineMA[0]);
|
||||
return retValue;
|
||||
} // get
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ public final class MRole extends X_AD_Role
|
|||
* @param reload if true forces load
|
||||
* @return role
|
||||
*/
|
||||
public static MRole get (Properties ctx, int AD_Role_ID, int AD_User_ID, boolean reload)
|
||||
public synchronized static MRole get (Properties ctx, int AD_Role_ID, int AD_User_ID, boolean reload)
|
||||
{
|
||||
if (s_log.isLoggable(Level.INFO)) s_log.info("AD_Role_ID=" + AD_Role_ID + ", AD_User_ID=" + AD_User_ID + ", reload=" + reload);
|
||||
String key = AD_Role_ID + "_" + AD_User_ID;
|
||||
|
|
|
@ -182,7 +182,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
|||
}
|
||||
else
|
||||
{
|
||||
query.setOrderBy(MStorageOnHand.COLUMNNAME_DateMaterialPolicy);
|
||||
query.setOrderBy(MStorageOnHand.COLUMNNAME_DateMaterialPolicy+","+ MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID);
|
||||
}
|
||||
if (forUpdate)
|
||||
{
|
||||
|
@ -335,7 +335,9 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
|||
}
|
||||
sql += "ORDER BY l.PriorityNo DESC, DateMaterialPolicy ";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
|
||||
else
|
||||
sql += ", s.M_AttributeSetInstance_ID ";
|
||||
// All Attribute Set Instances
|
||||
if (allAttributeInstances)
|
||||
{
|
||||
|
@ -369,13 +371,17 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
|||
if(product.isUseGuaranteeDateForMPolicy()){
|
||||
sql += "ORDER BY l.PriorityNo DESC, COALESCE(asi.GuaranteeDate,s.DateMaterialPolicy)";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
|
||||
else
|
||||
sql += ", s.M_AttributeSetInstance_ID ";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += "ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
|
||||
else
|
||||
sql += ", s.M_AttributeSetInstance_ID ";
|
||||
}
|
||||
|
||||
sql += ", s.QtyOnHand DESC";
|
||||
|
@ -523,7 +529,9 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
|||
{
|
||||
sql += "ORDER BY l.PriorityNo DESC, l.M_Locator_ID, s.DateMaterialPolicy";
|
||||
if (!FiFo)
|
||||
sql += " DESC";
|
||||
sql += " DESC, s.M_AttributeSetInstance_ID DESC ";
|
||||
else
|
||||
sql += ", s.M_AttributeSetInstance_ID ";
|
||||
}
|
||||
|
||||
sql += ", s.QtyOnHand DESC";
|
||||
|
@ -894,6 +902,12 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
|||
log.saveError("Error", Msg.getMsg(getCtx(), "NegativeInventoryDisallowed"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getM_AttributeSetInstance_ID() > 0 && getQtyOnHand().signum() < 0)
|
||||
{
|
||||
log.saveError("Error", Msg.getMsg(getCtx(), "NegativeInventoryDisallowed"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,9 @@ public class MTree extends MTree_Base
|
|||
if (!m_editable)
|
||||
sql.append(" AND tn.IsActive='Y'");
|
||||
sql.append(" ORDER BY COALESCE(tn.Parent_ID, -1), tn.SeqNo");
|
||||
sql = new StringBuffer(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
|
||||
//do not check access if allNodes
|
||||
if (AD_User_ID != -1)
|
||||
sql = new StringBuffer(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
|
||||
}
|
||||
if (log.isLoggable(Level.FINEST)) log.finest(sql.toString());
|
||||
// The Node Loop
|
||||
|
|
|
@ -434,4 +434,10 @@ public class ProductCost
|
|||
return sb.toString ();
|
||||
} // toString
|
||||
|
||||
/**
|
||||
* @param M_AttributeSetInstance_ID the m_M_AttributeSetInstance_ID to set
|
||||
*/
|
||||
public void setM_M_AttributeSetInstance_ID(int M_AttributeSetInstance_ID) {
|
||||
this.m_M_AttributeSetInstance_ID = M_AttributeSetInstance_ID;
|
||||
}
|
||||
} // ProductCost
|
||||
|
|
|
@ -30,7 +30,7 @@ public class X_M_AttributeSet extends PO implements I_M_AttributeSet, I_Persiste
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20161030L;
|
||||
private static final long serialVersionUID = 20170417L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_M_AttributeSet (Properties ctx, int M_AttributeSet_ID, String trxName)
|
||||
|
@ -516,4 +516,25 @@ public class X_M_AttributeSet extends PO implements I_M_AttributeSet, I_Persiste
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Auto Generated.
|
||||
@param IsAutoGenerateLot Auto Generate Lot */
|
||||
public void setIsAutoGenerateLot (boolean IsAutoGenerateLot)
|
||||
{
|
||||
set_ValueNoCheck (COLUMNNAME_IsAutoGenerateLot, Boolean.valueOf(IsAutoGenerateLot));
|
||||
}
|
||||
|
||||
/** Get Auto Generate Lot.
|
||||
@return Auto Generate Lot */
|
||||
public boolean isAutoGenerateLot ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsAutoGenerateLot);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -261,7 +261,7 @@ public class ServerReportCtl {
|
|||
String TableName = MTable.getTableName(ctx, format.getAD_Table_ID());
|
||||
MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName);
|
||||
PrintInfo info = new PrintInfo(pi);
|
||||
re = new ReportEngine(ctx, format, query, info);
|
||||
re = new ReportEngine(ctx, format, query, info, pi.getTransactionName());
|
||||
if (pi.isPrintPreview() && pi.isBatch())
|
||||
{
|
||||
pi.setPDFReport(re.getPDF());
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.logging.Level;
|
|||
|
||||
import org.compiere.model.MAcctSchemaElement;
|
||||
import org.compiere.model.MHierarchy;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTree;
|
||||
import org.compiere.model.MTreeNode;
|
||||
import org.compiere.util.CCache;
|
||||
|
@ -49,8 +50,14 @@ public class MReportTree
|
|||
* @return tree
|
||||
*/
|
||||
public static MReportTree get (Properties ctx, int PA_Hierarchy_ID, String ElementType)
|
||||
{
|
||||
String key = Env.getAD_Client_ID(ctx) + "_" + PA_Hierarchy_ID + ElementType;
|
||||
{
|
||||
MRole role = MRole.getDefault();
|
||||
String key = Env.getAD_Client_ID(ctx) + "_" + role.getAD_Role_ID() + "_" + PA_Hierarchy_ID + "_" + ElementType;
|
||||
if (!role.isAccessAllOrgs() && role.isUseUserOrgAccess() )
|
||||
{
|
||||
key = Env.getAD_Client_ID(ctx) + "_" + Env.getAD_User_ID(ctx) + "_" + role.getAD_Role_ID() + "_" + PA_Hierarchy_ID + "_" + ElementType;
|
||||
}
|
||||
|
||||
MReportTree tree = (MReportTree)s_trees.get(key);
|
||||
if (tree == null)
|
||||
{
|
||||
|
@ -93,14 +100,19 @@ public class MReportTree
|
|||
/** Map with Tree */
|
||||
private static CCache<String,MReportTree> s_trees = new CCache<String,MReportTree>(null, "MReportTree", 20, false);
|
||||
|
||||
|
||||
public MReportTree (Properties ctx, int PA_Hierarchy_ID, String ElementType)
|
||||
{
|
||||
this(ctx, PA_Hierarchy_ID, false, ElementType);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Report Tree
|
||||
* @param ctx context
|
||||
* @param PA_Hierarchy_ID optional hierarchy
|
||||
* @param allNodes true to always get full tree
|
||||
* @param ElementType Account Schema Element Type
|
||||
*/
|
||||
public MReportTree (Properties ctx, int PA_Hierarchy_ID, String ElementType)
|
||||
public MReportTree (Properties ctx, int PA_Hierarchy_ID, boolean allNodes, String ElementType)
|
||||
{
|
||||
m_ElementType = ElementType;
|
||||
m_TreeType = m_ElementType;
|
||||
|
@ -120,7 +132,7 @@ public class MReportTree
|
|||
+ ", PA_Hierarchy_ID=" + PA_Hierarchy_ID);
|
||||
//
|
||||
boolean clientTree = true;
|
||||
m_tree = new MTree (ctx, AD_Tree_ID, true, clientTree, null); // include inactive and empty summary nodes
|
||||
m_tree = new MTree (ctx, AD_Tree_ID, true, clientTree, allNodes, null); // include inactive and empty summary nodes
|
||||
// remove summary nodes without children
|
||||
m_tree.trimTree();
|
||||
} // MReportTree
|
||||
|
|
|
@ -245,7 +245,7 @@ public class AmtInWords_VI implements AmtInWords
|
|||
place++;
|
||||
number /= 1000;
|
||||
}
|
||||
while (number > 1000);
|
||||
while (number >= 1000);
|
||||
long m = number % 1000; //see Note 2, this rule does not apply for biggest major name
|
||||
if (m != 0)
|
||||
{
|
||||
|
@ -372,6 +372,14 @@ public class AmtInWords_VI implements AmtInWords
|
|||
aiw.print ("1.093.201.034.578");
|
||||
aiw.print ("100,932,010,345,780");
|
||||
aiw.print ("109.320.103,48");
|
||||
aiw.print ("1,000");
|
||||
aiw.print ("1,000,000");
|
||||
aiw.print ("1,000,000,000");
|
||||
aiw.print ("1,000,001,000");
|
||||
aiw.print ("9,000,001,000");
|
||||
aiw.print ("9,000,000,000");
|
||||
aiw.print ("9,000,000,001");
|
||||
|
||||
} // main
|
||||
|
||||
} // AmtInWords_VI
|
||||
|
|
|
@ -48,6 +48,7 @@ import javax.swing.JFrame;
|
|||
import org.adempiere.base.Core;
|
||||
import org.adempiere.base.IResourceFinder;
|
||||
import org.adempiere.util.IProcessUI;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.adempiere.util.ServerContextProvider;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.db.CConnection;
|
||||
|
@ -244,6 +245,11 @@ public final class Env
|
|||
{
|
||||
if (ctx == null)
|
||||
throw new IllegalArgumentException ("Require Context");
|
||||
|
||||
//nothing to do if ctx is already the current context
|
||||
if (ServerContext.getCurrentInstance() == ctx)
|
||||
return;
|
||||
|
||||
getCtx().clear();
|
||||
getCtx().putAll(ctx);
|
||||
} // setCtx
|
||||
|
|
|
@ -186,6 +186,7 @@ public class PoFiller{
|
|||
return 0;
|
||||
}
|
||||
} else {
|
||||
po.set_ValueNoCheck(columnName, null);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
<cq:advisorNode namePattern="^org\.eclipse\.jetty\.alpn\.api$" versionOverride="[0.0.0,9.3.11)"/>
|
||||
<cq:advisorNode namePattern="^org\.mortbay\.jasper\.apache-jsp$" componentType="osgi.bundle" versionOverride="(8.0.0,8.0.33]"/>
|
||||
<cq:advisorNode namePattern="^org\.eclipse\.jetty(\..+)?" useTargetPlatform="false" useWorkspace="false" versionOverride="[9.2.0,9.3.11)"/>
|
||||
<cq:advisorNode namePattern="^org\.atmosphere\.runtime$" componentType="osgi.bundle" useTargetPlatform="false" useWorkspace="false" versionOverride="[0.0.0,3.0.0)"/>
|
||||
<cq:advisorNode namePattern="^org\.atmosphere\.runtime$" componentType="osgi.bundle" useTargetPlatform="false" useWorkspace="false" versionOverride="[2.4.9,2.4.9]"/>
|
||||
<cq:advisorNode namePattern="^.*$" useTargetPlatform="false" useWorkspace="false"/>
|
||||
</cq:componentQuery>
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.math.BigDecimal;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -31,6 +32,9 @@ import org.compiere.model.MAcctProcessorLog;
|
|||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MCost;
|
||||
import org.compiere.model.MOrgInfo;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.TimeUtil;
|
||||
|
@ -70,6 +74,26 @@ public class AcctProcessor extends AdempiereServer
|
|||
protected void doWork ()
|
||||
{
|
||||
m_summary = new StringBuffer();
|
||||
|
||||
// Prepar ctx
|
||||
Env.setContext(getCtx(), "#AD_Client_ID", m_client.getAD_Client_ID());
|
||||
Env.setContext(getCtx(), "#AD_Language", m_client.getAD_Language());
|
||||
Env.setContext(getCtx(), "#AD_Org_ID", m_model.getAD_Org_ID());
|
||||
if (m_model.getAD_Org_ID() != 0) {
|
||||
MOrgInfo schedorg = MOrgInfo.get(getCtx(), m_model.getAD_Org_ID(), null);
|
||||
if (schedorg.getM_Warehouse_ID() > 0)
|
||||
Env.setContext(getCtx(), "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
||||
}
|
||||
Env.setContext(getCtx(), "#AD_User_ID", getAD_User_ID());
|
||||
Env.setContext(getCtx(), "#SalesRep_ID", getAD_User_ID());
|
||||
MUser scheduser = MUser.get(getCtx(), getAD_User_ID());
|
||||
MRole[] schedroles = scheduser.getRoles(m_model.getAD_Org_ID());
|
||||
if (schedroles != null && schedroles.length > 0)
|
||||
Env.setContext(getCtx(), "#AD_Role_ID", schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||
|
||||
// Get Schemata
|
||||
if (m_model.getC_AcctSchema_ID() == 0)
|
||||
m_ass = MAcctSchema.getClientAcctSchema(getCtx(), m_model.getAD_Client_ID());
|
||||
|
@ -88,6 +112,19 @@ public class AcctProcessor extends AdempiereServer
|
|||
pLog.saveEx();
|
||||
} // doWork
|
||||
|
||||
private int getAD_User_ID() {
|
||||
int AD_User_ID;
|
||||
if (m_model.getSupervisor_ID() > 0)
|
||||
AD_User_ID = m_model.getSupervisor_ID();
|
||||
else if (m_model.getCreatedBy() > 0)
|
||||
AD_User_ID = m_model.getCreatedBy();
|
||||
else if (m_model.getUpdatedBy() > 0)
|
||||
AD_User_ID = m_model.getUpdatedBy();
|
||||
else
|
||||
AD_User_ID = 100; //fall back to SuperUser
|
||||
return AD_User_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Session
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.compiere.server;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -25,9 +26,13 @@ import org.compiere.model.AdempiereProcessor;
|
|||
import org.compiere.model.AdempiereProcessor2;
|
||||
import org.compiere.model.AdempiereProcessorLog;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MOrgInfo;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSchedule;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.TimeUtil;
|
||||
|
@ -103,6 +108,28 @@ public abstract class AdempiereServer implements Runnable
|
|||
return Env.getCtx();
|
||||
} // getCtx
|
||||
|
||||
public void recalculateSleepMS()
|
||||
{
|
||||
if (p_model instanceof PO)
|
||||
{
|
||||
PO po = (PO) p_model;
|
||||
po.load(null);
|
||||
}
|
||||
m_sleepMS = 0;
|
||||
m_nextWork = 0;
|
||||
|
||||
Timestamp lastRun = new Timestamp(System.currentTimeMillis());
|
||||
m_nextWork = MSchedule.getNextRunMS(lastRun.getTime(),
|
||||
p_model.getScheduleType(), p_model.getFrequencyType(),
|
||||
p_model.getFrequency(), p_model.getCronPattern());
|
||||
|
||||
m_sleepMS = m_nextWork - lastRun.getTime();
|
||||
if (log.isLoggable(Level.INFO)) log.info(" Next run: " + new Timestamp(m_nextWork) + " sleep " + m_sleepMS);
|
||||
//
|
||||
p_model.setDateNextRun(new Timestamp(m_nextWork));
|
||||
p_model.saveEx();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the sleepMS.
|
||||
*/
|
||||
|
@ -119,14 +146,31 @@ public abstract class AdempiereServer implements Runnable
|
|||
public void runNow()
|
||||
{
|
||||
Properties context = new Properties();
|
||||
Env.setContext(context, "#AD_Client_ID", p_model.getAD_Client_ID());
|
||||
MClient schedclient = MClient.get(getCtx(), p_model.getAD_Client_ID());
|
||||
Env.setContext(context, "#AD_Client_ID", schedclient.getAD_Client_ID());
|
||||
Env.setContext(context, "#AD_Language", schedclient.getAD_Language());
|
||||
if (p_model instanceof PO) {
|
||||
PO po = (PO) p_model;
|
||||
if (po.get_ColumnIndex("AD_Org_ID") >= 0)
|
||||
if (po.get_ColumnIndex("AD_Org_ID") >= 0) {
|
||||
Env.setContext(context, "#AD_Org_ID", po.get_ValueAsInt("AD_Org_ID"));
|
||||
if (po.get_ColumnIndex("AD_User_ID") >= 0)
|
||||
Env.setContext(context, "#AD_User_ID", po.get_ValueAsInt("AD_User_ID"));
|
||||
MOrgInfo schedorg = new Query(context, MOrgInfo.Table_Name, "AD_Org_ID=?", null)
|
||||
.setParameters(po.get_ValueAsInt("AD_Org_ID")).first();
|
||||
if (schedorg != null && schedorg.getM_Warehouse_ID() > 0)
|
||||
Env.setContext(context, "#M_Warehouse_ID", schedorg.getM_Warehouse_ID());
|
||||
}
|
||||
int AD_User_ID = getAD_User_ID(po);
|
||||
if (AD_User_ID > 0) {
|
||||
Env.setContext(context, "#AD_User_ID", AD_User_ID);
|
||||
Env.setContext(context, "#SalesRep_ID", AD_User_ID);
|
||||
MUser scheduser = new MUser(context, AD_User_ID, null);
|
||||
MRole[] schedroles = scheduser.getRoles(po.get_ValueAsInt("AD_Org_ID"));
|
||||
if (schedroles != null && schedroles.length > 0)
|
||||
Env.setContext(context, "#AD_Role_ID", schedroles[0].getAD_Role_ID()); // first role, ordered by AD_Role_ID
|
||||
}
|
||||
}
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Env.setContext(context, "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||
|
||||
Properties prevContext = ServerContext.getCurrentInstance();
|
||||
try {
|
||||
|
@ -140,6 +184,19 @@ public abstract class AdempiereServer implements Runnable
|
|||
}
|
||||
}
|
||||
|
||||
private int getAD_User_ID(PO po) {
|
||||
int AD_User_ID = -1;
|
||||
if (po.get_ValueAsInt("Supervisor_ID") > 0)
|
||||
AD_User_ID = po.get_ValueAsInt("Supervisor_ID");
|
||||
else if (po.get_ValueAsInt("CreatedBy") > 0)
|
||||
AD_User_ID = po.get_ValueAsInt("CreatedBy");
|
||||
else if (po.get_ValueAsInt("UpdatedBy") > 0)
|
||||
AD_User_ID = po.get_ValueAsInt("UpdatedBy");
|
||||
else
|
||||
AD_User_ID = 100; //fall back to SuperUser
|
||||
return AD_User_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Now
|
||||
*/
|
||||
|
|
|
@ -237,6 +237,7 @@ public class AdempiereServerMgr implements ServiceTrackerCustomizer<IServerFacto
|
|||
try
|
||||
{
|
||||
// replace
|
||||
server.getServer().recalculateSleepMS();
|
||||
server.start();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -501,8 +502,13 @@ public class AdempiereServerMgr implements ServiceTrackerCustomizer<IServerFacto
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
server.run();
|
||||
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
|
||||
if (server.isSleeping()) {
|
||||
server.run();
|
||||
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, server.getSleepMS(), TimeUnit.MILLISECONDS);
|
||||
} else {
|
||||
//server busy, try again after one minute
|
||||
scheduleFuture = Adempiere.getThreadPoolExecutor().schedule(this, 60 * 1000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
public AdempiereServer getServer() {
|
||||
|
|
|
@ -118,7 +118,7 @@ public class Scheduler extends AdempiereServer
|
|||
m_summary.append(runProcess(process));
|
||||
m_trx.commit(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Throwable e)
|
||||
{
|
||||
if (m_trx != null)
|
||||
m_trx.rollback();
|
||||
|
@ -169,6 +169,7 @@ public class Scheduler extends AdempiereServer
|
|||
pi.setPrintPreview(true);
|
||||
MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null);
|
||||
|
||||
pi.setTransactionName(m_trx != null ? m_trx.getTrxName() : null);
|
||||
ServerProcessCtl.process(pi, m_trx);
|
||||
if ( pi.isError() ) // note, this call close the transaction, don't use m_trx below
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ import org.compiere.model.MStore;
|
|||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.server.AdempiereServer;
|
||||
import org.compiere.server.AdempiereServerGroup;
|
||||
import org.compiere.server.AdempiereServerMgr;
|
||||
import org.compiere.server.AdempiereServerMgr.ServerWrapper;
|
||||
|
@ -268,7 +269,32 @@ public class AdempiereMonitor extends HttpServlet
|
|||
return false;
|
||||
}
|
||||
//
|
||||
server.getServer().runNow();
|
||||
AdempiereServer serverInstance = server.getServer();
|
||||
if (serverInstance.isSleeping())
|
||||
{
|
||||
serverInstance.runNow();
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = 0;
|
||||
while(!serverInstance.isSleeping() && count < 5)
|
||||
{
|
||||
count++;
|
||||
try {
|
||||
Thread.sleep(60000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.interrupted();
|
||||
}
|
||||
}
|
||||
if (serverInstance.isSleeping())
|
||||
serverInstance.runNow();
|
||||
else
|
||||
{
|
||||
m_message = new p();
|
||||
m_message.addElement(new strong("Timeout waiting for server process to be available for execution."));
|
||||
m_message.addElement(serverID);
|
||||
}
|
||||
}
|
||||
//
|
||||
return true;
|
||||
} // processRunParameter
|
||||
|
|
|
@ -47,6 +47,7 @@ import javax.swing.RepaintManager;
|
|||
import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.compiere.acct.Doc;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.grid.ed.Calculator;
|
||||
import org.compiere.interfaces.Server;
|
||||
|
@ -54,7 +55,6 @@ import org.compiere.model.MMenu;
|
|||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.swing.CButton;
|
||||
import org.compiere.swing.CFrame;
|
||||
import org.compiere.swing.CMenuItem;
|
||||
|
@ -874,9 +874,7 @@ public final class AEnv
|
|||
+ ", AD_Table_ID=" + AD_Table_ID + "/" + Record_ID
|
||||
+ ", Force=" + force);
|
||||
|
||||
String error = DocumentEngine.postImmediate(Env.getCtx(), AD_Client_ID, AD_Table_ID, Record_ID, force, null);
|
||||
|
||||
return error;
|
||||
return Doc.manualPosting(WindowNo, AD_Client_ID, AD_Table_ID, Record_ID, force);
|
||||
} // postImmediate
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.compiere.acct.Doc;
|
|||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.I_AD_Window;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLanguage;
|
||||
import org.compiere.model.MLookup;
|
||||
|
@ -340,11 +339,7 @@ public final class AEnv
|
|||
+ ", AD_Table_ID=" + AD_Table_ID + "/" + Record_ID
|
||||
+ ", Force=" + force);
|
||||
|
||||
String error = null;
|
||||
MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(Env.getCtx(), AD_Client_ID);
|
||||
error = Doc.postImmediate(ass, AD_Table_ID, Record_ID, force, null);
|
||||
|
||||
return error;
|
||||
return Doc.manualPosting(WindowNo, AD_Client_ID, AD_Table_ID, Record_ID, force);
|
||||
} // postImmediate
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,6 +161,12 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
|||
if (m_GridTab != null) {
|
||||
M_Product_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, m_GridTab.getTabNo(), "M_Product_ID");
|
||||
M_ProductBOM_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, m_GridTab.getTabNo(), "M_ProductBOM_ID");
|
||||
//For third level tab (e.g, LineMA), should take M_Product_ID from Line instead of from Header
|
||||
if (m_GridTab.getTabLevel() > 1 && m_GridTab.getParentTab() != null && m_GridTab.getField("M_Product_ID")==null) {
|
||||
int tmp = Env.getContextAsInt (Env.getCtx (), m_WindowNo, m_GridTab.getParentTab().getTabNo(), "M_Product_ID");
|
||||
if (tmp > 0)
|
||||
M_Product_ID = tmp;
|
||||
}
|
||||
} else {
|
||||
M_Product_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_Product_ID");
|
||||
M_ProductBOM_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_ProductBOM_ID");
|
||||
|
|
|
@ -121,19 +121,19 @@ public class InvoiceGen extends GenForm
|
|||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
|
||||
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
|
||||
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON (rma.AD_Org_ID=org.AD_Org_ID) ");
|
||||
sql.append("INNER JOIN C_DocType dt ON (rma.C_DocType_ID=dt.C_DocType_ID) ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON (rma.C_BPartner_ID=bp.C_BPartner_ID) ");
|
||||
sql.append("INNER JOIN M_InOut io ON (rma.InOut_ID=io.M_InOut_ID) ");
|
||||
sql.append("WHERE rma.DocStatus='CO' ");
|
||||
sql.append("AND dt.DocBaseType = 'SOO' ");
|
||||
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
|
||||
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
|
||||
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
|
||||
sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
|
||||
sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
|
||||
sql.append("AND NOT EXISTS (SELECT * from C_Invoice i ");
|
||||
sql.append("where i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
|
||||
sql.append("AND EXISTS (SELECT * from C_InvoiceLine il inner join M_InOutLine iol ");
|
||||
sql.append("on il.M_InOutLine_ID=iol.M_InOutLine_ID inner join C_Invoice i ");
|
||||
sql.append("on i.C_Invoice_ID=il.C_Invoice_ID where i.DocStatus IN ('CO', 'CL') ");
|
||||
sql.append("AND iol.M_InOutLine_ID IN ");
|
||||
sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("(SELECT M_InOutLine_ID from M_RMALine rl where rl.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
|
||||
sql.append("AND rma.AD_Client_ID=?");
|
||||
|
||||
|
|
|
@ -74,12 +74,14 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
sqlStmt.append("COALESCE(p.Name, c.Name) AS ProductName, ");
|
||||
sqlStmt.append("iol.QtyEntered, ");
|
||||
sqlStmt.append("iol.movementQty-(SELECT COALESCE((SELECT SUM(rmal.qty) FROM M_RMALine rmal JOIN M_RMA rma ON rma.M_RMA_ID=rmal.M_RMA_ID WHERE rmal.M_InOutLine_ID=iol.M_InOutLine_ID AND rma.DocStatus IN ('CO','CL')),0)) AS MovementQty, ");
|
||||
sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi WHERE asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI ");
|
||||
sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi WHERE asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI, ");
|
||||
sqlStmt.append("iol.Description " );
|
||||
sqlStmt.append("FROM M_InOutLine iol ");
|
||||
sqlStmt.append("LEFT JOIN M_Product p ON p.M_Product_ID = iol.M_Product_ID ");
|
||||
sqlStmt.append("LEFT JOIN C_Charge c ON c.C_Charge_ID = iol.C_Charge_ID ");
|
||||
sqlStmt.append("WHERE M_InOut_ID=? ");
|
||||
sqlStmt.append("AND iol.M_InOutLine_ID NOT IN (SELECT rmal.M_InOutLine_ID FROM M_RMALine rmal WHERE rmal.M_RMA_ID=?)");
|
||||
sqlStmt.append(" ORDER BY iol.Line " );
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -91,7 +93,7 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Vector<Object> line = new Vector<Object>(7);
|
||||
Vector<Object> line = new Vector<Object>(8);
|
||||
line.add(new Boolean(false)); // 0-Selection
|
||||
|
||||
KeyNamePair lineKNPair = new KeyNamePair(rs.getInt(1), rs.getString(2)); // 1-Line
|
||||
|
@ -105,7 +107,7 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
line.add(qtyEntered); //4-Qty
|
||||
line.add(movementQty); //5-Movement Qty
|
||||
|
||||
|
||||
line.add(rs.getString(7)); // 6 - Description
|
||||
data.add(line);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +139,8 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
miniTable.setColumnClass(3, String.class, true); // 3-ASI
|
||||
miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Qty
|
||||
miniTable.setColumnClass(5, BigDecimal.class, false); // 5-Delivered Qty
|
||||
|
||||
miniTable.setColumnClass(6, String.class, true); // 6-Description
|
||||
|
||||
// Table UI
|
||||
miniTable.autoSize();
|
||||
}
|
||||
|
@ -167,6 +170,7 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
rmaLine.setM_InOutLine_ID(inOutLineId);
|
||||
rmaLine.setQty(d);
|
||||
rmaLine.setAD_Org_ID(rma.getAD_Org_ID());
|
||||
rmaLine.setDescription((String)miniTable.getValueAt(i, 6));
|
||||
if (!rmaLine.save())
|
||||
{
|
||||
throw new IllegalStateException("Could not create RMA Line");
|
||||
|
@ -187,7 +191,8 @@ public abstract class CreateFromRMA extends CreateFrom {
|
|||
columnNames.add(Msg.translate(Env.getCtx(), "SerNo"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Quantity"));
|
||||
columnNames.add(Msg.getElement(Env.getCtx(), "QtyDelivered", false));
|
||||
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Description"));
|
||||
|
||||
return columnNames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,8 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
}
|
||||
sqlStmt.append("WHERE rl.M_RMA_ID=? ");
|
||||
sqlStmt.append("AND rl.C_Charge_ID IS NOT NULL AND rl.M_InOutLine_ID IS NULL");
|
||||
|
||||
sqlStmt.append(" ORDER BY 2");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
|
|
|
@ -29,13 +29,12 @@
|
|||
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
|
@ -51,10 +50,10 @@ public class MWebServiceType extends X_WS_WebServiceType
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 134887822892217528L;
|
||||
private static final long serialVersionUID = 7216001796414414950L;
|
||||
|
||||
/** Parameters */
|
||||
private X_WS_WebService_Para[] m_para = null;
|
||||
private MWebServicePara[] m_para = null;
|
||||
|
||||
/** Allowed input columns */
|
||||
private String[] m_inputcolumnnames = null;
|
||||
|
@ -75,34 +74,17 @@ public class MWebServiceType extends X_WS_WebServiceType
|
|||
* @param requery requery
|
||||
* @return array of methods
|
||||
*/
|
||||
public X_WS_WebService_Para[] getParameters (boolean requery)
|
||||
public MWebServicePara[] getParameters (boolean requery)
|
||||
{
|
||||
if (m_para != null && !requery)
|
||||
return m_para;
|
||||
String sql = "SELECT * FROM WS_WebService_Para WHERE WS_WebServiceType_ID=? AND IsActive='Y' ORDER BY ParameterName";
|
||||
ArrayList<X_WS_WebService_Para> list = new ArrayList<X_WS_WebService_Para>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getWS_WebServiceType_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new X_WS_WebService_Para (getCtx(), rs, get_TrxName()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
m_para = new X_WS_WebService_Para[list.size ()];
|
||||
List<MWebServicePara> list = new Query(getCtx(), MWebServicePara.Table_Name,
|
||||
"WS_WebService_Para.WS_WebServiceType_ID=? AND WS_WebService_Para.AD_Client_ID=WS_WebServiceType.AD_Client_ID", get_TrxName())
|
||||
.addJoinClause("JOIN WS_WebServiceType ON (WS_WebServiceType.WS_WebServiceType_ID=WS_WebService_Para.WS_WebServiceType_ID)")
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(getWS_WebServiceType_ID())
|
||||
.list();
|
||||
m_para = new MWebServicePara[list.size ()];
|
||||
list.toArray (m_para);
|
||||
return m_para;
|
||||
} // getParameters
|
||||
|
@ -135,36 +117,24 @@ public class MWebServiceType extends X_WS_WebServiceType
|
|||
{
|
||||
if (m_inputcolumnnames != null && !requery)
|
||||
return m_inputcolumnnames;
|
||||
String sql = "SELECT c.ColumnName FROM WS_WebServiceFieldInput f, AD_Column c " +
|
||||
"WHERE f.WS_WebServiceType_ID=? " +
|
||||
"AND c.AD_Column_ID=f.AD_Column_ID " +
|
||||
"AND c.IsActive='Y' " +
|
||||
"AND f.IsActive='Y' " +
|
||||
"ORDER BY c.ColumnName";
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getWS_WebServiceType_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (rs.getString(1));
|
||||
final String sql = ""
|
||||
+ "SELECT c.ColumnName FROM WS_WebServiceFieldInput f "
|
||||
+ " JOIN AD_Column c ON (c.AD_Column_ID=f.AD_Column_ID) "
|
||||
+ " JOIN WS_WebServiceType t ON t.WS_WebServiceType_ID=f.WS_WebServiceType_ID "
|
||||
+ "WHERE f.WS_WebServiceType_ID=? "
|
||||
+ " AND f.AD_Client_ID=t.AD_Client_ID "
|
||||
+ " AND c.IsActive='Y' "
|
||||
+ " AND f.IsActive='Y' "
|
||||
+ "ORDER BY c.ColumnName";
|
||||
List<List<Object>> list = DB.getSQLArrayObjectsEx(get_TrxName(), sql, getWS_WebServiceType_ID());
|
||||
if (list == null) {
|
||||
m_inputcolumnnames = new String[0];
|
||||
} else {
|
||||
m_inputcolumnnames = new String[list.size()];
|
||||
for (int idx = 0; idx < list.size(); idx++) {
|
||||
m_inputcolumnnames[idx] = (String) list.get(idx).get(0);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
m_inputcolumnnames = new String[list.size ()];
|
||||
list.toArray (m_inputcolumnnames);
|
||||
return m_inputcolumnnames;
|
||||
} // getInputColumnNames
|
||||
|
||||
|
@ -196,36 +166,24 @@ public class MWebServiceType extends X_WS_WebServiceType
|
|||
{
|
||||
if (m_outputcolumnnames != null && !requery)
|
||||
return m_outputcolumnnames;
|
||||
String sql = "SELECT c.ColumnName FROM WS_WebServiceFieldOutput f, AD_Column c " +
|
||||
"WHERE f.WS_WebServiceType_ID=? " +
|
||||
"AND c.AD_Column_ID=f.AD_Column_ID " +
|
||||
"AND c.IsActive='Y' " +
|
||||
"AND f.IsActive='Y' " +
|
||||
"ORDER BY c.ColumnName";
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getWS_WebServiceType_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (rs.getString(1));
|
||||
final String sql = ""
|
||||
+ "SELECT c.ColumnName FROM WS_WebServiceFieldOutput f "
|
||||
+ " JOIN AD_Column c ON (c.AD_Column_ID=f.AD_Column_ID) "
|
||||
+ " JOIN WS_WebServiceType t ON t.WS_WebServiceType_ID=f.WS_WebServiceType_ID "
|
||||
+ "WHERE f.WS_WebServiceType_ID=? "
|
||||
+ " AND f.AD_Client_ID=t.AD_Client_ID "
|
||||
+ " AND c.IsActive='Y' "
|
||||
+ " AND f.IsActive='Y' "
|
||||
+ "ORDER BY c.ColumnName";
|
||||
List<List<Object>> list = DB.getSQLArrayObjectsEx(get_TrxName(), sql, getWS_WebServiceType_ID());
|
||||
if (list == null) {
|
||||
m_outputcolumnnames = new String[0];
|
||||
} else {
|
||||
m_outputcolumnnames = new String[list.size()];
|
||||
for (int idx = 0; idx < list.size(); idx++) {
|
||||
m_outputcolumnnames[idx] = (String) list.get(idx).get(0);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
m_outputcolumnnames = new String[list.size ()];
|
||||
list.toArray (m_outputcolumnnames);
|
||||
return m_outputcolumnnames;
|
||||
} // getOutputColumnNames
|
||||
|
||||
|
@ -299,41 +257,28 @@ public class MWebServiceType extends X_WS_WebServiceType
|
|||
m_keyColumns = new ArrayList<String>();
|
||||
else
|
||||
m_keyColumns.clear();
|
||||
|
||||
|
||||
String sql = "SELECT coalesce(c.ColumnName,f.ColumnName),f.* FROM WS_WebServiceFieldInput f left join AD_Column c on c.AD_Column_ID=f.AD_Column_ID " +
|
||||
"WHERE f.WS_WebServiceType_ID=? " +
|
||||
"AND (c.IsActive='Y' OR c.IsActive is null)" +
|
||||
"AND f.IsActive='Y' " +
|
||||
"ORDER BY c.ColumnName";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getWS_WebServiceType_ID());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
String colName = rs.getString(1);
|
||||
X_WS_WebServiceFieldInput inputField = new X_WS_WebServiceFieldInput(getCtx(), rs, null);
|
||||
if(inputField.isIdentifier())
|
||||
m_keyColumns.add(colName);
|
||||
|
||||
m_inputFieldMap.put(colName,inputField );
|
||||
List<X_WS_WebServiceFieldInput> list = new Query(getCtx(), X_WS_WebServiceFieldInput.Table_Name,
|
||||
"WS_WebServiceFieldInput.WS_WebServiceType_ID=? AND WS_WebServiceFieldInput.AD_Client_ID=WS_WebServiceFieldInput.AD_Client_ID",
|
||||
get_TrxName())
|
||||
.addJoinClause("JOIN WS_WebServiceType ON (WS_WebServiceType.WS_WebServiceType_ID=WS_WebServiceFieldInput.WS_WebServiceType_ID)")
|
||||
.addJoinClause("LEFT JOIN AD_Column ON (AD_Column.AD_Column_ID=WS_WebServiceFieldInput.AD_Column_ID)")
|
||||
.setOnlyActiveRecords(true)
|
||||
.setOrderBy("AD_Column.ColumnName")
|
||||
.setParameters(getWS_WebServiceType_ID())
|
||||
.list();
|
||||
for (X_WS_WebServiceFieldInput inputField : list) {
|
||||
String colName = inputField.getColumnName();
|
||||
if (inputField.getAD_Column_ID() > 0) {
|
||||
MColumn col = MColumn.get(getCtx(), inputField.getAD_Column_ID());
|
||||
if (! col.isActive()) {
|
||||
continue;
|
||||
}
|
||||
colName = col.getColumnName();
|
||||
}
|
||||
if(inputField.isIdentifier())
|
||||
m_keyColumns.add(colName);
|
||||
m_inputFieldMap.put(colName,inputField );
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public X_WS_WebServiceFieldInput getFieldInput(String colName){
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
package org.idempiere.webservices;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -40,6 +38,7 @@ import org.compiere.model.MWebService;
|
|||
import org.compiere.model.MWebServiceType;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.POInfo;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_WS_WebServiceMethod;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -220,28 +219,13 @@ public class AbstractService {
|
|||
if (m_webservicemethod == null || !m_webservicemethod.isActive())
|
||||
return "Method " + methodValue + " not registered";
|
||||
|
||||
MWebServiceType m_webservicetype = null;
|
||||
final String sql = "SELECT * FROM WS_WebServiceType " + "WHERE AD_Client_ID=? " + "AND WS_WebService_ID=? "
|
||||
+ "AND WS_WebServiceMethod_ID=? " + "AND Value=? " + "AND IsActive='Y'";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_cs.getAD_Client_ID());
|
||||
pstmt.setInt(2, m_webservice.getWS_WebService_ID());
|
||||
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
|
||||
pstmt.setString(4, serviceTypeValue);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
m_webservicetype = new MWebServiceType(m_cs.getCtx(), rs, null);
|
||||
} catch (Exception e) {
|
||||
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
|
||||
"authenticate"));
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
MWebServiceType m_webservicetype = new Query(m_cs.getCtx(), MWebServiceType.Table_Name,
|
||||
"AD_Client_ID IN (0,?) AND WS_WebService_ID=? AND WS_WebServiceMethod_ID=? AND Value=?",
|
||||
null)
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(m_cs.getAD_Client_ID(), m_webservice.getWS_WebService_ID(), m_webservicemethod.getWS_WebServiceMethod_ID(), serviceTypeValue)
|
||||
.setOrderBy("AD_Client_ID DESC") // IDEMPIERE-3394 give precedence to tenant defined if there are system+tenant
|
||||
.first();
|
||||
|
||||
if (m_webservicetype == null)
|
||||
return "Service type " + serviceTypeValue + " not configured";
|
||||
|
|
Loading…
Reference in New Issue