Курсовые работы / ПРИС КП_5
.pdfПРИЛОЖЕНИЕ А Модель бизнес-процессов учета движения товаров на складе организации по
продаже газобаллонного оборудования по стандарту IDEF0
Рисунок А.1 - Концептуальный уровень диаграммы IDEF0
Рисунок А.2 – Декомпозиция блока «Учет движения товаров на складе организации по продаже ГБО»
32
Рисунок А.2 – Декомпозиция блока «Поступление комплектующих»
Рисунок А.2 – Декомпозиция блока «Формирование сведений о клиентах»
33
Рисунок А.2 – Декомпозиция блока «Обслуживание клиентов»
Рисунок А.2 – Декомпозиция блока «Ведение БД учета комплектующих»
34
Приложение Б Программный код контроллеров
Листинг Б.1 – Котроллер clienteles_controller
class ClientelesController < ApplicationController
before_action :set_clientele, only: [:show, :edit, :update, :destroy]
#GET /clienteles
#GET /clienteles.json def index
@clienteles = Clientele.all end
def search end
#GET /clienteles/1
#GET /clienteles/1.json def show
end
#GET /clienteles/new
def new
@clientele = Clientele.new end
#GET /clienteles/1/edit def edit
end
#POST /clienteles
#POST /clienteles.json def create
@clientele = Clientele.new(clientele_params) respond_to do |format|
if @clientele.save
format.html { redirect_to @clientele, notice: 'Clientele was successfully created.' } format.json { render :show, status: :created, location: @clientele }
else
format.html { render :new }
format.json { render json: @clientele.errors, status: :unprocessable_entity } end
end end
#PATCH/PUT /clienteles/1
#PATCH/PUT /clienteles/1.json
def update
respond_to do |format|
if @clientele.update(clientele_params)
format.html { redirect_to @clientele, notice: 'Clientele was successfully updated.' } format.json { render :show, status: :ok, location: @clientele }
else
format.html { render :edit }
format.json { render json: @clientele.errors, status: :unprocessable_entity } end
35
end end
#DELETE /clienteles/1
#DELETE /clienteles/1.json def destroy @clientele.destroy respond_to do |format|
format.html { redirect_to clienteles_url, notice: 'Clientele was successfully destroyed.' } format.json { head :no_content }
end end private
def set_clientele
@clientele = Clientele.find(params[:id])
end
def clientele_params
params.require(:clientele).permit(:id_clientele, :adress, :telefon, :fio_ruk, :rs_banks, :s_delete) end
end
Листинг Б.2 – Контроллер details_controller
class DetailsController < ApplicationController
before_action :set_detail, only: [:show, :edit, :update, :destroy]
#GET /details
#GET /details.json def index
@details = Detail.all end
def search end
#GET /details/1
#GET /details/1.json def show
end
#GET /details/new def new
@detail = Detail.new end
#GET /details/1/edit def edit
end
#POST /details
#POST /details.json def create
@detail = Detail.new(detail_params) respond_to do |format|
if @detail.save
format.html { redirect_to @detail, notice: 'Detail was successfully created.' } format.json { render :show, status: :created, location: @detail }
else
36
format.html { render :new }
format.json { render json: @detail.errors, status: :unprocessable_entity } end
end end
#PATCH/PUT /details/1
#PATCH/PUT /details/1.json def update
respond_to do |format|
if @detail.update(detail_params)
format.html { redirect_to @detail, notice: 'Detail was successfully updated.' } format.json { render :show, status: :ok, location: @detail }
else
format.html { render :edit }
format.json { render json: @detail.errors, status: :unprocessable_entity } end
end end
#DELETE /details/1
#DELETE /details/1.json
def destroy @detail.destroy respond_to do |format|
format.html { redirect_to details_url, notice: 'Detail was successfully destroyed.' } format.json { head :no_content }
end end private
# Use callbacks to share common setup or constraints between actions. def set_detail
@detail = Detail.find(params[:id]) end.
def detail_params params.require(:detail).permit(:proizvod, :tip, :name) end
end
Листинг Б.3 – Контроллер prihod_detail_controller
class PrihodDetailsController < ApplicationController
before_action :set_prihod_detail, only: [:show, :edit, :update, :destroy]
#GET /prihod_details
#GET /prihod_details.json def index
@prihod_details = PrihodDetail.all end
def search end
#GET /prihod_details/1
#GET /prihod_details/1.json
def show end
37
# GET /prihod_details/new def new
@prihod_detail = PrihodDetail.new end
#GET /prihod_details/1/edit def edit
end
#POST /prihod_details
#POST /prihod_details.json def create
@prihod_detail = PrihodDetail.new(prihod_detail_params) respond_to do |format|
if @prihod_detail.save
format.html { redirect_to @prihod_detail, notice: 'Prihod detail was successfully created.' } format.json { render :show, status: :created, location: @prihod_detail }
else
format.html { render :new }
format.json { render json: @prihod_detail.errors, status: :unprocessable_entity } end
end end
#PATCH/PUT /prihod_details/1
#PATCH/PUT /prihod_details/1.json
def update
respond_to do |format|
if @prihod_detail.update(prihod_detail_params)
format.html { redirect_to @prihod_detail, notice: 'Prihod detail was successfully updated.' } format.json { render :show, status: :ok, location: @prihod_detail }
else
format.html { render :edit }
format.json { render json: @prihod_detail.errors, status: :unprocessable_entity } end
end end
#DELETE /prihod_details/1
#DELETE /prihod_details/1.json def destroy @prihod_detail.destroy respond_to do |format|
format.html { redirect_to prihod_details_url, notice: 'Prihod detail was successfully destroyed.' } format.json { head :no_content }
end end private
# Use callbacks to share common setup or constraints between actions. def set_prihod_detail
@prihod_detail = PrihodDetail.find(params[:id]) end
def prihod_detail_params
params.require(:prihod_detail).permit(:prihod_naclad, :details_id, :prihod_price_ed, :kol_vo, :suppliers_id)
end
38
end
Листинг Б.4 – Контроллер reshod_details_controller
class RashodDetailsController < ApplicationController
before_action :set_rashod_detail, only: [:show, :edit, :update, :destroy]
#GET /rashod_details
#GET /rashod_details.json def index
@rashod_details = RashodDetail.all end
def search end
#GET /rashod_details/1
#GET /rashod_details/1.json
def show end
# GET /rashod_details/new def new
@rashod_detail = RashodDetail.new end
#GET /rashod_details/1/edit def edit
end
#POST /rashod_details
#POST /rashod_details.json def create
@rashod_detail = RashodDetail.new(rashod_detail_params) respond_to do |format|
if @rashod_detail.save
format.html { redirect_to @rashod_detail, notice: 'Rashod detail was successfully created.' } format.json { render :show, status: :created, location: @rashod_detail }
else
format.html { render :new }
format.json { render json: @rashod_detail.errors, status: :unprocessable_entity } end
end end
#PATCH/PUT /rashod_details/1
#PATCH/PUT /rashod_details/1.json
def update
respond_to do |format|
if @rashod_detail.update(rashod_detail_params)
format.html { redirect_to @rashod_detail, notice: 'Rashod detail was successfully updated.' } format.json { render :show, status: :ok, location: @rashod_detail }
else
format.html { render :edit }
format.json { render json: @rashod_detail.errors, status: :unprocessable_entity } end
end end
39
#DELETE /rashod_details/1
#DELETE /rashod_details/1.json def destroy @rashod_detail.destroy respond_to do |format|
format.html { redirect_to rashod_details_url, notice: 'Rashod detail was successfully destroyed.' } format.json { head :no_content }
end end private
def set_rashod_detail
@rashod_detail = RashodDetail.find(params[:id]) end
def rashod_detail_params
params.require(:rashod_detail).permit(:rashod_naklad, :kol_vo, :clientele_id, :price) end
end
Листинг Б.5 – Контроллер sklads_controller
class SkladsController < ApplicationController
before_action :set_sklad, only: [:show, :edit, :update, :destroy]
#GET /sklads
#GET /sklads.json def index
@sklads = Sklad.all end
def search end
#GET /sklads/1
#GET /sklads/1.json def show
end
#GET /sklads/new def new
@sklad = Sklad.new end
#GET /sklads/1/edit def edit
end
#POST /sklads
#POST /sklads.json def create
@sklad = Sklad.new(sklad_params) respond_to do |format|
if @sklad.save
format.html { redirect_to @sklad, notice: 'Sklad was successfully created.' } format.json { render :show, status: :created, location: @sklad }
else
format.html { render :new }
format.json { render json: @sklad.errors, status: :unprocessable_entity } end
40
end end
#PATCH/PUT /sklads/1
#PATCH/PUT /sklads/1.json def update
respond_to do |format|
if @sklad.update(sklad_params)
format.html { redirect_to @sklad, notice: 'Sklad was successfully updated.' } format.json { render :show, status: :ok, location: @sklad }
else
format.html { render :edit }
format.json { render json: @sklad.errors, status: :unprocessable_entity } end
end end
#DELETE /sklads/1
#DELETE /sklads/1.json
def destroy @sklad.destroy respond_to do |format|
format.html { redirect_to sklads_url, notice: 'Sklad was successfully destroyed.' } format.json { head :no_content }
end end private
def set_sklad
@sklad = Sklad.find(params[:id]) end
def sklad_params params.require(:sklad).permit(:detail_id, :ostatok) end
end
Листинг Б.6 – Контроллер suppliers_controller
lass SuppliersController < ApplicationController
before_action :set_supplier, only: [:show, :edit, :update, :destroy]
#GET /suppliers
#GET /suppliers.json def index
@suppliers = Supplier.all end
def search end
#GET /suppliers/1
#GET /suppliers/1.json def show
end
#GET /suppliers/new
def new
@supplier = Supplier.new end
41