Hi!
If "Prodtable" is created by your class be sure to fill in both fields
prodTable.QtySched ,
prodTable.RemainInventPhysical (!!!) if this =0 ,
then on "start" production, there will not be generated records in table "InventTransOriginAssemblyComponent".
JOB: create/restore records :
static void adp_3819_RestoreAssembly(Args _args)
{
InventTransOrigin InventTransOrigin_prod;
InventTransOrigin InventTransOrigin_raw;
inventTransOriginAssemblyComponent inventTransOriginAssemblyComponent_prod;
inventTransOriginAssemblyComponent inventTransOriginAssemblyComponent_raw;
inventTransOriginAssemblyComponent inventTransOriginAssemblyComponent_new;
int i,k;
int starttime;
;
Starttime = timenow();
while select InventTransOrigin_prod
where
//InventTransOrigin_prod.ItemId == '8035' &&
InventTransOrigin_prod.ReferenceCategory == InventTransType::Production
notExists join inventTransOriginAssemblyComponent_prod
where inventTransOriginAssemblyComponent_prod.ASSEMBLYINVENTTRANSORIGIN == InventTransOrigin_prod.RecId
{
k++;
while select InventTransOrigin_raw
where
InventTransOrigin_raw.ReferenceCategory == InventTransType::ProdLine &&
InventTransOrigin_raw.ReferenceId == InventTransOrigin_prod.ReferenceId
notExists join inventTransOriginAssemblyComponent_raw
where
inventTransOriginAssemblyComponent_raw.ASSEMBLYINVENTTRANSORIGIN == InventTransOrigin_prod.RecId &&
inventTransOriginAssemblyComponent_raw.ComponentInventTransOrigin == InventTransOrigin_raw.RecId
{
inventTransOriginAssemblyComponent_new = null;
inventTransOriginAssemblyComponent_new.AssemblyInventTransOrigin = InventTransOrigin_prod.RecId;
inventTransOriginAssemblyComponent_new.ComponentInventTransOrigin = InventTransOrigin_raw.RecId;
inventTransOriginAssemblyComponent_new.insert();
i++;
}//while
} //while
info(strFmt("Total procesed %1, created lines %2", k, i));
info(strfmt('Time %1', time2str(timenow()- starttime, 1 , 1 )));
//info(strfmt("%1: ttsLevel %2 ", '', appl.ttsLevel() ) );
}