Commit 72116953 authored by Sebastien Robin's avatar Sebastien Robin

replace JobShop with PartJobShop, do not maintain JobShop any more

parent 82d5ffd3
......@@ -42,7 +42,6 @@
<div class="twelve columns">
<div id="main"></div>
<div id="wip_spreadsheet" style="display: none;"></div>
<div id="wip_part_spreadsheet" style="display: none;"></div>
<div id="shift_spreadsheet" style="display: none;"></div>
</div>
......
......@@ -382,133 +382,73 @@
}
var isVisibleStation = function (station) {
var result = 1;
if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet) {
// we should be able to define in the backend which station is visible
var visible_station_prefix_list = ["CAM", "CAD", "MIL", "EDM", "ASSM"];
result = visible_station_prefix_list.indexOf(station.substring(0, station.length - 1)) !== -1;
}
return result;
// we should be able to define in the backend which station is visible
return ["CAM", "CAD", "MIL", "EDM", "ASSM"].indexOf(
station.substring(0, station.length - 1)) !== -1;
};
if (obj._class === 'Dream.Job') {
// find the corresponding input
var data = that.getData(),
input_job, input_order;
if (configuration['Dream-Configuration'].gui.wip_spreadsheet) {
$.each(data.wip_spreadsheet, function(i, line){
if (line[1] == obj['id']) {
input_job = line;
}
});
} else if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet) {
var job_index = parseInt(obj["id"]);
input_job = data.wip_part_spreadsheet[job_index];
var i = job_index;
while (data.wip_part_spreadsheet[i][0] === null || data.wip_part_spreadsheet[i][0] === "") {
i = i-1;
}
input_order = data.wip_part_spreadsheet[i];
};
var job_index = parseInt(obj["id"]);
input_job = data.wip_part_spreadsheet[job_index];
var i = job_index;
while (data.wip_part_spreadsheet[i][0] === null || data.wip_part_spreadsheet[i][0] === "") {
i = i-1;
}
input_order = data.wip_part_spreadsheet[i];
var duration = 0;
if (configuration['Dream-Configuration'].gui.wip_spreadsheet) {
if (input_job == input_order) { // if we are on the order definition
gantt_data.data.push({
id: obj['id'],
text: input_job[1],
start_date: start_date,
duration: obj['results'].completionTime,
id: input_order[0],
text: input_order[0],
project: 1,
open: false,
parent: "by_job"
});
} else if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet) {
if (input_job == input_order) { // if we are on the order definition
gantt_data.data.push({
id: input_order[0],
text: input_order[0],
project: 1,
open: false,
parent: "by_job"
});
}
};
}
$.each(obj['results']['schedule'], function (i, schedule) {
// Filter intermediate steps in part job shop
if (isVisibleStation(schedule['stationId'])) {
if (configuration['Dream-Configuration'].gui.wip_spreadsheet) {
spreadsheet_data.push([
input_job[0],
obj['id'],
input_job[2], // orderDate
input_job[3], // dueDate
input_job[4], // priority
input_job[5], // material
schedule['entranceTime'],
input_job[7].split('-')[schedule['stepNumber']] || 0, // processing time
schedule['stationId'],
schedule['stepNumber']
]);
} else if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet) {
spreadsheet_data.push([
input_order[0] + "-" + input_job[4],
obj['id'],
null, // orderDate
input_order[1], // dueDate
input_order[2], // priority
null, // material
schedule['entranceTime'],
input_job[7].split('-')[schedule['stepNumber']] || 0, // processing time
schedule['stationId'],
schedule['stepNumber']
]);
}
spreadsheet_data.push([
input_order[0] + "-" + input_job[4],
obj['id'],
null, // orderDate
input_order[1], // dueDate
input_order[2], // priority
null, // material
schedule['entranceTime'],
input_job[7].split('-')[schedule['stepNumber']] || 0, // processing time
schedule['stationId'],
schedule['stepNumber']
]);
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.0) {
if (configuration['Dream-Configuration'].gui.wip_spreadsheet) {
var task_start_date = new Date(start_date.getTime());
task_start_date.setDate(task_start_date.getDate() + schedule['entranceTime']);
gantt_data.data.push({
id: obj['id'] + '.' + schedule['stepNumber'],
text: schedule['stationId'],
start_date: task_start_date,
duration: duration,
parent: obj['id']
});
console.log("going to push gantt by station", obj, schedule);
gantt_data.data.push({
id: 'job.' + obj['id'] + '.' + schedule['stepNumber'],
text: obj['id'],
start_date: task_start_date,
duration: duration,
parent: schedule['stationId'],
by_station:1
});
} else if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet) {
var task_start_date = new Date(start_date.getTime());
task_start_date.setDate(task_start_date.getDate() + schedule['entranceTime']);
console.log("going to push gantt by job", input_order[0], schedule, i);
gantt_data.data.push({
id: input_order[0] + '.' + idx + '_' + i,
text: schedule['stationId'],
start_date: task_start_date,
duration: duration,
parent: input_order[0]
});
gantt_data.data.push({
id: 'job.' + obj['id'] + '.' + idx + '_' + i,
text: input_order[0] + "-" + input_job[4],
start_date: task_start_date,
duration: duration,
parent: schedule['stationId'],
by_station:1
});
}
var task_start_date = new Date(start_date.getTime());
task_start_date.setDate(task_start_date.getDate() + schedule['entranceTime']);
console.log("going to push gantt by job", input_order[0], schedule, i);
gantt_data.data.push({
id: input_order[0] + '.' + idx + '_' + i,
text: schedule['stationId'],
start_date: task_start_date,
duration: duration,
parent: input_order[0]
});
gantt_data.data.push({
id: 'job.' + obj['id'] + '.' + idx + '_' + i,
text: input_order[0] + "-" + input_job[4],
start_date: task_start_date,
duration: duration,
parent: schedule['stationId'],
by_station:1
});
}
}
});
......
......@@ -69,12 +69,8 @@
$('#job_schedule_spreadsheet').hide();
$('#shift_spreadsheet').hide();
$("#job_gantt").hide();
$("#wip_spreadsheet").hide();
$("#wip_part_spreadsheet").hide();
if (configuration['Dream-Configuration'].gui.wip_spreadsheet){
$("#wip_spreadsheet").show();
}
if (configuration['Dream-Configuration'].gui.wip_part_spreadsheet){
$("#wip_part_spreadsheet").show();
}
......@@ -87,12 +83,6 @@
try {
// spreadsheets
var wip_spreadsheet_data = data.wip_spreadsheet;
if (wip_spreadsheet_data !== undefined) {
var spreadsheet = $('#wip_spreadsheet');
spreadsheet.handsontable('populateFromArray', 0, 0, wip_spreadsheet_data);
spreadsheet.find('.htCore').width(spreadsheet.width());
}
var shift_spreadsheet_data = data.shift_spreadsheet;
if (shift_spreadsheet_data !== undefined) {
var spreadsheet = $('#shift_spreadsheet');
......
......@@ -112,28 +112,6 @@
};
priv.initSpreadSheet = function () {
var wip_spreadsheet = $('#wip_spreadsheet');
var data = [
[
"Jobs",
"ID",
"Order Date",
"Due Date",
"Priority",
"Material",
"Sequence",
"Processing Times"
]
];
wip_spreadsheet.handsontable({
data: data,
minSpareRows: 1,
afterChange: function () {
priv.onDataChange();
}
});
wip_spreadsheet.find('.htCore').width(wip_spreadsheet.width());
var wip_part_spreadsheet = $('#wip_part_spreadsheet');
var data = [
[
......
from copy import copy
import json
import time
import random
import operator
from datetime import datetime
from dream.simulation.GUI import ACO
from dream.simulation.GUI.Default import schema
class Simulation(ACO.Simulation):
def getConfigurationDict(self):
conf = ACO.Simulation.getConfigurationDict(self)
conf["Dream-MachineJobShop"] = {
"property_list": [
schema["processingTime"],
schema["failures"]
],
"_class": 'Dream.MachineJobShop',
"name": 'Machine'
}
conf["Dream-QueueJobShop"] = {
"property_list": [
schema["capacity"],
schema["isDummy"],
schema["schedulingRule"]
],
"_class": 'Dream.QueueJobShop',
"name": 'Queue'
}
conf["Dream-ExitJobShop"] = {
"_class": 'Dream.ExitJobShop',
"name": 'Exit'
}
# XXX remove default machines etc ?
conf["Dream-Configuration"]["gui"]["wip_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_schedule_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_gantt"] = 1
# remove tools that does not make sense here
conf.pop('Dream-Machine')
conf.pop('Dream-Queue')
conf.pop('Dream-Exit')
return conf
def _preprocess(self, in_data):
""" Set the WIP in queue from spreadsheet data.
"""
data = copy(in_data)
now = datetime.now()
if data['general']['currentDate']:
now = datetime.strptime(data['general']['currentDate'], '%Y/%m/%d')
if 'wip_spreadsheet' in data:
wip_dict = {}
for value_list in data['wip_spreadsheet']:
if value_list[1] == 'ID' or not value_list[1]:
continue
dueDate = (datetime.strptime(value_list[3], '%Y/%m/%d') - now).days
sequence_list = value_list[6].split('-')
processing_time_list = value_list[7].split('-')
wip_dict.setdefault(sequence_list[0], []).append(
{
"_class": "Dream.Job",
"id": value_list[1],
"name": value_list[0],
"dueDate": dueDate,
"route": [
{
"processingTime": {
"distributionType": "Fixed",
"mean": processing_time_list[i],
},
"stationIdsList": sequence_list[i].split(','),
"stepNumber": i
} for i in xrange(len(sequence_list))]
}
)
for node_id in data['nodes'].keys():
if node_id in wip_dict:
data['nodes'][node_id]['wip'] = wip_dict[node_id]
del(data['wip_spreadsheet'])
return data
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