0% found this document useful (0 votes)
17 views30 pages

Project File

Uploaded by

Neha Makhija
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views30 pages

Project File

Uploaded by

Neha Makhija
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

Rukmini Devi Public

School

All India Secondary School Examination


Subject: Computer Science (083)
Project File
Class XII
Session 2024-2025

Name:
Roll No:

xaminer:
Page
S.no Description no.
.
1 Certificate 3
2 Acknowledgement 4
3 Introduction 5
4 Objective 6
5 Proposed System 7
6 Modules used 8
7 Flow Chart 10
8 Requirements 11
9 Source Code 12
10 Output 19
11 Limitations and Future Scope 24
12 Bibliography 25
Index
Certificate

This is to certify that ____________________, student of class


XII (Science) has successfully completed the report on the
project titled “Factory Management” under the guidance of
Mrs. Neha Makhija. The report is the result of his efforts and
endeavors. The report is found worthy of acceptance as the
final project report for the subject Computer Science of class XII
(Science).

Internal Examiner External Examiner


__________________ ____________________

Principal
______________
Acknowledgement
I would like to express my deepest gratitude to those who have
contributed to the completion of this project. Their support,
guidance, and encouragement have been invaluable throughout
this journey.
I am sincerely thankful to Mrs. Neha Makhija, our Computer
Science teacher, for contribution and support. Your expertise
and insights greatly enriched the aspect of the project. Your
dedication and willingness to share your knowledge played a
crucial role in the success of this project.
Finally, I want to express my heartfelt gratitude to my family and
friends for their unwavering support and understanding during
this endeavor.
Thank you all for being an integral part of this journey.

_____________________
Class XII (Science)
Introduction
The operations of a pharmaceutical factory are intricately
woven into a sophisticated and meticulously regulated process,
spanning crucial stages from the inception of research and
development to the intricacies of manufacturing, rigorous
quality control measures, and the intricate web of distribution.
This comprehensive program serves as a dynamic tool for
employers, facilitating the seamless monitoring of raw
materials, the manufacturing process, and the inventory of
pharmaceuticals. Operating on a user-friendly interface, the
program begins by prompting users to specify the operation
they wish to perform and provides options to either proceed or
halt after each task. Notably, it adeptly manages raw material
inventory, deducting materials based on usage to produce
medicines, orchestrating the formation of batches, maintaining
meticulous records of each batch, and conducting precise
calculations to track the sales of individual medicines.
Objective
The primary goal of this program is to streamline the
manufacturing process while effectively managing the
equilibrium between sales and stock levels. By automating key
functions, this program empowers employers to maintain
comprehensive material records with minimal effort.
Significantly minimizing manual labor, it serves as a facilitator
for a more efficient and effortlessly managed manufacturing
process.
Another key objective is to empower students in applying their
programming skills to real-life, practical challenges, fostering a
curious and problem-solving approach. This initiative
encourages students to not only develop technical proficiency
but also to cultivate a mindset that seeks innovative solutions to
real-world problems.
Proposed System
This program is made for the employer to keep a record of the stock of
medicines and raw materials. It also acts as the record of all medicines
and their components. When the program is run, it gives the user six
options which can be categorized into : -
 Handling of sale of products
 For this, the user can either order raw material or dispatch
medicine for sale.
 If the user chooses to order raw materials, they have to input the
raw material and also its corresponding amount needed. The
order is then successfully placed.
 If user choses to dispatch medicine, then they will have to input
the name and also the quantity of the medicine to be dispatched.
 After this is done, the name and the components are searched in
the details table. Then the quantity of components is searched
and deducted from the raw materials table.
 If the raw material is enough, then the manufacturing becomes a
success.
 If it is not enough, then it returns the name of raw materials that
were less in amount.
 Customize table
 For this, the user may can either add or delete a product from the
table.
 On choosing either of the options, the respective name, medicine
id, etc. are taken as prompt from the user and the corresponding
task is performed successfully.
 View details
 If the user chooses this option, the user must select a table for
viewing details.
Modules Used
1. mysql.connector module:-
This module enables python programs to access MySQL databases,
using an API that is compliant with the Python Database API
Specification v2.0 (PEP 249). It is written in pure Python and does not
have any dependencies except for the Python Standard Library.
MySql.connector module has a set of methods in which one is used in
that game.
a. cursor(): -
A database cursor is a useful control structure of database connectivity.
Normally when we connect to a database from within a script/program,
then the query gets sent to the server, where it gets executed, and the
set of records retrieved as per query is sent over the connection.
The syntax for using this function is 'conn.cursor ()'.

b. connect():-
After we have installed Python MySql connector, we can write python
scripts using MySql.connector library that can connect to MySql
databases from within Python.
Next we need to establish connection to a MySql database using
connect() function of mysql.connector package.
The connect() function of mysql.connector establishes connection to a
MySql database and requires four parameters, which are :
<connection-object>=mysql.connector.connect(host=<host-name>,
user=<username>, passwd=<password>, database=<database>)
- user is the username on MySql
- password is the password of the user
- host-name is the database server hostname or IP address
- database is optional which provides the database name of a MySql
database.
The syntax for using this function is :- 'mysql.connector.connect()'.
c. execute(): -
This method is used to execute an SQL statement. Once we have
created a cursor, we can execute SQL query using execute() function
with cursor object.
The syntax for using this method is 'cursor.execute()'.
For example,
If we want to view all the records of table data which is a table in the
database test to which we established connection, we can execute SQL
query "select from data" by writing: cursor.execute(“select * from
data”)
Flow Chart
User

View
Customize
details
table
Manage sale
of products

Add Delete Enter the name of the


product product table for which the
details are to be
Order raw Dispatch viewed
material medicine

Respective Details like Respective


columns are name & id are Enter the column is
given as taken as input name and the displayed
prompt for for the quantity of the
user to feed medicine to material
the details be deleted
which is then
deleted Enough raw
material available

Order for the


raw materials is
placed Yes No

The missing material


The material is
and the required
dispatched and table
amount is calculated
is updated
and then displayed
successfully
Requirements
Hardware required: -
➤ Modern Operating System:
 Windows 7 or 10
 Mac OS X 10.11 or higher, 64-bit
 Linux: RHEL 6/7, 64-bit (almost all libraries also work in Ubuntu)
➤ X86 64-bit CPU (Intel / AMD architecture)
➤ 4 GB RAM
➤ 5 GB free space
➤ Printer for printing project
Software required: -
➤ Operating System - Windows 10
➤ Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC
v.1916 bit (Intel)] on win32 for execution of program
➤ MS word, for preparing documentation
Source Code
import mysql.connector as sql

db = sql.connect(host="localhost", user="root",
password="123456", database="meddata")
cursor = db.cursor()

def run(query):
cursor.execute(query)
db.commit()
print("Saved Changes")

def view_specific(table, id, column):


cursor.execute(f"SELECT {id}, {column} FROM {table}")
lt = cursor.fetchall()
for t in lt:
for i in t:
print(i, end="\t")
print()
ch = int(input("Enter the required id: "))
return ch

def raw(med):
cursor.execute(f"SELECT composition FROM product_list
WHERE med_name = '{med}'")
lt = cursor.fetchall()
cursor.execute(f"SELECT packing FROM product_list WHERE
med_name = '{med}'")
plt = cursor.fetchall()
p = plt[0][0]
rms = lt[0][0]
rml = rms.split(", ")
rvd = {}
for rvp in rml:
rvl = rvp.split(": ")
rvd[rvl[0]] = float(rvl[1]) * p
return rvd
def add_details():
name = input("Enter name of product: ")
pack = int(input("Enter packaging of product: "))
n = int(input("Enter no. of ingredients: "))
s = ""
for _ in range(n):
ingred = input("Enter name of ingredient: ")
cursor.execute("SELECT mat_name FROM raw_material")
t = cursor.fetchall()
p = (ingred,)
if p not in t:
print("New Raw material, inserting...")
unit = input("Enter unit of Raw Material: ")
run(f"INSERT INTO raw_material(mat_name, unit, stock)
VALUES('{ingred}','{unit}', 0)")
amt = int(input("Enter amount of ingredient: "))
s += f"{ingred}: {amt}, "
print("Inserting into tables...")
run(f"INSERT INTO product_list(med_name, packing,
composition) VALUES('{name}', '{pack}', '{s[:-2]}')")
run(f"INSERT INTO products(med_name, stock)
VALUES('{name}', 0)")

def order():
choice = view_specific("raw_material", "mat_id",
"mat_name")
amt = int(input("Enter amount needed: "))
cursor.execute(f"SELECT mat_name, stock FROM
raw_material WHERE mat_id = {choice}")
a = cursor.fetchall()
print("Inserting and updating...")
run(f"INSERT INTO meddata.order(mat_name, raw_in)
VALUES('{a[0][0]}', {amt})")
run(f"UPDATE raw_material SET stock = {a[0][1] + amt}
WHERE mat_id = {choice}")

def view_details(table):
cursor.execute(f"SELECT * FROM {table}")
lt = cursor.fetchall()
for t in lt:
for i in t:
print(i, end="\t")
print()

def delete_details():
choice = view_specific("product_list", "med_id",
"med_name")
cursor.execute(f"SELECT stock FROM products WHERE
med_id = {choice}")
lt = cursor.fetchall()
stock = lt[0][0]
if stock == 0:
print("Deleting...")
run(f"DELETE FROM product_list WHERE med_id =
{choice}")
run(f"DELETE FROM products WHERE med_id = {choice}")
else:
print("Finish the stock first.")
def dispatch():
choice = view_specific("products", "med_id", "med_name")
amt_wanted = int(input("Enter amount of medicine to be
sent: "))
cursor.execute(f"SELECT med_name, stock FROM products
WHERE med_id = {choice}")
lt = cursor.fetchall()
amt_available = lt[0][1]
if amt_wanted <= amt_available:
print("Stock sufficient, updating tables...")
run(f"INSERT INTO dispatch(med_name, raw_used,
stock_before, stock_after, med_sent) VALUES('{lt[0][0]}', '-',
{amt_available}, {amt_available - amt_wanted},
{amt_wanted})")
run(f"UPDATE products SET stock = {amt_available -
amt_wanted} WHERE med_id = {choice}")
else:
print("Stock not enough, calculating material needed...")
raw_required = raw(lt[0][0])
s = ""
raw_wanted = {}
for key, item in raw_required.items():
raw_wanted[key] = item * (amt_wanted - amt_available)
s += f"{key}: {raw_wanted[key]}, "
cursor.execute(f"SELECT mat_name, stock FROM
raw_material")
rlt = cursor.fetchall()
lack = ""
for t in rlt:
if t[0] in raw_wanted.keys() and t[1] < raw_wanted[t[0]]:
lack += f"{t[0]}: {raw_wanted[t[0]] - t[1]}, "
if lack != "":
print("Raw material missing\n", lack[:-2])
else:
print("Manufacturing...")
run(f"INSERT INTO dispatch(med_name, raw_used,
stock_before, stock_after, med_sent) VALUES('{lt[0][0]}', '{s[:-
2]}', {amt_available}, 0, {amt_wanted})")
run(f"UPDATE products SET stock = 0 WHERE med_id =
{choice}")
print("Updating...")
for key, item in raw_wanted.items():
run(f"UPDATE raw_material SET stock = {item -
raw_wanted[key]} WHERE mat_name = '{key}'")

def main():
while True:
print("""Menu:
1) Add Product
2) Delete Product
3) Order Raw Material
4) View Details
5) Dispatch Medicine
0) Exit""")
operation_choice = int(input("Enter choice: "))
match operation_choice:
case 1:
add_details()
case 2:
delete_details()
case 3:
order()
case 4:
table_name = input("Enter name of table: ")
view_details(table_name)
case 5:
dispatch()
case 0:
break

if __name__ == '__main__':
main()
Output
Limitations and Future Scope

Limitations:
1. Only text input can be given.
2. Python must be downloaded on the system.
3. Error in the input can’t be rectified and may give an error.
4. Exceptions have not been handled properly.
Future Scope:
1. Graphical interface can be made by tkinter module.
2. An application can be made to overcome software restrictions.
3. A dropdown menu can be used to avoid mistakes in input.
4. Edit option can be given to avoid mistakes.
5. Exceptions can be handled by adding try and except blocks.
Bibliography
www.youtube.com
www.google.com
Computer Science with Python by Sumita Arora Class XII (Book)

You might also like