![]() |
#11 |
Участник
|
Query я подправил. Сейчас без InventTable работает, а вот с ней висит на подсчете количества
X++: query = new Query(querystr(myQuery)); SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(InventTransferTable)), fieldnum(InventTransferTable, ReceiveDate)).value(strfmt('%1..%2', 20\05\2017, toDay())); SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(InventTransferTable)), fieldnum(InventTransferTable, TransferStatus)).value(QueryValue(InventTransferStatus::Received)); SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(InventTransferTable)), fieldnum(InventTransferTable, InventLocationIdFrom)).value('242'); if (inventLocationType != InventLocationType::Standard) { qbrDataAreaId = SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(InventLocation), 2), fieldNum(InventLocation, DataAreaId)); qbrDataAreaId.value(strFmt('((%1.%3 = %4) || (%2.%3 = %4))', 'InventLocationTo', 'InventLocationFrom', fieldStr(InventLocation, InventLocationType), any2int(inventLocationType))); } s = query.datasourceno(1).toString(); info(s); queryRun = new QueryRun(query); iRowCountTmp = SysQuery::countLoops(queryRun); SELECT * FROM InventTransferTable WHERE ((ReceiveDate>={ts '2017-05-20 00:00:00.000'} AND ReceiveDate<={ts '2017-06-19 00:00:00.000'})) AND ((TransferStatus = 2)) JOIN * FROM InventLocation WHERE InventTransferTable.InventLocationIdTo = InventLocation.InventLocationId JOIN * FROM InventLocation WHERE InventTransferTable.InventLocationIdFrom = InventLocation.InventLocationId AND ((((InventLocationTo.InventLocationType = 3) || (InventLocationFrom.InventLocationType = 3)))) С InventTable SELECT * FROM InventTransferTable WHERE ((ReceiveDate>={ts '2017-05-20 00:00:00.000'} AND ReceiveDate<={ts '2017-06-19 00:00:00.000'})) AND ((TransferStatus = 2)) JOIN * FROM InventLocation WHERE InventTransferTable.InventLocationIdTo = InventLocation.InventLocationId AND ((((InventLocationTo.InventLocationType = 3) || (InventLocationFrom.InventLocationType = 3)))) JOIN * FROM InventLocation WHERE InventTransferTable.InventLocationIdFrom = InventLocation.InventLocationId |
|