Commit 193da8aa authored by Romain Courteaud's avatar Romain Courteaud Committed by Jérome Perrin

Publish build version.

parent 68409d9f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
var key = this.props.jio_key, gadget = this; var key = this.props.jio_key, gadget = this;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
// XXX Conditional simulation menu // XXX Conditional simulation menu
return RSVP.all([ gadget.whoWantToDisplayThisDocumentPage("edit_table", key), gadget.whoWantToDisplayThisDocumentPage("run_simulation", key), gadget.whoWantToDisplayThisDocumentPage("manage_document", key), gadget.whoWantToDisplayThisDocumentPage("station_utilisation_graph", key), gadget.whoWantToDisplayThisDocumentPage("queue_stat_graph", key), gadget.whoWantToDisplayThisDocumentPage("exit_stat", key), gadget.whoWantToDisplayThisDocumentPage("debug_json", key) ]); return RSVP.all([ gadget.whoWantToDisplayThisDocumentPage("edit_table", key), gadget.whoWantToDisplayThisDocumentPage("run_simulation", key), gadget.whoWantToDisplayThisDocumentPage("manage_document", key), gadget.whoWantToDisplayThisDocumentPage("station_utilisation_graph", key), gadget.whoWantToDisplayThisDocumentPage("queue_stat_graph", key), gadget.whoWantToDisplayThisDocumentPage("exit_stat", key), gadget.whoWantToDisplayThisDocumentPage("job_gantt", key), gadget.whoWantToDisplayThisDocumentPage("debug_json", key) ]);
}).push(function(result_list) { }).push(function(result_list) {
return [ { return [ {
link: result_list[0], link: result_list[0],
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
title: "Exit Statistics" title: "Exit Statistics"
}, { }, {
link: result_list[6], link: result_list[6],
title: "Job Gantt"
}, {
link: result_list[7],
title: "Debug JSON" title: "Debug JSON"
} ]; } ];
}); });
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
_attachment: "body.json" _attachment: "body.json"
}), gadget.getDeclaredGadget("tableeditor") ]); }), gadget.getDeclaredGadget("tableeditor") ]);
}).push(function(result_list) { }).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).shift_spreadsheet)); return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).wip_part_spreadsheet));
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
return this.getDeclaredGadget("tableeditor").push(function(tableeditor) { return this.getDeclaredGadget("tableeditor").push(function(tableeditor) {
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
} }
}).declareMethod("render", function(options) { }).declareMethod("render", function(options) {
var gadget = this, page_gadget, element = gadget.props.element.getElementsByClassName("gadget_container")[0]; var gadget = this, page_gadget, element = gadget.props.element.getElementsByClassName("gadget_container")[0];
options.configuration_dict = gadget.props.configuration_dict;
if (options.page === undefined) { if (options.page === undefined) {
// Redirect to the about page // Redirect to the about page
return gadget.aq_pleasePublishMyState({ return gadget.aq_pleasePublishMyState({
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Job Gantt</title>
<link rel="stylesheet" href="../lib/dhtmlxgantt.css">
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/dhtmlxgantt.js" type="text/javascript"></script>
<script src="document_page_mixin.js" type="text/javascript"></script>
<script src="job_gantt.js" type="text/javascript"></script>
</head>
<body>
<div class="gant_container" style="height: 800px;"></div>
</body>
</html>
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, gantt */
/*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, gantt) {
"use strict";
gantt.templates.task_class = function(start, end, obj) {
return obj.parent ? "sub_task" : "";
};
function job_gantt_widget(all_data) {
var now = new Date(), start_date, gantt_data = {
data: [ {
id: "by_order",
text: "By Order",
start_date: start_date,
duration: 0,
project: 1,
open: true
}, {
id: "by_station",
text: "By Station",
start_date: start_date,
duration: 0,
project: 1,
open: true
} ],
link: []
}, input_data = all_data.input, output_data = all_data.result;
// temporary hack
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
start_date = input_data.general.currentDate;
if (start_date !== undefined && start_date !== "") {
start_date = new Date(start_date);
} else {
start_date = new Date(now.getTime());
}
function isVisibleStation(station) {
// we should be able to define in the backend which
// station is visible
return input_data.nodes[station]._class !== "Dream.QueueManagedJob" && input_data.nodes[station]._class !== "Dream.OperatorManagedJob" && input_data.nodes[station]._class !== "Dream.ExitJobShop";
}
$.each(output_data.elementList.sort(function(a, b) {
return a.id < b.id ? -1 : 1;
}), function(idx, obj) {
var input_job = null, input_order = null, i, j, node, node_key, order, component, duration, seen_parts = {};
if (obj._class === "Dream.Job") {
// find the corresponding input
// find the input order and order component for this job
for (node_key in input_data.nodes) {
if (input_data.nodes.hasOwnProperty(node_key)) {
node = input_data.nodes[node_key];
if (node.wip) {
for (i = 0; i < node.wip.length; i += 1) {
order = node.wip[i];
if (order.id === obj.id) {
input_job = input_order = order;
}
if (input_job === null) {
for (j = 0; j < order.componentsList.length; j += 1) {
component = order.componentsList[j];
if (component.id === obj.id) {
input_order = order;
input_job = component;
}
}
}
}
}
}
}
duration = 0;
if (input_job === input_order) {
// if we are on the order definition
gantt_data.data.push({
id: input_order.id,
text: input_order.name,
project: 1,
open: false,
parent: "by_order"
});
}
seen_parts = {};
$.each(obj.results.schedule, function(i, schedule) {
var entrance_date, task_start_date, job_full_id;
// Filter intermediate steps in part job shop
if (isVisibleStation(schedule.stationId)) {
entrance_date = new Date(start_date.getTime());
entrance_date.setTime(entrance_date.getTime() + schedule.entranceTime * 1e3 * 3600);
if (obj.results.schedule[i + 1]) {
duration = obj.results.schedule[i + 1].entranceTime - schedule.entranceTime;
} else {
duration = obj.results.completionTime - schedule.entranceTime;
}
if (duration > 0) {
task_start_date = new Date(start_date.getTime());
// for simulation time unit as days
// task_start_date.setDate(task_start_date.getDate() +
// schedule['entranceTime']);
// for simulation time unit as days hours
task_start_date.setTime(task_start_date.getTime() + schedule.entranceTime * 1e3 * 3600);
job_full_id = input_job.id + "." + input_order.id;
if (seen_parts[job_full_id] === undefined) {
gantt_data.data.push({
id: job_full_id,
text: input_job.name,
parent: input_order.id
});
seen_parts[job_full_id] = 1;
}
gantt_data.data.push({
id: input_order.id + "." + idx + "_" + i,
text: schedule.stationId,
start_date: task_start_date,
duration: duration,
parent: job_full_id
});
gantt_data.data.push({
id: "job." + obj.id + "." + idx + "_" + i,
text: input_order.name + "-" + input_job.name,
start_date: task_start_date,
duration: duration,
parent: schedule.stationId,
by_station: 1
});
}
}
});
} else {
if (isVisibleStation(obj.id)) {
gantt_data.data.push({
id: obj.id,
text: obj.id,
project: 1,
open: false,
parent: "by_station"
});
}
}
});
// gantt_output_height = 35 * (gantt_data.data.length + 1) + 1;
gantt_data.data.sort(function(a, b) {
// sort gantt data in a chronological order
var result;
if (a.start_date === undefined && b.start_date !== undefined) {
result = 1;
} else if (a.start_date !== undefined && b.start_date === undefined) {
result = -1;
} else if (a.start_date === undefined && b.start_date === undefined) {
result = 0;
} else if (a.start_date > b.start_date) {
result = 1;
} else if (a.start_date < b.start_date) {
result = -1;
} else {
result = 0;
}
return result;
});
return gantt_data;
}
var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key;
return gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "simulation.json"
}).push(function(simulation_json) {
gadget.props.result = job_gantt_widget(// XXX Hardcoded result
JSON.parse(simulation_json)[0]);
});
}).declareMethod("startService", function() {
$(this.props.element).find(".gant_container").dhx_gantt({
data: this.props.result,
readonly: true,
/* for days has simulation time unit
scale_unit: 'day',
step: 7
*/
// for hours has simulation time unit
scale_unit: "day",
duration_unit: 60 * 60 * 1e3,
//date_grid: "%H:%i",
date_scale: "%M/%d",
step: 1,
subscales: [ {
unit: "hour",
step: 4,
date: "%H:%i"
} ]
});
return new RSVP.Queue().push(function() {
// Infinite wait, until cancelled
return new RSVP.defer().promise;
}).push(undefined, function(error) {
gantt.clearAll();
throw error;
});
});
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, gantt);
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<title>Stations Utilization</title> <title>Stations Utilization</title>
<script src="../lib/rsvp.min.js" type="text/javascript"></script> <script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery.flot.js"></script> <script src="../lib/jquery.flot.js"></script>
<script src="../lib/jquery.flot.stack.js"></script> <script src="../lib/jquery.flot.stack.js"></script>
<script src="document_page_mixin.js" type="text/javascript"></script> <script src="document_page_mixin.js" type="text/javascript"></script>
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment