remainingProcessingTime used instead of entry and exit

parent 17516175
...@@ -3,12 +3,13 @@ import json ...@@ -3,12 +3,13 @@ import json
import time import time
import random import random
import operator import operator
from datetime import datetime import datetime
import copy import copy
from dream.plugins import plugin from dream.plugins import plugin
from dream.plugins.TimeSupport import TimeSupportMixin
class ReadJSWIP(plugin.InputPreparationPlugin): class ReadJSWIP(plugin.InputPreparationPlugin, TimeSupportMixin):
""" Input preparation """ Input preparation
reads the wip from the spreadsheet and inserts it to the BOM reads the wip from the spreadsheet and inserts it to the BOM
""" """
...@@ -16,6 +17,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin): ...@@ -16,6 +17,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin):
def preprocess(self, data): def preprocess(self, data):
""" inserts the wip as introduced in the GUI to the BOM """ inserts the wip as introduced in the GUI to the BOM
""" """
strptime = datetime.datetime.strptime
# read the current date and define dateFormat from it
try:
now = strptime(data['general']['currentDate'], '%Y/%m/%d %H:%M')
data['general']['dateFormat']='%Y/%m/%d %H:%M'
except ValueError:
now = strptime(data['general']['currentDate'], '%Y/%m/%d')
data['general']['dateFormat']='%Y/%m/%d'
self.initializeTimeSupport(data)
WIPdata = data["input"].get("wip_spreadsheet",[]) WIPdata = data["input"].get("wip_spreadsheet",[])
workPlanData = data["input"].get("workplan_spreadsheet",[]) workPlanData = data["input"].get("workplan_spreadsheet",[])
try: try:
...@@ -36,37 +47,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin): ...@@ -36,37 +47,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin):
operatorID = WIPitem[4] operatorID = WIPitem[4]
sequence = WIPitem[1] sequence = WIPitem[1]
WP_id = WIPitem[2] WP_id = WIPitem[2]
start = WIPitem[5] # start = WIPitem[5]
# end = WIPitem[6] start = self.convertToSimulationTime(strptime("%s %s" % (data['general']['currentDate'], WIPitem[5]), '%Y/%m/%d %H:%M'))
remainingProcessinTime = start - now
wip[partID] = { wip[partID] = {
"task_id": WP_id, "task_id": WP_id,
"operator": operatorID, "operator": operatorID,
"station": stationID, "station": stationID,
"entry": start, "remainingProcessinTime": remainingProcessing,
"exit": end,
"sequence": sequence "sequence": sequence
} }
return data return data
'''
{ \ No newline at end of file
"name": "Part ID",
"type": "string"
}, {
"name": "Sequence",
"type": "string"
}, {
"name": "task ID",
"type": "string"
}, {
"name": "Station ID",
"type": "string"
}, {
"name": "Personnel ID",
"type": "string"
}, {
"name": "Start time",
"type": "string",
"format": "date-time"
}
'''
\ No newline at end of file
...@@ -19,7 +19,6 @@ class UpdateWIP(plugin.InputPreparationPlugin): ...@@ -19,7 +19,6 @@ class UpdateWIP(plugin.InputPreparationPlugin):
def preprocess(self, data): def preprocess(self, data):
""" updates the Work in Process according to what is provided by the BOM, i.e. if a design just exited the last step of it's sequence """ updates the Work in Process according to what is provided by the BOM, i.e. if a design just exited the last step of it's sequence
""" """
currentTime = datetime.datetime.now().time()
self.data = copy(data) self.data = copy(data)
orders = self.data["input"]["BOM"]["orders"] orders = self.data["input"]["BOM"]["orders"]
nodes = self.data["graph"]["node"] nodes = self.data["graph"]["node"]
...@@ -43,8 +42,7 @@ class UpdateWIP(plugin.InputPreparationPlugin): ...@@ -43,8 +42,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
work = wip[componentID] work = wip[componentID]
# # extract WIP information # # extract WIP information
workStation = work["station"] workStation = work["station"]
entryTime = float(work.pop("entry"),0) remainingProcessingTime = float(work.get("remainingProcessingTime",0))
exitTime = float(work.pop("exit", 0))
task_id = work["task_id"] task_id = work["task_id"]
assert len(route)>0, "the OrderComponent must have a route defined with length more than 0" assert len(route)>0, "the OrderComponent must have a route defined with length more than 0"
assert task_id, "there must be a task_id defined for the OrderComponent in the WIP" assert task_id, "there must be a task_id defined for the OrderComponent in the WIP"
...@@ -54,10 +52,7 @@ class UpdateWIP(plugin.InputPreparationPlugin): ...@@ -54,10 +52,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
last_step = step last_step = step
break break
# # check if the entity has left the station # # check if the entity has left the station
# the entity is a machine if there is no exitTime if remainingProcessingTime:
if not exitTime:
# # calculate remaining processing time
remainingProcessingTime = currentTime - entryTime
currentStation = workStation currentStation = workStation
current_step = last_step current_step = last_step
# the entity is in a buffer if the step_index is no larger than the length of the route # the entity is in a buffer if the step_index is no larger than the length of the route
...@@ -79,7 +74,7 @@ class UpdateWIP(plugin.InputPreparationPlugin): ...@@ -79,7 +74,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
wip[componentID]["station"] = currentStation wip[componentID]["station"] = currentStation
wip[componentID]["sequence"] = current_step["sequence"] wip[componentID]["sequence"] = current_step["sequence"]
wip[componentID]["task_id"] = current_step["task_id"] wip[componentID]["task_id"] = current_step["task_id"]
if not exitTime: if remainingProcessingTime:
wip[componentID]["remainingProcessingTime"] = {"Fixed": {"mean": remainingProcessingTime}} wip[componentID]["remainingProcessingTime"] = {"Fixed": {"mean": remainingProcessingTime}}
# if the entity is not recognized within the current WIP then check if it should be created # if the entity is not recognized within the current WIP then check if it should be created
# first the flag designComplete and the completedComponents list must be updated # first the flag designComplete and the completedComponents list must be updated
......
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