Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
+
import numpy as np
|
4 |
+
import pandas as pd
|
5 |
+
import math
|
6 |
+
|
7 |
+
|
8 |
+
st.set_page_config(
|
9 |
+
page_title="Ex-stream-ly Cool App",
|
10 |
+
page_icon="🧊",
|
11 |
+
layout="wide",
|
12 |
+
initial_sidebar_state="expanded"
|
13 |
+
)
|
14 |
+
|
15 |
+
|
16 |
+
st.title("Калькулятор мощности")
|
17 |
+
|
18 |
+
st.subheader('Выбор склада. Insource vs Outsource')
|
19 |
+
|
20 |
+
|
21 |
+
Number_of_incoming_pallets = st.number_input('Количество поступаемых паллет, паллет/месяц', value=40)
|
22 |
+
Number_of_pallets_shipped = st.number_input('Количество отгружаемых паллет, паллет/месяц', value=40)
|
23 |
+
The_average_cost_of_one_product = st.number_input('Средняя стоимость одного товара, руб.', value=3000)
|
24 |
+
|
25 |
+
col1, col2 = st.columns(2)
|
26 |
+
with col1:
|
27 |
+
st.write('Характеристики insource склада')
|
28 |
+
The_cost_of_warehouse_maintenance_services = st.number_input('Стоимость услуг по обеспечению склада, руб./месяц', value=50000)
|
29 |
+
Average_salary = st.number_input('Средняя зарпала, сотрудник', value=50850)
|
30 |
+
Equipment_breakdown_rate_in_stock = st.number_input('Коэффициент поломки оборудования на складе, %', value=5)
|
31 |
+
The_cost_of_equipment_repair_in_the_warehouse = st.number_input('Стоимость ремонта оборудования на складе, руб./шт.', value=20000)
|
32 |
+
The_cost_of_warehouse_information_support = st.number_input('Стоимость информационной поддержки склада, руб./месяц', value=20000)
|
33 |
+
Spoilage_coefficient = st.number_input('Коэффициент порчи, %', value=0.1)
|
34 |
+
Number_of_working_hours_per_month = st.number_input('Количество рабочих часов в месяц, час', value=176)
|
35 |
+
Average_number_of_goods_per_pallet = st.number_input('Среднее количество товаров в одном паллете, шт./палелт', value=120)
|
36 |
+
Productivity_of_one_employee = st.number_input('Производительность одного сотрудника, паллетомест/час', value=0.2)
|
37 |
+
|
38 |
+
with col2:
|
39 |
+
st.write('Характеристики outsource склада')
|
40 |
+
Number_of_storage_days = st.number_input('Количество дней хранения, дни', value=30)
|
41 |
+
Warehouse_area = st.number_input('Площадь склада, м2', value=150)
|
42 |
+
Storage_mezzanine = st.number_input('Стоимость хранения мезонина, руб. за м2/сутки', value=22.35)
|
43 |
+
Unloading_of_pallets_to_the_storage_place = st.number_input('Стоимость выгрузки паллет на место хранения, руб./паллета', value=120)
|
44 |
+
Acceptance = st.number_input('Стоимость приемки, руб./паллет', value=125.9)
|
45 |
+
Selection_of_spare_parts = st.number_input('Стоимость подбор запчастей, руб./паллет', value=183)
|
46 |
+
Shipment_of_spare_parts = st.number_input('Стоимость отгрузки запчастей, руб./паллет', value=120)
|
47 |
+
Registration_of_documents_entry_or_exit = st.number_input('Стоимость оформление документов вход/выход, руб./комплект', value=130)
|
48 |
+
Transaction_percentage = st.number_input('Процент транзакции, %', value=1)
|
49 |
+
|
50 |
+
|
51 |
+
def get_average_number_of_damaged_goods():
|
52 |
+
return (Number_of_incoming_pallets + Number_of_pallets_shipped) * Spoilage_coefficient * Average_number_of_goods_per_pallet / 100
|
53 |
+
|
54 |
+
def get_cnt_emplyes_and_equipment():
|
55 |
+
The_number_of_pallets_processed_by_one_employee = Productivity_of_one_employee * Number_of_working_hours_per_month
|
56 |
+
Number_of_employees = math.ceil((Number_of_incoming_pallets + Number_of_pallets_shipped) / The_number_of_pallets_processed_by_one_employee)
|
57 |
+
return Number_of_employees, Number_of_employees
|
58 |
+
|
59 |
+
def get_insource_cost():
|
60 |
+
Wage_fund = Number_of_employees * Average_salary
|
61 |
+
The_cost_of_repairing_broken_equipment = Number_of_equipment * The_cost_of_equipment_repair_in_the_warehouse * Equipment_breakdown_rate_in_stock / 100
|
62 |
+
Spoilage = Average_number_of_damaged_goods * The_average_cost_of_one_product
|
63 |
+
return {'Обеспечение склада': The_cost_of_warehouse_maintenance_services,
|
64 |
+
'ФОТ': Wage_fund,
|
65 |
+
'Информационная поддержка': The_cost_of_warehouse_information_support,
|
66 |
+
'Ремонт оборудования': The_cost_of_repairing_broken_equipment,
|
67 |
+
'Порча товара': Spoilage,
|
68 |
+
'Общие расходы': The_cost_of_warehouse_maintenance_services + Wage_fund + The_cost_of_repairing_broken_equipment + The_cost_of_warehouse_information_support + Spoilage}
|
69 |
+
|
70 |
+
|
71 |
+
def get_outsource_cost():
|
72 |
+
Total_cost_of_storage_of_goods = Number_of_storage_days * Warehouse_area * Storage_mezzanine
|
73 |
+
The_cost_of_unloading_pallets_at_the_storage_location = Unloading_of_pallets_to_the_storage_place * Number_of_incoming_pallets
|
74 |
+
The_cost_of_shipping_the_goods_from_the_storage_location = Shipment_of_spare_parts * Number_of_pallets_shipped
|
75 |
+
The_cost_of_acceptance_of_the_goods = Acceptance * Number_of_incoming_pallets
|
76 |
+
The_cost_of_product_selection = Selection_of_spare_parts * Number_of_pallets_shipped
|
77 |
+
The_cost_of_registration_of_documents = (Number_of_incoming_pallets + Number_of_pallets_shipped) * Registration_of_documents_entry_or_exit
|
78 |
+
|
79 |
+
Costs = Total_cost_of_storage_of_goods + The_cost_of_unloading_pallets_at_the_storage_location \
|
80 |
+
+ The_cost_of_shipping_the_goods_from_the_storage_location + The_cost_of_acceptance_of_the_goods \
|
81 |
+
+ The_cost_of_product_selection + The_cost_of_registration_of_documents
|
82 |
+
|
83 |
+
Transaction_costs = Costs * Transaction_percentage / 100
|
84 |
+
|
85 |
+
return {'Хранение товара': Total_cost_of_storage_of_goods,
|
86 |
+
'Выгрузка паллет': The_cost_of_unloading_pallets_at_the_storage_location,
|
87 |
+
'Отгрузка паллет': The_cost_of_shipping_the_goods_from_the_storage_location,
|
88 |
+
'Приемка товара': The_cost_of_acceptance_of_the_goods,
|
89 |
+
'Подбор товара': The_cost_of_product_selection,
|
90 |
+
'Оформление документов': The_cost_of_registration_of_documents,
|
91 |
+
'Транзакционные затраты': Transaction_costs,
|
92 |
+
'Общие расходы': Transaction_costs + Costs}
|
93 |
+
|
94 |
+
if st.button('Расчет эффективности'):
|
95 |
+
st.subheader('Вывод', anchor=None)
|
96 |
+
|
97 |
+
Number_of_employees, Number_of_equipment = get_cnt_emplyes_and_equipment()
|
98 |
+
Average_number_of_damaged_goods = get_average_number_of_damaged_goods()
|
99 |
+
|
100 |
+
insource_cost = get_insource_cost()
|
101 |
+
outsource_cost = get_outsource_cost()
|
102 |
+
|
103 |
+
cost_data = pd.DataFrame({'Insource': insource_cost['Общие расходы'],'Outsource': outsource_cost['Общие расходы']}, index=['Общие расходы']).T
|
104 |
+
|
105 |
+
|
106 |
+
st.write(f'Затраты Insource склад:', insource_cost['Общие расходы'])
|
107 |
+
st.write(f'Затраты Outsource склад:', outsource_cost['Общие расходы'])
|
108 |
+
|
109 |
+
insource_data = pd.DataFrame(insource_cost, index=['Расходы']).T
|
110 |
+
outsource_data = pd.DataFrame(outsource_cost, index=['Расходы']).T
|
111 |
+
|
112 |
+
col1, col2 = st.columns(2)
|
113 |
+
with col1:
|
114 |
+
st.bar_chart(cost_data)
|
115 |
+
|
116 |
+
|
117 |
+
col1, col2 = st.columns(2)
|
118 |
+
|
119 |
+
with col1:
|
120 |
+
st.write('Распределение затрат insource склада')
|
121 |
+
st.bar_chart(insource_data)
|
122 |
+
|
123 |
+
with col2:
|
124 |
+
st.write('Распределение затрат outsource склада')
|
125 |
+
st.bar_chart(outsource_data)
|