Step Success
This commit is contained in:
parent
1229d9e3c2
commit
382efa2139
|
@ -93,7 +93,7 @@ class FMSEnv(ap.Model):
|
||||||
self.op_os_to_dlv = self.the_firm.the_os.ev_ary_to_dlv # 当期及之前未满足需求总和
|
self.op_os_to_dlv = self.the_firm.the_os.ev_ary_to_dlv # 当期及之前未满足需求总和
|
||||||
# self.op_os_all_delay_time = self.the_firm.the_os.ev_lst_all_delay_time
|
# self.op_os_all_delay_time = self.the_firm.the_os.ev_lst_all_delay_time
|
||||||
|
|
||||||
self.op_ps_produced_num = self.the_firm.the_ps.ev_ary_produced_num # 当期产品生产数量
|
self.op_ps_produced_num = self.the_firm.the_ps.ev_ary_produce_number # 当期产品生产数量
|
||||||
self.op_ps_str_status = self.the_firm.the_os.ev_int_produce_type # 当期生产状态
|
self.op_ps_str_status = self.the_firm.the_os.ev_int_produce_type # 当期生产状态
|
||||||
|
|
||||||
# self.op_is_current_product = self.model.the_firm.the_is.ev_ary_current_product
|
# self.op_is_current_product = self.model.the_firm.the_is.ev_ary_current_product
|
||||||
|
@ -124,16 +124,18 @@ if __name__ == '__main__':
|
||||||
# 'xv_array_lead_time': 2, # 读取原材料表格 np.read, 暂时不读 变量代表的含义
|
# 'xv_array_lead_time': 2, # 读取原材料表格 np.read, 暂时不读 变量代表的含义
|
||||||
# 'xv_int_lead_time_c': 3,
|
# 'xv_int_lead_time_c': 3,
|
||||||
# 'xv_int_lead_time_d': 1,
|
# 'xv_int_lead_time_d': 1,
|
||||||
'xv_ary_product_id': pd.read_excel("initial_product.xlsx").to_numpy()[:, 0], # 产成品id顺序
|
'xv_ary_product_id': tuple(pd.read_excel("initial_product.xlsx").iloc[:, 0]), # 产成品id顺序
|
||||||
'xv_ary_material_id': pd.read_excel("initial_material.xlsx").to_numpy()[:, 0], # 原材料id顺序
|
'xv_ary_material_id': tuple(pd.read_excel("initial_material.xlsx").iloc[:, 0]), # 原材料id顺序
|
||||||
'xv_product_num': len(pd.read_excel("initial_product.xlsx").to_numpy()), # 产成品个数
|
'xv_product_num': len(pd.read_excel("initial_product.xlsx").to_numpy()), # 产成品个数
|
||||||
'xv_material_num': len(pd.read_excel("initial_material.xlsx").to_numpy()), # 原材料个数
|
'xv_material_num': len(pd.read_excel("initial_material.xlsx").to_numpy()), # 原材料个数
|
||||||
'xv_ary_initial_product_num': pd.read_excel("initial_product.xlsx").to_numpy(), # 初始产成品库存 23x2
|
'xv_ary_initial_product_num': tuple([tuple(x) for x in pd.read_excel("initial_product.xlsx").values]),
|
||||||
'xv_ary_initial_material_num': pd.read_excel("initial_material.xlsx").to_numpy(), # 初始原材料库存 115x2
|
# 初始产成品库存 23x2
|
||||||
'xv_ary_bom': pd.read_excel("bom23.xlsx").to_numpy(), # bom表
|
'xv_ary_initial_material_num': tuple([tuple(x) for x in pd.read_excel("initial_material.xlsx").values]),
|
||||||
'xv_ary_plan': pd.read_excel("plan.xlsx").to_numpy(), # plan表
|
# 初始原材料库存 115x2
|
||||||
'xv_ary_s': pd.read_excel("rawmaterial - s.xlsx").to_numpy(), # s
|
'xv_ary_bom': tuple([tuple(x) for x in pd.read_excel("bom23.xlsx").values]), # bom表
|
||||||
'xv_ary_S': pd.read_excel("rawmaterialS.xlsx").to_numpy(), # S
|
'xv_ary_plan': tuple([tuple(x) for x in pd.read_excel("plan.xlsx").values]), # plan表
|
||||||
|
'xv_ary_s': tuple([tuple(x) for x in pd.read_excel("rawmaterial - s.xlsx").values]), # s
|
||||||
|
'xv_ary_S': tuple([tuple(x) for x in pd.read_excel("rawmaterialS.xlsx").values]), # S
|
||||||
# 应读取遗传算法中随机生成的s,暂写为'1' 创建两个excel分别存储产品和原材料的库存 每个excel中存系统代码和库存
|
# 应读取遗传算法中随机生成的s,暂写为'1' 创建两个excel分别存储产品和原材料的库存 每个excel中存系统代码和库存
|
||||||
# 'xv_flt_initial_cash': 50000.0,
|
# 'xv_flt_initial_cash': 50000.0,
|
||||||
# 'dct_status_info': json.dumps({ #需要引入生产状态表
|
# 'dct_status_info': json.dumps({ #需要引入生产状态表
|
||||||
|
|
8
Firm.py
8
Firm.py
|
@ -20,7 +20,7 @@ class Firm:
|
||||||
self.xv_ary_initial_material_num = np.asarray(dct_all_para['xv_ary_initial_material_num']) # 初始原材料库存
|
self.xv_ary_initial_material_num = np.asarray(dct_all_para['xv_ary_initial_material_num']) # 初始原材料库存
|
||||||
self.xv_product_num = int(dct_all_para['xv_product_num']) # 产成品个数
|
self.xv_product_num = int(dct_all_para['xv_product_num']) # 产成品个数
|
||||||
self.xv_material_num = int(dct_all_para['xv_material_num']) # 原材料个数
|
self.xv_material_num = int(dct_all_para['xv_material_num']) # 原材料个数
|
||||||
self.xv_ary_plan = np.asarray(dct_all_para['xy_ary_plan'])
|
self.xv_ary_plan = np.asarray(dct_all_para['xv_ary_plan'])
|
||||||
self.xv_ary_bom = np.asarray(dct_all_para['xv_ary_bom'])
|
self.xv_ary_bom = np.asarray(dct_all_para['xv_ary_bom'])
|
||||||
self.xv_ary_product_id = np.asarray(dct_all_para['xv_ary_product_id'])
|
self.xv_ary_product_id = np.asarray(dct_all_para['xv_ary_product_id'])
|
||||||
self.xv_ary_material_id = np.asarray(dct_all_para['xv_ary_material_id'])
|
self.xv_ary_material_id = np.asarray(dct_all_para['xv_ary_material_id'])
|
||||||
|
@ -30,13 +30,13 @@ class Firm:
|
||||||
# self.xv_ary_lead_time = np.array([dct_all_para['xv_int_lead_time_a'], dct_all_para['xv_int_lead_time_b']])
|
# self.xv_ary_lead_time = np.array([dct_all_para['xv_int_lead_time_a'], dct_all_para['xv_int_lead_time_b']])
|
||||||
|
|
||||||
# create agents here
|
# create agents here
|
||||||
self.the_os = OrderSystem(env, xv_produt_num=self.xv_product_num, xv_ary_plan=self.xv_ary_plan,
|
self.the_os = OrderSystem(env, xv_product_num=self.xv_product_num, xv_ary_plan=self.xv_ary_plan,
|
||||||
xv_ary_product_id=self.xv_ary_product_id) # 实例Oss
|
xv_ary_product_id=self.xv_ary_product_id) # 实例Oss
|
||||||
self.the_is = InventorySystem(env, xv_ary_initial_material_num=self.xv_ary_initial_material_num,
|
self.the_is = InventorySystem(env, xv_ary_initial_material_num=self.xv_ary_initial_material_num,
|
||||||
xv_ary_initial_product_num=self.xv_ary_initial_product_num,
|
xv_ary_initial_product_num=self.xv_ary_initial_product_num,
|
||||||
xv_product_num=self.xv_product_num,
|
xv_product_num=self.xv_product_num,
|
||||||
xv_material_num=self.xv_material_num,
|
xv_material_num=self.xv_material_num,
|
||||||
xv_ary_bom=self.xv_ary_bom, xv_ary_pan=self.xv_ary_plan,
|
xv_ary_bom=self.xv_ary_bom, xv_ary_plan=self.xv_ary_plan,
|
||||||
xv_ary_material_id=self.xv_ary_material_id) # 实例Iss
|
xv_ary_material_id=self.xv_ary_material_id) # 实例Iss
|
||||||
self.the_ps = ProduceSystem(env, xv_ary_bom=self.xv_ary_bom, xv_ary_plan=self.xv_ary_plan,
|
self.the_ps = ProduceSystem(env, xv_ary_bom=self.xv_ary_bom, xv_ary_plan=self.xv_ary_plan,
|
||||||
xv_product_num=self.xv_product_num,
|
xv_product_num=self.xv_product_num,
|
||||||
|
@ -55,7 +55,7 @@ class Firm:
|
||||||
self.the_is.consume_and_store(ev_ary_produced_num=self.the_ps.ev_ary_produce_number,
|
self.the_is.consume_and_store(ev_ary_produced_num=self.the_ps.ev_ary_produce_number,
|
||||||
ev_changed_product=self.the_os.ev_changed_product,
|
ev_changed_product=self.the_os.ev_changed_product,
|
||||||
ev_lst_backtrans_material=self.the_ps.ev_lst_backtrans_material)
|
ev_lst_backtrans_material=self.the_ps.ev_lst_backtrans_material)
|
||||||
self.the_is.material_replenishment()
|
self.the_is.material_replenishment(xv_ary_s=self.xv_ary_s, xv_ary_S=self.xv_ary_S)
|
||||||
self.the_os.do_shipment(ev_ary_current_product=self.the_is.ev_ary_current_product)
|
self.the_os.do_shipment(ev_ary_current_product=self.the_is.ev_ary_current_product)
|
||||||
# self.the_is.inventory_cost()
|
# self.the_is.inventory_cost()
|
||||||
# self.the_fs.financial_calculating()
|
# self.the_fs.financial_calculating()
|
||||||
|
|
|
@ -23,7 +23,6 @@ class InventorySystem(ap.Agent):
|
||||||
ev_lst_trans_quan_material: list # Iss传递给Pss的原材料数量
|
ev_lst_trans_quan_material: list # Iss传递给Pss的原材料数量
|
||||||
ev_lst_backtrans_quan_material: list # Pss退回的原材料数量
|
ev_lst_backtrans_quan_material: list # Pss退回的原材料数量
|
||||||
|
|
||||||
|
|
||||||
# Material list
|
# Material list
|
||||||
xv_ary_material: np.ndarray
|
xv_ary_material: np.ndarray
|
||||||
xv_ary_bom: np.ndarray
|
xv_ary_bom: np.ndarray
|
||||||
|
@ -63,8 +62,8 @@ class InventorySystem(ap.Agent):
|
||||||
self.xv_ary_bom = xv_ary_bom # bom表
|
self.xv_ary_bom = xv_ary_bom # bom表
|
||||||
self.xv_ary_plan = xv_ary_plan # plan表
|
self.xv_ary_plan = xv_ary_plan # plan表
|
||||||
|
|
||||||
self.ev_lst_trans_quan_material = [] # Iss传递给Pss的原材料数量
|
self.ev_lst_trans_quan_material = [0 for i in range(xv_material_num)] # Iss传递给Pss的原材料数量
|
||||||
self.ev_lst_backtrans_quan_material = [] # Pss退回的原材料数量
|
self.ev_lst_backtrans_quan_material = [0 for i in range(xv_material_num)] # Pss退回的原材料数量
|
||||||
|
|
||||||
self.ev_ary_order_time = np.zeros((xv_material_num,)) # 原材料订货时间戳
|
self.ev_ary_order_time = np.zeros((xv_material_num,)) # 原材料订货时间戳
|
||||||
self.ev_ary_arrive_time = np.zeros((xv_material_num,)) # 原材料到货时间戳
|
self.ev_ary_arrive_time = np.zeros((xv_material_num,)) # 原材料到货时间戳
|
||||||
|
@ -82,21 +81,25 @@ class InventorySystem(ap.Agent):
|
||||||
for product_plan in produce_plan:
|
for product_plan in produce_plan:
|
||||||
for bom in self.xv_ary_bom:
|
for bom in self.xv_ary_bom:
|
||||||
if product_plan[1] == bom[0]:
|
if product_plan[1] == bom[0]:
|
||||||
self.ev_ary_material_state_to_use[np.where(self.xv_ary_material == bom[1])] += product_plan[3] * \
|
self.ev_ary_material_state_to_use[np.where(self.xv_ary_material == bom[1])] += float(
|
||||||
bom[
|
product_plan[3]) * \
|
||||||
2] # 某原材料的生产数量加等产品生产量乘单位原材料消耗量
|
float(bom[
|
||||||
|
2]) # 某原材料的生产数量加等产品生产量乘单位原材料消耗量
|
||||||
|
|
||||||
def material_check(self): # 检查库存是否充足
|
def material_check(self): # 检查库存是否充足
|
||||||
# 根据Iss决策,核对库存是否充足,并将拥有的原材料交给Pss
|
# 根据Iss决策,核对库存是否充足,并将拥有的原材料交给Pss
|
||||||
# 可能需要一部生成原材料列表在调用
|
# 可能需要一部生成原材料列表在调用
|
||||||
# Check whether materials are enough and transfer material
|
# Check whether materials are enough and transfer material
|
||||||
|
# print(len(self.ev_ary_current_material), self.xv_material_num)
|
||||||
|
# print(self.ev_ary_current_material[0, 1])
|
||||||
for i in range(self.xv_material_num):
|
for i in range(self.xv_material_num):
|
||||||
self.ev_lst_trans_quan_material[i] = min(self.ev_ary_current_material[i, 1],
|
self.ev_lst_trans_quan_material[i] = float(min(float(self.ev_ary_current_material[i, 1]),
|
||||||
self.ev_ary_material_state_to_use[i]) # 需要数量和库存两者间的较小值
|
self.ev_ary_material_state_to_use[i])) # 需要数量和库存两者间的较小值
|
||||||
# if self.ev_ary_current_material[i, 1] >= ev_ary_material_state_to_use[i]: # 库存足够按照计划生产
|
# if self.ev_ary_current_material[i, 1] >= ev_ary_material_state_to_use[i]: # 库存足够按照计划生产
|
||||||
# self.ev_lst_trans_quan_material[i] = ev_ary_material_state_to_use[i]
|
# self.ev_lst_trans_quan_material[i] = ev_ary_material_state_to_use[i]
|
||||||
# else:
|
# else:
|
||||||
# self.ev_lst_trans_quan_material[i] = self.ev_ary_current_material[i]
|
# self.ev_lst_trans_quan_material[i] = self.ev_ary_current_material[i]
|
||||||
|
# print(type(self.ev_lst_trans_quan_material[i]))
|
||||||
|
|
||||||
def consume_and_store(self, ev_ary_produced_num, ev_changed_product,
|
def consume_and_store(self, ev_ary_produced_num, ev_changed_product,
|
||||||
ev_lst_backtrans_material):
|
ev_lst_backtrans_material):
|
||||||
|
@ -107,12 +110,12 @@ class InventorySystem(ap.Agent):
|
||||||
self.ev_lst_backtrans_quan_material[i]
|
self.ev_lst_backtrans_quan_material[i]
|
||||||
|
|
||||||
if self.ev_ary_arrive_time[i] == self.model.t: # 判断材料是否到达
|
if self.ev_ary_arrive_time[i] == self.model.t: # 判断材料是否到达
|
||||||
self.ev_ary_current_material[i, 1] = self.ev_ary_current_material[i, 1] - self.ev_ary_material_to_use[i] \
|
self.ev_ary_current_material[i, 1] = float(self.ev_ary_current_material[i, 1]) - self.ev_ary_material_to_use[i] \
|
||||||
+ self.ev_ary_num_material_to_order[i] # 减消耗量 加订购量
|
+ self.ev_ary_num_material_to_order[i] # 减消耗量 加订购量
|
||||||
self.ev_ary_num_material_to_order[i] = 0
|
self.ev_ary_num_material_to_order[i] = 0
|
||||||
self.ev_ary_is_order_material[i] = False
|
self.ev_ary_is_order_material[i] = False
|
||||||
|
|
||||||
self.ev_ary_current_product[:, 1] = ev_changed_product + ev_ary_produced_num[:, 1] # 上期期末加本期生产
|
self.ev_ary_current_product[:, 1] = ev_changed_product + np.array([float(x) for x in ev_ary_produced_num[:, 1]]) # 上期期末加本期生产
|
||||||
|
|
||||||
# return self.ev_ary_current_material, self.ev_ary_current_product
|
# return self.ev_ary_current_material, self.ev_ary_current_product
|
||||||
|
|
||||||
|
@ -123,9 +126,9 @@ class InventorySystem(ap.Agent):
|
||||||
for i in range(self.xv_material_num):
|
for i in range(self.xv_material_num):
|
||||||
if self.ev_ary_current_material[i, 1] <= xv_ary_s[i, 1] and self.ev_ary_is_order_material[i] == False:
|
if self.ev_ary_current_material[i, 1] <= xv_ary_s[i, 1] and self.ev_ary_is_order_material[i] == False:
|
||||||
self.ev_ary_is_order_material[i] = True
|
self.ev_ary_is_order_material[i] = True
|
||||||
self.ev_ary_num_material_to_order[i] = xv_ary_S[i, 1] - self.ev_ary_current_material[i, 1]
|
self.ev_ary_num_material_to_order[i] = float(xv_ary_S[i, 1]) - float(self.ev_ary_current_material[i, 1])
|
||||||
self.ev_ary_order_time[i] = self.model.t
|
self.ev_ary_order_time[i] = self.model.t
|
||||||
self.ev_ary_arrive_time[i] = self.ev_int_order_time[i] + self.xv_ary_lead_time[
|
self.ev_ary_arrive_time[i] = self.ev_ary_order_time[i] + float(self.xv_ary_lead_time[
|
||||||
self.xv_ary_lead_time[:, 0] == self.ev_ary_current_material[i, 0]][0, 1]
|
self.xv_ary_lead_time[:, 0] == self.ev_ary_current_material[i, 0]][0, 1])
|
||||||
else:
|
else:
|
||||||
self.ev_ary_num_material_to_order[i] = 0
|
self.ev_ary_num_material_to_order[i] = 0
|
||||||
|
|
4
Order.py
4
Order.py
|
@ -21,8 +21,8 @@ class Order(ap.Agent):
|
||||||
def setup(self, time_created):
|
def setup(self, time_created):
|
||||||
self.xv_time_created = time_created # 订单创建时间
|
self.xv_time_created = time_created # 订单创建时间
|
||||||
# read the demand of 23 productions
|
# read the demand of 23 productions
|
||||||
self.xv_ary_dlv_product = pd.read_excel("demand23.xlsx").to_numpy() # 接神经网络结果
|
self.xv_ary_dlv_product = np.asarray(pd.read_excel("demand23.xlsx").to_records(index=False)) # 接神经网络结果
|
||||||
self.ev_ary_dlv_product = pd.read_excel("demand23.xlsx").to_numpy()[:, 1] # 23x1 把产品的顺序按照xv_ary_product_id重新排列!!!
|
self.ev_ary_dlv_product = np.asarray(tuple(pd.read_excel("demand23.xlsx").iloc[:, 1])) # 23x1 把产品的顺序按照xv_ary_product_id重新排列!!!
|
||||||
self.xv_time_circle = np.random.randint(7, 11, 1)
|
self.xv_time_circle = np.random.randint(7, 11, 1)
|
||||||
self.xv_dlv_t = self.xv_time_created + self.xv_time_circle # 随机生成期望交付时间
|
self.xv_dlv_t = self.xv_time_created + self.xv_time_circle # 随机生成期望交付时间
|
||||||
self.ev_actual_dlv_t = self.xv_dlv_t
|
self.ev_actual_dlv_t = self.xv_dlv_t
|
||||||
|
|
|
@ -47,7 +47,7 @@ class OrderSystem(ap.Agent):
|
||||||
self.ev_ary_to_dlv = np.zeros((self.xv_product_num,)) # 产品需求总和
|
self.ev_ary_to_dlv = np.zeros((self.xv_product_num,)) # 产品需求总和
|
||||||
for order in self.a_lst_order:
|
for order in self.a_lst_order:
|
||||||
self.ev_ary_to_dlv += order.ev_ary_dlv_product # 当前天之前所有的还未满足的需求求和
|
self.ev_ary_to_dlv += order.ev_ary_dlv_product # 当前天之前所有的还未满足的需求求和
|
||||||
self.ev_ary_product_to_produce = self.ev_ary_to_dlv - self.model.the_firm.the_is.ev_ary_current_product[:, 1]
|
self.ev_ary_product_to_produce = self.ev_ary_to_dlv - np.array([float(x) for x in self.model.the_firm.the_is.ev_ary_current_product[:, 1]])
|
||||||
# self.ev_ary_product_to_produce = self.model.the_firm.the_is.ev_ary_current_product - self.ev_ary_to_dlv
|
# self.ev_ary_product_to_produce = self.model.the_firm.the_is.ev_ary_current_product - self.ev_ary_to_dlv
|
||||||
# self.ev_ary_product_to_produce > 0:
|
# self.ev_ary_product_to_produce > 0:
|
||||||
# 选出这些产品,按照数值大小进行分类,数值最大的产品对应的能带来最大生产率的状态,则选定为ev_int_produce_type
|
# 选出这些产品,按照数值大小进行分类,数值最大的产品对应的能带来最大生产率的状态,则选定为ev_int_produce_type
|
||||||
|
@ -75,7 +75,7 @@ class OrderSystem(ap.Agent):
|
||||||
# 需要更新 order.ev_ary_dlv_product
|
# 需要更新 order.ev_ary_dlv_product
|
||||||
# Make shipments based on ranked order list
|
# Make shipments based on ranked order list
|
||||||
self.ev_ave_delay_time = 0
|
self.ev_ave_delay_time = 0
|
||||||
self.ev_changed_product = ev_ary_current_product[:, 1] # 23x1 ndarray 存储本次库存的改变
|
self.ev_changed_product = np.array([float(x) for x in ev_ary_current_product[:, 1]]) # 23x1 ndarray 存储本次库存的改变
|
||||||
for order in self.a_lst_order:
|
for order in self.a_lst_order:
|
||||||
if order.xv_dlv_t == self.model.t: # 第一次交付
|
if order.xv_dlv_t == self.model.t: # 第一次交付
|
||||||
# Check and make shipment
|
# Check and make shipment
|
||||||
|
|
|
@ -37,37 +37,59 @@ class ProduceSystem(ap.Agent):
|
||||||
sorted_data = ev_ary_product_to_produce[sorted_indices] # 对gap进行从大到小排序
|
sorted_data = ev_ary_product_to_produce[sorted_indices] # 对gap进行从大到小排序
|
||||||
self.ev_ary_product = self.ev_ary_product[sorted_indices]
|
self.ev_ary_product = self.ev_ary_product[sorted_indices]
|
||||||
sorted_indices_product = np.argsort(self.model.the_firm.the_is.ev_ary_current_product[:, 1]) # 对库存进行从小到大排序
|
sorted_indices_product = np.argsort(self.model.the_firm.the_is.ev_ary_current_product[:, 1]) # 对库存进行从小到大排序
|
||||||
sorted_data_product = self.model.the_firm.the_is.ev_ary_current_product[:, sorted_indices_product]
|
# print(sorted_indices_product)
|
||||||
|
sorted_data_product = self.model.the_firm.the_is.ev_ary_current_product[sorted_indices_product, :]
|
||||||
self.ev_lst_backtrans_material = ev_lst_trans_quan_material # 存储退回给Iss的原材料
|
self.ev_lst_backtrans_material = ev_lst_trans_quan_material # 存储退回给Iss的原材料
|
||||||
self.ev_ary_produce_number = np.zeros((self.xv_product_num, 2))
|
self.ev_ary_produce_number = np.zeros((self.xv_product_num, 2))
|
||||||
produce_number_lst = []
|
produce_number_lst = []
|
||||||
for i in range(self.xv_product_num):
|
for i in range(self.xv_product_num):
|
||||||
if sorted_data[i] > 0: # gap存在
|
if sorted_data[i] > 0: # gap存在
|
||||||
product_material = self.xv_ary_bom[self.xv_ary_bom[:, 0] == self.ev_ary_product[i]]
|
product_material = self.xv_ary_bom[self.xv_ary_bom[:, 0] == self.ev_ary_product[i]]
|
||||||
produce_number = produce_plan[produce_plan[:, 1] == self.ev_ary_product[i]][3]
|
# print(product_material)
|
||||||
|
# print(self.xv_ary_material)
|
||||||
|
# print(len(self.xv_ary_material))
|
||||||
|
# print(np.where(self.xv_ary_material == 'D12087F2126')[0][0])
|
||||||
|
# print(produce_plan[produce_plan[:, 1] == self.ev_ary_product[i]])
|
||||||
|
produce_number = float(produce_plan[produce_plan[:, 1] == self.ev_ary_product[i]][0, 3])
|
||||||
|
# print(type(produce_number))
|
||||||
for material in product_material:
|
for material in product_material:
|
||||||
produce_number = min(produce_number, int(
|
if np.isnan(
|
||||||
self.ev_lst_backtrans_material[np.where(self.xv_ary_material == material[1])] / material[
|
self.ev_lst_backtrans_material[np.where(self.xv_ary_material == material[1])[0][0]] / float(
|
||||||
2])) # 取能生产的最小个数
|
material[
|
||||||
|
2])):
|
||||||
|
number = 100000
|
||||||
|
else:
|
||||||
|
number = self.ev_lst_backtrans_material[
|
||||||
|
np.where(self.xv_ary_material == material[1])[0][0]] / float(material[
|
||||||
|
2])
|
||||||
|
produce_number = min(produce_number, int(number)) # 取能生产的最小个数
|
||||||
for material in product_material:
|
for material in product_material:
|
||||||
self.ev_lst_backtrans_material[np.where(self.xv_ary_material == material[1])] -= produce_number * \
|
# print(type(np.where(self.xv_ary_material == material[1])))
|
||||||
material[
|
self.ev_lst_backtrans_material[
|
||||||
2] # 更新原材料消耗情况
|
np.where(self.xv_ary_material == material[1])[0][0]] -= produce_number * \
|
||||||
|
float(material[
|
||||||
|
2]) # 更新原材料消耗情况
|
||||||
produce_number_lst.append([self.ev_ary_product[i], produce_number])
|
produce_number_lst.append([self.ev_ary_product[i], produce_number])
|
||||||
sorted_data_product = sorted_data_product[sorted_data_product[:, 0] != self.ev_ary_product[i]]
|
sorted_data_product = sorted_data_product[sorted_data_product[:, 0] != self.ev_ary_product[i]]
|
||||||
else:
|
else:
|
||||||
for current_product in sorted_data_product:
|
for current_product in sorted_data_product:
|
||||||
product_material = self.xv_ary_bom[self.xv_ary_bom[:, 0] == current_product[0]]
|
product_material = self.xv_ary_bom[self.xv_ary_bom[:, 0] == current_product[0]]
|
||||||
produce_number = produce_plan[produce_plan[:, 1] == current_product[0]][3]
|
produce_number = float(produce_plan[produce_plan[:, 1] == current_product[0]][0, 3])
|
||||||
for material in product_material:
|
for material in product_material:
|
||||||
produce_number = min(produce_number, int(
|
if np.isnan(self.ev_lst_backtrans_material[
|
||||||
self.ev_lst_backtrans_material[np.where(self.xv_ary_material == material[1])] / material[
|
np.where(self.xv_ary_material == material[1])[0][0]] / float(material[
|
||||||
2])) # 取能生产的最小个数
|
2])):
|
||||||
|
number = 100000
|
||||||
|
else:
|
||||||
|
number = self.ev_lst_backtrans_material[
|
||||||
|
np.where(self.xv_ary_material == material[1])[0][0]] / float(material[
|
||||||
|
2])
|
||||||
|
produce_number = min(produce_number, int(number)) # 取能生产的最小个数
|
||||||
for material in product_material:
|
for material in product_material:
|
||||||
self.ev_lst_backtrans_material[
|
self.ev_lst_backtrans_material[
|
||||||
np.where(self.xv_ary_material == material[1])] -= produce_number * \
|
np.where(self.xv_ary_material == material[1])[0][0]] -= produce_number * \
|
||||||
material[
|
float(material[
|
||||||
2] # 更新原材料消耗情况
|
2]) # 更新原材料消耗情况
|
||||||
produce_number_lst.append([current_product[0], produce_number])
|
produce_number_lst.append([current_product[0], produce_number])
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
BIN
bom23.xlsx
BIN
bom23.xlsx
Binary file not shown.
Loading…
Reference in New Issue