微调代码,加入部分剩余产品处理机制;
This commit is contained in:
parent
8d7ffe6904
commit
c1a8cdedcd
4
model.py
4
model.py
@ -93,9 +93,9 @@ class Process:
|
||||
def set_product_time(self, pdt_time: int):
|
||||
self.pdt_time: int = pdt_time
|
||||
|
||||
def add_res_need(self, rcs_attrs, amount):
|
||||
def add_res_need(self, rcs_attr: str, amount: int):
|
||||
self.res_needs.append({
|
||||
"rcs_attrs": rcs_attrs,
|
||||
"rcs_attr": rcs_attr,
|
||||
"amount": amount
|
||||
})
|
||||
|
||||
|
@ -4,6 +4,7 @@ import csv
|
||||
from typing import List, Dict
|
||||
from datetime import datetime
|
||||
import time
|
||||
import math
|
||||
import dataset_importer
|
||||
|
||||
|
||||
@ -59,6 +60,9 @@ def products_processor(runtime_products: List[runtime.RuntimeProduct]):
|
||||
processes_list: List[runtime.RuntimeProcess] = []
|
||||
production_times: int = 0
|
||||
for process in runtime_product.product.processes:
|
||||
# 执行工序的次数
|
||||
process_number = math.ceil(float(runtime_product.amount) / float(process.max_quantity))
|
||||
for i in range(process_number):
|
||||
runtime_process: runtime.RuntimeProcess = \
|
||||
runtime.RuntimeProcess(runtime_product, process)
|
||||
production_times += runtime_process.process.pdt_time
|
||||
@ -72,11 +76,27 @@ def products_processor(runtime_products: List[runtime.RuntimeProduct]):
|
||||
key=lambda dict_item:
|
||||
(dict_item["runtimeProduct"].ddl, dict_item["runtimeProduct"].delay))
|
||||
|
||||
# 输出检查
|
||||
for item in runtime_products_processes_list:
|
||||
for runtime_process in item["runtimeProcess"]:
|
||||
runtime_product: runtime.RuntimeProduct = item["runtimeProduct"]
|
||||
print(runtime_product.product.product_id, runtime_product.delay, runtime_process.process.pcs_id)
|
||||
|
||||
return runtime_products_processes_list
|
||||
|
||||
|
||||
# def resource_processor(resources: List[model.Resource], runtime_products_processes_list: List[Dict[str, any]]):
|
||||
# resource_pool = runtime.RuntimeResourcePool(resources)
|
||||
#
|
||||
# for item in runtime_products_processes_list:
|
||||
# ifalloc = True
|
||||
# for runtime_process in item["runtimeProcess"]:
|
||||
# runtime_process: runtime.RuntimeProcess = runtime_process
|
||||
# for resource_item in runtime_process.process.res_needs:
|
||||
# resource_item['']
|
||||
# runtime_resource_need = runtime.RuntimeResourceNeed(runtime_process.process)
|
||||
# if resource_pool.alloc_resource():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
m_orders, m_products, m_processes, m_resources = dataset_importer.import_dataset()
|
||||
|
Loading…
Reference in New Issue
Block a user