Obtain the positions of the user's warehouse and warehouse owner

Source: Internet
Author: User

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 ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.