Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
37a13947
Commit
37a13947
authored
Aug 22, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define Batch and SubBatch in new way
parent
83b3c602
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
55 deletions
+31
-55
dream/simulation/Batch.py
dream/simulation/Batch.py
+4
-3
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+5
-44
dream/simulation/Part.py
dream/simulation/Part.py
+1
-4
dream/simulation/SubBatch.py
dream/simulation/SubBatch.py
+21
-4
No files found.
dream/simulation/Batch.py
View file @
37a13947
...
@@ -34,11 +34,12 @@ from SubBatch import SubBatch
...
@@ -34,11 +34,12 @@ from SubBatch import SubBatch
class
Batch
(
Entity
):
class
Batch
(
Entity
):
type
=
"Batch"
type
=
"Batch"
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
):
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
,
remainingProcessingTime
=
0
,
unitsToProcess
=
0
):
Entity
.
__init__
(
self
,
name
=
name
,
id
=
id
)
Entity
.
__init__
(
self
,
name
=
name
,
id
=
id
,
remainingProcessingTime
=
remainingProcessingTime
)
self
.
numberOfUnits
=
numberOfUnits
self
.
numberOfUnits
=
int
(
numberOfUnits
)
self
.
numberOfSubBatches
=
1
#integer that shows in how many sub batches is the batch broken
self
.
numberOfSubBatches
=
1
#integer that shows in how many sub batches is the batch broken
self
.
subBatchList
=
[]
#list that contains the sub-batches that this batch has been broken into
self
.
subBatchList
=
[]
#list that contains the sub-batches that this batch has been broken into
self
.
unitsToProcess
=
int
(
unitsToProcess
)
#===========================================================================
#===========================================================================
# finds the schedule of each child and returns the combined route
# finds the schedule of each child and returns the combined route
...
...
dream/simulation/LineGenerationJSON.py
View file @
37a13947
...
@@ -374,7 +374,8 @@ def createWIP():
...
@@ -374,7 +374,8 @@ def createWIP():
inputDict
=
dict
(
entity
)
inputDict
=
dict
(
entity
)
inputDict
.
pop
(
'_class'
)
inputDict
.
pop
(
'_class'
)
if
entityClass
in
[
'Dream.CapacityEntity'
,
'Dream.CapacityProject'
,
'Dream.Part'
]:
if
entityClass
in
[
'Dream.CapacityEntity'
,
'Dream.CapacityProject'
,
'Dream.Part'
,
'Dream.Batch'
,
'Dream.SubBatch'
]:
entity
=
entityType
(
**
inputDict
)
entity
=
entityType
(
**
inputDict
)
G
.
EntityList
.
append
(
entity
)
G
.
EntityList
.
append
(
entity
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
object
=
Globals
.
findObjectById
(
element
[
'id'
])
...
@@ -531,47 +532,7 @@ def createWIP():
...
@@ -531,47 +532,7 @@ def createWIP():
G
.
WipList
.
append
(
J
)
G
.
WipList
.
append
(
J
)
G
.
EntityList
.
append
(
J
)
G
.
EntityList
.
append
(
J
)
elif
entityClass
==
'Dream.Batch'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
numberOfUnits
=
int
(
entity
.
get
(
'numberOfUnits'
,
'4'
))
B
=
Batch
(
id
,
name
,
numberOfUnits
)
G
.
BatchList
.
append
(
B
)
G
.
WipList
.
append
(
B
)
G
.
EntityList
.
append
(
B
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
B
.
unitsToProcess
=
int
(
entity
.
get
(
'unitsToProcess'
,
numberOfUnits
))
B
.
remainingProcessingTime
=
entity
.
get
(
'remainingProcessingTime'
,
{})
B
.
currentStation
=
object
elif
entityClass
==
'Dream.SubBatch'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
numberOfUnits
=
int
(
entity
.
get
(
'numberOfUnits'
,
'4'
))
parentBatchId
=
entity
.
get
(
'parentBatchId'
,
'not found'
)
parentBatchName
=
entity
.
get
(
'parentBatchName'
,
'not found'
)
# check if the parent batch is already created. If not, then create it
batch
=
None
for
b
in
G
.
BatchList
:
if
b
.
id
==
parentBatchId
:
batch
=
b
if
batch
:
#if the parent batch was found add the number of units of current sub-batch
batch
.
numberOfUnits
+=
numberOfUnits
else
:
#if the parent batch was not found create it
batch
=
Batch
(
parentBatchId
,
parentBatchName
,
numberOfUnits
)
G
.
BatchList
.
append
(
batch
)
G
.
WipList
.
append
(
batch
)
G
.
EntityList
.
append
(
batch
)
SB
=
SubBatch
(
id
,
name
,
numberOfUnits
=
numberOfUnits
,
parentBatch
=
batch
)
G
.
SubBatchList
.
append
(
SB
)
G
.
WipList
.
append
(
SB
)
G
.
EntityList
.
append
(
SB
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
SB
.
unitsToProcess
=
int
(
entity
.
get
(
'unitsToProcess'
,
numberOfUnits
))
SB
.
remainingProcessingTime
=
entity
.
get
(
'remainingProcessingTime'
,
{})
SB
.
currentStation
=
object
if
entityClass
==
'Dream.Order'
:
if
entityClass
==
'Dream.Order'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
id
=
entity
.
get
(
'id'
,
'not found'
)
...
...
dream/simulation/Part.py
View file @
37a13947
...
@@ -35,8 +35,5 @@ class Part(Entity):
...
@@ -35,8 +35,5 @@ class Part(Entity):
type
=
"Part"
type
=
"Part"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
remainingProcessingTime
=
0
):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
remainingProcessingTime
=
0
):
Entity
.
__init__
(
self
,
id
,
name
,
remainingProcessingTime
=
remainingProcessingTime
)
Entity
.
__init__
(
self
,
id
,
name
,
remainingProcessingTime
=
remainingProcessingTime
)
from
Globals
import
G
G
.
PartList
.
append
(
self
)
dream/simulation/SubBatch.py
View file @
37a13947
...
@@ -31,10 +31,27 @@ from Entity import Entity
...
@@ -31,10 +31,27 @@ from Entity import Entity
class
SubBatch
(
Entity
):
class
SubBatch
(
Entity
):
type
=
"SubBatch"
type
=
"SubBatch"
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
,
parentBatch
=
None
):
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
,
parentBatch
=
None
,
parentBatchName
=
None
,
parentBatchId
=
None
,
Entity
.
__init__
(
self
,
name
=
name
,
id
=
id
)
remainingProcessingTime
=
0
,
unitsToProcess
=
0
):
self
.
numberOfUnits
=
numberOfUnits
Entity
.
__init__
(
self
,
name
=
name
,
id
=
id
,
remainingProcessingTime
=
remainingProcessingTime
)
self
.
numberOfUnits
=
int
(
numberOfUnits
)
self
.
parentBatch
=
parentBatch
self
.
parentBatch
=
parentBatch
self
.
batchId
=
parentBatch
.
id
self
.
unitsToProcess
=
int
(
unitsToProcess
)
# if the parent batch was not given find it or create it
if
not
self
.
parentBatch
:
# check if the parent batch is already created. If not, then create it
batch
=
None
from
Batch
import
Batch
from
Globals
import
G
for
b
in
G
.
EntityList
:
if
b
.
id
==
parentBatchId
:
batch
=
b
if
batch
:
#if the parent batch was found add the number of units of current sub-batch
batch
.
numberOfUnits
+=
self
.
numberOfUnits
else
:
#if the parent batch was not found create it
batch
=
Batch
(
parentBatchId
,
parentBatchName
,
numberOfUnits
)
G
.
EntityList
.
append
(
batch
)
self
.
parentBatch
=
batch
self
.
batchId
=
self
.
parentBatch
.
id
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment