Situation:
- Depending on the processing equipment we expect some percentage of the bulk to be waste e.g. 2% of 1000kg (i.e. when starting 980kg the system automatically reserves 1000kg of ingredients, 980kg are expected as good qty).
- We have defined this as errorPct on the Workcenter, which gets copied to the route when created.
- When processing we will start with ingredient to make 1000Kg but expect only 980Kg good qty the rest will be waste.
- On the shop floor up to 5% might occur i.e. we might report 950 kg ( and 50 kg waste) as finished.
- We will produce the 1000kg in two lots of 500kg and report them independently.
What DAX does:
- Create a job for 980 kg
- Start the job for 980 kg (reserves 1000kg of ingredients)
- Two reporting as finished scenarios:
- Report it as fished in two lots of 450 kg (unexpected high scrap of 50 kg per lot)
- First lot: the system suggests 980 kg good qty, no error qty; we enter 450kg / 40kg (assuming the system already accounts for 10 kg error qty)
- Second lot: the system suggest 10 kg good qty and 0 kg error qty! (Problem #1) Expected would be either 490 kg or 530 kg (in our situation 490 kg, as we will take what comes out of the process and will not add more ingredient to make good for error qty).
- Although all ingredients have been used up the system still expects 80kg more product to be finished. (Problem #2) The remain status will stay at Material consumption until the job is ended. The actual remain status should be Ended.
- Report it as fished in two lots of 495 kg (unexpected low scrap of 5 kg per lot)
- First lot: the system suggests 980kg good qty, no error qty; we enter 495kg / -5kg (assuming the system already accounts for 10 kg error qty)
- Second lot: the system suggest 0kg good qty and 15 kg error qty! (Problem #1) Expected would be either 490 kg or 485kg. We again enter 495kg / -5kg.
- Even though the system realises that no more qty is to be expected as finished (i.e. remain qty = 0) the remain status will still stay at Material consumption until the job is ended. (Problem #2)
- Report it as fished in two lots of 450 kg (unexpected high scrap of 50 kg per lot)
It is incomprehensible how anyone could use the system together with error quantities on the route. Luckily Dynamics Ax allows every customer to dive into the code an the culprits leading to Problem #1 are quickly found:
The class ProdUpdReportFinished has a method called proposalQtyGood and proposalQtyError the returns proposed good and error quantities. Check the code below.
I will post the solution of Problem #2 it a future blog.
static InventQty proposalQtyGood(ProdId _prodId)
{
ProdTable prodTable = ProdTable::find(_prodId);
InventQty routeReportedError = prodTable.routeReportedError();
InventQty routeReportedTotal = prodTable.routeReportedGood() + routeReportedError;
InventQty reportedFinishedGood = prodTable.reportedFinishedGood();
InventQty reportedFinishedError = prodTable.reportedFinishedError();
InventQty maxReportedError = (reportedFinishedError < routeReportedError) ? routeReportedError : reportedFinishedError;
InventQty plannedOrder;
;
{
ProdTable prodTable = ProdTable::find(_prodId);
InventQty routeReportedError = prodTable.routeReportedError();
InventQty routeReportedTotal = prodTable.routeReportedGood() + routeReportedError;
InventQty reportedFinishedGood = prodTable.reportedFinishedGood();
InventQty reportedFinishedError = prodTable.reportedFinishedError();
InventQty maxReportedError = (reportedFinishedError < routeReportedError) ? routeReportedError : reportedFinishedError;
InventQty plannedOrder;
;
if (prodTable.mandatoryRegister())
{
plannedOrder = InventTransSum::new2TransId().idRegistered(prodTable.InventTransId);
}
else
{
//bw start
//Changed on 15 Mar 2007 by TW
/* Description:
Calculate the planned order qty relative to the qty started not relative to the qty on the route.
*/
/* original code
plannedOrder = routeReportedTotal;
if (!plannedOrder)
{
plannedOrder= prodTable.QtyStUp;
if (!plannedOrder)
plannedOrder= prodTable.QtySched;
}
{
plannedOrder = InventTransSum::new2TransId().idRegistered(prodTable.InventTransId);
}
else
{
//bw start
//Changed on 15 Mar 2007 by TW
/* Description:
Calculate the planned order qty relative to the qty started not relative to the qty on the route.
*/
/* original code
plannedOrder = routeReportedTotal;
if (!plannedOrder)
{
plannedOrder= prodTable.QtyStUp;
if (!plannedOrder)
plannedOrder= prodTable.QtySched;
}
plannedOrder = plannedOrder – reportedFinishedGood – maxReportedError;
*/
plannedOrder = prodTable.QtyStUp – reportedFinishedGood – reportedFinishedError;
//bw end
*/
plannedOrder = prodTable.QtyStUp – reportedFinishedGood – reportedFinishedError;
//bw end
if (plannedOrder < 0)
plannedOrder = 0;
}
plannedOrder = 0;
}
return plannedOrder;
}
}
static InventQty proposalQtyError(ProdId _prodId)
{
InventQty qtyError;
{
InventQty qtyError;
ProdTable _prodTable= ProdTable::find(_prodId);
;
;
if (_prodTable.mandatoryRegister())
return 0;
else
{
qtyError = _prodTable.routeReportedError() – _prodTable.reportedFinishedError();
return 0;
else
{
qtyError = _prodTable.routeReportedError() – _prodTable.reportedFinishedError();
if (qtyError < 0)
qtyError = 0;
}
//bw start
//Changed on 15 Mar 2007 by TW
/* Description:
Never suggest an error Quantity!
The error Qty should only reflect finished product that has been compleated,
but that has failed some sort of quality check. I.e. this value is expected to be zero.
*/
qtyError = 0;
//bw end
return qtyError;
}
qtyError = 0;
}
//bw start
//Changed on 15 Mar 2007 by TW
/* Description:
Never suggest an error Quantity!
The error Qty should only reflect finished product that has been compleated,
but that has failed some sort of quality check. I.e. this value is expected to be zero.
*/
qtyError = 0;
//bw end
return qtyError;
}
