Production Orders are cleaned up / deleted

 Production Orders are cleaned up / deleted



Song Nghia - Business Analyst

This will get the job done but needs more testing. After Production Orders are cleaned up / deleted, this will clean up the ProdParm* related tables.

static void Job39(Args _args)
{
ProdParmBOMCalc prodParmBomCalc;
ProdParmCostEstimation ProdParmCostEstimation;
ProdParmHistoricalCost ProdParmHistoricalCost;
ProdParmRelease ProdParmRelease;
ProdParmReportFinished ProdParmReportFinished;
ProdParmScheduling ProdParmScheduling;
ProdParmSplit ProdParmSplit;
ProdParmStartUp ProdParmStartUp;
ProdParmStatusDecrease ProdParmStatusDecrease;
ProdParmUpdate ProdParmUpdate;
ProdTable prodTable;

delete_from prodParmBomCalc
notexists join ProdTable
where prodTable.ProdId == prodParmBomCalc.ProdId;

delete_from ProdParmCostEstimation
notexists join ProdTable
where prodTable.ProdId == ProdParmCostEstimation.ProdId;

delete_from ProdParmHistoricalCost
notexists join ProdTable
where prodTable.ProdId == ProdParmHistoricalCost.ProdId;

delete_from ProdParmRelease
notexists join ProdTable
where prodTable.ProdId == ProdParmRelease.ProdId;

delete_from ProdParmReportFinished
notexists join ProdTable
where prodTable.ProdId == ProdParmReportFinished.ProdId;

delete_from ProdParmScheduling
notexists join ProdTable
where prodTable.ProdId == ProdParmScheduling.ProdId;

delete_from ProdParmSplit
notexists join ProdTable
where prodTable.ProdId == ProdParmSplit.ProdId;

delete_from ProdParmStartUp
notexists join ProdTable
where prodTable.ProdId == ProdParmStartUp.ProdId;

delete_from ProdParmStatusDecrease
notexists join ProdTable
where prodTable.ProdId == ProdParmStatusDecrease.ProdId;

}
Previous Post
Next Post

post written by: