2023年4月

FormRun formrun = sender formRun :
0bject PurchAgreementHeader ds = formRun.dataSource(formDataSourcetr(PurchAgreementCreate,PurchAgreementHeader)) as FormDataSource;
PurchAgreementHeader purchAgreementHeader = PurchAgreementHeader ds. cursor():

public void GetPricediscTable()
{

IWS_PricediscTable                        discTable;
IWS_TmpPricediscTable                      TmpTable;
IWS_InterfacePriceDiscDataEntity           entity;
Query           Query = new Query();
QueryRun        qr;
QueryBuildDataSource    qbds;
;

qbds = Query.addDataSource(tableNum(IWS_PricediscTable));
qbds.addRange(fieldNum(IWS_PricediscTable,Status)).value(SysQuery::value(NoYes::Yes));
qbds.addOrderByField(fieldNum(IWS_PricediscTable,RecId));

qr = new QueryRun(Query);

//IMPORTANT:  Enable position paging for the queryrun object
qr.enablePositionPaging(true);

  //IMPORTANT: Add a range by providing the parameters as starting record number and number of records

qr.addPageRange(#maxNum*(Page-1)+1,#maxNum);
while (qr.next())
{
    discTable = qr.get(tableNum(IWS_PricediscTable));

    entity =new  IWS_InterfacePriceDiscDataEntity();

    entity.ItemRelation(discTable.ItemRelation);
    entity.AccountRelation(discTable.AccountRelation);
    entity.Price(discTable.Price);
    entity.AccountCode(enum2str(discTable.AccountCode));
    entity.Name(discTable.Name);
    entity.CreateDateTime( DateTimeUtil::toFormattedStr(DateTimeUtil::addHours(discTable.TransDateTime,8),
                                            321,
                                            DateDay::Digits2,
                                            DateSeparator::Slash,
                                            DateMonth::Digits2,
                                            DateSeparator::Slash,
                                            DateYear::Digits4,
                                            TimeSeparator::Colon,
                                            TimeSeparator::Colon));

    retData.addEnd(entity);


    ttsBegin;
    discTable.selectForUpdate(true);
    discTable.IsSyn = true;
    discTable.doUpdate();
    ttsCommit;

}

}