mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add incoming stock for build orders
This commit is contained in:
parent
8f7164d5cd
commit
dfd6684699
@ -2035,6 +2035,7 @@ function loadPartSchedulingChart(canvas_id, part_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract purchase order information from the server
|
// Extract purchase order information from the server
|
||||||
|
if (part_info.purchaseable) {
|
||||||
inventreeGet(
|
inventreeGet(
|
||||||
`/api/order/po-line/`,
|
`/api/order/po-line/`,
|
||||||
{
|
{
|
||||||
@ -2075,6 +2076,7 @@ function loadPartSchedulingChart(canvas_id, part_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Extract sales order information from the server
|
// Extract sales order information from the server
|
||||||
if (part_info.salable) {
|
if (part_info.salable) {
|
||||||
@ -2117,6 +2119,42 @@ function loadPartSchedulingChart(canvas_id, part_id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request build orders for this part
|
||||||
|
if (part_info.assembly) {
|
||||||
|
inventreeGet(
|
||||||
|
`/api/build/`,
|
||||||
|
{
|
||||||
|
part: part_id,
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
async: false,
|
||||||
|
success: function(build_orders) {
|
||||||
|
|
||||||
|
build_orders.forEach(function(build_order) {
|
||||||
|
|
||||||
|
var target_date = build_order.target_date;
|
||||||
|
|
||||||
|
var delta = Math.max(build_order.quantity - build_order.completed, 0);
|
||||||
|
|
||||||
|
// TODO: How do we handle the case where the build order does not have a target date??
|
||||||
|
// TODO: Do we just ignore it?
|
||||||
|
|
||||||
|
if (target_date && delta > 0) {
|
||||||
|
var td = moment(target_date);
|
||||||
|
|
||||||
|
if (td >= today) {
|
||||||
|
addScheduleEntry(td, delta, "Build Order", "");
|
||||||
|
} else {
|
||||||
|
// TODO: Handle case where the build order is in the "past"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through future "events" to calculate expected quantity
|
// Iterate through future "events" to calculate expected quantity
|
||||||
|
|
||||||
var quantity = part_info.in_stock;
|
var quantity = part_info.in_stock;
|
||||||
|
Loading…
Reference in New Issue
Block a user