AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: За рубежом > DAX in English
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.09.2011, 18:29   #1  
Dark Smile is offline
Dark Smile
Junior AX Developer
 
16 / 10 (1) +
Регистрация: 17.06.2011
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
Can you help me to find my mistake with this code or do you maybe know a better and simplier way to stop a prod route?

Thanks in advance!
Миниатюры
Нажмите на изображение для увеличения
Название: screen4forum.jpg
Просмотров: 365
Размер:	212.3 Кб
ID:	7149  
__________________
Kind Regards
Robin

Последний раз редактировалось Dark Smile; 13.09.2011 в 18:32.
Старый 13.09.2011, 22:28   #2  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Set the parameter "AcceptErrors".
За это сообщение автора поблагодарили: Dark Smile (1).
Старый 14.09.2011, 10:54   #3  
Dark Smile is offline
Dark Smile
Junior AX Developer
 
16 / 10 (1) +
Регистрация: 17.06.2011
Thank you!
Now it works !
__________________
Kind Regards
Robin
Старый 14.09.2011, 12:02   #4  
Dark Smile is offline
Dark Smile
Junior AX Developer
 
16 / 10 (1) +
Регистрация: 17.06.2011
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  
Dark Smile is offline
Dark Smile
Junior AX Developer
 
16 / 10 (1) +
Регистрация: 17.06.2011
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
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dynamicscare: Why use a Report as Finished Journal to report a production? Blog bot DAX Blogs 0 05.08.2011 20:13
dynamicsaxtraining: Production life cycle Blog bot DAX Blogs 0 16.07.2011 01:23
dynamics-ax-dev: Copying a Production Environment into a Development/Test Environment Blog bot DAX Blogs 0 02.12.2010 00:11
dynamicsaxtraining: Production – Overview Blog bot DAX Blogs 0 26.06.2010 01:09
dynamicsaxtraining: Production training (TOC) Blog bot DAX Blogs 0 26.06.2010 01:09

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 08:26.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.