Main > Reference Manual > Modeling > Demand
Define independent demands for items.
These can be actual customer orders, or forecasted demands.
Fields
| Field | Type | Description |
| name | non-empty string |
Name of the demand. |
| description | string |
Free format description. |
| category | normalizedString |
Free format category. |
| subcategory | normalizedString |
Free format subcategory. |
| owner | demand |
Demands are organized in a hierarchical tree. |
| members | list of demand |
Demands are organized in a hierarchical tree. |
| quantity | double |
Requested quantity. |
| item | item |
Requested item. |
| due | dateTime |
Due date of the demand. |
| priority | integer |
Priority of the demand relative to the other demands. |
| operation | operation |
Operation to be used to satisfy the demand. |
| customer | customer |
Customer placing the demand. |
| detectproblems | boolean |
Set this field to false to supress problem detection on this demand. |
| maxlateness | duration |
The maximum delay that can be accepted to satisfy this demand. |
| minshipment | positive double |
The minimum quantity allowed for the shipment operationplans that satisfy this demand. |
| constraints | list of Problems |
This field returns the list of reasons why the demand was planned late or short. |
| hidden | boolean |
Marks entities that are considered hidden and are normally not shown to the end user. |
| action | A C AC (default) R |
Type of action to be executed:
|
Example XML structures
- Adding or changing demands
<plan>
<demands>
<demand name="order A">
<quantity>10</quantity>
<due>2007-01-10T00:00:00</due>
<priority>1</priority>
<item name="item 1" />
<!-- Don't allow any delay -->
<maxlateness>P0D</maxlateness>
<!-- Don't create a delivery for less than 5 units -->
<minshipment>5</minshipment>
</demand>
<demand name="order B" quantity="10"
due="2007-01-10T00:00:00" priority="1" >
<item name="item 1" />
</demand>
</demands>
</plan>
- Removing a demand
<plan>
<demands>
<demand name="order ABC" action="R"/>
</demands>
</plan>
Example Python code
- Adding or changing demands
it = frepple.item(name="item 1")
dem1 = frepple.demand(name="order A", quantity=10,
due=datetime.datetime(2007,01,10), priority=1, item=it,
# Don't allow any delay
maxlateness=0,
# Don't create a delivery for less than 5 units
minshipment=5)
dem2 = frepple.demand(name="order B", quantity=10,
due=datetime.datetime(2007,1,10), priority=1", item=it)
- Removing a demand
frepple.demand(name="order ABC", action="R")
- Iterating over all demands and their deliveries
for d in frepple.demands():
print "Demand:", d.name, d.due, d.item.name, d.quantity
for i in d.operationplans:
print " Operationplan:", i.operation.name, i.quantity, i.end
- Show the reason(s) why a demand is planned late or short:
dmd = frepple.demand(name="a demand")
for i in dmd.constraints:
print i.entity, i.name, str(i.owner), i.description,
i.start, i.end, i.weight
