PdcAllocations.ProcessMaterial
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
Only works with material setting Logistic processing on!
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 pdcAllocation.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 september 2017 (from version 5.4.40)