How to use to temporary table make lookup function
public void lookup(FormControl _formControl, str _filterStr)
{
;
//super(_formControl, _filterStr);
CustRequestItemTable.InventDimId = InventDim::findOrCreate(inventDim).InventDimId;
if (CustRequestItemTable.InventDimId != inventDim.InventDimId)
{
inventDim.data(InventDim::find(CustRequestItemTable.InventDimId));
inventDim_ds.setCurrent();
}
YIP_CustRequestItemTable::lookupInventTransIdByItemDim(_formControl, CustRequestItemTable, CustRequestItemTable.joinChild());
}
--------------------------
public void modified()
{
InventTrans inventTransLocal;
InventDimParm inventDimParm;
InventDim inventDimJoin;
InventDim inventDimCriteria, inventDimCur;
;
super();
inventDimCriteria = CustRequestItemTable.joinChild();
inventDimCriteria.clearNotActiveDim(CustRequestItemTable.inventTable().DimGroupId);
inventDimParm.initFromInventDim(inventDimCriteria);
inventDimParm.InventLocationIdFlag = Noyes::No;
inventDimCriteria = InventDim::findOrCreate(inventDimCriteria);
select firstonly inventTransLocal
where inventTransLocal.InventTransId == CustRequestItemTable.InventTransId &&
inventTransLocal.StatusIssue == StatusIssue::Sold &&
inventTransLocal.TransType == InventTransType::Sales
#InventDimExistsjoin(inventTransLocal.InventDimId,inventDimJoin,inventDimCriteria, inventDimParm);
if (!inventTransLocal)
{
inventDimParm.InventBatchIdFlag = Noyes::No;
select firstonly inventTransLocal
where inventTransLocal.InventTransId == CustRequestItemTable.InventTransId &&
inventTransLocal.StatusIssue == StatusIssue::Sold &&
inventTransLocal.TransType == InventTransType::Sales
#InventDimExistsjoin(inventTransLocal.InventDimId,inventDimJoin,inventDimCriteria, inventDimParm);
}
if (!inventTransLocal)
{
inventDimParm.ConfigIdFlag = Noyes::No;
select firstonly inventTransLocal
where inventTransLocal.InventTransId == CustRequestItemTable.InventTransId &&
inventTransLocal.StatusIssue == StatusIssue::Sold &&
inventTransLocal.TransType == InventTransType::Sales
#InventDimExistsjoin(inventTransLocal.InventDimId,inventDimJoin,inventDimCriteria, inventDimParm);
}
if (inventTransLocal)
{
inventDimCur = inventTransLocal.inventDim();
if (inventDimCriteria.InventLocationId)
inventDimCur.InventLocationId = inventDimCriteria.InventLocationId;
if (inventDimCriteria.inventBatchId)
inventDimCur.inventBatchId = inventDimCriteria.inventBatchId;
if (inventDimCriteria.configId)
inventDimCur.configId = inventDimCriteria.configId;
inventDimCur = inventDim::findOrCreate(inventDimCur);
CustRequestItemTable.InventDimId = inventDimCur.inventDimId;
CustRequestItemTable.ItemId = CustRequestItemTable.ItemId ? CustRequestItemTable.ItemId : inventTransLocal.ItemId;
CustRequestItemTable.validateWrite();
}
if (CustRequestItemTable.InventDimId != inventDim.InventDimId)
{
inventDim.data(InventDim::find(CustRequestItemTable.InventDimId));
inventDim_ds.setCurrent();
}
}
-----------------------------
// VAR Changed by Xie Yu Fan.Fandy
public static void lookupInventTransIdByItemDim(
FormControl _formControl,
YIP_CustRequestItemTable _table,
InventDim _inventDim)
{
SysTableLookup lookup = SysTableLookup::newParameters(tablenum(SalesLine), _formControl);
Query q = new Query();
queryRun qr;
QueryBuildDataSource qbds, qbdsTrans, qbdsDim;
QueryBuildRange qbr;
SalesLine tmpTable, salesLine;
set set = new set(types::String);
;
qbds = q.addDataSource(tablenum(SalesLine));
qbds.addRange(fieldnum(SalesLine, ItemId)).value(_table.ItemId);
qbr = qbds.addRange(fieldnum(SalesLine, SalesStatus));
qbr.value(queryValue(SalesStatus::Invoiced));//+","+queryValue(SalesStatus::Delivered));
if (_table.CustAccount)
qbds.addRange(fieldnum(SalesLine, CustAccount)).value(_table.CustAccount);
if (_table.SalesId)
qbds.addRange(fieldnum(SalesLine, SalesId)).value(_table.SalesId);
if (_inventDim.inventBatchId || _inventDim.configId)
{
qbdsTrans = qbds.addDataSource(tablenum(InventTrans));
qbdsTrans.addLink(fieldnum(SalesLine, InventTransId), fieldnum(InventTrans, InventTransId));
qbdsDim = qbdsTrans.addDataSource(tablenum(InventDim));
//qbdsDim.addLink(fieldnum(InventTrans, InventDimId), fieldnum(InventDim, InventDimId));
qbdsDim.joinMode(JoinMode::InnerJoin);
qbdsDim.relations(true);
if (_inventDim.inventBatchId)
qbdsDim.addRange(fieldnum(InventDim, InventBatchId)).value(_inventDim.inventBatchId);
if (_inventDim.configId)
qbdsDim.addRange(fieldnum(InventDim, configId)).value(_inventDim.configId);
}
tmpTable.setTmp();
qr = new queryRun(q);
while (qr.next())
{
salesLine = qr.getNo(1);
if (!set.in(salesLine.InventTransId))
{
tmpTable.SalesId = salesLine.SalesId;
tmpTable.InventTransId = salesLine.InventTransId;
tmpTable.CustAccount = salesLine.CustAccount;
tmpTable.ItemId = salesLine.ItemId;
tmpTable.SalesQty = salesLine.SalesQty;
tmpTable.SalesPrice = salesLine.SalesPrice;
tmpTable.SalesStatus = salesLine.SalesStatus;
tmpTable.doinsert();
set.add(salesLine.InventTransId);
}
}
if (set.elements())
{
lookup.addLookupfield(fieldnum(SalesLine, InventTransId),true);
lookup.addLookupfield(fieldnum(SalesLine, CustAccount));
lookup.addLookupfield(fieldnum(SalesLine, SalesId));
lookup.addLookupfield(fieldnum(SalesLine, ItemId));
lookup.addLookupfield(fieldnum(SalesLine, SalesQty));
lookup.addLookupfield(fieldnum(SalesLine, SalesPrice));
lookup.addLookupfield(fieldnum(SalesLine, SalesStatus));
lookup.parmTmpBuffer(tmpTable);
lookup.performFormLookup();
}
else
{
lookup.addLookupfield(fieldnum(SalesLine, InventTransId),true);
lookup.addLookupfield(fieldnum(SalesLine, CustAccount));
lookup.addLookupfield(fieldnum(SalesLine, SalesId));
lookup.addLookupfield(fieldnum(SalesLine, ItemId));
lookup.addLookupfield(fieldnum(SalesLine, SalesQty));
lookup.addLookupfield(fieldnum(SalesLine, SalesPrice));
lookup.addLookupfield(fieldnum(SalesLine, SalesStatus));
lookup.parmQuery(q);
lookup.performFormLookup();
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
ssh 시 암호 입력 상자(암호 입력 알림)가 늦게 나타 나 는 해결 방법서버(centos 6.2)를 새로 설 정 했 습 니 다.windows 에서 putty 로 로그 인 할 때 사용자 이름 을 입력 한 후에 야 비밀 번 호 를 입력 하 는 것 을 알 립 니 다. 다른 Liux 서버 연결...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.