Merge 1504e61

This commit is contained in:
Heng Sin Low 2012-11-26 11:16:05 +08:00
commit 6c89a97f01
74 changed files with 8076 additions and 1237 deletions

View File

@ -9,8 +9,11 @@ CREATE OR REPLACE VIEW AD_FIELD_V AS
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID,
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) AS AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) AS AD_Val_Rule_ID, c.AD_Process_ID,
COALESCE(f.Isalwaysupdateable , C.Isalwaysupdateable) As Isalwaysupdateable,
COALESCE(f.Readonlylogic, c.Readonlylogic ) As Readonlylogic,
COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic,
COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.IsEncrypted AS IsEncryptedColumn,
c.IsSelectionColumn,
tbl.TableName, c.ValueMin, c.ValueMax,
fg.NAME AS FieldGroup, vr.Code AS ValidationCode,
@ -19,13 +22,13 @@ CREATE OR REPLACE VIEW AD_FIELD_V AS
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
c.seqnoselection, f.xposition, f.columnspan, f.numlines,
COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton
FROM AD_FIELD f
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
LEFT OUTER JOIN AD_FIELDGROUP fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID = COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID))
WHERE f.IsActive = 'Y'
AND c.IsActive = 'Y';

View File

@ -9,8 +9,11 @@ CREATE OR REPLACE VIEW AD_FIELD_VT AS
COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory,
c.IsIdentifier, c.IsTranslated, COALESCE(f.AD_Reference_Value_ID, c.AD_Reference_Value_ID) AS AD_Reference_Value_ID,
c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) as AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable,
c.ReadOnlyLogic, c.MandatoryLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn,
COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID) as AD_Val_Rule_ID, c.AD_Process_ID,
COALESCE(f.Isalwaysupdateable , C.Isalwaysupdateable) As Isalwaysupdateable,
COALESCE(f.Readonlylogic, c.Readonlylogic ) As Readonlylogic,
COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic,
COALESCE(f.isupdateable, c.isupdateable) AS isupdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn,
tbl.TableName, c.ValueMin, c.ValueMax,
fgt.NAME AS FieldGroup, vr.Code AS ValidationCode,
f.Included_Tab_ID, fg.FieldGroupType, fg.IsCollapsedByDefault,
@ -18,7 +21,8 @@ CREATE OR REPLACE VIEW AD_FIELD_VT AS
c.IsAutocomplete, COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
c.seqnoselection, f.xposition, f.columnspan, f.numlines,
COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton
FROM AD_FIELD f
INNER JOIN AD_FIELD_TRL trl ON (f.AD_Field_ID = trl.AD_Field_ID)
INNER JOIN AD_TAB t ON (f.AD_Tab_ID = t.AD_Tab_ID)
@ -27,7 +31,6 @@ CREATE OR REPLACE VIEW AD_FIELD_VT AS
(f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_LANGUAGE=fgt.AD_LANGUAGE)
LEFT OUTER JOIN AD_COLUMN c ON (f.AD_Column_ID = c.AD_Column_ID)
INNER JOIN AD_TABLE tbl ON (c.AD_Table_ID = tbl.AD_Table_ID)
INNER JOIN AD_REFERENCE r ON (c.AD_Reference_ID = r.AD_Reference_ID)
LEFT OUTER JOIN AD_VAL_RULE vr ON (vr.AD_Val_Rule_ID=COALESCE(f.AD_Val_Rule_ID, c.AD_Val_Rule_ID))
WHERE f.IsActive = 'Y'
AND c.IsActive = 'Y';

View File

@ -0,0 +1,59 @@
CREATE OR REPLACE VIEW m_storage
AS
SELECT s.m_product_id,
s.m_locator_id,
s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.qtyonhand,
0 AS qtyreserved,
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
s.m_storageonhand_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
w.m_reservelocator_id AS m_locator_id,
sr.ad_client_id,
sr.ad_org_id,
sr.isactive,
sr.created,
sr.createdby,
sr.updated,
sr.updatedby,
0 AS qtyonhand,
sr.qty AS qtyreserved,
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
sr.m_storagereservation_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
WHERE sr.issotrx = 'Y'
UNION
SELECT so.m_product_id,
w.m_reservelocator_id AS m_locator_id,
so.ad_client_id,
so.ad_org_id,
so.isactive,
so.created,
so.createdby,
so.updated,
so.updatedby,
0 AS qtyonhand,
0 AS qtyreserved,
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
so.m_storagereservation_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
WHERE so.issotrx = 'N'
;

View File

@ -0,0 +1,14 @@
CREATE OR REPLACE VIEW rv_storage_per_product AS
SELECT strg.AD_Client_ID, strg.AD_Org_ID
, p.M_Product_ID, p.Value, p.Name
, p.Description, p.UPC, p.SKU
, p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo
, p.GuaranteeDays, p.GuaranteeDaysMin
, strg.SumQtyOnHand
FROM M_Product p
INNER JOIN ( SELECT M_Product_ID, M_Locator_ID, SUM (QtyOnHand) as SumQtyOnHand
, AD_Client_ID, AD_Org_ID
FROM RV_Storage
GROUP BY M_Product_ID, M_Locator_ID, AD_Client_ID, AD_Org_ID) strg ON (p.M_Product_ID = strg.M_Product_ID)
INNER JOIN M_Locator l ON (strg.M_Locator_ID=l.M_Locator_ID)
;

View File

@ -0,0 +1,111 @@
create or replace function altercolumn(tablename name, columnname name, datatype name,
nullclause varchar, defaultclause varchar) returns void as $$
declare
command text;
viewtext text[];
viewname name[];
dropviews name[];
i int;
j int;
v record;
sqltype text;
sqltype_short text;
typename name;
begin
if datatype is not null then
select pg_type.typname, format_type(pg_type.oid, pg_attribute.atttypmod)
into typename, sqltype
from pg_class, pg_attribute, pg_type
where relname = lower(tablename)
and relkind = 'r'
and pg_class.oid = pg_attribute.attrelid
and attname = lower(columnname)
and atttypid = pg_type.oid;
sqltype_short := sqltype;
if typename = 'numeric' then
sqltype_short := replace(sqltype, ',0', '');
elsif strpos(sqltype,'character varying') = 1 then
sqltype_short := replace(sqltype, 'character varying', 'varchar');
elsif sqltype = 'timestamp without time zone' then
sqltype_short := 'timestamp';
end if;
if lower(datatype) <> sqltype and lower(datatype) <> sqltype_short then
i := 0;
for v in select a.relname, a.oid
from pg_class a, pg_depend b, pg_depend c, pg_class d, pg_attribute e
where a.oid = b.refobjid
and b.objid = c.objid
and b.refobjid <> c.refobjid
and b.deptype = 'n'
and c.refobjid = d.oid
and d.relname = lower(tablename)
and d.relkind = 'r'
and d.oid = e.attrelid
and e.attname = lower(columnname)
and c.refobjsubid = e.attnum
and a.relkind = 'v'
loop
i := i + 1;
viewtext[i] := pg_get_viewdef(v.oid);
viewname[i] := v.relname;
end loop;
if i > 0 then
begin
for j in 1 .. i loop
command := 'drop view ' || viewname[j];
execute command;
dropviews[j] := viewname[j];
end loop;
exception
when others then
i := array_upper(dropviews, 1);
if i > 0 then
for j in 1 .. i loop
command := 'create or replace view ' || dropviews[j] || ' as ' || viewtext[j];
execute command;
end loop;
end if;
raise exception 'Failed to recreate dependent view';
end;
end if;
command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' type ' || lower(datatype);
execute command;
i := array_upper(dropviews, 1);
if i > 0 then
for j in 1 .. i loop
command := 'create or replace view ' || dropviews[j] || ' as ' || viewtext[j];
execute command;
end loop;
end if;
end if;
end if;
if defaultclause is not null then
if lower(defaultclause) = 'null' then
command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' drop default ';
else
command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' set default ''' || defaultclause || '''';
end if;
execute command;
end if;
if nullclause is not null then
if lower(nullclause) = 'not null' then
command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' set not null';
execute command;
elsif lower(nullclause) = 'null' then
command := 'alter table ' || lower(tablename) || ' alter column ' || lower(columnname) || ' drop not null';
execute command;
end if;
end if;
end;
$$ language plpgsql;
/*
create table t_alter_column
( tablename name, columnname name, datatype name, nullclause varchar(10), defaultclause varchar(200));
create rule alter_column_rule as on insert to t_alter_column
do instead select altercolumn(new.tablename, new.columnname, new.datatype, new.nullclause,
new.defaultclause);
*/

View File

@ -8,19 +8,22 @@ CREATE OR REPLACE VIEW ad_field_v AS
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout,
COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id,
c.isalwaysupdateable, c.readonlylogic, c.mandatorylogic, c.isupdateable,
COALESCE(f.Isalwaysupdateable , C.Isalwaysupdateable) As Isalwaysupdateable,
COALESCE(f.Readonlylogic, c.Readonlylogic ) As Readonlylogic,
COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic,
COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax,
fg.name AS fieldgroup, vr.code AS validationcode, f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault,
COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete,
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
c.seqnoselection, f.xposition, f.columnspan, f.numlines,
COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton
FROM ad_field f
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar;

View File

@ -4,13 +4,18 @@ CREATE OR REPLACE VIEW ad_field_vt AS
f.isencrypted AS isencryptedfield, f.obscuretype, c.columnname, c.columnsql, c.fieldlength, c.vformat, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.isparent, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, c.isidentifier, c.istranslated,
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id, c.callout, COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id, c.isalwaysupdateable, c.readonlylogic, c.mandatorylogic, c.isupdateable,
COALESCE(f.ad_val_rule_id,c.ad_val_rule_id) AS ad_val_rule_id, c.ad_process_id,
COALESCE(f.Isalwaysupdateable,C.Isalwaysupdateable) As Isalwaysupdateable,
COALESCE(f.Readonlylogic,c.Readonlylogic) As Readonlylogic,
COALESCE(f.Mandatorylogic , C.Mandatorylogic) As Mandatorylogic,
COALESCE(f.isupdateable, c.isupdateable) AS isupdateable,
c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode,
f.included_tab_id, fg.fieldgrouptype, fg.iscollapsedbydefault, COALESCE(f.infofactoryclass, c.infofactoryclass) AS infofactoryclass, c.isautocomplete,
COALESCE(f.IsAllowCopy, c.IsAllowCopy) AS IsAllowCopy,
f.isdisplayedgrid,
f.seqnogrid,
c.seqnoselection, f.xposition, f.columnspan, f.numlines, c.isToolbarButton
c.seqnoselection, f.xposition, f.columnspan, f.numlines,
COALESCE(f.istoolbarbutton , c.istoolbarbutton ) As istoolbarbutton
FROM ad_field f
JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
@ -18,6 +23,5 @@ CREATE OR REPLACE VIEW ad_field_vt AS
LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language::text = fgt.ad_language::text
LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
LEFT JOIN ad_val_rule vr ON vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)
WHERE f.isactive = 'Y'::bpchar AND c.isactive = 'Y'::bpchar;

View File

@ -0,0 +1,59 @@
CREATE OR REPLACE VIEW m_storage
AS
SELECT s.m_product_id,
s.m_locator_id,
s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.qtyonhand,
0 AS qtyreserved,
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
s.m_storageonhand_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
w.m_reservelocator_id AS m_locator_id,
sr.ad_client_id,
sr.ad_org_id,
sr.isactive,
sr.created,
sr.createdby,
sr.updated,
sr.updatedby,
0 AS qtyonhand,
sr.qty AS qtyreserved,
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
sr.m_storagereservation_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
WHERE sr.issotrx = 'Y'
UNION
SELECT so.m_product_id,
w.m_reservelocator_id AS m_locator_id,
so.ad_client_id,
so.ad_org_id,
so.isactive,
so.created,
so.createdby,
so.updated,
so.updatedby,
0 AS qtyonhand,
0 AS qtyreserved,
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
so.m_storagereservation_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
WHERE so.issotrx = 'N'
;

View File

@ -0,0 +1,14 @@
CREATE OR REPLACE VIEW rv_storage_per_product AS
SELECT strg.AD_Client_ID, strg.AD_Org_ID
, p.M_Product_ID, p.Value, p.Name
, p.Description, p.UPC, p.SKU
, p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo
, p.GuaranteeDays, p.GuaranteeDaysMin
, strg.SumQtyOnHand
FROM M_Product p
INNER JOIN ( SELECT M_Product_ID, M_Locator_ID, SUM (QtyOnHand) as SumQtyOnHand
, AD_Client_ID, AD_Org_ID
FROM RV_Storage
GROUP BY M_Product_ID, M_Locator_ID, AD_Client_ID, AD_Org_ID) strg ON (p.M_Product_ID = strg.M_Product_ID)
INNER JOIN M_Locator l ON (strg.M_Locator_ID=l.M_Locator_ID)
;

View File

@ -0,0 +1,379 @@
-- Oct 16, 2012 11:14:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table (IsSecurityEnabled,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsView,IsChangeLog,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','3',145,200026,'N','N','N','U','Y','N','L','M_StorageOnHand','M_StorageOnHand',0,'Y',0,100,TO_DATE('2012-10-16 11:14:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-10-16 11:14:30','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 16, 2012 11:14:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200026 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID)
;
-- Oct 16, 2012 11:14:34 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,CreatedBy,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive) VALUES (1,'N',200000,'Y',100,1000000,1000000,'N','Y',200026,'Table M_StorageOnHand','M_StorageOnHand',0,0,TO_DATE('2012-10-16 11:14:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-10-16 11:14:31','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Oct 16, 2012 11:14:41 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Client_ID@',200026,200614,'U',1,'Y','N','N','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N',129,'N',102,'N','Y','N','N','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_DATE('2012-10-16 11:14:40','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:40','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:41 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200614 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:42 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Org_ID@',200026,200615,'U',1,'Y','N','N','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',130,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_DATE('2012-10-16 11:14:41','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:41','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:42 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200615 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:45 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200616,'U',1,'Y','N','N','The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_DATE('2012-10-16 11:14:42','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:42','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:45 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200616 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:46 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200617,'U',1,110,'Y','N','N','The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_DATE('2012-10-16 11:14:45','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:46 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200617 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:48 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200618,'U',1,'N','N','N','The Date Last Inventory Count indicates the last time an Inventory count was done.','N',7,'N',15,'N','N',1088,'N','Y','N','Y','N','DateLastInventory','Date of Last Inventory Count','Date last inventory count','Y',100,TO_DATE('2012-10-16 11:14:46','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:46','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:48 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200618 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:50 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200026,200619,'U',1,'Y','N','N','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.','N',1,'N',20,'N','N',348,'N','Y','N','N','N','IsActive','The record is active in the system','Active','N',100,TO_DATE('2012-10-16 11:14:48','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:50 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200619 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:51 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200620,'U',1,'Y','N','N',0,'The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y',22,'N',35,'N','N',2019,'N','Y','N','N','N','M_AttributeSetInstance_ID','Product Attribute Set Instance','Attribute Set Instance','Y',100,TO_DATE('2012-10-16 11:14:50','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:50','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:51 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200620 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200621,'U',1,'Y','N','N','The Locator indicates where in a Warehouse a product is located.','Y',22,'N',31,'N','N',448,'N','Y','N','N','N','M_Locator_ID','Warehouse Locator','Locator','Y',100,TO_DATE('2012-10-16 11:14:51','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:51','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200621 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200622,'U',1,'Y','N','N','Identifies an item which is either purchased or sold in this organization.','Y',22,'N',30,'N',231,'N',454,'N','Y','N','N','N','M_Product_ID','Product, Service, Item','Product','Y',100,TO_DATE('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200622 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:53 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200623,'U',1,'Y','N','N','The On Hand Quantity indicates the quantity of a product that is on hand in a warehouse.','N',22,'N',29,'N','N',530,'N','Y','N','N','N','QtyOnHand','On Hand Quantity','On Hand Quantity','Y',100,TO_DATE('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:53 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200623 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:55 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200624,'U',1,'Y','N','N','The Ordered Quantity indicates the quantity of a product that was ordered.','N',22,'N',29,'N','N',531,'N','Y','N','N','N','QtyOrdered','Ordered Quantity','Ordered Quantity','Y',100,TO_DATE('2012-10-16 11:14:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:53','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:55 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200624 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200625,'U',1,'Y','N','N','The Reserved Quantity indicates the quantity of a product that is currently reserved.','N',22,'N',29,'N','N',532,'N','Y','N','N','N','QtyReserved','Reserved Quantity','Reserved Quantity','Y',100,TO_DATE('2012-10-16 11:14:55','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:55','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200625 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200626,'U',1,'Y','N','N','The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','N','N','Updated','Date this record was updated','Updated','N',100,TO_DATE('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200626 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:57 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200627,'U',1,110,'Y','N','N','The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_DATE('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:57 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200627 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=200624
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column WHERE AD_Column_ID=200624
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=200625
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column WHERE AD_Column_ID=200625
;
-- Oct 16, 2012 11:15:32 AM WIT
-- Resolve M_Storage locking and data consistency
CREATE TABLE M_StorageOnHand (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, DateLastInventory DATE DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, M_AttributeSetInstance_ID NUMBER(10) NOT NULL, M_Locator_ID NUMBER(10) NOT NULL, M_Product_ID NUMBER(10) NOT NULL, QtyOnHand NUMBER NOT NULL, Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, CONSTRAINT M_StorageOnHand_Key PRIMARY KEY (M_AttributeSetInstance_ID, M_Locator_ID, M_Product_ID))
;
-- Oct 16, 2012 11:16:16 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table (IsSecurityEnabled,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsView,IsChangeLog,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','3',145,200027,'N','N','N','U','Y','N','L','M_StorageReservation','M_StorageReservation',0,'Y',0,100,TO_DATE('2012-10-16 11:16:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-10-16 11:16:15','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 16, 2012 11:16:16 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200027 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID)
;
-- Oct 16, 2012 11:16:17 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,CreatedBy,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive) VALUES (1,'N',200000,'Y',100,1000000,1000000,'N','Y',200027,'Table M_StorageReservation','M_StorageReservation',0,0,TO_DATE('2012-10-16 11:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-10-16 11:16:16','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Client_ID@',200027,200628,'U',1,'Y','N','N','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N',129,'N',102,'N','Y','N','N','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_DATE('2012-10-16 11:16:23','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:23','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200628 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Org_ID@',200027,200629,'U',1,'Y','N','N','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',130,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_DATE('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200629 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:25 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200630,'U',1,'Y','N','N','The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_DATE('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:25 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200630 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:26 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200631,'U',1,110,'Y','N','N','The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_DATE('2012-10-16 11:16:25','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:25','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:26 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200631 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:28 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200632,'U',1,'N','N','N','The Date Last Inventory Count indicates the last time an Inventory count was done.','N',7,'N',15,'N','N',1088,'N','Y','N','Y','N','DateLastInventory','Date of Last Inventory Count','Date last inventory count','Y',100,TO_DATE('2012-10-16 11:16:26','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:28 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200632 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200027,200633,'U',1,'Y','N','N','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.','N',1,'N',20,'N','N',348,'N','Y','N','N','N','IsActive','The record is active in the system','Active','N',100,TO_DATE('2012-10-16 11:16:28','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:28','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200633 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200634,'U',1,'Y','N','N',0,'The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y',22,'N',35,'N','N',2019,'N','Y','N','N','N','M_AttributeSetInstance_ID','Product Attribute Set Instance','Attribute Set Instance','Y',100,TO_DATE('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200634 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:30 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200635,'U',1,'Y','N','N','The Locator indicates where in a Warehouse a product is located.','Y',22,'N',31,'N','N',448,'N','Y','N','N','N','M_Locator_ID','Warehouse Locator','Locator','Y',100,TO_DATE('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:30 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200635 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200636,'U',1,'Y','N','N','Identifies an item which is either purchased or sold in this organization.','Y',22,'N',30,'N',231,'N',454,'N','Y','N','N','N','M_Product_ID','Product, Service, Item','Product','Y',100,TO_DATE('2012-10-16 11:16:30','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200636 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:32 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200637,'U',1,'Y','N','N','The On Hand Quantity indicates the quantity of a product that is on hand in a warehouse.','N',22,'N',29,'N','N',530,'N','Y','N','N','N','QtyOnHand','On Hand Quantity','On Hand Quantity','Y',100,TO_DATE('2012-10-16 11:16:31','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:31','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:32 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200637 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200638,'U',1,'Y','N','N','The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','N','N','Updated','Date this record was updated','Updated','N',100,TO_DATE('2012-10-16 11:16:32','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200638 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200639,'U',1,110,'Y','N','N','The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_DATE('2012-10-16 11:16:33','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:16:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200639 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET Help='The Quantity indicates the number of a specific product or item for this document.', AD_Element_ID=526, ColumnName='Qty', Description='Quantity', Name='Quantity',Updated=TO_DATE('2012-10-16 11:17:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200637
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=200637
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Field SET Name='Quantity', Description='Quantity', Help='The Quantity indicates the number of a specific product or item for this document.' WHERE AD_Column_ID=200637 AND IsCentrallyMaintained='Y'
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET Help='The Warehouse identifies a unique Warehouse where products are stored or Services are provided.', AD_Element_ID=459, IsUpdateable='N', ColumnName='M_Warehouse_ID', Description='Storage Warehouse and Service Point', Name='Warehouse',Updated=TO_DATE('2012-10-16 11:17:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Field SET Name='Warehouse', Description='Storage Warehouse and Service Point', Help='The Warehouse identifies a unique Warehouse where products are stored or Services are provided.' WHERE AD_Column_ID=200635 AND IsCentrallyMaintained='Y'
;
-- Oct 16, 2012 11:17:20 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Reference_ID=19, IsUpdateable='N',Updated=TO_DATE('2012-10-16 11:17:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:35 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Val_Rule_ID=189, IsUpdateable='N',Updated=TO_DATE('2012-10-16 11:17:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:18:05 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200027,200640,'U',0,'N','N','N',0,'The Sales Transaction checkbox indicates if this item is a Sales Transaction.','N',1,'N',20,'N','N',1106,'N','Y','N','Y','N','IsSOTrx','This is a Sales Transaction','Sales Transaction','Y',100,TO_DATE('2012-10-16 11:18:04','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-16 11:18:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:18:05 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200640 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:18:28 AM WIT
-- Resolve M_Storage locking and data consistency
CREATE TABLE M_StorageReservation (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, DateLastInventory DATE DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, IsSOTrx CHAR(1) DEFAULT 'Y' CHECK (IsSOTrx IN ('Y','N')), M_AttributeSetInstance_ID NUMBER(10) NOT NULL, M_Product_ID NUMBER(10) NOT NULL, M_Warehouse_ID NUMBER(10) NOT NULL, Qty NUMBER NOT NULL, Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, CONSTRAINT M_StorageReservation_Key PRIMARY KEY (M_AttributeSetInstance_ID, M_Product_ID, M_Warehouse_ID))
;
SELECT register_migration_script('201211141732_IDEMPIERE-385_m_storage.sql') FROM dual
;

View File

@ -0,0 +1,35 @@
CREATE OR REPLACE VIEW m_product_stock_v AS
SELECT ms.isactive, ms.created, ms.createdby, ms.updated, ms.updatedby, mp.value, mp.help, ms.qtyonhand - NVL(mr.qty,0) AS qtyavailable, ms.qtyonhand, NVL(mr.qty,0) as qtyreserved, mp.description, mw.name AS warehouse, mw.m_warehouse_id, mw.ad_client_id, mw.ad_org_id, mp.documentnote
FROM m_storageonhand ms
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
ORDER BY mw.name;
CREATE OR REPLACE VIEW m_product_substituterelated_v AS
SELECT s.ad_client_id, s.ad_org_id, s.isactive, s.created, s.createdby, s.updated, s.updatedby, s.m_product_id, s.substitute_id, 'S' AS rowtype, mp.name, sum(ms.qtyonhand - NVL(mr.qty,0)) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, NVL(sum(mr.qty),0) AS qtyreserved, round(max(mpr.pricestd), 0) AS pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, org.name AS orgname
FROM m_substitute s
JOIN m_storageonhand ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
GROUP BY s.ad_client_id, s.ad_org_id, s.isactive, s.created, s.createdby, s.updated, s.updatedby, s.m_product_id, s.substitute_id, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name
UNION
SELECT r.ad_client_id, r.ad_org_id, r.isactive, r.created, r.createdby, r.updated, r.updatedby, r.m_product_id, r.relatedproduct_id AS substitute_id, 'R' AS rowtype, mp.name, sum(ms.qtyonhand - NVL(mr.qty,0)) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, NVL(sum(mr.qty),0) AS qtyreserved, round(max(mpr.pricestd), 0) AS pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, org.name AS orgname
FROM m_relatedproduct r
JOIN m_storageonhand ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
GROUP BY r.ad_client_id, r.ad_org_id, r.isactive, r.created, r.createdby, r.updated, r.updatedby, r.m_product_id, r.relatedproduct_id, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name;
SELECT register_migration_script('201211141733_IDEMPIERE-385_m_viewProduct.sql') FROM dual
;

View File

@ -0,0 +1,48 @@
-- Oct 19, 2012 2:07:52 PM WIT
-- Reserve Locator
INSERT INTO AD_Element (AD_Element_ID,ColumnName,EntityType,Name,PrintName,AD_Client_ID,Created,Updated,IsActive,AD_Org_ID,CreatedBy,UpdatedBy) VALUES (200188,'M_ReserveLocator_ID','U','M_ReserveLocator_ID','Reserve Locator',0,TO_DATE('2012-10-19 14:07:51','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-19 14:07:51','YYYY-MM-DD HH24:MI:SS'),'Y',0,100,100)
;
-- Oct 19, 2012 2:07:52 PM WIT
-- Reserve Locator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_PrintName,PO_Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_PrintName,t.PO_Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200188 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 2:08:25 PM WIT
-- Reserve Locator
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (190,200704,'U',0,'N','N','N',0,'N',10,'N',31,'N','N',200188,'N','Y','N','Y','N','M_ReserveLocator_ID','M_ReserveLocator_ID','Y',100,TO_DATE('2012-10-19 14:08:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_DATE('2012-10-19 14:08:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 19, 2012 2:08:25 PM WIT
-- Reserve Locator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200704 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 2:08:28 PM WIT
-- Reserve Locator
ALTER TABLE M_Warehouse ADD M_ReserveLocator_ID NUMBER(10) DEFAULT NULL
;
-- Oct 19, 2012 2:08:49 PM WIT
-- Reserve Locator
INSERT INTO AD_Field (IsEncrypted,DisplayLength,AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N',10,177,'Y','N','N',200704,'N','Y',200649,'N','U','M_ReserveLocator_ID',100,0,'Y',TO_DATE('2012-10-19 14:08:48','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-10-19 14:08:48','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 2:08:49 PM WIT
-- Reserve Locator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200649 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Oct 19, 2012 2:09:08 PM WIT
-- Reserve Locator
UPDATE AD_Field SET Name='Reserve Locator',Updated=TO_DATE('2012-10-19 14:09:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649
;
-- Oct 19, 2012 2:09:08 PM WIT
-- Reserve Locator
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=200649
;
SELECT register_migration_script('201211141734_IDEMPIERE-385_reserveLocator.sql') FROM dual
;

View File

@ -0,0 +1,395 @@
-- Nov 19, 2012 10:56:55 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('M_StorageOnHand_UU',200233,'U','M_StorageOnHand_UU','M_StorageOnHand_UU','d22731f0-0762-43bf-9f29-66383f3038f8',0,TO_DATE('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Nov 19, 2012 10:56:55 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200233 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES ('N',1.00,200026,200917,'U','N','N','N','N',36,'N',10,'N',200233,'66058949-db74-48a6-a940-79ee28d0f0ed','Y','N','M_StorageOnHand_UU','M_StorageOnHand_UU',TO_DATE('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200917 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
ALTER TABLE M_StorageOnHand ADD M_StorageOnHand_UU NVARCHAR2(36) DEFAULT NULL
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
CREATE UNIQUE INDEX M_StorageOnHand_UU_idx ON m_storageonhand(M_StorageOnHand_UU)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('M_StorageReservation_UU',200234,'U','M_StorageReservation_UU','M_StorageReservation_UU','283bcf86-e8af-4ac7-aaff-efcfa104e700',0,TO_DATE('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200234 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES ('N',1.00,200027,200918,'U','N','N','N','N',36,'N',10,'N',200234,'fb178aac-4ffe-4244-907c-89a0a527acf8','Y','N','M_StorageReservation_UU','M_StorageReservation_UU',TO_DATE('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200918 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
ALTER TABLE M_StorageReservation ADD M_StorageReservation_UU NVARCHAR2(36) DEFAULT NULL
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
CREATE UNIQUE INDEX M_StorageReservation_UU_idx ON m_storagereservation(M_StorageReservation_UU)
;
ALTER TABLE m_storageonhand DROP CONSTRAINT m_storageonhand_key
;
ALTER TABLE m_storageonhand ADD (CONSTRAINT m_storageonhand_pkey PRIMARY KEY (m_product_id, m_locator_id, m_attributesetinstance_id))
;
ALTER TABLE m_storagereservation DROP CONSTRAINT m_storagereservation_key
;
ALTER TABLE m_storagereservation ADD (CONSTRAINT m_storagereservation_pkey PRIMARY KEY (m_product_id, m_warehouse_id, issotrx, m_attributesetinstance_id))
;
insert into m_storageonhand (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
m_attributesetinstance_id,
m_locator_id,
m_product_id,
qtyonhand,
updated,
updatedby,
m_storageonhand_uu
)
select ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
m_attributesetinstance_id,
m_locator_id,
m_product_id,
qtyonhand,
updated,
updatedby,
generate_uuid()
from m_storage
;
insert into m_storagereservation (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
issotrx,
m_attributesetinstance_id,
m_product_id,
m_warehouse_id,
qty,
updated,
updatedby,
m_storagereservation_uu
)
select
min(s.ad_client_id),
min(s.ad_org_id),
min(s.created),
min(s.createdby),
null,
'Y',
'Y',
s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id,
sum(s.qtyreserved),
max(s.updated),
max(s.updatedby),
generate_uuid()
from m_storage s
join m_locator l on (s.m_locator_id=l.m_locator_id)
where s.isactive='Y'
and s.qtyreserved!=0
group by s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id
;
insert into m_storagereservation (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
issotrx,
m_attributesetinstance_id,
m_product_id,
m_warehouse_id,
qty,
updated,
updatedby,
m_storagereservation_uu
)
select
min(s.ad_client_id),
min(s.ad_org_id),
min(s.created),
min(s.createdby),
null,
'Y',
'N',
s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id,
sum(s.qtyordered),
max(s.updated),
max(s.updatedby),
generate_uuid()
from m_storage s
join m_locator l on (s.m_locator_id=l.m_locator_id)
where s.isactive='Y'
and s.qtyordered!=0
group by s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id
;
ALTER TABLE m_storage RENAME TO m_storage_to_drop
;
CREATE OR REPLACE VIEW m_storage
AS
SELECT s.m_product_id,
s.m_locator_id,
s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.qtyonhand,
0 AS qtyreserved,
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
s.m_storageonhand_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
w.m_reservelocator_id AS m_locator_id,
sr.ad_client_id,
sr.ad_org_id,
sr.isactive,
sr.created,
sr.createdby,
sr.updated,
sr.updatedby,
0 AS qtyonhand,
sr.qty AS qtyreserved,
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
sr.m_storagereservation_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
WHERE sr.issotrx = 'Y'
UNION
SELECT so.m_product_id,
w.m_reservelocator_id AS m_locator_id,
so.ad_client_id,
so.ad_org_id,
so.isactive,
so.created,
so.createdby,
so.updated,
so.updatedby,
0 AS qtyonhand,
0 AS qtyreserved,
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
so.m_storagereservation_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
WHERE so.issotrx = 'N'
;
-- Comment the next if you want to preserve a backup of the M_Storage table
DROP TABLE m_storage_to_drop
;
-- Nov 19, 2012 12:19:33 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Table SET IsView='Y',Updated=TO_DATE('2012-11-19 12:19:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=250
;
-- Nov 19, 2012 12:26:17 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Tab SET OrderByClause='M_Product_ID, M_AttributeSetInstance_ID, M_Locator_ID',Updated=TO_DATE('2012-11-19 12:26:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=179
;
-- Nov 19, 2012 12:26:42 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Tab SET OrderByClause='M_Product_ID, M_AttributeSetInstance_ID, M_Locator_ID',Updated=TO_DATE('2012-11-19 12:26:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53244
;
update m_warehouse set m_reservelocator_id =
(select min(m_locator_id)
from m_locator
where m_warehouse_id =m_warehouse.m_warehouse_id and isactive='Y' and isdefault='Y')
where m_reservelocator_id is null
;
-- Nov 19, 2012 1:15:02 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Reference_Value_ID=191, AD_Reference_ID=18, AD_Val_Rule_ID=127, IsToolbarButton='N',Updated=TO_DATE('2012-11-19 13:15:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200704
;
--create views
CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
AS
SELECT
ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
mp.VALUE, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand,
ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id,
mw.ad_org_id, mp.documentnote
FROM M_STORAGE ms
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
ORDER BY mw.NAME
;
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
SELECT s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.m_product_id,
s.substitute_id,
'S' AS rowtype,
mp.name,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
FROM m_substitute s
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.m_product_id,
s.substitute_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
UNION
SELECT r.ad_client_id,
r.ad_org_id,
r.isactive,
r.created,
r.createdby,
r.updated,
r.updatedby,
r.m_product_id,
r.relatedproduct_id AS substitute_id,
'R' AS rowtype,
mp.name,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
FROM m_relatedproduct r
JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY r.ad_client_id,
r.ad_org_id,
r.isactive,
r.created,
r.createdby,
r.updated,
r.updatedby,
r.m_product_id,
r.relatedproduct_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
;
-- Nov 20, 2012 5:06:02 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET IsParent='Y', IsUpdateable='N', IsToolbarButton='N',Updated=TO_DATE('2012-11-20 17:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640
;
-- Nov 20, 2012 5:28:27 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_DATE('2012-11-20 17:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640
;
-- Nov 20, 2012 5:28:36 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
ALTER TABLE M_StorageReservation MODIFY IsSOTrx CHAR(1) DEFAULT 'Y'
;
-- Nov 20, 2012 5:28:36 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE M_StorageReservation SET IsSOTrx='Y' WHERE IsSOTrx IS NULL
;
SELECT register_migration_script('201211191100_IDEMPIERE-385_DB.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,428 @@
-- Nov 16, 2012 2:47:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 14:47:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53210
;
-- Nov 16, 2012 2:47:13 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 14:47:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=331
;
-- Nov 16, 2012 2:49:20 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 14:49:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=549
;
-- Nov 16, 2012 2:49:27 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 14:49:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=136
;
-- Nov 16, 2012 2:49:33 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 14:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=215
;
-- Nov 16, 2012 2:50:55 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 14:50:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=557
;
-- Nov 16, 2012 2:51:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 14:51:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=127
;
-- Nov 16, 2012 2:56:23 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 14:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=303
;
-- Nov 16, 2012 2:56:28 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 14:56:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=309
;
-- Nov 16, 2012 2:59:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 14:59:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=233
;
-- Nov 16, 2012 2:59:10 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 14:59:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=503
;
-- Nov 16, 2012 3:01:47 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_DATE('2012-11-16 15:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=171
;
-- Nov 16, 2012 3:01:51 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=104
;
-- Nov 16, 2012 3:01:56 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=172
;
-- Nov 16, 2012 3:02:00 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:02:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=103
;
-- Nov 16, 2012 3:02:05 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_DATE('2012-11-16 15:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=773
;
-- Nov 16, 2012 3:08:20 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:08:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=246
;
-- Nov 16, 2012 3:08:29 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:08:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=247
;
-- Nov 16, 2012 3:08:36 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:08:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=248
;
-- Nov 16, 2012 3:08:40 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_DATE('2012-11-16 15:08:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=308
;
-- Nov 16, 2012 3:10:04 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:10:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=101
;
-- Nov 16, 2012 3:10:10 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:10:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=681
;
-- Nov 16, 2012 3:10:13 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:10:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53298
;
-- Nov 16, 2012 3:10:17 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_DATE('2012-11-16 15:10:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53069
;
-- Nov 16, 2012 3:10:21 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_DATE('2012-11-16 15:10:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=673
;
-- Nov 16, 2012 3:11:11 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=333
;
-- Nov 16, 2012 3:11:15 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=640
;
-- Nov 16, 2012 3:11:19 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:11:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=458
;
-- Nov 16, 2012 3:12:02 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:12:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=134
;
-- Nov 16, 2012 3:12:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:12:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=273
;
-- Nov 16, 2012 3:13:49 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:13:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=106
;
-- Nov 16, 2012 3:13:53 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:13:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=116
;
-- Nov 16, 2012 3:13:57 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:13:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=430
;
-- Nov 16, 2012 3:14:04 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_DATE('2012-11-16 15:14:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200009
;
-- Nov 16, 2012 3:14:08 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_DATE('2012-11-16 15:14:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
;
-- Nov 16, 2012 3:14:25 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_DATE('2012-11-16 15:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=115
;
-- Nov 16, 2012 3:14:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=80,Updated=TO_DATE('2012-11-16 15:14:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200028
;
-- Nov 16, 2012 3:14:34 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=90,Updated=TO_DATE('2012-11-16 15:14:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=117
;
-- Nov 16, 2012 3:14:39 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=100,Updated=TO_DATE('2012-11-16 15:14:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=311
;
-- Nov 16, 2012 3:17:02 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:17:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
;
-- Nov 16, 2012 3:17:24 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_DATE('2012-11-16 15:17:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=116
;
-- Nov 16, 2012 3:17:28 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_DATE('2012-11-16 15:17:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=115
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=275
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=6432
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=1990
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=126
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=127
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=128
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=129
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=274
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=130
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=5808
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=4259
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=1551
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=132
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=200276
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=924
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=133
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=136
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=142
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=137
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=200274
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=139
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=138
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=8343
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=140
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=141
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=13425
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=54401
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=54402
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=13424
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=62468
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=200771
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=53280
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=200275
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=200350
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=200348
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=200349
;
-- Nov 16, 2012 3:25:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_DATE('2012-11-16 15:25:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=149
;
-- Nov 16, 2012 3:25:34 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=80,Updated=TO_DATE('2012-11-16 15:25:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=312
;
-- Nov 16, 2012 3:25:38 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_DATE('2012-11-16 15:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=122
;
-- Nov 16, 2012 3:25:43 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_DATE('2012-11-16 15:25:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=577
;
-- Nov 16, 2012 3:25:46 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_DATE('2012-11-16 15:25:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=123
;
-- Nov 16, 2012 3:25:51 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_DATE('2012-11-16 15:25:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=124
;
-- Nov 16, 2012 3:25:55 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_DATE('2012-11-16 15:25:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=644
;
SELECT register_migration_script('201211231024_IDEMPIERE-369_ReorgTabs.sql') FROM dual
;

View File

@ -0,0 +1,379 @@
-- Oct 16, 2012 11:14:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table (IsSecurityEnabled,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsView,IsChangeLog,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','3',145,200026,'N','N','N','U','Y','N','L','M_StorageOnHand','M_StorageOnHand',0,'Y',0,100,TO_TIMESTAMP('2012-10-16 11:14:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-10-16 11:14:30','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 16, 2012 11:14:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200026 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID)
;
-- Oct 16, 2012 11:14:34 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,CreatedBy,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive) VALUES (1,'N',200000,'Y',100,1000000,1000000,'N','Y',200026,'Table M_StorageOnHand','M_StorageOnHand',0,0,TO_TIMESTAMP('2012-10-16 11:14:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-10-16 11:14:31','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Oct 16, 2012 11:14:41 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Client_ID@',200026,200614,'U',1,'Y','N','N','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N',129,'N',102,'N','Y','N','N','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_TIMESTAMP('2012-10-16 11:14:40','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:40','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:41 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200614 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:42 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Org_ID@',200026,200615,'U',1,'Y','N','N','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',130,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_TIMESTAMP('2012-10-16 11:14:41','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:41','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:42 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200615 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:45 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200616,'U',1,'Y','N','N','The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_TIMESTAMP('2012-10-16 11:14:42','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:42','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:45 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200616 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:46 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200617,'U',1,110,'Y','N','N','The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_TIMESTAMP('2012-10-16 11:14:45','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:45','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:46 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200617 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:48 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200618,'U',1,'N','N','N','The Date Last Inventory Count indicates the last time an Inventory count was done.','N',7,'N',15,'N','N',1088,'N','Y','N','Y','N','DateLastInventory','Date of Last Inventory Count','Date last inventory count','Y',100,TO_TIMESTAMP('2012-10-16 11:14:46','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:46','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:48 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200618 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:50 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200026,200619,'U',1,'Y','N','N','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.','N',1,'N',20,'N','N',348,'N','Y','N','N','N','IsActive','The record is active in the system','Active','N',100,TO_TIMESTAMP('2012-10-16 11:14:48','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:50 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200619 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:51 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200620,'U',1,'Y','N','N',0,'The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y',22,'N',35,'N','N',2019,'N','Y','N','N','N','M_AttributeSetInstance_ID','Product Attribute Set Instance','Attribute Set Instance','Y',100,TO_TIMESTAMP('2012-10-16 11:14:50','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:50','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:51 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200620 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200621,'U',1,'Y','N','N','The Locator indicates where in a Warehouse a product is located.','Y',22,'N',31,'N','N',448,'N','Y','N','N','N','M_Locator_ID','Warehouse Locator','Locator','Y',100,TO_TIMESTAMP('2012-10-16 11:14:51','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:51','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200621 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200622,'U',1,'Y','N','N','Identifies an item which is either purchased or sold in this organization.','Y',22,'N',30,'N',231,'N',454,'N','Y','N','N','N','M_Product_ID','Product, Service, Item','Product','Y',100,TO_TIMESTAMP('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:52 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200622 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:53 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200623,'U',1,'Y','N','N','The On Hand Quantity indicates the quantity of a product that is on hand in a warehouse.','N',22,'N',29,'N','N',530,'N','Y','N','N','N','QtyOnHand','On Hand Quantity','On Hand Quantity','Y',100,TO_TIMESTAMP('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:52','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:53 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200623 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:55 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200624,'U',1,'Y','N','N','The Ordered Quantity indicates the quantity of a product that was ordered.','N',22,'N',29,'N','N',531,'N','Y','N','N','N','QtyOrdered','Ordered Quantity','Ordered Quantity','Y',100,TO_TIMESTAMP('2012-10-16 11:14:53','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:53','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:55 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200624 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200625,'U',1,'Y','N','N','The Reserved Quantity indicates the quantity of a product that is currently reserved.','N',22,'N',29,'N','N',532,'N','Y','N','N','N','QtyReserved','Reserved Quantity','Reserved Quantity','Y',100,TO_TIMESTAMP('2012-10-16 11:14:55','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:55','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200625 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200626,'U',1,'Y','N','N','The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','N','N','Updated','Date this record was updated','Updated','N',100,TO_TIMESTAMP('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:56 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200626 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:14:57 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200026,200627,'U',1,110,'Y','N','N','The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_TIMESTAMP('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:14:56','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:14:57 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200627 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=200624
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column WHERE AD_Column_ID=200624
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column_Trl WHERE AD_Column_ID=200625
;
-- Oct 16, 2012 11:15:19 AM WIT
-- Resolve M_Storage locking and data consistency
DELETE FROM AD_Column WHERE AD_Column_ID=200625
;
-- Oct 16, 2012 11:15:32 AM WIT
-- Resolve M_Storage locking and data consistency
CREATE TABLE M_StorageOnHand (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, DateLastInventory TIMESTAMP DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, M_AttributeSetInstance_ID NUMERIC(10) NOT NULL, M_Locator_ID NUMERIC(10) NOT NULL, M_Product_ID NUMERIC(10) NOT NULL, QtyOnHand NUMERIC NOT NULL, Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, CONSTRAINT M_StorageOnHand_Key PRIMARY KEY (M_AttributeSetInstance_ID, M_Locator_ID, M_Product_ID))
;
-- Oct 16, 2012 11:16:16 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table (IsSecurityEnabled,AccessLevel,LoadSeq,AD_Table_ID,IsHighVolume,IsView,IsChangeLog,EntityType,IsCentrallyMaintained,IsDeleteable,ReplicationType,TableName,Name,AD_Client_ID,IsActive,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Created) VALUES ('N','3',145,200027,'N','N','N','U','Y','N','L','M_StorageReservation','M_StorageReservation',0,'Y',0,100,TO_TIMESTAMP('2012-10-16 11:16:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-10-16 11:16:15','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 16, 2012 11:16:16 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=200027 AND NOT EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Table_ID=t.AD_Table_ID)
;
-- Oct 16, 2012 11:16:17 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Sequence (IncrementNo,StartNewYear,CurrentNextSys,IsTableID,CreatedBy,StartNo,CurrentNext,IsAudited,IsAutoSequence,AD_Sequence_ID,Description,Name,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,Created,IsActive) VALUES (1,'N',200000,'Y',100,1000000,1000000,'N','Y',200027,'Table M_StorageReservation','M_StorageReservation',0,0,TO_TIMESTAMP('2012-10-16 11:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-10-16 11:16:16','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Client_ID@',200027,200628,'U',1,'Y','N','N','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','N',22,'N',19,'N',129,'N',102,'N','Y','N','N','N','AD_Client_ID','Client/Tenant for this installation.','Client','N',100,TO_TIMESTAMP('2012-10-16 11:16:23','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:23','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200628 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('@AD_Org_ID@',200027,200629,'U',1,'Y','N','N','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','N',22,'N',19,'N',130,'N',113,'N','Y','N','N','N','AD_Org_ID','Organizational entity within client','Organization','N',100,TO_TIMESTAMP('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:24 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200629 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:25 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200630,'U',1,'Y','N','N','The Created field indicates the date that this record was created.','N',7,'N',16,'N','N',245,'N','Y','N','N','N','Created','Date this record was created','Created','N',100,TO_TIMESTAMP('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:25 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200630 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:26 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200631,'U',1,110,'Y','N','N','The Created By field indicates the user who created this record.','N',22,'N',18,'N','N',246,'N','Y','N','N','N','CreatedBy','User who created this records','Created By','N',100,TO_TIMESTAMP('2012-10-16 11:16:25','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:25','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:26 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200631 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:28 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200632,'U',1,'N','N','N','The Date Last Inventory Count indicates the last time an Inventory count was done.','N',7,'N',15,'N','N',1088,'N','Y','N','Y','N','DateLastInventory','Date of Last Inventory Count','Date last inventory count','Y',100,TO_TIMESTAMP('2012-10-16 11:16:26','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:26','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:28 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200632 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200027,200633,'U',1,'Y','N','N','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.','N',1,'N',20,'N','N',348,'N','Y','N','N','N','IsActive','The record is active in the system','Active','N',100,TO_TIMESTAMP('2012-10-16 11:16:28','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:28','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200633 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200634,'U',1,'Y','N','N',0,'The values of the actual Product Attribute Instances. The product level attributes are defined on Product level.','Y',22,'N',35,'N','N',2019,'N','Y','N','N','N','M_AttributeSetInstance_ID','Product Attribute Set Instance','Attribute Set Instance','Y',100,TO_TIMESTAMP('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:29 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200634 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:30 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200635,'U',1,'Y','N','N','The Locator indicates where in a Warehouse a product is located.','Y',22,'N',31,'N','N',448,'N','Y','N','N','N','M_Locator_ID','Warehouse Locator','Locator','Y',100,TO_TIMESTAMP('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:29','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:30 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200635 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,AD_Val_Rule_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200636,'U',1,'Y','N','N','Identifies an item which is either purchased or sold in this organization.','Y',22,'N',30,'N',231,'N',454,'N','Y','N','N','N','M_Product_ID','Product, Service, Item','Product','Y',100,TO_TIMESTAMP('2012-10-16 11:16:30','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:30','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:31 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200636 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:32 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200637,'U',1,'Y','N','N','The On Hand Quantity indicates the quantity of a product that is on hand in a warehouse.','N',22,'N',29,'N','N',530,'N','Y','N','N','N','QtyOnHand','On Hand Quantity','On Hand Quantity','Y',100,TO_TIMESTAMP('2012-10-16 11:16:31','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:31','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:32 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200637 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200638,'U',1,'Y','N','N','The Updated field indicates the date that this record was updated.','N',7,'N',16,'N','N',607,'N','Y','N','N','N','Updated','Date this record was updated','Updated','N',100,TO_TIMESTAMP('2012-10-16 11:16:32','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:32','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200638 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,AD_Reference_Value_ID,IsMandatory,IsTranslated,IsIdentifier,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (200027,200639,'U',1,110,'Y','N','N','The Updated By field indicates the user who updated this record.','N',22,'N',18,'N','N',608,'N','Y','N','N','N','UpdatedBy','User who updated this records','Updated By','N',100,TO_TIMESTAMP('2012-10-16 11:16:33','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:16:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:16:33 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200639 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET Help='The Quantity indicates the number of a specific product or item for this document.', AD_Element_ID=526, ColumnName='Qty', Description='Quantity', Name='Quantity',Updated=TO_TIMESTAMP('2012-10-16 11:17:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200637
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=200637
;
-- Oct 16, 2012 11:17:01 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Field SET Name='Quantity', Description='Quantity', Help='The Quantity indicates the number of a specific product or item for this document.' WHERE AD_Column_ID=200637 AND IsCentrallyMaintained='Y'
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET Help='The Warehouse identifies a unique Warehouse where products are stored or Services are provided.', AD_Element_ID=459, IsUpdateable='N', ColumnName='M_Warehouse_ID', Description='Storage Warehouse and Service Point', Name='Warehouse',Updated=TO_TIMESTAMP('2012-10-16 11:17:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column_Trl SET IsTranslated='N' WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:12 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Field SET Name='Warehouse', Description='Storage Warehouse and Service Point', Help='The Warehouse identifies a unique Warehouse where products are stored or Services are provided.' WHERE AD_Column_ID=200635 AND IsCentrallyMaintained='Y'
;
-- Oct 16, 2012 11:17:20 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Reference_ID=19, IsUpdateable='N',Updated=TO_TIMESTAMP('2012-10-16 11:17:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:17:35 AM WIT
-- Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Val_Rule_ID=189, IsUpdateable='N',Updated=TO_TIMESTAMP('2012-10-16 11:17:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200635
;
-- Oct 16, 2012 11:18:05 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (DefaultValue,AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,Help,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Description,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES ('Y',200027,200640,'U',0,'N','N','N',0,'The Sales Transaction checkbox indicates if this item is a Sales Transaction.','N',1,'N',20,'N','N',1106,'N','Y','N','Y','N','IsSOTrx','This is a Sales Transaction','Sales Transaction','Y',100,TO_TIMESTAMP('2012-10-16 11:18:04','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-16 11:18:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 16, 2012 11:18:05 AM WIT
-- Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200640 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 16, 2012 11:18:28 AM WIT
-- Resolve M_Storage locking and data consistency
CREATE TABLE M_StorageReservation (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, DateLastInventory TIMESTAMP DEFAULT NULL , IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, IsSOTrx CHAR(1) DEFAULT 'Y' CHECK (IsSOTrx IN ('Y','N')), M_AttributeSetInstance_ID NUMERIC(10) NOT NULL, M_Product_ID NUMERIC(10) NOT NULL, M_Warehouse_ID NUMERIC(10) NOT NULL, Qty NUMERIC NOT NULL, Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, CONSTRAINT M_StorageReservation_Key PRIMARY KEY (M_AttributeSetInstance_ID, M_Product_ID, M_Warehouse_ID))
;
SELECT register_migration_script('201211141732_IDEMPIERE-385_m_storage.sql') FROM dual
;

View File

@ -0,0 +1,35 @@
CREATE OR REPLACE VIEW m_product_stock_v AS
SELECT ms.isactive, ms.created, ms.createdby, ms.updated, ms.updatedby, mp.value, mp.help, ms.qtyonhand - coalesce(mr.qty,0) AS qtyavailable, ms.qtyonhand, coalesce(mr.qty,0) as qtyreserved, mp.description, mw.name AS warehouse, mw.m_warehouse_id, mw.ad_client_id, mw.ad_org_id, mp.documentnote
FROM m_storageonhand ms
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
ORDER BY mw.name;
CREATE OR REPLACE VIEW m_product_substituterelated_v AS
SELECT s.ad_client_id, s.ad_org_id, s.isactive, s.created, s.createdby, s.updated, s.updatedby, s.m_product_id, s.substitute_id, 'S'::text AS rowtype, mp.name, sum(ms.qtyonhand - coalesce(mr.qty,0)) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, coalesce(sum(mr.qty),0) AS qtyreserved, round(max(mpr.pricestd), 0) AS pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, org.name AS orgname
FROM m_substitute s
JOIN m_storageonhand ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
GROUP BY s.ad_client_id, s.ad_org_id, s.isactive, s.created, s.createdby, s.updated, s.updatedby, s.m_product_id, s.substitute_id, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name
UNION
SELECT r.ad_client_id, r.ad_org_id, r.isactive, r.created, r.createdby, r.updated, r.updatedby, r.m_product_id, r.relatedproduct_id AS substitute_id, 'R'::text AS rowtype, mp.name, sum(ms.qtyonhand - coalesce(mr.qty,0)) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, coalesce(sum(mr.qty),0) AS qtyreserved, round(max(mpr.pricestd), 0) AS pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, org.name AS orgname
FROM m_relatedproduct r
JOIN m_storageonhand ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
LEFT JOIN m_storagereservation mr ON ms.m_product_id = mr.m_product_id AND mw.m_warehouse_id = mr.m_warehouse_id AND mr.isSOTrx='Y'
GROUP BY r.ad_client_id, r.ad_org_id, r.isactive, r.created, r.createdby, r.updated, r.updatedby, r.m_product_id, r.relatedproduct_id, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name;
SELECT register_migration_script('201211141733_IDEMPIERE-385_m_viewProduct.sql') FROM dual
;

View File

@ -0,0 +1,48 @@
-- Oct 19, 2012 2:07:52 PM WIT
-- Reserve Locator
INSERT INTO AD_Element (AD_Element_ID,ColumnName,EntityType,Name,PrintName,AD_Client_ID,Created,Updated,IsActive,AD_Org_ID,CreatedBy,UpdatedBy) VALUES (200188,'M_ReserveLocator_ID','U','M_ReserveLocator_ID','Reserve Locator',0,TO_TIMESTAMP('2012-10-19 14:07:51','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-19 14:07:51','YYYY-MM-DD HH24:MI:SS'),'Y',0,100,100)
;
-- Oct 19, 2012 2:07:52 PM WIT
-- Reserve Locator
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_PrintName,PO_Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_PrintName,t.PO_Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200188 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Oct 19, 2012 2:08:25 PM WIT
-- Reserve Locator
INSERT INTO AD_Column (AD_Table_ID,AD_Column_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Client_ID,AD_Org_ID,IsActive,Created,UpdatedBy) VALUES (190,200704,'U',0,'N','N','N',0,'N',10,'N',31,'N','N',200188,'N','Y','N','Y','N','M_ReserveLocator_ID','M_ReserveLocator_ID','Y',100,TO_TIMESTAMP('2012-10-19 14:08:24','YYYY-MM-DD HH24:MI:SS'),0,0,'Y',TO_TIMESTAMP('2012-10-19 14:08:24','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Oct 19, 2012 2:08:25 PM WIT
-- Reserve Locator
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200704 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Oct 19, 2012 2:08:28 PM WIT
-- Reserve Locator
ALTER TABLE M_Warehouse ADD COLUMN M_ReserveLocator_ID NUMERIC(10) DEFAULT NULL
;
-- Oct 19, 2012 2:08:49 PM WIT
-- Reserve Locator
INSERT INTO AD_Field (IsEncrypted,DisplayLength,AD_Tab_ID,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,UpdatedBy,AD_Org_ID,IsActive,Created,AD_Client_ID,CreatedBy,Updated) VALUES ('N',10,177,'Y','N','N',200704,'N','Y',200649,'N','U','M_ReserveLocator_ID',100,0,'Y',TO_TIMESTAMP('2012-10-19 14:08:48','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-10-19 14:08:48','YYYY-MM-DD HH24:MI:SS'))
;
-- Oct 19, 2012 2:08:49 PM WIT
-- Reserve Locator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200649 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Oct 19, 2012 2:09:08 PM WIT
-- Reserve Locator
UPDATE AD_Field SET Name='Reserve Locator',Updated=TO_TIMESTAMP('2012-10-19 14:09:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200649
;
-- Oct 19, 2012 2:09:08 PM WIT
-- Reserve Locator
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=200649
;
SELECT register_migration_script('201211141734_IDEMPIERE-385_reserveLocator.sql') FROM dual
;

View File

@ -0,0 +1,515 @@
-- Nov 19, 2012 10:56:55 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('M_StorageOnHand_UU',200233,'U','M_StorageOnHand_UU','M_StorageOnHand_UU','d22731f0-0762-43bf-9f29-66383f3038f8',0,TO_TIMESTAMP('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Nov 19, 2012 10:56:55 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200233 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES ('N',1.00,200026,200917,'U','N','N','N','N',36,'N',10,'N',200233,'66058949-db74-48a6-a940-79ee28d0f0ed','Y','N','M_StorageOnHand_UU','M_StorageOnHand_UU',TO_TIMESTAMP('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2012-11-19 10:56:54','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200917 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
ALTER TABLE M_StorageOnHand ADD COLUMN M_StorageOnHand_UU VARCHAR(36) DEFAULT NULL
;
-- Nov 19, 2012 10:56:56 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
CREATE UNIQUE INDEX M_StorageOnHand_UU_idx ON m_storageonhand(M_StorageOnHand_UU)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('M_StorageReservation_UU',200234,'U','M_StorageReservation_UU','M_StorageReservation_UU','283bcf86-e8af-4ac7-aaff-efcfa104e700',0,TO_TIMESTAMP('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200234 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID) VALUES ('N',1.00,200027,200918,'U','N','N','N','N',36,'N',10,'N',200234,'fb178aac-4ffe-4244-907c-89a0a527acf8','Y','N','M_StorageReservation_UU','M_StorageReservation_UU',TO_TIMESTAMP('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2012-11-19 10:56:56','YYYY-MM-DD HH24:MI:SS'),100,0)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200918 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
ALTER TABLE M_StorageReservation ADD COLUMN M_StorageReservation_UU VARCHAR(36) DEFAULT NULL
;
-- Nov 19, 2012 10:56:57 AM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
CREATE UNIQUE INDEX M_StorageReservation_UU_idx ON m_storagereservation(M_StorageReservation_UU)
;
ALTER TABLE m_storageonhand DROP CONSTRAINT m_storageonhand_key
;
ALTER TABLE m_storageonhand ADD CONSTRAINT m_storageonhand_pkey PRIMARY KEY (m_product_id, m_locator_id, m_attributesetinstance_id)
;
ALTER TABLE m_storagereservation DROP CONSTRAINT m_storagereservation_key
;
ALTER TABLE m_storagereservation ADD CONSTRAINT m_storagereservation_pkey PRIMARY KEY (m_product_id, m_warehouse_id, issotrx, m_attributesetinstance_id)
;
insert into m_storageonhand (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
m_attributesetinstance_id,
m_locator_id,
m_product_id,
qtyonhand,
updated,
updatedby,
m_storageonhand_uu
)
select ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
m_attributesetinstance_id,
m_locator_id,
m_product_id,
qtyonhand,
updated,
updatedby,
generate_uuid()
from m_storage
;
insert into m_storagereservation (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
issotrx,
m_attributesetinstance_id,
m_product_id,
m_warehouse_id,
qty,
updated,
updatedby,
m_storagereservation_uu
)
select
min(s.ad_client_id),
min(s.ad_org_id),
min(s.created),
min(s.createdby),
null,
'Y',
'Y',
s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id,
sum(s.qtyreserved),
max(s.updated),
max(s.updatedby),
generate_uuid()
from m_storage s
join m_locator l on (s.m_locator_id=l.m_locator_id)
where s.isactive='Y'
and s.qtyreserved!=0
group by s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id
;
insert into m_storagereservation (
ad_client_id,
ad_org_id,
created,
createdby,
datelastinventory,
isactive,
issotrx,
m_attributesetinstance_id,
m_product_id,
m_warehouse_id,
qty,
updated,
updatedby,
m_storagereservation_uu
)
select
min(s.ad_client_id),
min(s.ad_org_id),
min(s.created),
min(s.createdby),
null,
'Y',
'N',
s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id,
sum(s.qtyordered),
max(s.updated),
max(s.updatedby),
generate_uuid()
from m_storage s
join m_locator l on (s.m_locator_id=l.m_locator_id)
where s.isactive='Y'
and s.qtyordered!=0
group by s.m_attributesetinstance_id,
s.m_product_id,
l.m_warehouse_id
;
ALTER TABLE m_storage RENAME TO m_storage_to_drop
;
CREATE OR REPLACE VIEW m_storage
AS
SELECT s.m_product_id,
s.m_locator_id,
s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.qtyonhand,
0 AS qtyreserved,
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
s.m_storageonhand_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
w.m_reservelocator_id AS m_locator_id,
sr.ad_client_id,
sr.ad_org_id,
sr.isactive,
sr.created,
sr.createdby,
sr.updated,
sr.updatedby,
0 AS qtyonhand,
sr.qty AS qtyreserved,
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
sr.m_storagereservation_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
WHERE sr.issotrx = 'Y'
UNION
SELECT so.m_product_id,
w.m_reservelocator_id AS m_locator_id,
so.ad_client_id,
so.ad_org_id,
so.isactive,
so.created,
so.createdby,
so.updated,
so.updatedby,
0 AS qtyonhand,
0 AS qtyreserved,
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
so.m_storagereservation_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
WHERE so.issotrx = 'N'
;
-- PostgreSQL requires to recreate all views before dropping a table
CREATE OR REPLACE VIEW RV_STORAGE
(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, VALUE, NAME,
DESCRIPTION, UPC, SKU, C_UOM_ID, M_PRODUCT_CATEGORY_ID,
CLASSIFICATION, WEIGHT, VOLUME, VERSIONNO, GUARANTEEDAYS,
GUARANTEEDAYSMIN, M_LOCATOR_ID, M_WAREHOUSE_ID, X, Y,
Z, QTYONHAND, QTYRESERVED, QTYAVAILABLE, QTYORDERED,
DATELASTINVENTORY, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT,
M_LOT_ID, GUARANTEEDATE, SHELFLIFEDAYS, GOODFORDAYS, SHELFLIFEREMAININGPCT)
AS
SELECT s.AD_Client_ID, s.AD_Org_ID,
-- Product
s.M_Product_ID, p.Value,p.Name, p.Description, p.UPC, p.SKU,
p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo,
p.GuaranteeDays, p.GuaranteeDaysMin,
-- Locator
s.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
-- Storage
s.QtyOnHand, s.QtyReserved, s.QtyOnHand-s.QtyReserved AS QtyAvailable,
s.QtyOrdered, s.DateLastInventory,
-- Instance
s.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,
asi.GuaranteeDate, -- see PAttributeInstance.java
daysBetween(asi.GuaranteeDate,getdate()) AS ShelfLifeDays,
daysBetween(asi.GuaranteeDate,getdate())-p.GuaranteeDaysMin AS GoodForDays,
CASE WHEN COALESCE(p.GuaranteeDays,0)>0
THEN ROUND((daysBetween(asi.GuaranteeDate,getdate())/p.GuaranteeDays)*100,0)
ELSE NULL
END AS ShelfLifeRemainingPct
FROM M_Storage s
INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)
INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
;
CREATE OR REPLACE VIEW rv_pp_order_receipt_issue AS
SELECT obl.pp_order_bomline_id,
obl.iscritical,
p.value,
obl.m_product_id,
mos.name AS productname,
mos.m_attributesetinstance_id,
asi.description AS instancename,
mos.c_uom_id,
u.name AS uomname,
obl.qtyrequiered,
obl.qtyreserved AS qtyreserved_order,
mos.qtyonhand,
mos.qtyreserved AS qtyreserved_storage,
mos.qtyavailable,
mos.m_locator_id,
mos.m_warehouse_id,
w.name AS warehousename,
mos.qtybom,
mos.isqtypercentage,
mos.qtybatch,
obl.componenttype,
mos.qtyrequiered - obl.qtydelivered AS qtyopen,
obl.pp_order_id
FROM rv_pp_order_storage mos
JOIN pp_order_bomline obl ON mos.pp_order_bomline_id = obl.pp_order_bomline_id
JOIN m_attributesetinstance asi ON mos.m_attributesetinstance_id = asi.m_attributesetinstance_id
JOIN c_uom u ON mos.c_uom_id = u.c_uom_id
JOIN m_product p ON mos.m_product_id = p.m_product_id
JOIN m_warehouse w ON mos.m_warehouse_id = w.m_warehouse_id
;
CREATE OR REPLACE VIEW rv_pp_order_storage AS
SELECT
obl.ad_client_id,
obl.ad_org_id,
obl.createdby,
obl.updatedby,
obl.updated,
obl.created,
obl.isactive,
obl.pp_order_bom_id,
obl.pp_order_bomline_id,
obl.pp_order_id,
obl.iscritical,
obl.m_product_id,
( SELECT p.name FROM m_product p WHERE p.m_product_id = o.m_product_id) AS name,
obl.c_uom_id,
s.qtyonhand,
round(obl.qtyrequiered, 4) AS qtyrequiered,
CASE WHEN o.qtybatchs = 0 THEN 1 ELSE round(obl.qtyrequiered / o.qtybatchs, 4) END AS qtybatchsize,
round(bomqtyreserved(obl.m_product_id,obl.m_warehouse_id, 0), 4) AS qtyreserved,
round(bomqtyavailable(obl.m_product_id, obl.m_warehouse_id,0), 4) AS qtyavailable,
obl.m_warehouse_id,
obl.qtybom,
obl.isqtypercentage,
round(obl.qtybatch, 4) AS qtybatch,
obl.m_attributesetinstance_id,
l.m_locator_id,
l.x,
l.y,
l.z
FROM pp_order_bomline obl
JOIN pp_order o ON o.pp_order_id = obl.pp_order_id
LEFT JOIN m_storage s ON s.m_product_id = obl.m_product_id AND s.qtyonhand <> 0 AND obl.m_warehouse_id = (( SELECT ld.m_warehouse_id FROM m_locator ld WHERE s.m_locator_id = ld.m_locator_id))
LEFT JOIN m_locator l ON l.m_locator_id = s.m_locator_id
ORDER BY obl.m_product_id
;
CREATE OR REPLACE VIEW rv_storage_per_product AS
SELECT strg.AD_Client_ID, strg.AD_Org_ID
, p.M_Product_ID, p.Value, p.Name
, p.Description, p.UPC, p.SKU
, p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo
, p.GuaranteeDays, p.GuaranteeDaysMin
, strg.SumQtyOnHand
FROM M_Product p
INNER JOIN ( SELECT M_Product_ID, M_Locator_ID, SUM (QtyOnHand) as SumQtyOnHand
, AD_Client_ID, AD_Org_ID
FROM RV_Storage
GROUP BY M_Product_ID, M_Locator_ID, AD_Client_ID, AD_Org_ID) strg ON (p.M_Product_ID = strg.M_Product_ID)
INNER JOIN M_Locator l ON (strg.M_Locator_ID=l.M_Locator_ID)
;
-- Comment the next if you want to preserve a backup of the M_Storage table
DROP TABLE m_storage_to_drop
;
-- Nov 19, 2012 12:19:33 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Table SET IsView='Y',Updated=TO_TIMESTAMP('2012-11-19 12:19:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=250
;
-- Nov 19, 2012 12:26:17 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Tab SET OrderByClause='M_Product_ID, M_AttributeSetInstance_ID, M_Locator_ID',Updated=TO_TIMESTAMP('2012-11-19 12:26:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=179
;
-- Nov 19, 2012 12:26:42 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Tab SET OrderByClause='M_Product_ID, M_AttributeSetInstance_ID, M_Locator_ID',Updated=TO_TIMESTAMP('2012-11-19 12:26:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53244
;
update m_warehouse set m_reservelocator_id =
(select min(m_locator_id)
from m_locator
where m_warehouse_id =m_warehouse.m_warehouse_id and isactive='Y' and isdefault='Y')
where m_reservelocator_id is null
;
-- Nov 19, 2012 1:15:02 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET AD_Reference_Value_ID=191, AD_Reference_ID=18, AD_Val_Rule_ID=127, IsToolbarButton='N',Updated=TO_TIMESTAMP('2012-11-19 13:15:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200704
;
--create views
CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
AS
SELECT
ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
mp.VALUE, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand,
ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id,
mw.ad_org_id, mp.documentnote
FROM M_STORAGE ms
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
ORDER BY mw.NAME
;
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
SELECT s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.m_product_id,
s.substitute_id,
'S' AS rowtype,
mp.name,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
FROM m_substitute s
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY s.ad_client_id,
s.ad_org_id,
s.isactive,
s.created,
s.createdby,
s.updated,
s.updatedby,
s.m_product_id,
s.substitute_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
UNION
SELECT r.ad_client_id,
r.ad_org_id,
r.isactive,
r.created,
r.createdby,
r.updated,
r.updatedby,
r.m_product_id,
r.relatedproduct_id AS substitute_id,
'R' AS rowtype,
mp.name,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
FROM m_relatedproduct r
JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY r.ad_client_id,
r.ad_org_id,
r.isactive,
r.created,
r.createdby,
r.updated,
r.updatedby,
r.m_product_id,
r.relatedproduct_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
;
-- Nov 20, 2012 5:06:02 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET IsParent='Y', IsUpdateable='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2012-11-20 17:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640
;
-- Nov 20, 2012 5:28:27 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2012-11-20 17:28:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200640
;
-- Nov 20, 2012 5:28:36 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
-- INSERT INTO t_alter_column values('m_storagereservation','IsSOTrx','CHAR(1)',null,'Y')
-- not needed - avoid ERROR: failed to recreate dependent view
;
-- Nov 20, 2012 5:28:36 PM COT
-- IDEMPIERE-385 Resolve M_Storage locking and data consistency
UPDATE M_StorageReservation SET IsSOTrx='Y' WHERE IsSOTrx IS NULL
;
SELECT register_migration_script('201211191100_IDEMPIERE-385_DB.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,428 @@
-- Nov 16, 2012 2:47:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 14:47:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53210
;
-- Nov 16, 2012 2:47:13 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 14:47:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=331
;
-- Nov 16, 2012 2:49:20 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 14:49:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=549
;
-- Nov 16, 2012 2:49:27 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 14:49:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=136
;
-- Nov 16, 2012 2:49:33 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 14:49:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=215
;
-- Nov 16, 2012 2:50:55 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 14:50:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=557
;
-- Nov 16, 2012 2:51:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 14:51:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=127
;
-- Nov 16, 2012 2:56:23 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 14:56:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=303
;
-- Nov 16, 2012 2:56:28 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 14:56:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=309
;
-- Nov 16, 2012 2:59:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 14:59:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=233
;
-- Nov 16, 2012 2:59:10 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 14:59:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=503
;
-- Nov 16, 2012 3:01:47 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_TIMESTAMP('2012-11-16 15:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=171
;
-- Nov 16, 2012 3:01:51 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=104
;
-- Nov 16, 2012 3:01:56 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=172
;
-- Nov 16, 2012 3:02:00 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:02:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=103
;
-- Nov 16, 2012 3:02:05 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_TIMESTAMP('2012-11-16 15:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=773
;
-- Nov 16, 2012 3:08:20 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:08:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=246
;
-- Nov 16, 2012 3:08:29 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:08:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=247
;
-- Nov 16, 2012 3:08:36 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:08:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=248
;
-- Nov 16, 2012 3:08:40 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_TIMESTAMP('2012-11-16 15:08:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=308
;
-- Nov 16, 2012 3:10:04 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:10:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=101
;
-- Nov 16, 2012 3:10:10 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:10:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=681
;
-- Nov 16, 2012 3:10:13 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:10:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53298
;
-- Nov 16, 2012 3:10:17 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_TIMESTAMP('2012-11-16 15:10:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53069
;
-- Nov 16, 2012 3:10:21 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_TIMESTAMP('2012-11-16 15:10:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=673
;
-- Nov 16, 2012 3:11:11 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=333
;
-- Nov 16, 2012 3:11:15 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=640
;
-- Nov 16, 2012 3:11:19 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:11:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=458
;
-- Nov 16, 2012 3:12:02 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:12:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=134
;
-- Nov 16, 2012 3:12:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:12:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=273
;
-- Nov 16, 2012 3:13:49 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:13:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=106
;
-- Nov 16, 2012 3:13:53 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:13:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=116
;
-- Nov 16, 2012 3:13:57 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:13:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=430
;
-- Nov 16, 2012 3:14:04 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_TIMESTAMP('2012-11-16 15:14:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200009
;
-- Nov 16, 2012 3:14:08 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_TIMESTAMP('2012-11-16 15:14:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
;
-- Nov 16, 2012 3:14:25 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_TIMESTAMP('2012-11-16 15:14:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=115
;
-- Nov 16, 2012 3:14:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=80,Updated=TO_TIMESTAMP('2012-11-16 15:14:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=200028
;
-- Nov 16, 2012 3:14:34 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=90,Updated=TO_TIMESTAMP('2012-11-16 15:14:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=117
;
-- Nov 16, 2012 3:14:39 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=100,Updated=TO_TIMESTAMP('2012-11-16 15:14:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=311
;
-- Nov 16, 2012 3:17:02 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:17:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=107
;
-- Nov 16, 2012 3:17:24 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_TIMESTAMP('2012-11-16 15:17:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=116
;
-- Nov 16, 2012 3:17:28 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_TIMESTAMP('2012-11-16 15:17:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=115
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=275
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=6432
;
-- Nov 16, 2012 3:22:06 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=1990
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=126
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=127
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=128
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=129
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=274
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=130
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=5808
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=4259
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=1551
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=132
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=200276
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=924
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=133
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=150,IsDisplayedGrid='Y' WHERE AD_Field_ID=136
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=160,IsDisplayedGrid='Y' WHERE AD_Field_ID=142
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=170,IsDisplayedGrid='Y' WHERE AD_Field_ID=137
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=180,IsDisplayedGrid='Y' WHERE AD_Field_ID=200274
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=190,IsDisplayedGrid='Y' WHERE AD_Field_ID=139
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=200,IsDisplayedGrid='Y' WHERE AD_Field_ID=138
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=210,IsDisplayedGrid='Y' WHERE AD_Field_ID=8343
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=220,IsDisplayedGrid='Y' WHERE AD_Field_ID=140
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=230,IsDisplayedGrid='Y' WHERE AD_Field_ID=141
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=240,IsDisplayedGrid='Y' WHERE AD_Field_ID=13425
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=250,IsDisplayedGrid='Y' WHERE AD_Field_ID=54401
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=260,IsDisplayedGrid='Y' WHERE AD_Field_ID=54402
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=270,IsDisplayedGrid='Y' WHERE AD_Field_ID=13424
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=280,IsDisplayedGrid='Y' WHERE AD_Field_ID=62468
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=290,IsDisplayedGrid='Y' WHERE AD_Field_ID=200771
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=300,IsDisplayedGrid='Y' WHERE AD_Field_ID=53280
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=310,IsDisplayedGrid='Y' WHERE AD_Field_ID=200275
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=320,IsDisplayedGrid='Y' WHERE AD_Field_ID=200350
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=330,IsDisplayedGrid='Y' WHERE AD_Field_ID=200348
;
-- Nov 16, 2012 3:22:07 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Field SET SeqNoGrid=340,IsDisplayedGrid='Y' WHERE AD_Field_ID=200349
;
-- Nov 16, 2012 3:25:30 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=70,Updated=TO_TIMESTAMP('2012-11-16 15:25:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=149
;
-- Nov 16, 2012 3:25:34 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=80,Updated=TO_TIMESTAMP('2012-11-16 15:25:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=312
;
-- Nov 16, 2012 3:25:38 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=20,Updated=TO_TIMESTAMP('2012-11-16 15:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=122
;
-- Nov 16, 2012 3:25:43 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=30,Updated=TO_TIMESTAMP('2012-11-16 15:25:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=577
;
-- Nov 16, 2012 3:25:46 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=40,Updated=TO_TIMESTAMP('2012-11-16 15:25:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=123
;
-- Nov 16, 2012 3:25:51 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=50,Updated=TO_TIMESTAMP('2012-11-16 15:25:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=124
;
-- Nov 16, 2012 3:25:55 PM COT
-- IDEMPIERE-369 Master Detail layout improvements
UPDATE AD_Tab SET SeqNo=60,Updated=TO_TIMESTAMP('2012-11-16 15:25:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=644
;
SELECT register_migration_script('201211231024_IDEMPIERE-369_ReorgTabs.sql') FROM dual
;

View File

@ -12,7 +12,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/model.generator"/>
<booleanAttribute key="default" value="false"/>
<stringAttribute key="deselected_workspace_plugins" value="com.trekglobal.ui.zk.theme,org.adempiere.base.callout,org.adempiere.base.process,org.adempiere.payment.processor,org.adempiere.pipo,org.adempiere.pipo.handlers,org.adempiere.plugin.utils,org.adempiere.replication,org.adempiere.replication.server,org.adempiere.report.jasper.swing,org.adempiere.report.jasper.webapp,org.adempiere.server,org.adempiere.tomcat.config,org.adempiere.ui,org.adempiere.ui.swing,org.adempiere.ui.zk,org.adempiere.ui.zk.example,org.adempiere.webstore,org.adempiere.webstore.resource,org.adempiere.webstore.servlet,org.idempiere.webservices,org.zkoss.zk.library"/>
<stringAttribute key="deselected_workspace_plugins" value="org.adempiere.base.callout,org.adempiere.base.process,org.adempiere.payment.processor,org.adempiere.pipo,org.adempiere.pipo.handlers,org.adempiere.replication,org.adempiere.replication.server,org.adempiere.report.jasper.swing,org.adempiere.report.jasper.webapp,org.adempiere.server,org.adempiere.tomcat.config,org.adempiere.ui.zk,org.adempiere.ui.zk.example,org.adempiere.webstore,org.adempiere.webstore.resource,org.adempiere.webstore.servlet,org.idempiere.webservices,org.zkoss.zk.library"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-model.generator"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
@ -20,8 +20,8 @@
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail*1.4.0@default:default,com.springsource.javax.mail*1.4.5@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet.ext.net@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="event.test@default:default,org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.pipo.legacy@default:default,org.adempiere.plugin.utils@default:default,org.adempiere.report.jasper.font.demo@default:false,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper@default:default,org.adempiere.ui.swing.pluginlist@default:default,org.adempiere.ui.swing@default:default,org.adempiere.ui@default:default,org.apache.ecs@default:default,org.apache.poi@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>

View File

@ -147,12 +147,12 @@ public class CalloutInventory extends CalloutEngine
private BigDecimal setQtyBook (int M_AttributeSetInstance_ID, int M_Product_ID, int M_Locator_ID) throws Exception {
// Set QtyBook from first storage location
BigDecimal bd = null;
String sql = "SELECT QtyOnHand FROM M_Storage "
String sql = "SELECT QtyOnHand FROM M_StorageOnHand "
+ "WHERE M_Product_ID=?" // 1
+ " AND M_Locator_ID=?" // 2
+ " AND M_AttributeSetInstance_ID=?";
if (M_AttributeSetInstance_ID == 0)
sql = "SELECT SUM(QtyOnHand) FROM M_Storage "
sql = "SELECT SUM(QtyOnHand) FROM M_StorageOnHand "
+ "WHERE M_Product_ID=?" // 1
+ " AND M_Locator_ID=?"; // 2

View File

@ -20,6 +20,7 @@ package org.compiere.model;
import java.math.BigDecimal;
import java.util.Properties;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
@ -121,7 +122,10 @@ public class CalloutMovement extends CalloutEngine
if (M_Locator_ID <= 0)
return;
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
BigDecimal available = MStorage.getQtyAvailable(0, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
BigDecimal available = Env.ZERO;
MStorageOnHand oh = MStorageOnHand.get(ctx, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
if (oh != null)
available = oh.getQtyOnHand();
if (available == null)
available = Env.ZERO;
if (available.signum() == 0)

View File

@ -821,8 +821,8 @@ public class CalloutOrder extends CalloutEngine
BigDecimal QtyOrdered = (BigDecimal)mTab.getValue("QtyOrdered");
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
BigDecimal available = MStorage.getQtyAvailable
(M_Warehouse_ID, 0, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null);
BigDecimal available = MStorageReservation.getQtyAvailable
(M_Warehouse_ID, M_Product_ID.intValue(), M_AttributeSetInstance_ID, null);
if (available == null)
available = Env.ZERO;
if (available.signum() == 0)
@ -1296,8 +1296,8 @@ public class CalloutOrder extends CalloutEngine
{
int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID");
int M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, "M_AttributeSetInstance_ID");
BigDecimal available = MStorage.getQtyAvailable
(M_Warehouse_ID, 0, M_Product_ID, M_AttributeSetInstance_ID, null);
BigDecimal available = MStorageReservation.getQtyAvailable
(M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, null);
if (available == null)
available = Env.ZERO;
if (available.signum() == 0)

View File

@ -27,12 +27,6 @@ import org.compiere.util.Env;
*/
public class CalloutWindowCustomization extends CalloutEngine
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Set fields to current values from DB for selected window.
* @param ctx context
@ -57,15 +51,15 @@ public class CalloutWindowCustomization extends CalloutEngine
ud_win.setDescription(window.get_Translation("Description", lang));
ud_win.setHelp(window.get_Translation("Help", lang));
// XXX what for?
// what for?
ud_win.setIsDefault(window.isDefault());
// default from menu, actual from role
// XXX Read Only
// XXX User updateable
// Read Only
// User updateable
return NO_ERROR;
} // storeAttachmentOnFilesystem
} // window
/**
* Set fields to current values from DB for selected Tab
@ -93,9 +87,9 @@ public class CalloutWindowCustomization extends CalloutEngine
ud_tab.setIsSingleRow(tab.isSingleRow());
ud_tab.setIsReadOnly(tab.isReadOnly());
return NO_ERROR;
} // storeArchiveOnFileSystem
} // tab
/**
* Set fields to current values from DB for selected Tab
@ -113,25 +107,16 @@ public class CalloutWindowCustomization extends CalloutEngine
return "";
I_AD_UserDef_Field ud_field = GridTabWrapper.create(mTab, I_AD_UserDef_Field.class);
MField field = new MField(Env.getCtx(),p_AD_Field_ID, null);
MField field = new MField(ctx, p_AD_Field_ID, null);
String lang = Env.getContext(ctx, WindowNo, "AD_Language");
ud_field.setName(field.get_Translation("Name", lang));
ud_field.setDescription(field.get_Translation("Description", lang));
ud_field.setHelp(field.get_Translation("Help", lang));
ud_field.setIsDisplayed(field.isDisplayed());
ud_field.setDisplayLength(field.getDisplayLength());
ud_field.setDisplayLogic(field.getDisplayLogic());
ud_field.setIsReadOnly(field.isReadOnly());
// XXX from column? set to true for starters
ud_field.setIsUpdateable(true);
ud_field.setSeqNo(field.getSeqNo());
ud_field.setIsSameLine(field.isSameLine());
ud_field.setSortNo(field.getSortNo().intValue());
//IDEMPIERE-163 / do not inherit configuration from field - all configuration was made nullable, if null it inherit the field/column config
return NO_ERROR;
} // storeArchiveOnFileSystem
} // field
} // CalloutClient

View File

@ -30,7 +30,7 @@ import org.compiere.model.MInOutLine;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MProduct;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -78,11 +78,11 @@ public class InOutGenerate extends SvrProcess
/** Storages temp space */
private HashMap<SParameter,MStorage[]> m_map = new HashMap<SParameter,MStorage[]>();
private HashMap<SParameter,MStorageOnHand[]> m_map = new HashMap<SParameter,MStorageOnHand[]>();
/** Last Parameter */
private SParameter m_lastPP = null;
/** Last Storage */
private MStorage[] m_lastStorages = null;
private MStorageOnHand[] m_lastStorages = null;
/**
@ -299,13 +299,13 @@ public class InOutGenerate extends SvrProcess
// Stored Product
String MMPolicy = product.getMMPolicy();
MStorage[] storages = getStorages(line.getM_Warehouse_ID(),
MStorageOnHand[] storages = getStorages(line.getM_Warehouse_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy));
for (int j = 0; j < storages.length; j++)
{
MStorage storage = storages[j];
MStorageOnHand storage = storages[j];
onHand = onHand.add(storage.getQtyOnHand());
}
boolean fullLine = onHand.compareTo(toDeliver) >= 0
@ -377,7 +377,7 @@ public class InOutGenerate extends SvrProcess
MProduct product = line.getProduct();
BigDecimal toDeliver = line.getQtyOrdered().subtract(line.getQtyDelivered());
//
MStorage[] storages = null;
MStorageOnHand[] storages = null;
if (product != null && product.isStocked())
{
String MMPolicy = product.getMMPolicy();
@ -425,7 +425,7 @@ public class InOutGenerate extends SvrProcess
* @param force force delivery
*/
private void createLine (MOrder order, MOrderLine orderLine, BigDecimal qty,
MStorage[] storages, boolean force)
MStorageOnHand[] storages, boolean force)
{
// Complete last Shipment - can have multiple shipments
if (m_lastC_BPartner_Location_ID != orderLine.getC_BPartner_Location_ID() )
@ -466,7 +466,7 @@ public class InOutGenerate extends SvrProcess
BigDecimal toDeliver = qty;
for (int i = 0; i < storages.length; i++)
{
MStorage storage = storages[i];
MStorageOnHand storage = storages[i];
BigDecimal deliver = toDeliver;
//skip negative storage record
if (storage.getQtyOnHand().signum() < 0)
@ -550,7 +550,7 @@ public class InOutGenerate extends SvrProcess
* @param FiFo
* @return storages
*/
private MStorage[] getStorages(int M_Warehouse_ID,
private MStorageOnHand[] getStorages(int M_Warehouse_ID,
int M_Product_ID, int M_AttributeSetInstance_ID,
Timestamp minGuaranteeDate, boolean FiFo)
{
@ -562,7 +562,7 @@ public class InOutGenerate extends SvrProcess
if (m_lastStorages == null)
{
m_lastStorages = MStorage.getWarehouse(getCtx(),
m_lastStorages = MStorageOnHand.getWarehouse(getCtx(),
M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID,
minGuaranteeDate, FiFo,false, 0, get_TrxName());
m_map.put(m_lastPP, m_lastStorages);
@ -590,7 +590,7 @@ public class InOutGenerate extends SvrProcess
m_created++;
//reset storage cache as MInOut.completeIt will update m_storage
m_map = new HashMap<SParameter,MStorage[]>();
m_map = new HashMap<SParameter,MStorageOnHand[]>();
m_lastPP = null;
m_lastStorages = null;
}

View File

@ -135,13 +135,13 @@ public class InventoryCountCreate extends SvrProcess
// Create Null Storage records
if (p_QtyRange != null && p_QtyRange.equals("="))
{
StringBuilder sql = new StringBuilder("INSERT INTO M_Storage ");
StringBuilder sql = new StringBuilder("INSERT INTO M_StorageOnHand ");
sql.append("(AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,");
sql.append(" M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,");
sql.append(" QtyOnHand, QtyReserved, QtyOrdered, DateLastInventory) ");
sql.append(" QtyOnHand, DateLastInventory) ");
sql.append("SELECT l.AD_CLIENT_ID, l.AD_ORG_ID, 'Y', SysDate, 0,SysDate, 0,");
sql.append(" l.M_Locator_ID, p.M_Product_ID, 0,");
sql.append(" 0,0,0,null ");
sql.append(" 0,null ");
sql.append("FROM M_Locator l");
sql.append(" INNER JOIN M_Product p ON (l.AD_Client_ID=p.AD_Client_ID) ");
sql.append("WHERE l.M_Warehouse_ID=");
@ -151,7 +151,7 @@ public class InventoryCountCreate extends SvrProcess
sql.append(" AND l.M_Locator_ID=").append(p_M_Locator_ID);
sql.append(" AND l.IsDefault='Y'")
.append(" AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'")
.append(" AND NOT EXISTS (SELECT * FROM M_Storage s")
.append(" AND NOT EXISTS (SELECT * FROM M_StorageOnHand s")
.append(" INNER JOIN M_Locator sl ON (s.M_Locator_ID=sl.M_Locator_ID) ")
.append("WHERE sl.M_Warehouse_ID=l.M_Warehouse_ID")
.append(" AND s.M_Product_ID=p.M_Product_ID)");
@ -162,7 +162,7 @@ public class InventoryCountCreate extends SvrProcess
StringBuilder sql = new StringBuilder("SELECT s.M_Product_ID, s.M_Locator_ID, s.M_AttributeSetInstance_ID,");
sql.append(" s.QtyOnHand, p.M_AttributeSet_ID ");
sql.append("FROM M_Product p");
sql.append(" INNER JOIN M_Storage s ON (s.M_Product_ID=p.M_Product_ID)");
sql.append(" INNER JOIN M_StorageOnHand s ON (s.M_Product_ID=p.M_Product_ID)");
sql.append(" INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) ");
sql.append("WHERE l.M_Warehouse_ID=?");
sql.append(" AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'");

View File

@ -24,7 +24,7 @@ import java.util.logging.Level;
import org.compiere.model.MInventory;
import org.compiere.model.MInventoryLine;
import org.compiere.model.MInventoryLineMA;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.util.AdempiereSystemError;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -92,14 +92,14 @@ public class InventoryCountUpdate extends SvrProcess
// ASI
sql = new StringBuilder("UPDATE M_InventoryLine l ")
.append("SET (QtyBook,QtyCount) = ")
.append("(SELECT QtyOnHand,QtyOnHand FROM M_Storage s ")
.append("(SELECT QtyOnHand,QtyOnHand FROM M_StorageOnHand s ")
.append("WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID")
.append(" AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID),")
.append(" Updated=SysDate,")
.append(" UpdatedBy=").append(getAD_User_ID())
//
.append(" WHERE M_Inventory_ID=").append(p_M_Inventory_ID)
.append(" AND EXISTS (SELECT * FROM M_Storage s ")
.append(" AND EXISTS (SELECT * FROM M_StorageOnHand s ")
.append("WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID")
.append(" AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID)");
int no = DB.executeUpdate(sql.toString(), get_TrxName());
@ -145,11 +145,11 @@ public class InventoryCountUpdate extends SvrProcess
{
MInventoryLine il = new MInventoryLine (getCtx(), rs, get_TrxName());
BigDecimal onHand = Env.ZERO;
MStorage[] storages = MStorage.getAll(getCtx(), il.getM_Product_ID(), il.getM_Locator_ID(), get_TrxName());
MStorageOnHand[] storages = MStorageOnHand.getAll(getCtx(), il.getM_Product_ID(), il.getM_Locator_ID(), get_TrxName());
MInventoryLineMA ma = null;
for (int i = 0; i < storages.length; i++)
{
MStorage storage = storages[i];
MStorageOnHand storage = storages[i];
if (storage.getQtyOnHand().signum() == 0)
continue;
onHand = onHand.add(storage.getQtyOnHand());

View File

@ -175,7 +175,7 @@ public class InventoryValue extends SvrProcess
// Get current QtyOnHand with ASI
sql = new StringBuilder ("UPDATE T_InventoryValue iv SET QtyOnHand = ")
.append("(SELECT SUM(QtyOnHand) FROM M_Storage s")
.append("(SELECT SUM(QtyOnHand) FROM M_StorageOnHand s")
.append(" INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) ")
.append("WHERE iv.M_Product_ID=s.M_Product_ID")
.append(" AND iv.M_Warehouse_ID=l.M_Warehouse_ID")
@ -186,7 +186,7 @@ public class InventoryValue extends SvrProcess
log.fine("QtHand with ASI=" + no);
// Get current QtyOnHand without ASI
sql = new StringBuilder ("UPDATE T_InventoryValue iv SET QtyOnHand = ")
.append("(SELECT SUM(QtyOnHand) FROM M_Storage s")
.append("(SELECT SUM(QtyOnHand) FROM M_StorageOnHand s")
.append(" INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) ")
.append("WHERE iv.M_Product_ID=s.M_Product_ID")
.append(" AND iv.M_Warehouse_ID=l.M_Warehouse_ID) ")

View File

@ -24,7 +24,8 @@ import java.util.logging.Level;
import org.compiere.model.MClient;
import org.compiere.model.MLocator;
import org.compiere.model.MProduct;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MStorageReservation;
import org.compiere.model.MTransaction;
import org.compiere.model.Query;
import org.compiere.model.X_M_Production;
@ -140,9 +141,8 @@ public class M_Production_Run extends SvrProcess {
continue ;
else if(MovementQty.signum() < 0)
{
BigDecimal QtyAvailable = MStorage.getQtyAvailable(
BigDecimal QtyAvailable = MStorageReservation.getQtyAvailable(
locator.getM_Warehouse_ID(),
locator.getM_Locator_ID(),
pline.getM_Product_ID(),
pline.getM_AttributeSetInstance_ID(),
get_TrxName());
@ -155,13 +155,11 @@ public class M_Production_Run extends SvrProcess {
MovementType = MTransaction.MOVEMENTTYPE_Production_;
}
if (!MStorage.add(getCtx(), locator.getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(), locator.getM_Warehouse_ID(),
locator.getM_Locator_ID(),
pline.getM_Product_ID(),
pline.getM_AttributeSetInstance_ID(), 0 ,
MovementQty,
Env.ZERO,
Env.ZERO,
get_TrxName()))
{
raiseError("Cannot correct Inventory", "");

View File

@ -140,7 +140,7 @@ public class OrgOwnership extends SvrProcess
// Set Storage
sql = new StringBuilder();
sql.append("UPDATE M_Storage s ")
sql.append("UPDATE M_StorageOnHand s ")
.append("SET AD_Org_ID=").append(p_AD_Org_ID)
.append(" WHERE EXISTS ")
.append("(SELECT * FROM M_Locator l WHERE l.M_Locator_ID=s.M_Locator_ID")
@ -150,6 +150,16 @@ public class OrgOwnership extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "Storage"));
// Set Storage Reservation
sql = new StringBuilder();
sql.append("UPDATE M_StorageReservation s ")
.append("SET AD_Org_ID=").append(p_AD_Org_ID)
.append(" WHERE M_Warehouse_ID=").append(p_M_Warehouse_ID)
.append(" AND AD_Client_ID=").append(getAD_Client_ID())
.append(" AND AD_Org_ID<>").append(p_AD_Org_ID);
no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0,null, new BigDecimal(no), Msg.translate(getCtx(), "StorageReservation"));
return "";
} // warehouseOwnership

View File

@ -25,7 +25,7 @@ import org.compiere.model.MInOutLine;
import org.compiere.model.MProject;
import org.compiere.model.MProjectIssue;
import org.compiere.model.MProjectLine;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MTimeExpense;
import org.compiere.model.MTimeExpenseLine;
import org.compiere.util.Env;
@ -234,7 +234,7 @@ public class ProjectIssue extends SvrProcess
int M_Locator_ID = 0;
// MProduct product = new MProduct (getCtx(), expenseLines[i].getM_Product_ID());
// if (product.isStocked())
M_Locator_ID = MStorage.getM_Locator_ID(expense.getM_Warehouse_ID(),
M_Locator_ID = MStorageOnHand.getM_Locator_ID(expense.getM_Warehouse_ID(),
expenseLines[i].getM_Product_ID(), 0, // no ASI
expenseLines[i].getQty(), null);
if (M_Locator_ID == 0) // Service/Expense - get default (and fallback)

View File

@ -35,7 +35,7 @@ import org.compiere.model.MOrg;
import org.compiere.model.MProduct;
import org.compiere.model.MRequisition;
import org.compiere.model.MRequisitionLine;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MWarehouse;
import org.compiere.model.X_T_Replenish;
import org.compiere.util.AdempiereSystemError;
@ -249,12 +249,12 @@ public class ReplenishReport extends SvrProcess
log.fine("Insert (BP) #" + no);
}
sql = new StringBuilder("UPDATE T_Replenish t SET ");
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyReserved = (SELECT COALESCE(SUM(QtyReserved),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(QtyOrdered),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID)");
sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID)");
if (p_C_DocType_ID != 0)
sql.append(", C_DocType_ID=").append(p_C_DocType_ID);
sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());
@ -534,15 +534,14 @@ public class ReplenishReport extends SvrProcess
// From: Look-up Storage
MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID());
String MMPolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getWarehouse(getCtx(),
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0,
true, null,
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, null,
MClient.MMPOLICY_FiFo.equals(MMPolicy), false, 0, get_TrxName());
//
BigDecimal target = replenish.getQtyToOrder();
for (int j = 0; j < storages.length; j++)
{
MStorage storage = storages[j];
MStorageOnHand storage = storages[j];
if (storage.getQtyOnHand().signum() <= 0)
continue;
BigDecimal moveQty = target;

View File

@ -38,7 +38,7 @@ import org.compiere.model.MProduction;
import org.compiere.model.MReplenish;
import org.compiere.model.MRequisition;
import org.compiere.model.MRequisitionLine;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MWarehouse;
import org.compiere.model.X_T_Replenish;
import org.compiere.util.AdempiereSystemError;
@ -269,12 +269,12 @@ public class ReplenishReportProduction extends SvrProcess
}
sql = new StringBuilder("UPDATE T_Replenish t SET ");
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append("QtyOnHand = (SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyReserved = (SELECT COALESCE(SUM(QtyReserved),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(QtyOrdered),0) FROM M_Storage s, M_Locator l WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND l.M_Locator_ID=s.M_Locator_ID AND l.M_Warehouse_ID=t.M_Warehouse_ID)");
sql.append("QtyReserved = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID),");
sql.append("QtyOrdered = (SELECT COALESCE(SUM(Qty),0) FROM M_StorageReservation s WHERE t.M_Product_ID=s.M_Product_ID");
sql.append(" AND t.M_Warehouse_ID=s.M_Warehouse_ID)");
if (p_C_DocType_ID != 0)
sql.append(", C_DocType_ID=").append(p_C_DocType_ID);
sql.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());
@ -570,15 +570,14 @@ public class ReplenishReportProduction extends SvrProcess
// From: Look-up Storage
MProduct product = MProduct.get(getCtx(), replenish.getM_Product_ID());
String MMPolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getWarehouse(getCtx(),
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, 0,
true, null,
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
whSource.getM_Warehouse_ID(), replenish.getM_Product_ID(), 0, null,
MClient.MMPOLICY_FiFo.equals(MMPolicy), false, 0, get_TrxName());
//
BigDecimal target = replenish.getQtyToOrder();
for (int j = 0; j < storages.length; j++)
{
MStorage storage = storages[j];
MStorageOnHand storage = storages[j];
if (storage.getQtyOnHand().signum() <= 0)
continue;
BigDecimal moveQty = target;

View File

@ -26,7 +26,7 @@ import org.compiere.model.MLocator;
import org.compiere.model.MMovement;
import org.compiere.model.MMovementLine;
import org.compiere.model.MRefList;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -68,15 +68,22 @@ public class StorageCleanup extends SvrProcess
{
log.info("");
// Clean up empty Storage
String sql = "DELETE FROM M_Storage "
+ "WHERE QtyOnHand = 0 AND QtyReserved = 0 AND QtyOrdered = 0"
String sql = "DELETE FROM M_StorageOnHand "
+ "WHERE QtyOnHand = 0"
+ " AND Created < SysDate-3";
int no = DB.executeUpdate(sql, get_TrxName());
log.info("Delete Empty #" + no);
// Clean up empty Reservation Storage
sql = "DELETE FROM M_StorageReservation "
+ "WHERE Qty = 0"
+ " AND Created < SysDate-3";
no = DB.executeUpdate(sql, get_TrxName());
log.info("Delete Empty #" + no);
//
sql = "SELECT * "
+ "FROM M_Storage s "
+ "FROM M_StorageOnHand s "
+ "WHERE AD_Client_ID = ?"
+ " AND QtyOnHand < 0"
// Instance Attribute
@ -89,7 +96,7 @@ public class StorageCleanup extends SvrProcess
// + " AND s.M_Product_ID=sl.M_Product_ID"
// + " AND s.M_Locator_ID=sl.M_Locator_ID)"
// Stock in same Warehouse
+ " AND EXISTS (SELECT * FROM M_Storage sw"
+ " AND EXISTS (SELECT * FROM M_StorageOnHand sw"
+ " INNER JOIN M_Locator swl ON (sw.M_Locator_ID=swl.M_Locator_ID), M_Locator sl "
+ "WHERE sw.QtyOnHand > 0"
+ " AND s.M_Product_ID=sw.M_Product_ID"
@ -105,7 +112,7 @@ public class StorageCleanup extends SvrProcess
rs = pstmt.executeQuery ();
while (rs.next ())
{
lines += move (new MStorage(getCtx(), rs, get_TrxName()));
lines += move (new MStorageOnHand(getCtx(), rs, get_TrxName()));
}
}
catch (Exception e)
@ -126,7 +133,7 @@ public class StorageCleanup extends SvrProcess
* @param target target storage
* @return no of movements
*/
private int move (MStorage target)
private int move (MStorageOnHand target)
{
log.info(target.toString());
BigDecimal qty = target.getQtyOnHand().negate();
@ -140,10 +147,10 @@ public class StorageCleanup extends SvrProcess
return 0;
int lines = 0;
MStorage[] sources = getSources(target.getM_Product_ID(), target.getM_Locator_ID());
MStorageOnHand[] sources = getSources(target.getM_Product_ID(), target.getM_Locator_ID());
for (int i = 0; i < sources.length; i++)
{
MStorage source = sources[i];
MStorageOnHand source = sources[i];
// Movement Line
MMovementLine ml = new MMovementLine(mh);
@ -189,13 +196,14 @@ public class StorageCleanup extends SvrProcess
* Eliminate Reserved/Ordered
* @param target target Storage
*/
private void eliminateReservation(MStorage target)
private void eliminateReservation(MStorageOnHand target)
{
/*
// Negative Ordered / Reserved Qty
if (target.getQtyReserved().signum() != 0 || target.getQtyOrdered().signum() != 0)
{
int M_Locator_ID = target.getM_Locator_ID();
MStorage storage0 = MStorage.get(getCtx(), M_Locator_ID,
MStorageOnHand storage0 = MStorageOnHand.get(getCtx(), M_Locator_ID,
target.getM_Product_ID(), 0, get_TrxName());
if (storage0 == null)
{
@ -203,7 +211,7 @@ public class StorageCleanup extends SvrProcess
if (M_Locator_ID != defaultLoc.getM_Locator_ID())
{
M_Locator_ID = defaultLoc.getM_Locator_ID();
storage0 = MStorage.get(getCtx(), M_Locator_ID,
storage0 = MStorageOnHand.get(getCtx(), M_Locator_ID,
target.getM_Product_ID(), 0, get_TrxName());
}
}
@ -218,15 +226,15 @@ public class StorageCleanup extends SvrProcess
// Eliminate Reservation
if (reserved.signum() != 0 || ordered.signum() != 0)
{
if (MStorage.add(getCtx(), target.getM_Warehouse_ID(), target.getM_Locator_ID(),
if (MStorageOnHand.add(getCtx(), target.getM_Warehouse_ID(), target.getM_Locator_ID(),
target.getM_Product_ID(),
target.getM_AttributeSetInstance_ID(), target.getM_AttributeSetInstance_ID(),
Env.ZERO, reserved.negate(), ordered.negate(), get_TrxName()))
Env.ZERO, get_TrxName()))
{
if (MStorage.add(getCtx(), storage0.getM_Warehouse_ID(), storage0.getM_Locator_ID(),
if (MStorageOnHand.add(getCtx(), storage0.getM_Warehouse_ID(), storage0.getM_Locator_ID(),
storage0.getM_Product_ID(),
storage0.getM_AttributeSetInstance_ID(), storage0.getM_AttributeSetInstance_ID(),
Env.ZERO, reserved, ordered, get_TrxName()))
Env.ZERO, get_TrxName()))
log.info("Reserved=" + reserved + ",Ordered=" + ordered);
else
log.warning("Failed Storage0 Update");
@ -236,6 +244,7 @@ public class StorageCleanup extends SvrProcess
}
}
}
*/
} // eliminateReservation
/**
@ -244,11 +253,11 @@ public class StorageCleanup extends SvrProcess
* @param M_Locator_ID locator
* @return sources
*/
private MStorage[] getSources (int M_Product_ID, int M_Locator_ID)
private MStorageOnHand[] getSources (int M_Product_ID, int M_Locator_ID)
{
ArrayList<MStorage> list = new ArrayList<MStorage>();
ArrayList<MStorageOnHand> list = new ArrayList<MStorageOnHand>();
String sql = "SELECT * "
+ "FROM M_Storage s "
+ "FROM M_StorageOnHand s "
+ "WHERE QtyOnHand > 0"
+ " AND M_Product_ID=?"
// Empty ASI
@ -272,7 +281,7 @@ public class StorageCleanup extends SvrProcess
rs = pstmt.executeQuery ();
while (rs.next ())
{
list.add (new MStorage (getCtx(), rs, get_TrxName()));
list.add (new MStorageOnHand (getCtx(), rs, get_TrxName()));
}
}
catch (Exception e)
@ -284,7 +293,7 @@ public class StorageCleanup extends SvrProcess
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
MStorage[] retValue = new MStorage[list.size()];
MStorageOnHand[] retValue = new MStorageOnHand[list.size()];
list.toArray(retValue);
return retValue;
} // getSources

View File

@ -188,9 +188,9 @@ public class AccessSqlParserTest extends TestCase
*/
public void testProductInstanceAttributeQuery()
{
String sql = "SELECT p.M_Product_ID, p.Discontinued, p.Value, p.Name, BOM_Qty_Available(p.M_Product_ID,?) AS QtyAvailable, bomQtyList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd, BOM_Qty_OnHand(p.M_Product_ID,?) AS QtyOnHand, BOM_Qty_Reserved(p.M_Product_ID,?) AS QtyReserved, BOM_Qty_Ordered(p.M_Product_ID,?) AS QtyOrdered, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin, bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit, pa.IsInstanceAttribute FROM M_Product p INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID) LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID) WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND pr.M_PriceList_Version_ID=? AND EXISTS (SELECT * FROM M_Storage s INNER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) WHERE s.M_Product_ID=p.M_Product_ID AND asi.SerNo LIKE '33' AND asi.Lot LIKE '33' AND asi.M_Lot_ID=101 AND TRUNC(asi.GuaranteeDate)<TO_DATE('2003-10-16','YYYY-MM-DD') AND asi.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=103 AND Value LIKE '33') AND (M_Attribute_ID=102 AND M_AttributeValue_ID=106))) AND p.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=101 AND M_AttributeValue_ID=105) AND (M_Attribute_ID=100 AND M_AttributeValue_ID=102)) AND p.AD_Client_ID IN(0,11) AND p.AD_Org_ID IN(0,11,12) ORDER BY QtyAvailable DESC, Margin DESC";
String sql = "SELECT p.M_Product_ID, p.Discontinued, p.Value, p.Name, BOM_Qty_Available(p.M_Product_ID,?) AS QtyAvailable, bomQtyList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd, BOM_Qty_OnHand(p.M_Product_ID,?) AS QtyOnHand, BOM_Qty_Reserved(p.M_Product_ID,?) AS QtyReserved, BOM_Qty_Ordered(p.M_Product_ID,?) AS QtyOrdered, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin, bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit, pa.IsInstanceAttribute FROM M_Product p INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID) LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID) WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND pr.M_PriceList_Version_ID=? AND EXISTS (SELECT * FROM M_StorageOnHand s INNER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) WHERE s.M_Product_ID=p.M_Product_ID AND asi.SerNo LIKE '33' AND asi.Lot LIKE '33' AND asi.M_Lot_ID=101 AND TRUNC(asi.GuaranteeDate)<TO_DATE('2003-10-16','YYYY-MM-DD') AND asi.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=103 AND Value LIKE '33') AND (M_Attribute_ID=102 AND M_AttributeValue_ID=106))) AND p.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=101 AND M_AttributeValue_ID=105) AND (M_Attribute_ID=100 AND M_AttributeValue_ID=102)) AND p.AD_Client_ID IN(0,11) AND p.AD_Org_ID IN(0,11,12) ORDER BY QtyAvailable DESC, Margin DESC";
AccessSqlParser fixture = new AccessSqlParser(sql);
assertEquals("AccessSqlParser[M_AttributeInstance|M_Storage=s,M_AttributeSetInstance=asi|M_AttributeInstance|M_Product=p,M_ProductPrice=pr,M_AttributeSet=pa|3]", fixture.toString());
assertEquals("AccessSqlParser[M_AttributeInstance|M_StorageOnHand=s,M_AttributeSetInstance=asi|M_AttributeInstance|M_Product=p,M_ProductPrice=pr,M_AttributeSet=pa|3]", fixture.toString());
}
/**

View File

@ -42,12 +42,10 @@ import static org.compiere.model.SystemIDs.*;
*/
public class GridFieldVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -6196878184196075974L;
private static final long serialVersionUID = 542767511640866058L;
/**
* Return the SQL statement used for the MFieldVO.create
@ -232,16 +230,12 @@ public class GridFieldVO implements Serializable
userDef = MUserDefField.get(vo.ctx,AD_Field_ID, AD_Tab_ID, AD_Window_ID);
if (userDef != null)
{
vo.IsDisplayed = userDef.isDisplayed();
if (userDef.getName() != null)
vo.Header = userDef.getName();
if (userDef.getDescription() != null)
vo.Description = userDef.getDescription();
if (userDef.getHelp() != null)
vo.Help = userDef.getHelp();
vo.IsReadOnly = userDef.isReadOnly();
vo.IsSameLine = userDef.isSameLine();
vo.IsUpdateable = userDef.isUpdateable();
if (userDef.getDisplayLength() > 0)
vo.DisplayLength = userDef.getDisplayLength();
if (userDef.getDisplayLogic() != null)
@ -250,9 +244,35 @@ public class GridFieldVO implements Serializable
vo.DefaultValue = userDef.getDefaultValue();
if (userDef.getSortNo() > 0)
vo.SortNo = userDef.getSortNo();
// ToDo SeqNo
//if (userDef.getSeqNo() > 0)
// vo.SeqNo = userDef.getSeqNo();
//IDEMPIERE-163
if (userDef.getIsDisplayed()!= null)
vo.IsDisplayed = "Y".equals(userDef.getIsDisplayed());
if (userDef.getIsReadOnly()!= null)
vo.IsReadOnly = "Y".equals(userDef.getIsReadOnly());
if (userDef.getIsSameLine()!= null)
vo.IsSameLine = "Y".equals(userDef.getIsSameLine());
if (userDef.getIsUpdateable()!= null)
vo.IsUpdateable = "Y".equals(userDef.getIsUpdateable());
if (userDef.getIsAlwaysUpdateable()!= null)
vo.IsAlwaysUpdateable = "Y".equals(userDef.getIsAlwaysUpdateable());
if (userDef.getReadOnlyLogic()!= null)
vo.ReadOnlyLogic = userDef.getReadOnlyLogic();
if (userDef.getMandatoryLogic()!= null )
vo.MandatoryLogic = userDef.getMandatoryLogic();
if (userDef.getAD_Reference_ID()>0)
vo.displayType = userDef.getAD_Reference_ID();
if (userDef.getAD_Reference_Value_ID()>0)
vo.AD_Reference_Value_ID = userDef.getAD_Reference_Value_ID();
if (userDef.getIsMandatory()!= null)
vo.IsMandatory = "Y".equals(userDef.getIsMandatory());
if (userDef.getXPosition() > 0)
vo.XPosition = userDef.getXPosition();
if (userDef.getColumnSpan() > 0)
vo.ColumnSpan=userDef.getColumnSpan();
if (userDef.getNumLines() > 0)
vo.NumLines=userDef.getNumLines();
if (userDef.getIsToolbarButton() != null)
vo.IsToolbarButton = "Y".equals(userDef.getIsToolbarButton());
}
}
//

View File

@ -339,6 +339,19 @@ public interface I_AD_Field
*/
public String getIsAllowCopy();
/** Column name IsAlwaysUpdateable */
public static final String COLUMNNAME_IsAlwaysUpdateable = "IsAlwaysUpdateable";
/** Set Always Updateable.
* The column is always updateable, even if the record is not active or processed
*/
public void setIsAlwaysUpdateable (String IsAlwaysUpdateable);
/** Get Always Updateable.
* The column is always updateable, even if the record is not active or processed
*/
public String getIsAlwaysUpdateable();
/** Column name IsCentrallyMaintained */
public static final String COLUMNNAME_IsCentrallyMaintained = "IsCentrallyMaintained";
@ -461,6 +474,41 @@ public interface I_AD_Field
*/
public boolean isSameLine();
/** Column name IsToolbarButton */
public static final String COLUMNNAME_IsToolbarButton = "IsToolbarButton";
/** Set Toolbar Button.
* Add the column button to the toolbar
*/
public void setIsToolbarButton (String IsToolbarButton);
/** Get Toolbar Button.
* Add the column button to the toolbar
*/
public String getIsToolbarButton();
/** Column name IsUpdateable */
public static final String COLUMNNAME_IsUpdateable = "IsUpdateable";
/** Set Updatable.
* Determines, if the field can be updated
*/
public void setIsUpdateable (String IsUpdateable);
/** Get Updatable.
* Determines, if the field can be updated
*/
public String getIsUpdateable();
/** Column name MandatoryLogic */
public static final String COLUMNNAME_MandatoryLogic = "MandatoryLogic";
/** Set Mandatory Logic */
public void setMandatoryLogic (String MandatoryLogic);
/** Get Mandatory Logic */
public String getMandatoryLogic();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
@ -500,6 +548,19 @@ public interface I_AD_Field
*/
public String getObscureType();
/** Column name ReadOnlyLogic */
public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic";
/** Set Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic);
/** Get Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";

View File

@ -77,6 +77,36 @@ public interface I_AD_UserDef_Field
*/
public int getAD_Org_ID();
/** Column name AD_Reference_ID */
public static final String COLUMNNAME_AD_Reference_ID = "AD_Reference_ID";
/** Set Reference.
* System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID);
/** Get Reference.
* System Reference and Validation
*/
public int getAD_Reference_ID();
public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException;
/** Column name AD_Reference_Value_ID */
public static final String COLUMNNAME_AD_Reference_Value_ID = "AD_Reference_Value_ID";
/** Set Reference Key.
* Required to specify, if data type is Table or List
*/
public void setAD_Reference_Value_ID (int AD_Reference_Value_ID);
/** Get Reference Key.
* Required to specify, if data type is Table or List
*/
public int getAD_Reference_Value_ID();
public org.compiere.model.I_AD_Reference getAD_Reference_Value() throws RuntimeException;
/** Column name AD_UserDef_Field_ID */
public static final String COLUMNNAME_AD_UserDef_Field_ID = "AD_UserDef_Field_ID";
@ -106,6 +136,19 @@ public interface I_AD_UserDef_Field
public org.compiere.model.I_AD_UserDef_Tab getAD_UserDef_Tab() throws RuntimeException;
/** Column name ColumnSpan */
public static final String COLUMNNAME_ColumnSpan = "ColumnSpan";
/** Set Column Span.
* Number of column for a box of field
*/
public void setColumnSpan (int ColumnSpan);
/** Get Column Span.
* Number of column for a box of field
*/
public int getColumnSpan();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -202,18 +245,44 @@ public interface I_AD_UserDef_Field
*/
public boolean isActive();
/** Column name IsAlwaysUpdateable */
public static final String COLUMNNAME_IsAlwaysUpdateable = "IsAlwaysUpdateable";
/** Set Always Updatable.
* The column is always updateable, even if the record is not active or processed
*/
public void setIsAlwaysUpdateable (String IsAlwaysUpdateable);
/** Get Always Updatable.
* The column is always updateable, even if the record is not active or processed
*/
public String getIsAlwaysUpdateable();
/** Column name IsDisplayed */
public static final String COLUMNNAME_IsDisplayed = "IsDisplayed";
/** Set Displayed.
* Determines, if this field is displayed
*/
public void setIsDisplayed (boolean IsDisplayed);
public void setIsDisplayed (String IsDisplayed);
/** Get Displayed.
* Determines, if this field is displayed
*/
public boolean isDisplayed();
public String getIsDisplayed();
/** Column name IsMandatory */
public static final String COLUMNNAME_IsMandatory = "IsMandatory";
/** Set Mandatory.
* Data entry is required in this column
*/
public void setIsMandatory (String IsMandatory);
/** Get Mandatory.
* Data entry is required in this column
*/
public String getIsMandatory();
/** Column name IsReadOnly */
public static final String COLUMNNAME_IsReadOnly = "IsReadOnly";
@ -221,12 +290,12 @@ public interface I_AD_UserDef_Field
/** Set Read Only.
* Field is read only
*/
public void setIsReadOnly (boolean IsReadOnly);
public void setIsReadOnly (String IsReadOnly);
/** Get Read Only.
* Field is read only
*/
public boolean isReadOnly();
public String getIsReadOnly();
/** Column name IsSameLine */
public static final String COLUMNNAME_IsSameLine = "IsSameLine";
@ -234,12 +303,25 @@ public interface I_AD_UserDef_Field
/** Set Same Line.
* Displayed on same line as previous field
*/
public void setIsSameLine (boolean IsSameLine);
public void setIsSameLine (String IsSameLine);
/** Get Same Line.
* Displayed on same line as previous field
*/
public boolean isSameLine();
public String getIsSameLine();
/** Column name IsToolbarButton */
public static final String COLUMNNAME_IsToolbarButton = "IsToolbarButton";
/** Set Toolbar Button.
* Add the column button to the toolbar
*/
public void setIsToolbarButton (String IsToolbarButton);
/** Get Toolbar Button.
* Add the column button to the toolbar
*/
public String getIsToolbarButton();
/** Column name IsUpdateable */
public static final String COLUMNNAME_IsUpdateable = "IsUpdateable";
@ -247,12 +329,21 @@ public interface I_AD_UserDef_Field
/** Set Updatable.
* Determines, if the field can be updated
*/
public void setIsUpdateable (boolean IsUpdateable);
public void setIsUpdateable (String IsUpdateable);
/** Get Updatable.
* Determines, if the field can be updated
*/
public boolean isUpdateable();
public String getIsUpdateable();
/** Column name MandatoryLogic */
public static final String COLUMNNAME_MandatoryLogic = "MandatoryLogic";
/** Set Mandatory Logic */
public void setMandatoryLogic (String MandatoryLogic);
/** Get Mandatory Logic */
public String getMandatoryLogic();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
@ -267,6 +358,32 @@ public interface I_AD_UserDef_Field
*/
public String getName();
/** Column name NumLines */
public static final String COLUMNNAME_NumLines = "NumLines";
/** Set Number of Lines.
* Number of lines for a field
*/
public void setNumLines (int NumLines);
/** Get Number of Lines.
* Number of lines for a field
*/
public int getNumLines();
/** Column name ReadOnlyLogic */
public static final String COLUMNNAME_ReadOnlyLogic = "ReadOnlyLogic";
/** Set Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic);
/** Get Read Only Logic.
* Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
@ -310,4 +427,17 @@ public interface I_AD_UserDef_Field
* User who updated this records
*/
public int getUpdatedBy();
/** Column name XPosition */
public static final String COLUMNNAME_XPosition = "XPosition";
/** Set X Position.
* Absolute X (horizontal) position in 1/72 of an inch
*/
public void setXPosition (int XPosition);
/** Get X Position.
* Absolute X (horizontal) position in 1/72 of an inch
*/
public int getXPosition();
}

View File

@ -20,18 +20,18 @@ import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for M_Storage
/** Generated Interface for M_StorageOnHand
* @author iDempiere (generated)
* @version Release 1.0a
*/
public interface I_M_Storage
public interface I_M_StorageOnHand
{
/** TableName=M_Storage */
public static final String Table_Name = "M_Storage";
/** TableName=M_StorageOnHand */
public static final String Table_Name = "M_StorageOnHand";
/** AD_Table_ID=250 */
public static final int Table_ID = 250;
/** AD_Table_ID=200026 */
public static final int Table_ID = 200026;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -149,14 +149,14 @@ public interface I_M_Storage
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
/** Column name M_Storage_UU */
public static final String COLUMNNAME_M_Storage_UU = "M_Storage_UU";
/** Column name M_StorageOnHand_UU */
public static final String COLUMNNAME_M_StorageOnHand_UU = "M_StorageOnHand_UU";
/** Set M_Storage_UU */
public void setM_Storage_UU (String M_Storage_UU);
/** Set M_StorageOnHand_UU */
public void setM_StorageOnHand_UU (String M_StorageOnHand_UU);
/** Get M_Storage_UU */
public String getM_Storage_UU();
/** Get M_StorageOnHand_UU */
public String getM_StorageOnHand_UU();
/** Column name QtyOnHand */
public static final String COLUMNNAME_QtyOnHand = "QtyOnHand";
@ -171,32 +171,6 @@ public interface I_M_Storage
*/
public BigDecimal getQtyOnHand();
/** Column name QtyOrdered */
public static final String COLUMNNAME_QtyOrdered = "QtyOrdered";
/** Set Ordered Quantity.
* Ordered Quantity
*/
public void setQtyOrdered (BigDecimal QtyOrdered);
/** Get Ordered Quantity.
* Ordered Quantity
*/
public BigDecimal getQtyOrdered();
/** Column name QtyReserved */
public static final String COLUMNNAME_QtyReserved = "QtyReserved";
/** Set Reserved Quantity.
* Reserved Quantity
*/
public void setQtyReserved (BigDecimal QtyReserved);
/** Get Reserved Quantity.
* Reserved Quantity
*/
public BigDecimal getQtyReserved();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";

View File

@ -0,0 +1,202 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for M_StorageReservation
* @author iDempiere (generated)
* @version Release 1.0a
*/
public interface I_M_StorageReservation
{
/** TableName=M_StorageReservation */
public static final String Table_Name = "M_StorageReservation";
/** AD_Table_ID=200027 */
public static final int Table_ID = 200027;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name DateLastInventory */
public static final String COLUMNNAME_DateLastInventory = "DateLastInventory";
/** Set Date last inventory count.
* Date of Last Inventory Count
*/
public void setDateLastInventory (Timestamp DateLastInventory);
/** Get Date last inventory count.
* Date of Last Inventory Count
*/
public Timestamp getDateLastInventory();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsSOTrx */
public static final String COLUMNNAME_IsSOTrx = "IsSOTrx";
/** Set Sales Transaction.
* This is a Sales Transaction
*/
public void setIsSOTrx (boolean IsSOTrx);
/** Get Sales Transaction.
* This is a Sales Transaction
*/
public boolean isSOTrx();
/** Column name M_AttributeSetInstance_ID */
public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID";
/** Set Attribute Set Instance.
* Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID);
/** Get Attribute Set Instance.
* Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID();
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException;
/** Column name M_Product_ID */
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
/** Set Product.
* Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID);
/** Get Product.
* Product, Service, Item
*/
public int getM_Product_ID();
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
/** Column name M_StorageReservation_UU */
public static final String COLUMNNAME_M_StorageReservation_UU = "M_StorageReservation_UU";
/** Set M_StorageReservation_UU */
public void setM_StorageReservation_UU (String M_StorageReservation_UU);
/** Get M_StorageReservation_UU */
public String getM_StorageReservation_UU();
/** Column name M_Warehouse_ID */
public static final String COLUMNNAME_M_Warehouse_ID = "M_Warehouse_ID";
/** Set Warehouse.
* Storage Warehouse and Service Point
*/
public void setM_Warehouse_ID (int M_Warehouse_ID);
/** Get Warehouse.
* Storage Warehouse and Service Point
*/
public int getM_Warehouse_ID();
public org.compiere.model.I_M_Warehouse getM_Warehouse() throws RuntimeException;
/** Column name Qty */
public static final String COLUMNNAME_Qty = "Qty";
/** Set Quantity.
* Quantity
*/
public void setQty (BigDecimal Qty);
/** Get Quantity.
* Quantity
*/
public BigDecimal getQty();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -1002,7 +1002,7 @@ public class MCostDetail extends X_M_CostDetail
* Solution:
* Make sure the current qty is reflecting the actual qty in storage
*/
StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage")
StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand")
.append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID())
.append(" AND M_Product_ID=").append(cost.getM_Product_ID());
//Costing Level
@ -1159,7 +1159,7 @@ public class MCostDetail extends X_M_CostDetail
MCostElement[] lce = MCostElement.getNonCostingMethods(this);
if (lce.length > 0)
{
StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage")
StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand")
.append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID())
.append(" AND M_Product_ID=").append(cost.getM_Product_ID());
//Costing Level

View File

@ -101,12 +101,12 @@ public class MInOut extends X_M_InOut implements DocAction
if (qty.signum() == 0)
continue;
// Stock Info
MStorage[] storages = null;
MStorageOnHand[] storages = null;
MProduct product = oLines[i].getProduct();
if (product != null && product.get_ID() != 0 && product.isStocked())
{
String MMPolicy = product.getMMPolicy();
storages = MStorage.getWarehouse (order.getCtx(), order.getM_Warehouse_ID(),
storages = MStorageOnHand.getWarehouse (order.getCtx(), order.getM_Warehouse_ID(),
oLines[i].getM_Product_ID(), oLines[i].getM_AttributeSetInstance_ID(),
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, 0, trxName);
} else {
@ -1353,31 +1353,67 @@ public class MInOut extends X_M_InOut implements DocAction
// Update Storage - see also VMatch.createMatchRecord
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Locator_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
QtyMA,
sameWarehouse ? reservedDiff : Env.ZERO,
sameWarehouse ? orderedDiff : Env.ZERO,
get_TrxName()))
{
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory (MA) - " + lastError;
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
if (sameWarehouse && reservedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
reservedDiff,
true,
get_TrxName()))
{
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory Reserved (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
}
if (sameWarehouse && orderedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
orderedDiff,
false,
get_TrxName()))
{
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory Ordered (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
}
if (!sameWarehouse) {
//correct qtyOrdered in warehouse of order
MWarehouse wh = MWarehouse.get(getCtx(), oLine.getM_Warehouse_ID());
if (!MStorage.add(getCtx(), oLine.getM_Warehouse_ID(),
wh.getDefaultLocator().getM_Locator_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Env.ZERO, reservedDiff, orderedDiff, get_TrxName()))
if (reservedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
reservedDiff, true, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA) in order warehouse";
m_processMsg = "Cannot correct Inventory Reserved (MA) in order warehouse";
return DocAction.STATUS_Invalid;
}
}
if (orderedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(),
sLine.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
orderedDiff, false, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory Ordered (MA) in order warehouse";
return DocAction.STATUS_Invalid;
}
}
}
// Create Transaction
mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(),
@ -1399,27 +1435,59 @@ public class MInOut extends X_M_InOut implements DocAction
BigDecimal orderedDiff = sameWarehouse ? QtyPO.negate(): Env.ZERO;
// Fallback: Update Storage - see also VMatch.createMatchRecord
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Locator_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Qty, reservedDiff, orderedDiff, get_TrxName()))
Qty, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand - " + lastError;
return DocAction.STATUS_Invalid;
}
if (reservedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
reservedDiff, true, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory Reserved";
return DocAction.STATUS_Invalid;
}
}
if (orderedDiff.signum() != 0) {
if (!MStorageReservation.add(getCtx(), getM_Warehouse_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
orderedDiff, false, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory Ordered";
return DocAction.STATUS_Invalid;
}
}
if (!sameWarehouse) {
//correct qtyOrdered in warehouse of order
MWarehouse wh = MWarehouse.get(getCtx(), oLine.getM_Warehouse_ID());
if (!MStorage.add(getCtx(), oLine.getM_Warehouse_ID(),
wh.getDefaultLocator().getM_Locator_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Env.ZERO, QtySO.negate(), QtyPO.negate(), get_TrxName()))
if (QtySO.signum() != 0) {
if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
QtySO.negate(), true, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory";
m_processMsg = "Cannot correct Inventory Reserved";
return DocAction.STATUS_Invalid;
}
}
if (QtyPO.signum() != 0) {
if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
QtyPO.negate(), false, get_TrxName()))
{
m_processMsg = "Cannot correct Inventory Ordered";
return DocAction.STATUS_Invalid;
}
}
}
// FallBack: Create Transaction
mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(),
@ -1775,9 +1843,9 @@ public class MInOut extends X_M_InOut implements DocAction
{
MAttributeSetInstance asi = null;
//auto balance negative on hand
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, line.getM_Locator_ID(), get_TrxName());
for (MStorage storage : storages)
for (MStorageOnHand storage : storages)
{
if (storage.getQtyOnHand().signum() < 0)
{
@ -1799,10 +1867,10 @@ public class MInOut extends X_M_InOut implements DocAction
{
String MMPolicy = product.getMMPolicy();
Timestamp minGuaranteeDate = getMovementDate();
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
BigDecimal qtyToDeliver = line.getMovementQty();
for (MStorage storage: storages)
for (MStorageOnHand storage: storages)
{
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
{

View File

@ -304,7 +304,7 @@ public class MInOutLine extends X_M_InOutLine
}
// Get existing Location
int M_Locator_ID = MStorage.getM_Locator_ID (getM_Warehouse_ID(),
int M_Locator_ID = MStorageOnHand.getM_Locator_ID (getM_Warehouse_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
Qty, get_TrxName());
// Get default Location

View File

@ -437,11 +437,11 @@ public class MInventory extends X_M_Inventory implements DocAction
log.fine("Diff=" + qtyDiff
+ " - Instance OnHand=" + QtyMA + "->" + QtyNew);
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
line.getM_Locator_ID(),
line.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), 0,
QtyMA.negate(), Env.ZERO, Env.ZERO, get_TrxName()))
QtyMA.negate(), get_TrxName()))
{
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory (MA) - " + lastError;
@ -451,7 +451,7 @@ public class MInventory extends X_M_Inventory implements DocAction
// Only Update Date Last Inventory if is a Physical Inventory
if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0)
{
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), get_TrxName());
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
@ -488,20 +488,21 @@ public class MInventory extends X_M_Inventory implements DocAction
if (mtrx == null)
{
//Fallback: Update Storage - see also VMatch.createMatchRecord
if (!MStorage.add(getCtx(), getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(),
line.getM_Locator_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstance_ID(), 0,
qtyDiff, Env.ZERO, Env.ZERO, get_TrxName()))
qtyDiff,get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA)";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
// Only Update Date Last Inventory if is a Physical Inventory
if(line.getQtyInternalUse().compareTo(Env.ZERO) == 0)
{
MStorage storage = MStorage.get(getCtx(), line.getM_Locator_ID(),
MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), get_TrxName());
storage.setDateLastInventory(getMovementDate());
@ -583,9 +584,9 @@ public class MInventory extends X_M_Inventory implements DocAction
{
MAttributeSetInstance asi = null;
//auto balance negative on hand
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, line.getM_Locator_ID(), get_TrxName());
for (MStorage storage : storages)
for (MStorageOnHand storage : storages)
{
if (storage.getQtyOnHand().signum() < 0)
{
@ -603,12 +604,12 @@ public class MInventory extends X_M_Inventory implements DocAction
else // Outgoing Trx
{
String MMPolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
BigDecimal qtyToDeliver = qtyDiff.negate();
for (MStorage storage: storages)
for (MStorageOnHand storage: storages)
{
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
{

View File

@ -350,7 +350,7 @@ public class MInventoryLine extends X_M_InventoryLine
*/
private void createMA()
{
MStorage[] storages = MStorage.getAll(getCtx(), getM_Product_ID(),
MStorageOnHand[] storages = MStorageOnHand.getAll(getCtx(), getM_Product_ID(),
getM_Locator_ID(), get_TrxName());
boolean allZeroASI = true;
for (int i = 0; i < storages.length; i++)
@ -368,7 +368,7 @@ public class MInventoryLine extends X_M_InventoryLine
BigDecimal sum = Env.ZERO;
for (int i = 0; i < storages.length; i++)
{
MStorage storage = storages[i];
MStorageOnHand storage = storages[i];
if (storage.getQtyOnHand().signum() == 0)
continue;
if (ma != null

View File

@ -25,6 +25,7 @@ import java.util.Properties;
import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -399,13 +400,14 @@ public class MMovement extends X_M_Movement implements DocAction
//
MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName());
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_Locator_ID(),
line.getM_Product_ID(),
ma.getM_AttributeSetInstance_ID(), 0,
ma.getMovementQty().negate(), Env.ZERO , Env.ZERO , get_TrxName()))
ma.getMovementQty().negate(), get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA)";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
@ -416,13 +418,14 @@ public class MMovement extends X_M_Movement implements DocAction
M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID();
}
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_LocatorTo_ID(),
line.getM_Product_ID(),
M_AttributeSetInstanceTo_ID, 0,
ma.getMovementQty(), Env.ZERO , Env.ZERO , get_TrxName()))
ma.getMovementQty(), get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA)";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
@ -455,24 +458,26 @@ public class MMovement extends X_M_Movement implements DocAction
{
MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName());
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_Locator_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstance_ID(), 0,
line.getMovementQty().negate(), Env.ZERO , Env.ZERO , get_TrxName()))
line.getMovementQty().negate(), get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA)";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
//Update Storage
if (!MStorage.add(getCtx(),locator.getM_Warehouse_ID(),
if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(),
line.getM_LocatorTo_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstanceTo_ID(), 0,
line.getMovementQty(), Env.ZERO , Env.ZERO , get_TrxName()))
line.getMovementQty(), get_TrxName()))
{
m_processMsg = "Cannot correct Inventory (MA)";
String lastError = CLogger.retrieveErrorString("");
m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError;
return DocAction.STATUS_Invalid;
}
@ -550,12 +555,12 @@ public class MMovement extends X_M_Movement implements DocAction
{
MProduct product = MProduct.get(getCtx(), line.getM_Product_ID());
String MMPolicy = product.getMMPolicy();
MStorage[] storages = MStorage.getWarehouse(getCtx(), 0, line.getM_Product_ID(), 0,
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0, line.getM_Product_ID(), 0,
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName());
BigDecimal qtyToDeliver = line.getMovementQty();
for (MStorage storage: storages)
for (MStorageOnHand storage: storages)
{
if (storage.getQtyOnHand().compareTo(qtyToDeliver) >= 0)
{

View File

@ -137,9 +137,9 @@ public class MOrder extends X_C_Order implements DocAction
if (to.copyLinesFrom(from, counter, copyASI) == 0)
throw new IllegalStateException("Could not create Order Lines");
// don't copy linked PO/SO
to.setLink_Order_ID(0);
// don't copy linked PO/SO
to.setLink_Order_ID(0);
return to;
} // copyFrom
@ -543,8 +543,8 @@ public class MOrder extends X_C_Order implements DocAction
else
line.setRef_OrderLine_ID(0);
// don't copy linked lines
line.setLink_OrderLine_ID(0);
// don't copy linked lines
line.setLink_OrderLine_ID(0);
// Tax
if (getC_BPartner_ID() != otherOrder.getC_BPartner_ID())
line.setTax(); // recalculate
@ -1514,7 +1514,7 @@ public class MOrder extends X_C_Order implements DocAction
// Closing Binding Quotation
|| (MDocType.DOCSUBTYPESO_Quotation.equals(dt.getDocSubTypeSO())
&& DOCACTION_Close.equals(getDocAction()))
) // || isDropShip() )
) // || isDropShip() )
binding = false;
boolean isSOTrx = isSOTrx();
log.fine("Binding=" + binding + " - IsSOTrx=" + isSOTrx);
@ -1566,38 +1566,13 @@ public class MOrder extends X_C_Order implements DocAction
{
if (product.isStocked())
{
BigDecimal ordered = isSOTrx ? Env.ZERO : difference;
BigDecimal reserved = isSOTrx ? difference : Env.ZERO;
int M_Locator_ID = 0;
// Get Locator to reserve
if (line.getM_AttributeSetInstance_ID() != 0) // Get existing Location
M_Locator_ID = MStorage.getM_Locator_ID (line.getM_Warehouse_ID(),
line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
ordered, get_TrxName());
// Get default Location
if (M_Locator_ID == 0)
{
// try to take default locator for product first
// if it is from the selected warehouse
MWarehouse wh = MWarehouse.get(getCtx(), line.getM_Warehouse_ID());
M_Locator_ID = product.getM_Locator_ID();
if (M_Locator_ID!=0) {
MLocator locator = new MLocator(getCtx(), product.getM_Locator_ID(), get_TrxName());
//product has default locator defined but is not from the order warehouse
if(locator.getM_Warehouse_ID()!=wh.get_ID()) {
M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID();
}
} else {
M_Locator_ID = wh.getDefaultLocator().getM_Locator_ID();
}
}
// Update Storage
if (!MStorage.add(getCtx(), line.getM_Warehouse_ID(), M_Locator_ID,
// Update Reservation Storage
if (!MStorageReservation.add(getCtx(), line.getM_Warehouse_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
Env.ZERO, reserved, ordered, get_TrxName()))
difference, isSOTrx, get_TrxName()))
return false;
} // stockec
} // stocked
// update line
line.setQtyReserved(line.getQtyReserved().add(difference));
if (!line.save(get_TrxName()))
@ -2036,7 +2011,7 @@ public class MOrder extends X_C_Order implements DocAction
// Qty = Ordered - Delivered
BigDecimal MovementQty = oLine.getQtyOrdered().subtract(oLine.getQtyDelivered());
// Location
int M_Locator_ID = MStorage.getM_Locator_ID (oLine.getM_Warehouse_ID(),
int M_Locator_ID = MStorageOnHand.getM_Locator_ID (oLine.getM_Warehouse_ID(),
oLine.getM_Product_ID(), oLine.getM_AttributeSetInstance_ID(),
MovementQty, get_TrxName());
if (M_Locator_ID == 0) // Get default Location

View File

@ -19,6 +19,7 @@ package org.compiere.model;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Properties;
import java.util.logging.Level;
@ -200,9 +201,9 @@ public class MOrderLine extends X_C_OrderLine
private boolean m_IsSOTrx = true;
// Product Pricing
private MProductPricing m_productPrice = null;
/** Tax */
private MTax m_tax = null;
/** Tax */
private MTax m_tax = null;
/** Cached Currency Precision */
private Integer m_precision = null;
@ -418,17 +419,17 @@ public class MOrderLine extends X_C_OrderLine
if (m_charge == null && getC_Charge_ID() != 0)
m_charge = MCharge.get (getCtx(), getC_Charge_ID());
return m_charge;
}
/**
* Get Tax
* @return tax
*/
protected MTax getTax()
{
if (m_tax == null)
m_tax = MTax.get(getCtx(), getC_Tax_ID());
return m_tax;
} // getTax
}
/**
* Get Tax
* @return tax
*/
protected MTax getTax()
{
if (m_tax == null)
m_tax = MTax.get(getCtx(), getC_Tax_ID());
return m_tax;
} // getTax
/**
* Get Currency Precision from Currency
@ -873,9 +874,9 @@ public class MOrderLine extends X_C_OrderLine
// Max
if (isInstance)
{
MStorage[] storages = MStorage.getWarehouse(getCtx(),
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
M_AttributeSet_ID, false, null, true, get_TrxName());
null, true, false, 0, get_TrxName());
BigDecimal qty = Env.ZERO;
for (int i = 0; i < storages.length; i++)
{

View File

@ -26,6 +26,7 @@ import org.compiere.util.CCache;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
/**
* Product Model
@ -571,24 +572,8 @@ public class MProduct extends X_M_Product
|| (is_ValueChanged("ProductType") // from Item
&& PRODUCTTYPE_Item.equals(get_ValueOld("ProductType")))))
{
MStorage[] storages = MStorage.getOfProduct(getCtx(), get_ID(), get_TrxName());
BigDecimal OnHand = Env.ZERO;
BigDecimal Ordered = Env.ZERO;
BigDecimal Reserved = Env.ZERO;
for (int i = 0; i < storages.length; i++)
{
OnHand = OnHand.add(storages[i].getQtyOnHand());
Ordered = Ordered.add(storages[i].getQtyOrdered());
Reserved = Reserved.add(storages[i].getQtyReserved());
}
String errMsg = "";
if (OnHand.signum() != 0)
errMsg = "@QtyOnHand@ = " + OnHand;
if (Ordered.signum() != 0)
errMsg += " - @QtyOrdered@ = " + Ordered;
if (Reserved.signum() != 0)
errMsg += " - @QtyReserved@" + Reserved;
if (errMsg.length() > 0)
String errMsg = verifyStorage();
if (! Util.isEmpty(errMsg))
{
log.saveError("Error", Msg.parseTranslation(getCtx(), errMsg));
return false;
@ -629,6 +614,32 @@ public class MProduct extends X_M_Product
return true;
} // beforeSave
private String verifyStorage() {
BigDecimal qtyOnHand = Env.ZERO;
BigDecimal qtyOrdered = Env.ZERO;
BigDecimal qtyReserved = Env.ZERO;
for (MStorageOnHand ohs: MStorageOnHand.getOfProduct(getCtx(), get_ID(), get_TrxName()))
{
qtyOnHand = qtyOnHand.add(ohs.getQtyOnHand());
}
for (MStorageReservation rs : MStorageReservation.getOfProduct(getCtx(), get_ID(), get_TrxName()))
{
if (rs.isSOTrx())
qtyReserved = qtyReserved.add(rs.getQty());
else
qtyOrdered = qtyOrdered.add(rs.getQty());
}
StringBuilder errMsg = new StringBuilder();
if (qtyOnHand.signum() != 0)
errMsg.append("@QtyOnHand@ = ").append(qtyOnHand);
if (qtyOrdered.signum() != 0)
errMsg.append(" - @QtyOrdered@ = ").append(qtyOrdered);
if (qtyReserved.signum() != 0)
errMsg.append(" - @QtyReserved@").append(qtyReserved);
return errMsg.toString();
}
/**
* HasInventoryOrCost
* @return true if it has Inventory or Cost
@ -710,24 +721,8 @@ public class MProduct extends X_M_Product
// Check Storage
if (isStocked() || PRODUCTTYPE_Item.equals(getProductType()))
{
MStorage[] storages = MStorage.getOfProduct(getCtx(), get_ID(), get_TrxName());
BigDecimal OnHand = Env.ZERO;
BigDecimal Ordered = Env.ZERO;
BigDecimal Reserved = Env.ZERO;
for (int i = 0; i < storages.length; i++)
{
OnHand = OnHand.add(storages[i].getQtyOnHand());
Ordered = OnHand.add(storages[i].getQtyOrdered());
Reserved = OnHand.add(storages[i].getQtyReserved());
}
String errMsg = "";
if (OnHand.signum() != 0)
errMsg = "@QtyOnHand@ = " + OnHand;
if (Ordered.signum() != 0)
errMsg += " - @QtyOrdered@ = " + Ordered;
if (Reserved.signum() != 0)
errMsg += " - @QtyReserved@" + Reserved;
if (errMsg.length() > 0)
String errMsg = verifyStorage();
if (! Util.isEmpty(errMsg))
{
log.saveError("Error", Msg.parseTranslation(getCtx(), errMsg));
return false;

View File

@ -186,7 +186,7 @@ public class MProduction extends X_M_Production {
{
// BOM stock info
MStorage[] storages = null;
MStorageOnHand[] storages = null;
MProduct usedProduct = MProduct.get(getCtx(), BOMProduct_ID);
defaultLocator = usedProduct.getM_Locator_ID();
if ( defaultLocator == 0 )
@ -203,7 +203,7 @@ public class MProduction extends X_M_Production {
MMPolicy = client.getMMPolicy();
}
storages = MStorage.getWarehouse(getCtx(), M_Warehouse_ID, BOMProduct_ID, 0, null,
storages = MStorageOnHand.getWarehouse(getCtx(), M_Warehouse_ID, BOMProduct_ID, 0, null,
MProductCategory.MMPOLICY_FiFo.equals(MMPolicy), true, 0, get_TrxName());
MProductionLine BOMLine = null;

View File

@ -104,7 +104,7 @@ public class MProductionLine extends X_M_ProductionLine {
log.log(Level.SEVERE, "Could not save transaction for " + toString());
errorString.append("Could not save transaction for " + toString() + "\n");
}
MStorage storage = MStorage.getCreate(getCtx(), getM_Locator_ID(),
MStorageOnHand storage = MStorageOnHand.getCreate(getCtx(), getM_Locator_ID(),
getM_Product_ID(), asi.get_ID(), get_TrxName());
storage.changeQtyOnHand(getMovementQty(), true);
if ( !storage.save(get_TrxName()) ) {
@ -117,7 +117,7 @@ public class MProductionLine extends X_M_ProductionLine {
}
// create transactions and update stock used in production
MStorage[] storages = MStorage.getAll( getCtx(), getM_Product_ID(),
MStorageOnHand[] storages = MStorageOnHand.getAll( getCtx(), getM_Product_ID(),
getM_Locator_ID(), get_TrxName());
MProductionLineMA lineMA = null;
@ -192,10 +192,10 @@ public class MProductionLine extends X_M_ProductionLine {
}
else
{
MStorage storage = MStorage.get(Env.getCtx(), getM_Locator_ID(), getM_Product_ID(), 0, get_TrxName());
MStorageOnHand storage = MStorageOnHand.get(Env.getCtx(), getM_Locator_ID(), getM_Product_ID(), 0, get_TrxName());
if (storage == null)
{
storage = new MStorage(Env.getCtx(), 0, get_TrxName());
storage = new MStorageOnHand(Env.getCtx(), 0, get_TrxName());
storage.setM_Locator_ID(getM_Locator_ID());
storage.setM_Product_ID(getM_Product_ID());
storage.setM_AttributeSetInstance_ID(0);

View File

@ -163,9 +163,9 @@ public class MProjectIssue extends X_C_ProjectIssue
mTrx.setC_ProjectIssue_ID(getC_ProjectIssue_ID());
//
MLocator loc = MLocator.get(getCtx(), getM_Locator_ID());
if (MStorage.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(),
if (MStorageOnHand.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_AttributeSetInstance_ID(),
getMovementQty().negate(), null, null, get_TrxName()))
getMovementQty().negate(), get_TrxName()))
{
if (mTrx.save(get_TrxName()))
{

View File

@ -0,0 +1,318 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 iDempiere All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
public class MStorageReservation extends X_M_StorageReservation {
/**
*
*/
private static final long serialVersionUID = -8646802850122507899L;
/**
* Get Storage Info
* @param ctx context
* @param M_Warehouse_ID warehouse
* @param M_Product_ID product
* @param M_AttributeSetInstance_ID instance
* @param isSOTrx
* @param trxName transaction
* @return existing or null
*/
public static MStorageReservation get (Properties ctx, int M_Warehouse_ID,
int M_Product_ID, int M_AttributeSetInstance_ID, boolean isSOTrx, String trxName)
{
MStorageReservation retValue = null;
String sql = "SELECT * FROM M_StorageReservation "
+ "WHERE M_Warehouse_ID=? AND M_Product_ID=? AND IsSOTrx=? AND ";
if (M_AttributeSetInstance_ID == 0)
sql += "(M_AttributeSetInstance_ID=? OR M_AttributeSetInstance_ID IS NULL)";
else
sql += "M_AttributeSetInstance_ID=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, M_Warehouse_ID);
pstmt.setInt (2, M_Product_ID);
pstmt.setString (3, isSOTrx ? "Y" : "N");
pstmt.setInt (4, M_AttributeSetInstance_ID);
rs = pstmt.executeQuery ();
if (rs.next ())
retValue = new MStorageReservation (ctx, rs, trxName);
}
catch (SQLException ex)
{
s_log.log(Level.SEVERE, sql, ex);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
if (retValue == null)
s_log.fine("Not Found - M_Warehouse_ID=" + M_Warehouse_ID
+ ", M_Product_ID=" + M_Product_ID + ", M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID + ", IsSOTrx=" + isSOTrx);
else
s_log.fine("M_Warehouse_ID=" + M_Warehouse_ID
+ ", M_Product_ID=" + M_Product_ID + ", M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID + ", IsSOTrx=" + isSOTrx);
return retValue;
} // get
private static CLogger s_log = CLogger.getCLogger(MStorageReservation.class);
public MStorageReservation(Properties ctx, int M_StorageReservation_ID,
String trxName) {
super(ctx, M_StorageReservation_ID, trxName);
}
public MStorageReservation(Properties ctx, ResultSet rs,
String trxName) {
super(ctx, rs, trxName);
}
/**
* Full NEW Constructor
* @param warehouse (parent) warehouse
* @param M_Product_ID product
* @param M_AttributeSetInstance_ID attribute
* @param isSOTrx
*/
private MStorageReservation (MWarehouse warehouse, int M_Product_ID, int M_AttributeSetInstance_ID, boolean isSOTrx)
{
this (warehouse.getCtx(), 0, warehouse.get_TrxName());
setClientOrg(warehouse);
setM_Warehouse_ID(warehouse.getM_Warehouse_ID());
setM_Product_ID (M_Product_ID);
setM_AttributeSetInstance_ID (M_AttributeSetInstance_ID);
setIsSOTrx(isSOTrx);
setQty(Env.ZERO);
} // MStorageReservation
/**
* Get Storage Info for Product on specified Warehouse
* @param ctx
* @param m_Warehouse_ID
* @param m_Product_ID
* @param i
* @param get_TrxName
* @return
*/
public static MStorageReservation[] get(Properties ctx, int m_Warehouse_ID,
int m_Product_ID, int i, String trxName) {
String sqlWhere = "M_Product_ID=? AND M_Warehouse_ID=?";
List<MStorageReservation> list = new Query(ctx, MStorageReservation.Table_Name, sqlWhere, trxName)
.setParameters(m_Product_ID, m_Warehouse_ID)
.list();
MStorageReservation[] retValue = new MStorageReservation[list.size()];
list.toArray(retValue);
return retValue;
}
/**
* Get Storage Info for Product across warehouses
* @param ctx context
* @param M_Product_ID product
* @param trxName transaction
* @return existing or null
*/
public static MStorageReservation[] getOfProduct (Properties ctx, int M_Product_ID, String trxName)
{
String sqlWhere = "M_Product_ID=?";
List<MStorageReservation> list = new Query(ctx, MStorageReservation.Table_Name, sqlWhere, trxName)
.setParameters(M_Product_ID)
.list();
MStorageReservation[] retValue = new MStorageReservation[list.size()];
list.toArray(retValue);
return retValue;
} // getOfProduct
/**
* Get Quantity Reserved of Warehouse
* @param M_Product_ID
* @param M_Warehouse_ID
* @param M_AttributeSetInstance_ID
* @param isSOTrx - true to get reserved, false to get ordered
* @param trxName
* @return
*/
private static BigDecimal getQty(int M_Product_ID, int M_Warehouse_ID, int M_AttributeSetInstance_ID, boolean isSOTrx, String trxName) {
ArrayList<Object> params = new ArrayList<Object>();
StringBuffer sql = new StringBuffer();
sql.append(" SELECT SUM(Qty) FROM M_StorageReservation sr")
.append(" WHERE sr.M_Product_ID=? AND sr.M_Warehouse_ID=?")
.append(" AND sr.IsSOTrx=?");
params.add(M_Product_ID);
params.add(M_Warehouse_ID);
params.add(isSOTrx ? "Y" : "N");
// With ASI
if (M_AttributeSetInstance_ID != 0) {
sql.append(" AND M_AttributeSetInstance_ID=?");
params.add(M_AttributeSetInstance_ID);
}
BigDecimal qty = DB.getSQLValueBD(trxName, sql.toString(), params);
if (qty==null)
qty = Env.ZERO;
return qty;
}
/**
* Get Available Qty.
* The call is accurate only if there is a storage record
* and assumes that the product is stocked
* @param M_Warehouse_ID wh
* @param M_Product_ID product
* @param M_AttributeSetInstance_ID masi
* @param trxName transaction
* @return qty available (QtyOnHand-QtyReserved) or null
*/
public static BigDecimal getQtyAvailable (int M_Warehouse_ID,
int M_Product_ID, int M_AttributeSetInstance_ID, String trxName)
{
BigDecimal qtyOnHand = MStorageOnHand.getQtyOnHand(M_Product_ID, M_Warehouse_ID, M_AttributeSetInstance_ID, trxName);
BigDecimal qtyReserved = MStorageReservation.getQty(M_Product_ID, M_Warehouse_ID, M_AttributeSetInstance_ID, true, trxName);
BigDecimal retValue = qtyOnHand.subtract(qtyReserved);
return retValue;
}
/**
* Update Storage Info add.
* Called from MProjectIssue
* @param ctx context
* @param M_Warehouse_ID warehouse
* @param M_Product_ID product
* @param M_AttributeSetInstance_ID AS Instance
* @param reservationAttributeSetInstance_ID reservation AS Instance
* @param diffQty add
* @param isSOTrx
* @param trxName transaction
* @return true if updated
*/
public static boolean add (Properties ctx, int M_Warehouse_ID,
int M_Product_ID, int M_AttributeSetInstance_ID, int reservationAttributeSetInstance_ID,
BigDecimal diffQty, boolean isSOTrx, String trxName)
{
/* Do NOT use FIFO ASI for reservation */
MProduct prd = new MProduct(ctx, M_Product_ID, trxName);
if (prd.getM_AttributeSet_ID() == 0 || ! prd.getM_AttributeSet().isInstanceAttribute()) {
// Product doesn't manage attribute set, always reserved with 0
reservationAttributeSetInstance_ID = 0;
M_AttributeSetInstance_ID = 0;
}
//
MStorageReservation storage = null;
StringBuffer diffText = new StringBuffer("(");
// Get Storage
if (storage == null)
storage = getCreate (ctx, M_Warehouse_ID,
M_Product_ID, M_AttributeSetInstance_ID, isSOTrx, trxName);
// Verify
if (storage.getM_Warehouse_ID() != M_Warehouse_ID
&& storage.getM_Product_ID() != M_Product_ID
&& storage.getM_AttributeSetInstance_ID() != M_AttributeSetInstance_ID)
{
s_log.severe ("No Storage found - M_Warehouse_ID=" + M_Warehouse_ID
+ ",M_Product_ID=" + M_Product_ID + ",ASI=" + M_AttributeSetInstance_ID);
return false;
}
MStorageReservation storage0 = null;
if (M_AttributeSetInstance_ID != reservationAttributeSetInstance_ID)
{
storage0 = get(ctx, M_Warehouse_ID,
M_Product_ID, reservationAttributeSetInstance_ID, isSOTrx, trxName);
if (storage0 == null) // create if not existing - should not happen
{
storage0 = getCreate (ctx, M_Warehouse_ID,
M_Product_ID, reservationAttributeSetInstance_ID, isSOTrx, trxName);
}
}
boolean changed = false;
if (diffQty != null && diffQty.signum() != 0)
{
if (storage0 == null)
storage.setQty (storage.getQty().add(diffQty));
else
storage0.setQty (storage0.getQty().add (diffQty));
diffText.append(" Qty=").append(diffQty);
changed = true;
}
if (changed)
{
diffText.append(") -> ").append(storage.toString());
s_log.fine(diffText.toString());
if (storage0 != null)
storage0.saveEx(trxName); // No AttributeSetInstance
return storage.save (trxName);
}
return true;
} // add
/**
* Create or Get Storage Info
* @param ctx context
* @param M_Locator_ID locator
* @param M_Product_ID product
* @param M_AttributeSetInstance_ID instance
* @param trxName transaction
* @return existing/new or null
*/
public static MStorageReservation getCreate (Properties ctx, int M_Warehouse_ID,
int M_Product_ID, int M_AttributeSetInstance_ID, boolean isSOTrx, String trxName)
{
if (M_Warehouse_ID == 0)
throw new IllegalArgumentException("M_Warehouse_ID=0");
if (M_Product_ID == 0)
throw new IllegalArgumentException("M_Product_ID=0");
MStorageReservation retValue = get(ctx, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID, isSOTrx, trxName);
if (retValue != null)
return retValue;
// Insert row based on warehouse
MWarehouse warehouse = new MWarehouse (ctx, M_Warehouse_ID, trxName);
if (warehouse.get_ID() != M_Warehouse_ID)
throw new IllegalArgumentException("Not found M_Warehouse_ID=" + M_Warehouse_ID);
//
retValue = new MStorageReservation (warehouse, M_Product_ID, M_AttributeSetInstance_ID, isSOTrx);
retValue.saveEx(trxName);
s_log.fine("New " + retValue);
return retValue;
} // getCreate
}

View File

@ -213,7 +213,7 @@ public class MWarehouse extends X_M_Warehouse
with negative onhand. */
if (is_ValueChanged("IsDisallowNegativeInv") && isDisallowNegativeInv())
{
String sql = "SELECT M_Product_ID FROM M_Storage s "+
String sql = "SELECT M_Product_ID FROM M_StorageOnHand s "+
"WHERE s.M_Locator_ID IN (SELECT M_Locator_ID FROM M_Locator l " +
"WHERE M_Warehouse_ID=? )" +
" GROUP BY M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID " +

View File

@ -1321,6 +1321,8 @@ public abstract class PO
Object oo = m_IDs[i];
if (oo instanceof Integer)
pstmt.setInt(i+1, ((Integer)m_IDs[i]).intValue());
else if (oo instanceof Boolean)
pstmt.setString(i+1, ((Boolean) m_IDs[i] ? "Y" : "N"));
else
pstmt.setString(i+1, m_IDs[i].toString());
}
@ -2955,8 +2957,19 @@ public abstract class PO
{
if (m_KeyColumns[i].endsWith("_ID"))
sb.append(m_IDs[i]);
else
sb.append("'").append(m_IDs[i]).append("'");
else {
sb.append("'");
if (m_IDs[i] instanceof Boolean) {
if ((Boolean) m_IDs[i]) {
sb.append("Y");
} else {
sb.append("N");
}
} else {
sb.append(m_IDs[i]);
}
sb.append("'");
}
}
else
sb.append("?");

View File

@ -32,7 +32,7 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20121101L;
private static final long serialVersionUID = 20121120L;
/** Standard Constructor */
public X_AD_Field (Properties ctx, int AD_Field_ID, String trxName)
@ -490,6 +490,30 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return (String)get_Value(COLUMNNAME_IsAllowCopy);
}
/** IsAlwaysUpdateable AD_Reference_ID=319 */
public static final int ISALWAYSUPDATEABLE_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISALWAYSUPDATEABLE_Yes = "Y";
/** No = N */
public static final String ISALWAYSUPDATEABLE_No = "N";
/** Set Always Updateable.
@param IsAlwaysUpdateable
The column is always updateable, even if the record is not active or processed
*/
public void setIsAlwaysUpdateable (String IsAlwaysUpdateable)
{
set_Value (COLUMNNAME_IsAlwaysUpdateable, IsAlwaysUpdateable);
}
/** Get Always Updateable.
@return The column is always updateable, even if the record is not active or processed
*/
public String getIsAlwaysUpdateable ()
{
return (String)get_Value(COLUMNNAME_IsAlwaysUpdateable);
}
/** Set Centrally maintained.
@param IsCentrallyMaintained
Information maintained in System Element table
@ -724,6 +748,68 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return false;
}
/** IsToolbarButton AD_Reference_ID=319 */
public static final int ISTOOLBARBUTTON_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISTOOLBARBUTTON_Yes = "Y";
/** No = N */
public static final String ISTOOLBARBUTTON_No = "N";
/** Set Toolbar Button.
@param IsToolbarButton
Add the column button to the toolbar
*/
public void setIsToolbarButton (String IsToolbarButton)
{
set_Value (COLUMNNAME_IsToolbarButton, IsToolbarButton);
}
/** Get Toolbar Button.
@return Add the column button to the toolbar
*/
public String getIsToolbarButton ()
{
return (String)get_Value(COLUMNNAME_IsToolbarButton);
}
/** IsUpdateable AD_Reference_ID=319 */
public static final int ISUPDATEABLE_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISUPDATEABLE_Yes = "Y";
/** No = N */
public static final String ISUPDATEABLE_No = "N";
/** Set Updatable.
@param IsUpdateable
Determines, if the field can be updated
*/
public void setIsUpdateable (String IsUpdateable)
{
set_Value (COLUMNNAME_IsUpdateable, IsUpdateable);
}
/** Get Updatable.
@return Determines, if the field can be updated
*/
public String getIsUpdateable ()
{
return (String)get_Value(COLUMNNAME_IsUpdateable);
}
/** Set Mandatory Logic.
@param MandatoryLogic Mandatory Logic */
public void setMandatoryLogic (String MandatoryLogic)
{
set_Value (COLUMNNAME_MandatoryLogic, MandatoryLogic);
}
/** Get Mandatory Logic.
@return Mandatory Logic */
public String getMandatoryLogic ()
{
return (String)get_Value(COLUMNNAME_MandatoryLogic);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
@ -797,6 +883,23 @@ public class X_AD_Field extends PO implements I_AD_Field, I_Persistent
return (String)get_Value(COLUMNNAME_ObscureType);
}
/** Set Read Only Logic.
@param ReadOnlyLogic
Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic)
{
set_Value (COLUMNNAME_ReadOnlyLogic, ReadOnlyLogic);
}
/** Get Read Only Logic.
@return Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic ()
{
return (String)get_Value(COLUMNNAME_ReadOnlyLogic);
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first

View File

@ -30,7 +30,7 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
/**
*
*/
private static final long serialVersionUID = 20121031L;
private static final long serialVersionUID = 20121122L;
/** Standard Constructor */
public X_AD_UserDef_Field (Properties ctx, int AD_UserDef_Field_ID, String trxName)
@ -41,12 +41,6 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
setAD_Field_ID (0);
setAD_UserDef_Field_ID (0);
setAD_UserDef_Tab_ID (0);
setIsDisplayed (true);
// 'Y'
setIsReadOnly (false);
// 'N'
setIsSameLine (false);
// 'N'
setSeqNo (0);
// 0
} */
@ -116,6 +110,62 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return new KeyNamePair(get_ID(), String.valueOf(getAD_Field_ID()));
}
public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException
{
return (org.compiere.model.I_AD_Reference)MTable.get(getCtx(), org.compiere.model.I_AD_Reference.Table_Name)
.getPO(getAD_Reference_ID(), get_TrxName()); }
/** Set Reference.
@param AD_Reference_ID
System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID)
{
if (AD_Reference_ID < 1)
set_Value (COLUMNNAME_AD_Reference_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID));
}
/** Get Reference.
@return System Reference and Validation
*/
public int getAD_Reference_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Reference getAD_Reference_Value() throws RuntimeException
{
return (org.compiere.model.I_AD_Reference)MTable.get(getCtx(), org.compiere.model.I_AD_Reference.Table_Name)
.getPO(getAD_Reference_Value_ID(), get_TrxName()); }
/** Set Reference Key.
@param AD_Reference_Value_ID
Required to specify, if data type is Table or List
*/
public void setAD_Reference_Value_ID (int AD_Reference_Value_ID)
{
if (AD_Reference_Value_ID < 1)
set_Value (COLUMNNAME_AD_Reference_Value_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_Value_ID, Integer.valueOf(AD_Reference_Value_ID));
}
/** Get Reference Key.
@return Required to specify, if data type is Table or List
*/
public int getAD_Reference_Value_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_Value_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set User defined Field.
@param AD_UserDef_Field_ID User defined Field */
public void setAD_UserDef_Field_ID (int AD_UserDef_Field_ID)
@ -175,6 +225,26 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return ii.intValue();
}
/** Set Column Span.
@param ColumnSpan
Number of column for a box of field
*/
public void setColumnSpan (int ColumnSpan)
{
set_Value (COLUMNNAME_ColumnSpan, Integer.valueOf(ColumnSpan));
}
/** Get Column Span.
@return Number of column for a box of field
*/
public int getColumnSpan ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ColumnSpan);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Default Logic.
@param DefaultValue
Default value hierarchy, separated by ;
@ -263,100 +333,186 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return (String)get_Value(COLUMNNAME_Help);
}
/** IsAlwaysUpdateable AD_Reference_ID=319 */
public static final int ISALWAYSUPDATEABLE_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISALWAYSUPDATEABLE_Yes = "Y";
/** No = N */
public static final String ISALWAYSUPDATEABLE_No = "N";
/** Set Always Updatable.
@param IsAlwaysUpdateable
The column is always updateable, even if the record is not active or processed
*/
public void setIsAlwaysUpdateable (String IsAlwaysUpdateable)
{
set_Value (COLUMNNAME_IsAlwaysUpdateable, IsAlwaysUpdateable);
}
/** Get Always Updatable.
@return The column is always updateable, even if the record is not active or processed
*/
public String getIsAlwaysUpdateable ()
{
return (String)get_Value(COLUMNNAME_IsAlwaysUpdateable);
}
/** IsDisplayed AD_Reference_ID=319 */
public static final int ISDISPLAYED_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISDISPLAYED_Yes = "Y";
/** No = N */
public static final String ISDISPLAYED_No = "N";
/** Set Displayed.
@param IsDisplayed
Determines, if this field is displayed
*/
public void setIsDisplayed (boolean IsDisplayed)
public void setIsDisplayed (String IsDisplayed)
{
set_Value (COLUMNNAME_IsDisplayed, Boolean.valueOf(IsDisplayed));
set_Value (COLUMNNAME_IsDisplayed, IsDisplayed);
}
/** Get Displayed.
@return Determines, if this field is displayed
*/
public boolean isDisplayed ()
public String getIsDisplayed ()
{
Object oo = get_Value(COLUMNNAME_IsDisplayed);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
return (String)get_Value(COLUMNNAME_IsDisplayed);
}
/** IsMandatory AD_Reference_ID=319 */
public static final int ISMANDATORY_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISMANDATORY_Yes = "Y";
/** No = N */
public static final String ISMANDATORY_No = "N";
/** Set Mandatory.
@param IsMandatory
Data entry is required in this column
*/
public void setIsMandatory (String IsMandatory)
{
set_Value (COLUMNNAME_IsMandatory, IsMandatory);
}
/** Get Mandatory.
@return Data entry is required in this column
*/
public String getIsMandatory ()
{
return (String)get_Value(COLUMNNAME_IsMandatory);
}
/** IsReadOnly AD_Reference_ID=319 */
public static final int ISREADONLY_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISREADONLY_Yes = "Y";
/** No = N */
public static final String ISREADONLY_No = "N";
/** Set Read Only.
@param IsReadOnly
Field is read only
*/
public void setIsReadOnly (boolean IsReadOnly)
public void setIsReadOnly (String IsReadOnly)
{
set_Value (COLUMNNAME_IsReadOnly, Boolean.valueOf(IsReadOnly));
set_Value (COLUMNNAME_IsReadOnly, IsReadOnly);
}
/** Get Read Only.
@return Field is read only
*/
public boolean isReadOnly ()
public String getIsReadOnly ()
{
Object oo = get_Value(COLUMNNAME_IsReadOnly);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
return (String)get_Value(COLUMNNAME_IsReadOnly);
}
/** IsSameLine AD_Reference_ID=319 */
public static final int ISSAMELINE_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISSAMELINE_Yes = "Y";
/** No = N */
public static final String ISSAMELINE_No = "N";
/** Set Same Line.
@param IsSameLine
Displayed on same line as previous field
*/
public void setIsSameLine (boolean IsSameLine)
public void setIsSameLine (String IsSameLine)
{
set_Value (COLUMNNAME_IsSameLine, Boolean.valueOf(IsSameLine));
set_Value (COLUMNNAME_IsSameLine, IsSameLine);
}
/** Get Same Line.
@return Displayed on same line as previous field
*/
public boolean isSameLine ()
public String getIsSameLine ()
{
Object oo = get_Value(COLUMNNAME_IsSameLine);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
return (String)get_Value(COLUMNNAME_IsSameLine);
}
/** IsToolbarButton AD_Reference_ID=319 */
public static final int ISTOOLBARBUTTON_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISTOOLBARBUTTON_Yes = "Y";
/** No = N */
public static final String ISTOOLBARBUTTON_No = "N";
/** Set Toolbar Button.
@param IsToolbarButton
Add the column button to the toolbar
*/
public void setIsToolbarButton (String IsToolbarButton)
{
set_Value (COLUMNNAME_IsToolbarButton, IsToolbarButton);
}
/** Get Toolbar Button.
@return Add the column button to the toolbar
*/
public String getIsToolbarButton ()
{
return (String)get_Value(COLUMNNAME_IsToolbarButton);
}
/** IsUpdateable AD_Reference_ID=319 */
public static final int ISUPDATEABLE_AD_Reference_ID=319;
/** Yes = Y */
public static final String ISUPDATEABLE_Yes = "Y";
/** No = N */
public static final String ISUPDATEABLE_No = "N";
/** Set Updatable.
@param IsUpdateable
Determines, if the field can be updated
*/
public void setIsUpdateable (boolean IsUpdateable)
public void setIsUpdateable (String IsUpdateable)
{
set_Value (COLUMNNAME_IsUpdateable, Boolean.valueOf(IsUpdateable));
set_Value (COLUMNNAME_IsUpdateable, IsUpdateable);
}
/** Get Updatable.
@return Determines, if the field can be updated
*/
public boolean isUpdateable ()
public String getIsUpdateable ()
{
Object oo = get_Value(COLUMNNAME_IsUpdateable);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
return (String)get_Value(COLUMNNAME_IsUpdateable);
}
/** Set Mandatory Logic.
@param MandatoryLogic Mandatory Logic */
public void setMandatoryLogic (String MandatoryLogic)
{
set_Value (COLUMNNAME_MandatoryLogic, MandatoryLogic);
}
/** Get Mandatory Logic.
@return Mandatory Logic */
public String getMandatoryLogic ()
{
return (String)get_Value(COLUMNNAME_MandatoryLogic);
}
/** Set Name.
@ -376,6 +532,43 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return (String)get_Value(COLUMNNAME_Name);
}
/** Set Number of Lines.
@param NumLines
Number of lines for a field
*/
public void setNumLines (int NumLines)
{
set_Value (COLUMNNAME_NumLines, Integer.valueOf(NumLines));
}
/** Get Number of Lines.
@return Number of lines for a field
*/
public int getNumLines ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_NumLines);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Read Only Logic.
@param ReadOnlyLogic
Logic to determine if field is read only (applies only when field is read-write)
*/
public void setReadOnlyLogic (String ReadOnlyLogic)
{
set_Value (COLUMNNAME_ReadOnlyLogic, ReadOnlyLogic);
}
/** Get Read Only Logic.
@return Logic to determine if field is read only (applies only when field is read-write)
*/
public String getReadOnlyLogic ()
{
return (String)get_Value(COLUMNNAME_ReadOnlyLogic);
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
@ -415,4 +608,24 @@ public class X_AD_UserDef_Field extends PO implements I_AD_UserDef_Field, I_Pers
return 0;
return ii.intValue();
}
/** Set X Position.
@param XPosition
Absolute X (horizontal) position in 1/72 of an inch
*/
public void setXPosition (int XPosition)
{
set_Value (COLUMNNAME_XPosition, Integer.valueOf(XPosition));
}
/** Get X Position.
@return Absolute X (horizontal) position in 1/72 of an inch
*/
public int getXPosition ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_XPosition);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -23,34 +23,32 @@ import java.sql.Timestamp;
import java.util.Properties;
import org.compiere.util.Env;
/** Generated Model for M_Storage
/** Generated Model for M_StorageOnHand
* @author iDempiere (generated)
* @version Release 1.0a - $Id$ */
public class X_M_Storage extends PO implements I_M_Storage, I_Persistent
public class X_M_StorageOnHand extends PO implements I_M_StorageOnHand, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20121031L;
private static final long serialVersionUID = 20121119L;
/** Standard Constructor */
public X_M_Storage (Properties ctx, int M_Storage_ID, String trxName)
public X_M_StorageOnHand (Properties ctx, int M_StorageOnHand_ID, String trxName)
{
super (ctx, M_Storage_ID, trxName);
/** if (M_Storage_ID == 0)
super (ctx, M_StorageOnHand_ID, trxName);
/** if (M_StorageOnHand_ID == 0)
{
setM_AttributeSetInstance_ID (0);
setM_Locator_ID (0);
setM_Product_ID (0);
setQtyOnHand (Env.ZERO);
setQtyOrdered (Env.ZERO);
setQtyReserved (Env.ZERO);
} */
}
/** Load Constructor */
public X_M_Storage (Properties ctx, ResultSet rs, String trxName)
public X_M_StorageOnHand (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
@ -72,7 +70,7 @@ public class X_M_Storage extends PO implements I_M_Storage, I_Persistent
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_Storage[")
StringBuffer sb = new StringBuffer ("X_M_StorageOnHand[")
.append(get_ID()).append("]");
return sb.toString();
}
@ -178,18 +176,18 @@ public class X_M_Storage extends PO implements I_M_Storage, I_Persistent
return ii.intValue();
}
/** Set M_Storage_UU.
@param M_Storage_UU M_Storage_UU */
public void setM_Storage_UU (String M_Storage_UU)
/** Set M_StorageOnHand_UU.
@param M_StorageOnHand_UU M_StorageOnHand_UU */
public void setM_StorageOnHand_UU (String M_StorageOnHand_UU)
{
set_Value (COLUMNNAME_M_Storage_UU, M_Storage_UU);
set_Value (COLUMNNAME_M_StorageOnHand_UU, M_StorageOnHand_UU);
}
/** Get M_Storage_UU.
@return M_Storage_UU */
public String getM_Storage_UU ()
/** Get M_StorageOnHand_UU.
@return M_StorageOnHand_UU */
public String getM_StorageOnHand_UU ()
{
return (String)get_Value(COLUMNNAME_M_Storage_UU);
return (String)get_Value(COLUMNNAME_M_StorageOnHand_UU);
}
/** Set On Hand Quantity.
@ -211,44 +209,4 @@ public class X_M_Storage extends PO implements I_M_Storage, I_Persistent
return Env.ZERO;
return bd;
}
/** Set Ordered Quantity.
@param QtyOrdered
Ordered Quantity
*/
public void setQtyOrdered (BigDecimal QtyOrdered)
{
set_ValueNoCheck (COLUMNNAME_QtyOrdered, QtyOrdered);
}
/** Get Ordered Quantity.
@return Ordered Quantity
*/
public BigDecimal getQtyOrdered ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOrdered);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Reserved Quantity.
@param QtyReserved
Reserved Quantity
*/
public void setQtyReserved (BigDecimal QtyReserved)
{
set_ValueNoCheck (COLUMNNAME_QtyReserved, QtyReserved);
}
/** Get Reserved Quantity.
@return Reserved Quantity
*/
public BigDecimal getQtyReserved ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyReserved);
if (bd == null)
return Env.ZERO;
return bd;
}
}

View File

@ -0,0 +1,236 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Properties;
import org.compiere.util.Env;
/** Generated Model for M_StorageReservation
* @author iDempiere (generated)
* @version Release 1.0a - $Id$ */
public class X_M_StorageReservation extends PO implements I_M_StorageReservation, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20121119L;
/** Standard Constructor */
public X_M_StorageReservation (Properties ctx, int M_StorageReservation_ID, String trxName)
{
super (ctx, M_StorageReservation_ID, trxName);
/** if (M_StorageReservation_ID == 0)
{
setM_AttributeSetInstance_ID (0);
setM_Product_ID (0);
setM_Warehouse_ID (0);
setQty (Env.ZERO);
} */
}
/** Load Constructor */
public X_M_StorageReservation (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_StorageReservation[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Date last inventory count.
@param DateLastInventory
Date of Last Inventory Count
*/
public void setDateLastInventory (Timestamp DateLastInventory)
{
set_Value (COLUMNNAME_DateLastInventory, DateLastInventory);
}
/** Get Date last inventory count.
@return Date of Last Inventory Count
*/
public Timestamp getDateLastInventory ()
{
return (Timestamp)get_Value(COLUMNNAME_DateLastInventory);
}
/** Set Sales Transaction.
@param IsSOTrx
This is a Sales Transaction
*/
public void setIsSOTrx (boolean IsSOTrx)
{
set_Value (COLUMNNAME_IsSOTrx, Boolean.valueOf(IsSOTrx));
}
/** Get Sales Transaction.
@return This is a Sales Transaction
*/
public boolean isSOTrx ()
{
Object oo = get_Value(COLUMNNAME_IsSOTrx);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
{
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
/** Set Attribute Set Instance.
@param M_AttributeSetInstance_ID
Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
{
if (M_AttributeSetInstance_ID < 0)
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
}
/** Get Attribute Set Instance.
@return Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set M_StorageReservation_UU.
@param M_StorageReservation_UU M_StorageReservation_UU */
public void setM_StorageReservation_UU (String M_StorageReservation_UU)
{
set_Value (COLUMNNAME_M_StorageReservation_UU, M_StorageReservation_UU);
}
/** Get M_StorageReservation_UU.
@return M_StorageReservation_UU */
public String getM_StorageReservation_UU ()
{
return (String)get_Value(COLUMNNAME_M_StorageReservation_UU);
}
public org.compiere.model.I_M_Warehouse getM_Warehouse() throws RuntimeException
{
return (org.compiere.model.I_M_Warehouse)MTable.get(getCtx(), org.compiere.model.I_M_Warehouse.Table_Name)
.getPO(getM_Warehouse_ID(), get_TrxName()); }
/** Set Warehouse.
@param M_Warehouse_ID
Storage Warehouse and Service Point
*/
public void setM_Warehouse_ID (int M_Warehouse_ID)
{
if (M_Warehouse_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_Warehouse_ID, Integer.valueOf(M_Warehouse_ID));
}
/** Get Warehouse.
@return Storage Warehouse and Service Point
*/
public int getM_Warehouse_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Warehouse_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Quantity.
@param Qty
Quantity
*/
public void setQty (BigDecimal Qty)
{
set_ValueNoCheck (COLUMNNAME_Qty, Qty);
}
/** Get Quantity.
@return Quantity
*/
public BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
}
}

View File

@ -36,7 +36,7 @@ import org.compiere.model.MPeriod;
import org.compiere.model.MProduct;
import org.compiere.model.MProject;
import org.compiere.model.MRefList;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MUser;
import org.compiere.model.ModelValidationEngine;
import org.compiere.model.ModelValidator;
@ -883,18 +883,18 @@ public class MDDOrder extends X_DD_Order implements DocAction
if (product.isStocked())
{
// Update Storage
if (!MStorage.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
if (!MStorageOnHand.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstance_ID(), line.getM_AttributeSetInstance_ID(),
Env.ZERO, Env.ZERO , reserved_ordered , get_TrxName()))
Env.ZERO, get_TrxName()))
{
throw new AdempiereException();
}
if (!MStorage.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
if (!MStorageOnHand.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(),
line.getM_Product_ID(),
line.getM_AttributeSetInstanceTo_ID(), line.getM_AttributeSetInstance_ID(),
Env.ZERO, reserved_ordered, Env.ZERO , get_TrxName()))
Env.ZERO, get_TrxName()))
{
throw new AdempiereException();
}

View File

@ -23,9 +23,10 @@ import java.util.Properties;
import org.compiere.model.MAttributeSet;
import org.compiere.model.MCharge;
import org.compiere.model.MClient;
import org.compiere.model.MLocator;
import org.compiere.model.MProduct;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MUOM;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -577,9 +578,9 @@ public class MDDOrderLine extends X_DD_OrderLine
if (isInstance)
{
MLocator locator_from = MLocator.get(getCtx(), getM_Locator_ID());
MStorage[] storages = MStorage.getWarehouse(getCtx(),
locator_from.getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
M_AttributeSet_ID, false, null, true, get_TrxName());
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(),
locator_from.getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
null, true, false, 0, get_TrxName());
BigDecimal qty = Env.ZERO;
for (int i = 0; i < storages.length; i++)
{

View File

@ -16,7 +16,8 @@ package test.functional;
import java.math.BigDecimal;
import org.compiere.model.MLocator;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MStorageReservation;
import org.compiere.model.MWarehouse;
import org.compiere.util.Env;
@ -44,18 +45,18 @@ public class MStorageTest extends AdempiereTestCase
loc.saveEx();
//
BigDecimal targetQty = BigDecimal.valueOf(qtyOnHand).setScale(12, BigDecimal.ROUND_HALF_UP);
MStorage s1 = MStorage.getCreate(getCtx(), loc.get_ID(), product_id, 0, getTrxName());
MStorageOnHand s1 = MStorageOnHand.getCreate(getCtx(), loc.get_ID(), product_id, 0, getTrxName());
s1.setQtyOnHand(targetQty);
s1.saveEx();
//
BigDecimal qty = MStorage.getQtyAvailable(wh.get_ID(), loc.get_ID(), product_id, 0, getTrxName()).setScale(12, BigDecimal.ROUND_HALF_UP);
BigDecimal qty = MStorageReservation.getQtyAvailable(wh.get_ID(), product_id, 0, getTrxName()).setScale(12, BigDecimal.ROUND_HALF_UP);
assertEquals("Error on locator "+locatorValue, targetQty, qty);
//
return loc;
}
private void assertWarehouseQty(MWarehouse wh, BigDecimal targetQty)
{
BigDecimal qty = MStorage.getQtyAvailable(wh.get_ID(), 0, product_id, 0, getTrxName());
BigDecimal qty = MStorageReservation.getQtyAvailable(wh.get_ID(), product_id, 0, getTrxName());
qty = qty.setScale(12, BigDecimal.ROUND_HALF_UP);
targetQty = targetQty.setScale(12, BigDecimal.ROUND_HALF_UP);
assertEquals(targetQty, qty);

View File

@ -28,7 +28,7 @@ import org.adempiere.exceptions.DBException;
import org.compiere.model.MDocType;
import org.compiere.model.MLocator;
import org.compiere.model.MProduct;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -185,22 +185,18 @@ public class InventoryTest extends AdempiereTestCase
ArrayList<Object> params = new ArrayList<Object>();
String sql = "SELECT"
+" COALESCE(SUM(QtyOnHand),0)"
+",COALESCE(SUM(QtyReserved),0)"
+",COALESCE(SUM(QtyOrdered),0)"
+" FROM M_Storage"
+" FROM M_StorageOnHand"
+" WHERE M_Locator_ID=? AND M_Product_ID=?";
params.add(locator.get_ID());
params.add(product.get_ID());
if (M_ASI_ID >= 0)
{
sql += " AND "+MStorage.COLUMNNAME_M_AttributeSetInstance_ID+"=?";
sql += " AND "+MStorageOnHand.COLUMNNAME_M_AttributeSetInstance_ID+"=?";
params.add(M_ASI_ID);
}
PreparedStatement pstmt = null;
ResultSet rs = null;
BigDecimal qtyOnHand = Env.ZERO;
BigDecimal qtyOrdered = Env.ZERO;
BigDecimal qtyReserved = Env.ZERO;
try
{
pstmt = DB.prepareStatement(sql, trxName);
@ -209,8 +205,6 @@ public class InventoryTest extends AdempiereTestCase
if (rs.next())
{
qtyOnHand = rs.getBigDecimal(1);
qtyReserved = rs.getBigDecimal(2);
qtyOrdered = rs.getBigDecimal(3);
}
}
catch (SQLException e)
@ -225,18 +219,17 @@ public class InventoryTest extends AdempiereTestCase
//
//
assertEquals("QtyOnHand not match "+doc, doc.Qty, qtyOnHand);
assertEquals("QtyReserved not match "+doc, doc.QtyReserved, qtyReserved);
assertEquals("QtyOrdered not match "+doc, doc.QtyOrdered, qtyOrdered);
}
private void dumpStatus(MMDocument doc, String trxName)
{
MProduct product = InventoryUtil.getCreateProduct(doc.ProductValue, null);
MStorage[] storage = MStorage.getOfProduct(getCtx(), product.get_ID(), trxName);
MStorageOnHand[] storage = MStorageOnHand.getOfProduct(getCtx(), product.get_ID(), trxName);
System.err.println("STORAGE____________________________________________________");
System.err.println(" "+doc);
for (MStorage s : storage)
for (MStorageOnHand s : storage)
{
System.err.println(""+s);
}

View File

@ -50,7 +50,8 @@ import org.compiere.model.MAttributeValue;
import org.compiere.model.MProduct;
import org.compiere.model.MProductPrice;
import org.compiere.model.MRole;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MStorageReservation;
import org.compiere.swing.CComboBox;
import org.compiere.swing.CLabel;
import org.compiere.swing.CPanel;
@ -518,7 +519,7 @@ public class VAttributeGrid extends CPanel
formatted = "";
if (m_M_Warehouse_ID != 0)
{
BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
BigDecimal qty = MStorageReservation.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
if (qty == null)
formatted = "-";
else

View File

@ -43,7 +43,8 @@ import org.compiere.model.MAttributeValue;
import org.compiere.model.MProduct;
import org.compiere.model.MProductPrice;
import org.compiere.model.MRole;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MStorageReservation;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
@ -607,7 +608,7 @@ public class WAttributeGrid extends ADForm implements EventListener
formatted = "";
if (m_M_Warehouse_ID != 0)
{
BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
BigDecimal qty = MStorageReservation.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
if (qty == null)
formatted = "-";
else

View File

@ -64,6 +64,9 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
/** Logger. */
private static CLogger logger = CLogger.getCLogger(WListbox.class);
/** Is Total Show */
private boolean showTotals = false;
/** Model Index of Key Column. */
protected int m_keyColumnIndex = -1;
@ -623,6 +626,8 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
{
logger.log(Level.SEVERE, "", exception);
}
if (getShowTotals())
addTotals(m_layout);
// TODO implement this
//autoSize();
@ -700,6 +705,8 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
getModel().setDataAt(data, row, col);
}
}
if (getShowTotals())
addTotals(m_layout);
// TODO implement this
//autoSize();
@ -850,6 +857,23 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
return this.isMultiple();
} // isMultiSelection
/**
* Set if Totals is Show
* @param boolean Show
*/
public void setShowTotals(boolean show)
{
showTotals= show;
}
/**
* get if Totals is Show
* @param boolean Show
*/
public boolean getShowTotals()
{
return showTotals;
}
/**
* Set ColorColumn comparison criteria.
*
@ -1061,4 +1085,79 @@ public class WListbox extends Listbox implements IMiniTable, TableValueChangeLis
return m_keyColumnIndex;
}
/**
* Adding a new row with the totals
*/
public void addTotals(ColumnInfo[] layout)
{
if (getRowCount() == 0 || layout.length == 0)
return;
Object[] total = new Object[layout.length];
for (int row = 0 ; row < getRowCount(); row ++)
{
for (int col = 0; col < layout.length; col++)
{
Object data = getModel().getValueAt(row, col);
Class<?> c = layout[col].getColClass();
if (c == BigDecimal.class)
{
BigDecimal subtotal = Env.ZERO;
if(total[col]!= null)
subtotal = (BigDecimal)(total[col]);
BigDecimal amt = (BigDecimal) data;
if(subtotal == null)
subtotal = Env.ZERO;
if(amt == null )
amt = Env.ZERO;
total[col] = subtotal.add(amt);
}
else if (c == Double.class)
{
Double subtotal = new Double(0);
if(total[col] != null)
subtotal = (Double)(total[col]);
Double amt = (Double) data;
if(subtotal == null)
subtotal = new Double(0);
if(amt == null )
subtotal = new Double(0);
total[col] = subtotal + amt;
}
}
}
//adding total row
int row = getRowCount() + 1;
setRowCount(row);
for (int col = 0; col < layout.length; col++)
{
Class<?> c = layout[col].getColClass();
if (c == BigDecimal.class)
{
setValueAt(total[col] , row - 1, col);
}
else if (c == Double.class)
{
setValueAt(total[col] , row -1 , col);
}
else
{
if(col == 0 )
{
setValueAt(" Σ " , row -1 , col);
}
else
setValueAt(null , row - 1, col );
}
}
}
}

View File

@ -88,7 +88,11 @@ public class DashboardRunnable implements Runnable, Serializable
boolean isEventThread = Events.inEventListener();
if (!isEventThread)
{
ctx = (Properties)template.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
try {
ctx = (Properties)template.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
} catch (Exception e) {
ctx = null;
}
if (ctx == null)
return;
}

View File

@ -349,7 +349,7 @@ public class WLocatorEditor extends WEditor implements EventListener<Event>, Pro
sql.append(" AND (IsDefault='Y' ") // Default Locator
.append("OR EXISTS (SELECT * FROM M_Product p ") // Product Locator
.append("WHERE p.M_Locator_ID=M_Locator.M_Locator_ID AND p.M_Product_ID=?)")
.append("OR EXISTS (SELECT * FROM M_Storage s ") // Storage Locator
.append("OR EXISTS (SELECT * FROM M_StorageOnHand s ") // Storage Locator
.append("WHERE s.M_Locator_ID=M_Locator.M_Locator_ID AND s.M_Product_ID=?))");
String finalSql = MRole.getDefault(Env.getCtx(), false).addAccessSQL(

View File

@ -376,7 +376,8 @@ public class InfoProductPanel extends InfoPanel implements EventListener
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
m_sqlWarehouse += " Group By Warehouse, documentnote ";
warehouseTbl.setMultiSelection(false);
warehouseTbl.autoSize();
warehouseTbl.setShowTotals(true);
warehouseTbl.autoSize();
warehouseTbl.getModel().addTableModelListener(this);
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{

View File

@ -31,7 +31,8 @@ import org.compiere.model.MMatchInv;
import org.compiere.model.MMatchPO;
import org.compiere.model.MOrderLine;
import org.compiere.model.MRole;
import org.compiere.model.MStorage;
import org.compiere.model.MStorageOnHand;
import org.compiere.model.MStorageReservation;
import org.compiere.process.DocumentEngine;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -491,11 +492,10 @@ public class Match
success = true;
// Correct Ordered Qty for Stocked Products (see MOrder.reserveStock / MInOut.processIt)
if (sLine.getProduct() != null && sLine.getProduct().isStocked())
success = MStorage.add (Env.getCtx(), sLine.getM_Warehouse_ID(),
sLine.getM_Locator_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), oLine.getM_AttributeSetInstance_ID(),
null, null, qty.negate(), trxName);
success = MStorageReservation.add (Env.getCtx(), sLine.getM_Warehouse_ID(),
sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), oLine.getM_AttributeSetInstance_ID(),
qty.negate(), false, trxName);
}
}
else

View File

@ -51,4 +51,7 @@ public interface IMiniTable
public void repaint();
public void autoSize();
public void setShowTotals(boolean show);
}