1. Add a new method in hcmWorker table, and add this script :

public static client void lookupWorkerByLegalEntity
(FormStringControl _lookupctrl, Int64   _LegalEntity)
{
    SysTableLookup          sysTableLookup;               
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource, queryBuildDataSource1;
    ;
    SysTableLookup = SysTableLookup::newParameters(tableNum(HcmWorker), _lookupctrl);
    sysTableLookup.addLookupfield(fieldNum(HcmWorker, PersonnelNumber));
    sysTableLookup.addLookupfield(fieldNum(HcmWorker, Person));
    sysTableLookup.addLookupMethod(tableMethodStr(HcmWorker,workerRelationType));
    queryBuildDataSource = query.addDataSource(tableNum(HcmWorker));

    queryBuildDataSource1 = queryBuildDataSource.addDataSource(tableNum(HcmEmployment));
    queryBuildDataSource1.joinMode(JoinMode::ExistsJoin);
    queryBuildDataSource1.relations(true);
    queryBuildDataSource1.addRange(fieldNum(HcmEmployment, LegalEntity))
            .value(SysQuery::value(_LegalEntity));

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

 

2. Overide method Lookup in datasource field in form which lookup to worker with this script :

public void lookup(FormControl _formControl, str _filterStr)
{
    HcmWorker::lookupWorkerByLegalEntity(_formControl, CompanyInfo::find().RecId);
}

 

相关文章:

  • 2021-12-20
  • 2022-01-12
  • 2021-11-06
  • 2021-11-21
  • 2022-03-01
  • 2022-12-23
  • 2022-03-06
  • 2021-12-21
猜你喜欢
  • 2021-11-20
  • 2021-06-12
  • 2021-10-28
  • 2022-02-14
  • 2021-12-24
  • 2022-01-10
  • 2022-12-23
相关资源
相似解决方案