In the Act solution, each user allocates the corresponding warehouse and warehouse location to avoid some unrelated warehouse storage operations.
In ax, the user's warehouse is stored in the act_locationownerauth table (location authorization). Generally, the user is controlled to use the warehouse to filter data during lookup, so that the operation cannot select irrelevant warehouse positions, to achieve warehouse permission control.
See the following section.Code, This code is used for the lookup Repository:
Private void fld2_1_lookup ()
{
Query query;
Querybuilddatasource qbds;
Act_inventlocationresults inventlocationresults;
Act_inventlocationlookup curinventlocationresults;
Export ablelookup tablelookup = export ablelookup: newparameters (tablenum (act_inventlocationlookup), dlgwmslocationid. Control ());
;
Inventlocationresults = new act_inventlocationresults ();
Curinventlocationresults = inventlocationresults. Get (); // obtain all the repositories of the current user
Tablelookup. parmtmpbuffer (curinventlocationresults );
Tablelookup. addlookupfield (fieldnum (act_inventlocationlookup, inventlocationid ));
Tablelookup. addlookupfield (fieldnum (act_inventlocationlookup, name ));
Tablelookup. Batch mformlookup ();
}
The above Code uses the act_inventlocationresults.get () method to obtain the repository of the current user. In this method, the table "act_locationownerauth" is read cyclically, the user's corresponding warehouse records are inserted into the temporary table "act_inventlocationlookup", and then the temporary table is returned.
Next, it is the position of the lookup user. The method is similar to the above. Use the selected warehouse to further lookup the corresponding position. The same is the act_locationownerauth table.
Let's look at the Code: (use of lookup's position)
Private void fld3_1_lookup ()
{
systablelookup tablelookup;
tableid;
query;
querybuilddatasource qbdsauth;
querybuildrange;
querybuildrange qbruser;
dictrelation Dr;
Object Control = DLG. formrun (). controlcallingmethod ();
;
Tablelookup = systablelookup: newparameters (tablenum (wmslocation), control );
Query = new query ();
Querybuilddatasource = query. adddatasource (tablenum (wmslocation ));
Qbdsauth = querybuilddatasource. adddatasource (tablenum (act_locationownerauth ));
Dr = new dictrelation (tablenum (act_locationownerauth ));
Dr. loadfieldrelation (fieldnum (act_locationownerauth, inventlocationid ));
Dr. loadfieldrelation (fieldnum (act_locationownerauth, wmslocationid ));
Qbdsauth. addrelation (DR );
Querybuildrange = querybuilddatasource. addrange (fieldnum (wmslocation, inventlocationid ));
Qbruser = qbdsauth. addrange (fieldnum (act_locationownerauth, userid ));
Querybuildrange. Value (queryvalue (dlglocationid. Value ()));
Querybuilddatasource. addrange (fieldnum (wmslocation, act_status). Value (sysquery: Value (act_status: inuse); // note this status
Qbruser. Value (queryvalue (curuserid ()));
Tablelookup. parmquery (query );
Tablelookup. addlookupfield (fieldnum (wmslocation, wmslocationid ));
Tablelookup. addlookupfield (fieldnum (wmslocation, inventlocationid ));
Tablelookup. addlookupfield (fieldnum (wmslocation, name ));
Tablelookup. addlookupfield (fieldnum (wmslocation, cnname ));
Tablelookup. addlookupfield (fieldnum (wmslocation, locationtype ));
Tablelookup. addlookupfield (fieldnum (wmslocation, storeareaid ));
Tablelookup. Batch mformlookup ();
}