Automatic delivery of transfer ticket

Source: Internet
Author: User

When talking about development, the first thing that comes to mind is familiarity with language syntax details and an object-oriented understanding. these are of course important for the secondary development of ax, but it is more important to be familiar with the existing thousands of tables and thousands of classes in the system. the main factor that determines the speed of secondary development is the understanding of these tables and classes, because a large number of functions in the system have been encapsulated into better classes that can be called, for example, if you want to obtain the inventory quantity, you can use inventonhand to obtain the inventory quantity of the previous day, you can use inventsumdate. You can call the update Methods of saelsformletter and purchformletter to obtain the inventory quantity of the previous day.
Some companies do not want to charge fees for purchasing and selling data, but want the system to do it by itself.CodeIt is important to generate the corresponding records and pass the bills automatically. The following code is the code for creating and shipping the transfer order.

Static   Void Newinventtransfer (ARGs _ ARGs)
{

Inventtransfertable;
Inventtransferline;
Inventtransferparmtable;
Inventtransferparmline;
Inventdim;
Inventtransfermultiship
= Inventtransfermultiship: Construct ();
Inventtransferid;
Numberseq
= Numberseq: newreservenumfromcode (inventparameters: numreftransferid (). numbersequence );
Num parmid
= Numberseq: newreservenumfromcode (numberseqreference: findreference (typeid2extendedtypeid (typeid (parmid). numbersequence). Num ();
;

Ttsbegin;
// Insert inventtransfertable
Inventtransferid = Numberseq. Num ();
Inventtransfertable. transferid
= Inventtransferid;
Inventtransfertable. initvalue ();
Inventtransfertable. inventlocationidfrom
= ' GW ' ;
Inventtransfertable. inventlocationidtransit
= ' GW-T ' ;
Inventtransfertable. inventlocationidto
= ' EW ' ;
Inventtransfertable. insert ();

// Insert inventtransferline
Inventtransferline. initfrominventtransfertable (inventtransfertable, True );
Inventtransferline. Itemid
= ' CN-01 ' ;
Inventtransferline. initfrominventtable (inventtable: Find (
' CN-01 ' ));
Inventmovement: setautoreserving (inventtransferline );
Inventmovement: buffersetremainqty (inventtransferline, inventmovsubtype: none );
// Set remain Qty
Inventmovement: buffersetremainqty (inventtransferline, inventmovsubtype: transferordertransitfrom ); // Set receive Qty
Inventtransferline. linenum = 1 ;
Inventdim. inventlocationid
= ' GW ' ;
Inventtransferline. inventdimid
= Inventdim: findorcreate (inventdim). inventdimid;
Inventtransferline. remainstatus
= Inventtransferremainstatus: shipping;
Inventtransferline. insert ();

// Insert inventtransferparmtable and inventtransferparmline
Inventtransferparmtable. parmid = Parmid;
Inventtransferparmtable. transferid
= Inventtransferid;
Inventtransferparmtable. updatetype
= Inventtransferupdatetype: shipment;
Inventtransferparmtable. shipupdateqty
= Inventtransfershipupdateqty: All;
Inventtransferparmtable. editlines
= Noyes: No;
Inventtransferparmtable. autoreceiveqty
= Noyes: No;
Inventtransferparmtable. transdate
= Systemdateget ();
Inventtransferparmtable. insert ();

// Ship
Inventtransfermultiship. runupdate (inventtransferparmtable );
Ttscommit;


}

Of course, only a job is written here. This method can be encapsulated in the inventtransferupd class just like the update method of salesformletter.

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.