13.09.2011, 18:29 | #1 |
Junior AX Developer
|
Stopping a production route with x++
Hello,
for a customer i have to start and stop production route's automatically from x++. I have all needed data from the beginning and for starting i use the class "ProdMultiStartUp" which works fine for me. For stopping i looked at the standard form (ProdParmReportFinished) and found the class "ProdMultiReportFinished". I tried to do it like with the starting and created a duplicate of this class and modified it. Now my problem is, it looses the QtyError and QtyGood values during the run. This causes a error and cancel the proccess to stop the route. The Error Message is: "Quantity reported as finished exceeds the quantity started. Total good quantity reported as finished for the production will be 15.00. Feedback for the last operation is 0 in total. Update has been canceled." I am setting these values at the call of the class and they are present. While debugging i recognized in "\Classes\JournalCheckPost\runInit" there is a call to "journalTableData = JournalTableData::newTable(JournalStatic::findJournalTableId(journalTableId,journalId,true));" and then there aren't QryError and QtyGood values anymore in "journalTableData.journalTable". My Callstack: Цитата:
[s] \Classes\JournalCheckPost\runInit 4
[s] \Classes\ProdJournalCheckPost\runInit 6 [s] \Classes\ProdJournalCheckPostRoute\runInit 7 [s] \Classes\JournalCheckPost\run 14 [s] \Classes\ProdJournalCheckPostRoute\run 4 [s] \Classes\ProdUpdReportFinished\updateRouteConsumption 17 [s] \Classes\ProdUpdReportFinished\run 46 [s] \Classes\YAV_ProdBatchStopClass\stopOpr 63 [s] \Classes\YAV_ProdBatchStopClass\run 33 [c] \Jobs\Job2 23 Thanks in advance!
__________________
Kind Regards Robin Последний раз редактировалось Dark Smile; 13.09.2011 в 18:32. |
|
13.09.2011, 22:28 | #2 |
Banned
|
Set the parameter "AcceptErrors".
|
|
|
За это сообщение автора поблагодарили: Dark Smile (1). |
14.09.2011, 10:54 | #3 |
Junior AX Developer
|
Thank you!
Now it works !
__________________
Kind Regards Robin |
|
14.09.2011, 12:02 | #4 |
Junior AX Developer
|
Sorry for my early positive statement.
i saw that it now reports the whole production with all routes in it as finished ! how can i avoid this ? (looks like he has no oprNum any more => the number of the route i want to report as finished) Kind Regards,
__________________
Kind Regards Robin |
|
14.09.2011, 16:25 | #5 |
Junior AX Developer
|
i got the solution we can close this thread.
solution: I added the following lines to Class ProdUpdReportFinished: method: updateProdReceipt X++: ProdJournalCheckPostProd prodJournalCheckPostProd; ProdJournalCreateProd prodJournalCreate; ProdJournalTable prodJournalTable; ; prodJournalCreate = ProdJournalCreateProd::newReportFinished(prodParmReportFinished); prodJournalCreate.run(); prodJournalTable = prodJournalCreate.usedProdJournalTable(); // new code --> prodJournalTable.qtyError = prodParmReportFinished.QtyError; prodJournalTable.QtyGood = prodParmReportFinished.QtyGood; prodJournalTable.OprNum = prodParmReportFinished.FromOprNum; //<-- new code if (prodJournalTable.RecId && prodJournalTable.JournalId) { prodJournalCheckPostProd = ProdJournalCheckPostProd::newPostJournal(prodJournalTable.JournalId,prodParmReportFinished.JournalShowInfo); prodJournalCheckPostProd.run(); this.sysSignBuffer(prodJournalTable,true); prodJournalTable.doUpdate(); } this.addUpdateRec(ProdTable::find(prodParmReportFinished.ProdId));
__________________
Kind Regards Robin |
|
|
|