Danielka's picture
Upload app.py
ffa1c1a
raw
history blame
No virus
7.95 kB
import streamlit as st
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import math
st.set_page_config(
page_title="Ex-stream-ly Cool App",
page_icon="🧊",
layout="wide",
initial_sidebar_state="expanded"
)
st.title("Калькулятор мощности")
st.subheader('Выбор склада. Insource vs Outsource')
Number_of_incoming_pallets = st.number_input('Количество поступаемых паллет, паллет/месяц', value=40)
Number_of_pallets_shipped = st.number_input('Количество отгружаемых паллет, паллет/месяц', value=40)
The_average_cost_of_one_product = st.number_input('Средняя стоимость одного товара, руб.', value=3000)
col1, col2 = st.columns(2)
with col1:
st.write('Характеристики insource склада')
The_cost_of_warehouse_maintenance_services = st.number_input('Стоимость услуг по обеспечению склада, руб./месяц', value=50000)
Average_salary = st.number_input('Средняя зарпала, сотрудник', value=50850)
Equipment_breakdown_rate_in_stock = st.number_input('Коэффициент поломки оборудования на складе, %', value=5)
The_cost_of_equipment_repair_in_the_warehouse = st.number_input('Стоимость ремонта оборудования на складе, руб./шт.', value=20000)
The_cost_of_warehouse_information_support = st.number_input('Стоимость информационной поддержки склада, руб./месяц', value=20000)
Spoilage_coefficient = st.number_input('Коэффициент порчи, %', value=0.1)
Number_of_working_hours_per_month = st.number_input('Количество рабочих часов в месяц, час', value=176)
Average_number_of_goods_per_pallet = st.number_input('Среднее количество товаров в одном паллете, шт./палелт', value=120)
Productivity_of_one_employee = st.number_input('Производительность одного сотрудника, паллетомест/час', value=0.2)
with col2:
st.write('Характеристики outsource склада')
Number_of_storage_days = st.number_input('Количество дней хранения, дни', value=30)
Warehouse_area = st.number_input('Площадь склада, м2', value=150)
Storage_mezzanine = st.number_input('Стоимость хранения мезонина, руб. за м2/сутки', value=22.35)
Unloading_of_pallets_to_the_storage_place = st.number_input('Стоимость выгрузки паллет на место хранения, руб./паллета', value=120)
Acceptance = st.number_input('Стоимость приемки, руб./паллет', value=125.9)
Selection_of_spare_parts = st.number_input('Стоимость подбор запчастей, руб./паллет', value=183)
Shipment_of_spare_parts = st.number_input('Стоимость отгрузки запчастей, руб./паллет', value=120)
Registration_of_documents_entry_or_exit = st.number_input('Стоимость оформление документов вход/выход, руб./комплект', value=130)
Transaction_percentage = st.number_input('Процент транзакции, %', value=1)
def get_average_number_of_damaged_goods():
return (Number_of_incoming_pallets + Number_of_pallets_shipped) * Spoilage_coefficient * Average_number_of_goods_per_pallet / 100
def get_cnt_emplyes_and_equipment():
The_number_of_pallets_processed_by_one_employee = Productivity_of_one_employee * Number_of_working_hours_per_month
Number_of_employees = math.ceil((Number_of_incoming_pallets + Number_of_pallets_shipped) / The_number_of_pallets_processed_by_one_employee)
return Number_of_employees, Number_of_employees
def get_insource_cost():
Wage_fund = Number_of_employees * Average_salary
The_cost_of_repairing_broken_equipment = Number_of_equipment * The_cost_of_equipment_repair_in_the_warehouse * Equipment_breakdown_rate_in_stock / 100
Spoilage = Average_number_of_damaged_goods * The_average_cost_of_one_product
return {'Обеспечение склада': The_cost_of_warehouse_maintenance_services,
'ФОТ': Wage_fund,
'Информационная поддержка': The_cost_of_warehouse_information_support,
'Ремонт оборудования': The_cost_of_repairing_broken_equipment,
'Порча товара': Spoilage,
'Общие расходы': The_cost_of_warehouse_maintenance_services + Wage_fund + The_cost_of_repairing_broken_equipment + The_cost_of_warehouse_information_support + Spoilage}
def get_outsource_cost():
Total_cost_of_storage_of_goods = Number_of_storage_days * Warehouse_area * Storage_mezzanine
The_cost_of_unloading_pallets_at_the_storage_location = Unloading_of_pallets_to_the_storage_place * Number_of_incoming_pallets
The_cost_of_shipping_the_goods_from_the_storage_location = Shipment_of_spare_parts * Number_of_pallets_shipped
The_cost_of_acceptance_of_the_goods = Acceptance * Number_of_incoming_pallets
The_cost_of_product_selection = Selection_of_spare_parts * Number_of_pallets_shipped
The_cost_of_registration_of_documents = (Number_of_incoming_pallets + Number_of_pallets_shipped) * Registration_of_documents_entry_or_exit
Costs = Total_cost_of_storage_of_goods + The_cost_of_unloading_pallets_at_the_storage_location \
+ The_cost_of_shipping_the_goods_from_the_storage_location + The_cost_of_acceptance_of_the_goods \
+ The_cost_of_product_selection + The_cost_of_registration_of_documents
Transaction_costs = Costs * Transaction_percentage / 100
return {'Хранение товара': Total_cost_of_storage_of_goods,
'Выгрузка паллет': The_cost_of_unloading_pallets_at_the_storage_location,
'Отгрузка паллет': The_cost_of_shipping_the_goods_from_the_storage_location,
'Приемка товара': The_cost_of_acceptance_of_the_goods,
'Подбор товара': The_cost_of_product_selection,
'Оформление документов': The_cost_of_registration_of_documents,
'Транзакционные затраты': Transaction_costs,
'Общие расходы': Transaction_costs + Costs}
if st.button('Расчет эффективности'):
st.subheader('Вывод', anchor=None)
Number_of_employees, Number_of_equipment = get_cnt_emplyes_and_equipment()
Average_number_of_damaged_goods = get_average_number_of_damaged_goods()
insource_cost = get_insource_cost()
outsource_cost = get_outsource_cost()
cost_data = pd.DataFrame({'Insource': insource_cost['Общие расходы'],'Outsource': outsource_cost['Общие расходы']}, index=['Общие расходы']).T
st.write(f'Затраты Insource склад:', insource_cost['Общие расходы'])
st.write(f'Затраты Outsource склад:', outsource_cost['Общие расходы'])
insource_data = pd.DataFrame(insource_cost, index=['Расходы']).T
outsource_data = pd.DataFrame(outsource_cost, index=['Расходы']).T
col1, col2 = st.columns(2)
with col1:
st.bar_chart(cost_data)
col1, col2 = st.columns(2)
with col1:
st.write('Распределение затрат insource склада')
st.bar_chart(insource_data)
with col2:
st.write('Распределение затрат outsource склада')
st.bar_chart(outsource_data)