Initial Commit.
This commit is contained in:
commit
335fc32732
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (scheduling)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/scheduling.iml" filepath="$PROJECT_DIR$/.idea/scheduling.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
10
.idea/scheduling.iml
generated
Normal file
10
.idea/scheduling.iml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.7 (scheduling)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
95
model.py
Normal file
95
model.py
Normal file
@ -0,0 +1,95 @@
|
||||
from __future__ import annotations
|
||||
from datetime import datetime
|
||||
from typing import List, Dict, Set
|
||||
|
||||
|
||||
class Order:
|
||||
|
||||
def __init__(self, order_id: str, description: str):
|
||||
self.order_id: str = order_id
|
||||
self.description: str = description
|
||||
self.earliest_start_time: datetime = datetime.today()
|
||||
self.latest_end_time: datetime = datetime.today()
|
||||
self.products: List[Dict[str, any]] = []
|
||||
|
||||
def set_time(self, earliest_start_time: datetime, latest_end_time: datetime):
|
||||
self.earliest_start_time = earliest_start_time
|
||||
self.latest_end_time = latest_end_time
|
||||
|
||||
def add_product(self, product, amount):
|
||||
self.products.append({
|
||||
"product": product,
|
||||
"amount": amount
|
||||
})
|
||||
|
||||
|
||||
class Product:
|
||||
|
||||
def __init__(self, product_id: str, product_name: str):
|
||||
self.product_id: str = product_id
|
||||
self.product_name: str = product_name
|
||||
|
||||
|
||||
class Workspace:
|
||||
|
||||
def __init__(self, name: str):
|
||||
self.name: str = name
|
||||
|
||||
|
||||
class Process:
|
||||
|
||||
def __init__(self,
|
||||
pcs_id: str,
|
||||
pcs_name: str,
|
||||
product: Product,
|
||||
prev_pcs: Process,
|
||||
last_pcs: Process,
|
||||
workspace: Workspace):
|
||||
|
||||
self.pcs_id: str = pcs_id
|
||||
self.pcs_name: str = pcs_name
|
||||
self.product: Product = product
|
||||
|
||||
self.production_mode: int = 0
|
||||
self.min_quantity: int = 0
|
||||
self.max_quantity: int = 0
|
||||
|
||||
self.pdt_time: int = 0
|
||||
|
||||
self.prev_pcs: Process = prev_pcs
|
||||
self.last_pcs: Process = last_pcs
|
||||
self.res_needs: List[Dict[str, any]] = []
|
||||
self.workspace: Workspace = workspace
|
||||
|
||||
def set_mode_quantity(self, production_mode: int, min_quantity: int, max_quantity: int):
|
||||
self.production_mode: int = production_mode
|
||||
self.min_quantity: int = max_quantity
|
||||
self.max_quantity: int = min_quantity
|
||||
|
||||
def set_product_time(self, pdt_time: int):
|
||||
self.pdt_time: int = pdt_time
|
||||
|
||||
def add_res_need(self, rcs_attrs, amount):
|
||||
self.res_needs.append({
|
||||
"rcs_attrs": rcs_attrs,
|
||||
"amount": amount
|
||||
})
|
||||
|
||||
|
||||
class Resource:
|
||||
|
||||
def __init__(self, rsc_id: str, rsc_name: str, rsc_type: str, workspace: Workspace):
|
||||
self.rsc_id: str = rsc_id
|
||||
self.rsc_name: str = rsc_name
|
||||
self.rsc_type: str = rsc_type
|
||||
|
||||
self.attr: str = ""
|
||||
self.basic_attrs: Set = set()
|
||||
self.workspace: Workspace = workspace
|
||||
|
||||
def set_attr(self, attr: str, basic_attrs: List[str]):
|
||||
if attr not in basic_attrs:
|
||||
raise Exception("Attr NOT IN Basic_Attrs")
|
||||
|
||||
self.attr: str = attr
|
||||
self.basic_attrs: List[str] = basic_attrs
|
33
runtime.py
Normal file
33
runtime.py
Normal file
@ -0,0 +1,33 @@
|
||||
import model
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List
|
||||
|
||||
|
||||
class RuntimeProduct:
|
||||
|
||||
def __init__(self, product, amount):
|
||||
self.ddl: datetime = datetime.today()
|
||||
self.product: model.Product = product
|
||||
self.amount: int = amount
|
||||
|
||||
def set_ddl(self, ddl: datetime):
|
||||
self.ddl = ddl
|
||||
pass
|
||||
|
||||
|
||||
class ProductLine:
|
||||
|
||||
def __init__(self, product: model.Product):
|
||||
self.product: product = product
|
||||
self.runtime_products: List[RuntimeProduct] = []
|
||||
|
||||
def add_runtime_product(self, runtime_product: RuntimeProduct):
|
||||
self.runtime_products.append(runtime_product)
|
||||
|
||||
|
||||
class RuntimeProcess:
|
||||
|
||||
def __init__(self, runtime_product: RuntimeProduct, process: model.Process):
|
||||
self.runtime_product = runtime_product
|
||||
self.process = process
|
||||
self.start_ddl = self.runtime_product.ddl - timedelta(minutes=process.pdt_time)
|
14
scheduling.py
Normal file
14
scheduling.py
Normal file
@ -0,0 +1,14 @@
|
||||
import runtime
|
||||
import model
|
||||
import csv
|
||||
from typing import List
|
||||
from datetime import datetime
|
||||
import time
|
||||
|
||||
|
||||
def read_dataset():
|
||||
order_list: List[model.Order] = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
read_dataset()
|
Loading…
Reference in New Issue
Block a user