Commit a4ad1f05 authored by aakash.bedi's avatar aakash.bedi

batch_master_qty logic added

parent c08d46d4
......@@ -42,40 +42,57 @@ class BatchMaster:
if process_stage_name == "Stage-01":
df_stage['batch_no'] = df['batch_no']
df_stage['input_qty'] = df['Input Qty. (kg) F00056-BULK-001']
df_stage['input_qty_uom'] = 'kg'
df_stage['formaldehyde_content'] = df['F00041-BULK-001 content nil']
df_stage['unreactive_alpha_picoline'] = df['un reacted F00056-BULK-001 ( for infor.)']
df_stage['moisture_content'] = df['Moisture content \n(for infor)']
df_stage['output_qty'] = df['Output Qty. (kg)']
df_stage['output_qty_uom'] = 'kg'
elif process_stage_name == "Stage-02":
df_stage['batch_no'] = df['batch_no']
df_stage['input_qty'] = df['Input Qty.\n(kg) Stage-I']
df_stage['input_qty_uom'] = 'kg'
df_stage['formaldehyde_content'] = None
df_stage['unreactive_alpha_picoline'] = df['F00056-BULK-001 \n(NLT 50 %)']
df_stage['moisture_content'] = df['Moisture content \n(for Information).1']
df_stage['output_qty'] = df['Output \nQty. (kg)']
df_stage['output_qty_uom'] = 'kg'
elif process_stage_name == "Stage-03":
df_stage['batch_no'] = df['batch_no']
df_stage['input_qty'] = df['Input Qty. (kg) Stage-I']
df_stage['input_qty_uom'] = 'kg'
df_stage['formaldehyde_content'] = None
df_stage['unreactive_alpha_picoline'] = None
df_stage['moisture_content'] = df['M/C for infor']
df_stage['output_qty'] = df['Output Qty. (kg)']
df_stage['output_qty_uom'] = 'kg'
elif process_stage_name == "Stage-04":
df_stage['batch_no'] = df['batch_no']
df_stage['input_qty'] = None
df_stage['input_qty_uom'] = 'kg'
df_stage['formaldehyde_content'] = None
df_stage['unreactive_alpha_picoline'] = None
df_stage['moisture_content'] = df['NMT 0.5%']
df_stage['output_qty'] = None
df_stage['output_qty_uom'] = 'kg'
elif process_stage_name == "Stage-05":
df_stage['batch_no'] = df['batch_no']
df_stage['input_qty'] = None
df_stage['input_qty_uom'] = 'kg'
df_stage['formaldehyde_content'] = None
df_stage['unreactive_alpha_picoline'] = None
df_stage['moisture_content'] = df[' NMT 1.0%']
df_stage['output_qty'] = None
df_stage['output_qty_uom'] = 'kg'
df_stage.reset_index(drop=True, inplace=True)
df_stage = df_stage[['batch_no', 'input_qty', 'formaldehyde_content',
'unreactive_alpha_picoline', 'moisture_content']]
df_stage = df_stage[['batch_no', 'input_qty', 'input_qty_uom', 'formaldehyde_content',
'unreactive_alpha_picoline', 'moisture_content', 'output_qty',
'output_qty_uom']]
return df_stage
except Exception as e:
......@@ -206,9 +223,9 @@ class BatchMaster:
df = pd.merge(left=df_master, right=df_other, how='left', on='batch_no')
df['bct_input_qty_ratio'] = df['batch_cycle_time_minutes']/df['input_qty']
df.reset_index(drop=True, inplace=True)
df.to_excel(f"{base_path}/master_proto.xlsx", index=False)
df.to_excel(f"{base_path}/master_batch_material.xlsx", index=False)
logger.info(f'Pushing master_join to postgres')
df.set_index('batch_no').to_sql("master_proto", "postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai", if_exists='replace')
df.set_index('batch_no').to_sql("master_batch_material", "postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai", if_exists='replace')
logger.debug(f'Pushed master_join to postgres')
except Exception as e:
logger.exception(f"Exception - {e}")
......@@ -224,9 +241,9 @@ class BatchMaster:
df = pd.concat([df_stage_1, df_stage_2, df_stage_3, df_stage_4, df_stage_5], axis=0)
df.reset_index(drop=True, inplace=True)
df.to_excel(f"{base_path}/batch_master_quantity.xlsx", index=False)
df.to_excel(f"{base_path}/batch_material.xlsx", index=False)
logger.info(f'Pushing batch_master to postgres')
df.set_index('batch_no').to_sql("batch_master_quantity",
df.set_index('batch_no').to_sql("batch_material",
"postgresql://ilens:iLens$456@192.168.0.207:5328/ilens_ai",
if_exists="replace")
logger.debug(f'Pushed batch_master to postgres')
......
No preview for this file type
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