|
![]() |
#1 |
Участник
|
Цитата:
Вот вся программа посмотрите, что не так. X++: ProdJournalTable ProdJournalTable; ProdJournalRoute ProdJournalRoute; ProdJournalRoute ProdJournalRoute_1; ProdJournalRoute ProdJOurnalRoute_2; TmpProdJournalRouteOutTime tmpTable; tmpprodjournalrouteouttime tmpTable_1; tmpprodjournalrouteouttime tmpTable_2; ProdTable ProdTable; int nDay; SysOperationProgress sop; int cntItems; date fromDate = 01\09\2008; date toDate = 31\09\2008; ; delete_from tmpTable; select count (Recid)from Prodjournaltable exists join ProdJournalRoute where ProdJournalRoute.JournalId==ProdJournalTable.JournalId&& ProdJournalTable.Createddate >= fromDate && ProdJournalTable.createdDate <= toDate && (ProdJournalRoute.WrkCtrId == '113' || ProdJournalRoute.WrkCtrId == '135'); cntItems = ProdJournalTable.RecId; sop = SysOperationProgress::newGeneral('','',cntItems); // преоброзование шкалы while select createddate,journalid,posted,posteddate From ProdJournalTable exists join ProdJournalRoute where ProdJournalRoute.JournalId==ProdJournalTable.JournalId&& ProdJournalTable.Createddate >= fromDate && ProdJournalTable.createdDate <= toDate && (ProdJournalRoute.WrkCtrId == '113' || ProdJournalRoute.WrkCtrId == '135') { select ProdJournalRoute_1 order by oprnum desc where ProdJournalRoute_1.JournalId == ProdJournalTable.JournalId; select ProdTable where ProdTable.ProdId == ProdJournalRoute_1.ProdId; select ProdJournalRoute_2 where ProdJournalRoute_2.OprId like '045*' && ProdJournalRoute_2.JournalId == ProdJournalTable.JournalId; sop.incCount(); /* info ( strfmt("%1,%2,%3", ProdJournalTable.createdDate, ProdJournalTable.JournalId, toDay() - ProdJournalTable.createdDate) );*/ tmpTable.clear(); tmpTable.ITEMID =ProdTable.ItemId; tmpTable.WRKCTRID=ProdjournalRoute_1.WrkCtrId; tmpTable.Qty=ProdJournalRoute_1.QtyGood+ProdJournalRoute_1.QtyError; if(ProdJournalTable.Posted==noyes::No) { tmpTable.Days= (toDay() - ProdJournalTable.createdDate)+1; //toDay() - ProdjournalRoute_1.transDate; } else { tmpTable.Days=(ProdJournalTable.PostedDate - ProdJournalTable.createdDate)+1 ; } tmpTable.Normal=noYes::No; if ( tmpTable.WRKCTRID == '135') { nDay = 1; } if ( tmpTable.WRKCTRID == '113') { if (ProdJournalRoute_2 != NULL) { nDay=5; } else { nDay = 3; } } if (tmpTable.Days > nDay) tmpTable.Normal=NoYes::No; else tmpTable.Normal=NoYes::Yes ; tmpTable.insert(); } X++: while select sum(Qty) from tmpTable group by ItemId,Normal { select sum(Qty)from tmpTable_1 group by ItemId where tmpTable.Normal==noyes::Yes; select sum (Qty) from tmpTable_2 group by itemid where tmpTable.Normal==noYes::No; |
|