File size: 7,953 Bytes
ffa1c1a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
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) |