PdcAllocations.ProcessMaterial: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == ProcessMaterial(DM_ID as Integer, MaterialNo as String, Quantity as Double, LMV_ID, RS_ID as Integer, blnChangeReser, blnCreateNewReser, blnAllocat..."
 
No edit summary
Line 17: Line 17:
Using the MaterialID 2075, materialNo "ASSY3 SCHAW10" and a quantity of 3, this code example will change the reservation(RS_ID: 223), create an allocation(with LMV_ID: 111) and then write off the allocation.  
Using the MaterialID 2075, materialNo "ASSY3 SCHAW10" and a quantity of 3, this code example will change the reservation(RS_ID: 223), create an allocation(with LMV_ID: 111) and then write off the allocation.  


source lang="vb"
<source lang="vb">
if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 111, 223, True, False, True, False, True ) then
if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 111, 223, True, False, True, False, True ) then
   Label1.Caption = "success"
   Label1.Caption = "success"
Line 23: Line 23:
   Label1.Caption = "error: " + PDC.LastError
   Label1.Caption = "error: " + PDC.LastError
end if
end if
/source
</source>
This code will create a new reservation and create an allocation without a LMV_ID.  
This code will create a new reservation and create an allocation without a LMV_ID.  
source lang="vb"
<source lang="vb">
if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 0, 0, True, True, True, False, False ) then
if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 0, 0, True, True, True, False, False ) then
   Label1.Caption = "success"
   Label1.Caption = "success"
Line 31: Line 31:
   Label1.Caption = "error: " + PDC.LastError
   Label1.Caption = "error: " + PDC.LastError
end if
end if
/source
</source>
== Availability ==
== Availability ==
Available since May 2017 (from version 5.4)
Available since May 2017 (from version 5.4)

Revision as of 14:00, 25 April 2017

Declaration

ProcessMaterial(DM_ID as Integer, MaterialNo as String, Quantity as Double,

         LMV_ID, RS_ID as Integer, blnChangeReser, blnCreateNewReser, blnAllocate,
         blnUseExistingAllocations, blnWriteOff as Boolean) as Boolean

Description

Depending on what parameters are filled this function can change a reservation(or create a new reservation), create an allocation(and take existing allocation into account) and write off the allocation.

Notes

The ProcessMaterial function will return a Boolean, if it returns false then the PDC.LastError will contain a message what went wrong.

The ProcessMaterial function uses the private ChangeReservation function. This function can change a reservation according to the RS_ID, but if RS_ID isn’t filled in and blnCreateNewReser is set to False, it will remove any existing reservations and create a new one.

Keep in mind that an allocation can only be written off through scripting if the material has the correct write-off-settings. Check the notes in WriteOff for more information.

Code example

Using the MaterialID 2075, materialNo "ASSY3 SCHAW10" and a quantity of 3, this code example will change the reservation(RS_ID: 223), create an allocation(with LMV_ID: 111) and then write off the allocation.

if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 111, 223, True, False, True, False, True ) then
  Label1.Caption = "success"
else
  Label1.Caption = "error: " + PDC.LastError
end if

This code will create a new reservation and create an allocation without a LMV_ID.

if PDC.Logistics.Allocations.ProcessMaterial(2075, "ASSY3 SCHAW10", 3, 0, 0, True, True, True, False, False ) then
  Label1.Caption = "success"
else
  Label1.Caption = "error: " + PDC.LastError
end if

Availability

Available since May 2017 (from version 5.4)