Ax Content : Advance lookup

2017-11-29  本文已影响0人  axxxxxxxx
// in the from data source method
public Common lookupReference(FormReferenceControl _formReferenceControl)
{
    Common ret;

    //ret = super(_formReferenceControl);

    ret = ACT_TeamBuyerTable::lookupReferenceFiltered(_formReferenceControl, SalesTable.CustAccount);

    return ret;
}
// in the ACT_TeamBuyerTable Table method
public static client Common lookupReferenceFiltered(FormControl _lookupctrl, CustAccount _buyer)
{
    SysReferenceTableLookup     sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(ACT_TeamBuyerTable), _lookupctrl,true);
    Query                       query = new Query();
    QueryBuildDataSource        queryBuildDataSource;
    QueryBuildDataSource        queryBuildDataSource2;
    DictRelation                relation;
    ;

    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,TeamId));
    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,TEX_BAS_LABELID));
    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,DivisionId));
    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,DepartmentId));
    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,CategoryId));
    sysTableLookup.addLookupfield(fieldnum(ACT_TeamBuyerTable,ProductTypeId));

    queryBuildDataSource = query.addDataSource(tablenum(ACT_TeamBuyerTable));
    queryBuildDataSource.addRange(fieldnum(ACT_TeamBuyerTable,buyer)).value(SysQuery::value(_buyer));

    sysTableLookup.parmQuery(query);
    return sysTableLookup.performFormLookup();
}
// override table method . once change ,change other fi
public void modifiedField(FieldId _fieldId)
{
    NumberSeq                       numSeq;
    NumberSequenceCode              curNumberSeqCode;
    Num                             lastNumber;
    TEX_TnATemplate                 findTnATemplate;
    ACT_TeamBuyerTable              teamBuyerTable;
    ;
    super(_fieldId);

    switch (_fieldId)
    {
        case fieldNum(TEX_LabDipTable, TEX_DeveDocTypeId):
            if (this.TEX_DeveDocTypeId)
                this.initFromDeveDocTypeId();
            break;

        case fieldNum(TEX_LabDipTable, TargetDate):
            findTnATemplate = this.tnaTemplate();

            if(this.TargetDate - systemdateget() < findTnATemplate.dispLeadTime()
                    && this.TargetDate - systemdateget() >= findTnATemplate.dispUrgetLeadTime())
            {
                this.IsUrgent = NoYes::Yes;
            }
            else if(this.TargetDate - systemdateget() >= findTnATemplate.dispLeadTime())
            {
                this.IsUrgent = NoYes::No;
            }
        break;

         //ACT --- Chloe li 2017.11.29
        case fieldNum(TEX_LabDipTable, ACT_TeamBuyer):
            select firstOnly teamBuyerTable
                where teamBuyerTable.recid == this.act_teamBuyer;
            this.ACT_Division = ACT_Division::find(teamBuyerTable.DivisionId).RecId;
            this.ACT_Department = ACT_Department::find(teamBuyerTable.DepartmentId).RecId;
            this.ACT_Category = ACT_Category::find(teamBuyerTable.CategoryId).RecId;
            this.ACT_ProductType = ACT_ProductType::find(teamBuyerTable.ProductTypeId).RecId;
            this.LabelId = TEX_BAS_Label::find(teamBuyerTable.TEX_BAS_LabelId).LabelId;
            break;
        //ACT -- end by chloe li
    }
}
上一篇下一篇

猜你喜欢

热点阅读