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.