Implement pick and reigister

Source: Internet
Author: User
A problem with ax is that many functions are bound to the form at the presentation layer. Code To directly implement a function, you need to see how the code in the form is processed and stripped out.
For example, the collection and registration functions are encapsulated in the forms inventtranspick and inventtransregister. Although they are also implemented through the inventtranswms class, inventtranswms_pick and inventtranswms_register classes, but if you want to directly implement the pick and register functions through code, you need to take a look at their processing logic and modify it.
1. Add the movement method to inventtranswms_pick and inventtranswms_register respectively. The code can be pasted from the corresponding form:
Inventtranswms_pick: Static Inventmovement Movement (Common _ record)
{
Inventmovement movement;
Inventquarantineorder;
;

If (_ Record. tableid = Tablenum (inventquarantineorder ))
{
Inventquarantineorder = _ Record;

If (Inventquarantineorder. Status = Inventquarantinestatus: created)
{
Movement=Inventmovement: Construct (inventquarantineorder, inventmovsubtype: transferreceept );
}
}

If ( ! Movement)
{
Movement=Inventmovement: Construct (_ record );
}


Return Movement;
}

Inventtranswms_resigter: Static Inventmovement Movement (Common _ record)
{
Inventmovement movement;
Inventquarantineorder;

If (_ Record. tableid = Tablenum (inventquarantineorder ))
{
Inventquarantineorder = _ Record;

If (Inventquarantineorder. Status = Inventquarantinestatus: created)
{
Movement=Inventmovement: Construct (inventquarantineorder, inventmovsubtype: none );
}
Else
{
Movement=Inventmovement: Construct (inventquarantineorder, inventmovsubtype: transferreceept );
}
}
Else
{
Movement=Inventmovement: Construct (_ record );
}

If (Movement. newmovement_transferreceept ())
{< br> movement = movement. newmovement_transferreceept ();
movement = movement. newmovement_transferissuereceive () ? movement. newmovement_transferissuereceive (): movement;
movement = movement. newmovement_transferreceept () ? movement. newmovement_transferreceipt (): movement;
}


Return Movement;
}

2. Add the pick and registe methods to the two classes:
Inventtranswms_pick: Static   Void Pick (Common _ cursor, tmpinventtranswms _ tmpinventtranswms)
{
Inventtranswms_pick= NewInventtranswms_pick (inventtranswms_pick: Movement (_ cursor), _ tmpinventtranswms );
;
Inventtranswms_pick: updateinvent (inventtranswms_pick, _ tmpinventtranswms );

}

Inventtranswms_register: Static   Void Register (Common _ cursor, tmpinventtranswms _ tmpinventtranswms)
{
Inventtranswms_register= NewInventtranswms_register (inventtranswms_register: Movement (_ cursor), _ tmpinventtranswms );
;
Inventtranswms_register: updateinvent (inventtranswms_register, _ tmpinventtranswms );

}

3. Call example:
Collect details of a line transfer ticket
Inventdim. inventlocationid =   ' GW ' ;
Tmpinventtranswms. inventqty =   1 ;
Tmpinventtranswms. inventdimid = Inventdim: findorcreate (inventdim). inventdimid;
Tmpinventtranswms. insert ();

Inventdim. inventlocationid =   ' GW ' ;
Tmpinventtranswms. inventqty =   1 ;
Tmpinventtranswms. inventdimid = Inventdim: findorcreate (inventdim). inventdimid;
Tmpinventtranswms. insert ();

Inventtranswms_pick: Pick (inventtransferline, tmpinventtranswms );

Register the details of a purchase order: Tmpinventtranswms. inventqty =   1 ;

Inventdim. inventlocationid =   ' MW ' ;
Inventdim. inventbatchid =   ' 001 ' ;

Tmpinventtranswms. inventdimid = Inventdim: findorcreate (inventdim). inventdimid;
Tmpinventtranswms. insert ();

Tmpinventtranswms. inventqty =   1 ;
Inventdim. inventlocationid =   ' MW ' ;
Inventdim. inventbatchid =   ' 002 ' ;
Tmpinventtranswms. inventdimid = Inventdim: findorcreate (inventdim). inventdimid;
Tmpinventtranswms. insert ();
// Insert end

Inventtranswms_register: Register (purchline, tmpinventtranswms );

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.