Файл: Проектирование реализации операций бизнес-процесса «Складской учёт» ( Аналитическая часть ).pdf
Добавлен: 15.05.2023
Просмотров: 255
Скачиваний: 2
СОДЕРЖАНИЕ
1.1. Выбор комплекса задач автоматизации
1.2. Характеристика существующих бизнес-процессов
1.3. Характеристика документооборота, возникающего при решении задачи
1.4. Обоснование проектных решений по информационному обеспечению
1.5. Обоснование проектных решений по программному обеспечению
2.1. Информационная модель и её описание
2.2. Характеристика нормативно-справочной, входной и оперативной информации
2.3. Характеристика результатной информации
2.4. Общие положения (дерево функций и сценарий диалога)
2.5. Характеристика базы данных
9. Дунаев В. HTML, скрипты и стили / В. Дунаев. – Спб. : БХВ-Петербург, 2015. – 816 с.
10. Жадеев А. PHP для начинающих / А. Жадеев. – Спб.: «Питер», 2014. – 592 c.
11. Колисниченко Д. PHP и MySQL. Разработка WEB-приложений / Д. Колисниченков – Спб: БХВ-Петербург, 2013. – 560 с.
12. Конналли Т. Базы данных. Проектирование, реализация и сопровождение. Теория и практика / Т. Коналли, К. Бегг. – М.: Издательский дом «Вильямс», 2013. – 1093 c.
13. Лобова Г. Моделирование и анализ бизнес-процессов SADT. – М.: LAP Lambert Academic Publishing, 2014. – 352 c.
14. Макдональд, М. Созданиец Web-сайта. Недостающее руководство / М. Макдональд. – Спб. : БХВ-Петербург, 2013. – 624 с.
17. Маклаков С.В. BPwin и Erwin. CASE-средства разработки информационных систем / С.В. Маклаков. – М. : ДИАЛОГ–МИФИ, 2014. – 369 c.
18. Тельнов, Ю.Ф. Информационные системы и технологии. Information System and Technologies: науч. издание под ред. Тельнова Ю. Ф. – М: Юнити-Дана, 2012 – 303 с.
19. Флэнаган, Д. Javascript. Подробное руководство / Д. Флэнаган : пер с англ. – М. : Символ-Плюс, 2013. – 1080 с.
ПРИЛОЖЕНИЯ
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Client;
use AppBundle\Entity\Notification;
use AppBundle\Entity\Postup;
use AppBundle\Entity\PostupComment;
use AppBundle\Entity\PostupProduct;
use AppBundle\Entity\User;
use AppBundle\Form\Type\PostupFilterFormType;
use AppBundle\Form\Type\PostupFormType;
use AppBundle\Form\Type\PostupProductFormType;
use Doctrine\ORM\Query;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class PostupController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/postups/index/{pagenum}", name = "site_postups_index", defaults={ "pagenum": "1"})
*/
public function indexAction($pagenum=1)
{
$form=$this->createForm(new PostupFilterFormType());
$caption = null;
$form->handleRequest($this->request);
$postupsquery = $this->getRepository('Postup')->createQueryBuilder('o')
->where('o.deleted = 0')
->addPostupBy('o.status', 'ASC')
->addPostupBy('o.createdAt', 'ASC');
$postupsquerycount = $this->getRepository('Postup')->createQueryBuilder('o')
->select('COUNT(DISTINCT o.id)')
->where('o.deleted = 0');
if ($form->isSubmitted() && $form->isValid()) {
$id = $form->get('id')->getData();
$status=$form->get('status')->getData();
$user=$form->get('user')->getData();
}
if (!empty($id)) {
$postupsquery->andWhere('o.id = :id')->setParameter('id', $id);
$postupsquerycount->andWhere('o.id = :id')->setParameter('id', $id);
}
if (!empty($status)) {
$postupsquery->andWhere('o.status = :status')->setParameter('status', $status);
$postupsquerycount->andWhere('o.status = :status')->setParameter('status', $status);
}
if (!empty($user)) {
$postupsquery->andWhere('o.user = :user')->setParameter('user', $user);
$postupsquerycount->andWhere('o.user = :user')->setParameter('user', $user);
}
$count=$postupsquerycount->getQuery()->getSingleScalarResult();
$pages = floor($count / 20) + ($count % 20 > 0 ? 1 : 0);
if ($pages < 1) $pages = 1;
if ($pagenum > $pages) $pagenum = $pages;
$postups = $postupsquery->setFirstResult(($pagenum - 1) * 20)
->setMaxResults(20)
->getQuery()->getResult();
$this->view['postups'] = $postups;
$this->view['form'] = $form->createView();
$this->view['page']=$pagenum;
$this->view['pages']=$pages;
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:index.html.twig');
}
/**
* @return RedirectResponse|Response
* @Config\Route("/postups/add", name = "site_postups_add")
*/
public function addAction()
{
$postup = new Postup();
$client_id=$this->request->get('client_id');
if (!(empty($client_id))) {
/** @var Client $client */
$client=$this->getRepository('Client')->findOneBy(array('id'=>$client_id));
$postup->setClient($client);
}
$form = $this->createForm(new PostupFormType(), $postup);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var PostupStatus $newstatus**/
$newstatus = $this->getRepository('PostupStatus')->findOneBy(array('id'=>1));
$postup->setStatus($newstatus);
$postup->setUser($this->user);
$this->manager->persist($postup);
$this->manager->flush();
$this->addNotice('success',
'postups.html.twig',
array('notice' => 'added', 'caption' => $postup->getId())
);
return $this->redirectToRoute('site_postups_edit',array('postup' => $postup->getId(), 'step' => 1));
}
$this->view['postup'] = null;
$this->forms['postup'] = $form->createView();
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:postup1.html.twig');
}
/**
* @param Postup $postup
* @return RedirectResponse|Response
* @Config\Route("/postups/{postup}/edit/{step}", name = "site_postups_edit")
* @Config\ParamConverter("postup", options = {"mapping": {"postup": "id"}})
*/
public function editAction(Postup $postup, $step)
{
if ($step > 4) {
$step = 4;
}
switch ($step) {
//общие данные
case 1:
$form = $this->createForm(new PostupFormType(), $postup);
if ($this->request->isMethod('POST')) {
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$postup->setUser($this->user);
$this->manager->persist($postup);
$this->manager->flush();
$this->addNotice('success',
'postups.html.twig',
array('notice' => 'changed', 'caption' => $postup->getId())
);
return $this->redirectToRoute(
'site_postups_edit',
array('postup' => $postup->getId(), 'step' => 1)
);
}
}
$this->view['postup'] = $postup;
$this->forms['postup'] = $form->createView();
break;
//список товаров
case 2:
$form = $this->createForm(new PostupProductFormType());
$products=$this->getRepository('PostupProduct')->createQueryBuilder('op')
->leftJoin('op.product','p')
->where('p.deleted <> 1')
->andWhere('op.postup = :postup')
->setParameters(array('postup'=>$postup))
->postupBy('p.category')->getQuery()->getResult();
if ($this->request->isXmlHttpRequest() && $this->request->isMethod('POST')) {
return $this->handleProductsAjaxRequest();
}
if ($this->request->isMethod('POST')) {
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var PostupProduct $postupproduct */
$postupproduct = $form->getData();
$postupproduct->setPostup($postup);
$postupproduct->setPrice($postupproduct->getProduct()->getPrice());
$this->manager->persist($postupproduct);
$this->manager->flush();
$postup->refreshCurrency();
$this->manager->persist($postup);
$this->manager->flush();
return $this->redirectToRoute(
'site_postups_edit',
array('postup' => $postup->getId(), 'step' => 2)
);
}
}
$this->view['postup'] = $postup;
$this->view['products'] = $products;
$this->forms['postupproduct'] = $form->createView();
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:postup2.html.twig');
break;
//список услуг
case 3:
$form = $this->createForm(new PostupServiceFormType());
$services=$this->getRepository('PostupService')->createQueryBuilder('os')
->leftJoin('os.service','s')
->where('s.deleted <> 1')
->andWhere('os.postup = :postup')
->setParameters(array('postup'=>$postup))
->postupBy('s.caption')->getQuery()->getResult();
if ($this->request->isMethod('POST')) {
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var PostupService $postupservice */
$postupservice = $form->getData();
$postupservice->setPostup($postup);
$postupservice->setPrice($postupservice->getService()->getPrice());
$this->manager->persist($postupservice);
$this->manager->flush();
$postup->refreshCurrency();
$this->manager->persist($postup);
$this->manager->flush();
return $this->redirectToRoute(
'site_postups_edit',
array('postup' => $postup->getId(), 'step' => 3)
);
}
}
$this->view['postup'] = $postup;
$this->view['services'] = $services;
$this->forms['postupservice'] = $form->createView();
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:postup3.html.twig');
break;
//доки
case 4:
$this->view['postup'] = $postup;
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:postup4.html.twig');
break;
}
$this->navigation = array('active' => 'postups');
return $this->render('AppBundle:Postups:postup'.$step.'.html.twig');
}
protected function handleProductsAjaxRequest()
{
$category = $this->request->get('category', null);
if (is_null($category)) return new JsonResponse();
$products=$this->getRepository('Product')->createQueryBuilder('p')
->select('p.id as id')
->where('p.category = :category')
->andWhere('p.deleted=0')
->setParameters(array('category'=> $category))
->getQuery()->getResult(Query::HYDRATE_ARRAY);
return new JsonResponse($products);
}
/**
* @param Postup $postup
* @return Response
* @Config\Route("/postups/{postup}/remove", name = "site_postups_remove")
* @Config\ParamConverter("postup", options = {"mapping": {"postup": "id"}})
*/
public function removeAction(Postup $postup)
{
$postup->setDeleted(true);
$this->manager->persist($postup);
$this->manager->flush();
return $this->redirectToRoute('site_postups_index');
}
/**
* @param Postup $postup
* @return Response
* @Config\Route("/postups/{postup}/changestatus/{status}", name = "site_postups_changestatus")
* @Config\ParamConverter("postup", options = {"mapping": {"postup": "id"}})
*/
public function changestatusAction(Postup $postup, $status)
{
$oldstatus=$postup->getStatus()->getId();
/** @var PostupStatus $newstatus**/
$newstatus = $this->getRepository('PostupStatus')->findOneBy(array('id'=>$status));
$postup->setStatus($newstatus);
//отправляем уведомление пользователю
$descriptiontext='';
$notifusers=$postup->getSpecs();
switch ($status) {
case 2:
$descriptiontext="Вам был назначен новый заказ № ".$postup->getId().". Не забудьте подтвердить принятие в работу. <a href='".$this->generateUrl('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>1))."'>Подробнее</a> ";
break;
case 3:
//если перед этим был статус "Ждет подтверждения"
if ($oldstatus==4) {
$descriptiontext="Заказ № ".$postup->getId()." был вернут в работу. <a href='".$this->generateUrl('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>1))."'>Подробнее</a> ";
//отменяем выбор поставщика
foreach ($postup->getPostupproviders() as $postupprovider) {
$postupprovider->setSelected(false);
$this->manager->persist($postupprovider);
$this->manager->flush();
}
}
//иначе увеомление админу
else {
$descriptiontext="Пользователь ".$this->getUser()->getUserfio()." принял заказ № ".$postup->getId()." в работу. <a href='".$this->generateUrl('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>1))."'>Подробнее</a> ";
$notifusers=array();
/** @var User $notifuser**/
$notifuser = $this->getRepository('User')->findOneBy(array('username'=>'admin'));
array_push($notifusers,$notifuser );
}
break;
case 5: $descriptiontext="Выбор поставщика в заказе №".$postup->getId()." был утвержден. <a href='".$this->generateUrl('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>1))."'>Подробнее</a>";
break;
case 6: $descriptiontext="Заказ №".$postup->getId()." был отменен. <a href='".$this->generateUrl('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>1))."'>Подробнее</a>";
break;
}
foreach ( $notifusers as $notifuser) {
$this->addNotification($notifuser,$descriptiontext);
}
$this->manager->persist($postup);
$this->manager->flush();
$this->addNotice('success',
'postups.html.twig',
array('notice' => 'postup_changestatus', 'caption' => $postup->getId())
);
return $this->redirectToRoute('site_postups_edit', array('postup' => $postup->getId(), 'step' => 1));
}
/**
* @param PostupProduct $postupproduct
* @param Postup $postup
* @return Response
* @Config\Route("/postups/{postup}/postupproducts/{postupproduct}/remove", name = "site_postupproducts_remove")
* @Config\ParamConverter("postupproduct", options = {"mapping": {"postupproduct": "id"}})
* @Config\ParamConverter("postup", options = {"mapping": {"postup": "id"}})
*/
public function removeproductAction(PostupProduct $postupproduct, Postup $postup)
{
$this->manager->remove($postupproduct);
$this->manager->flush();
$postup->refreshCurrency();
$this->manager->persist($postup);
$this->manager->flush();
return $this->redirectToRoute('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>2));
}
/**
* @param PostupService $postupservice
* @param Postup $postup
* @return Response
* @Config\Route("/postups/{postup}/postupservices/{postupservice}/remove", name = "site_postupservices_remove")
* @Config\ParamConverter("postupservice", options = {"mapping": {"postupservice": "id"}})
* @Config\ParamConverter("postup", options = {"mapping": {"postup": "id"}})
*/
public function removeserviceAction(PostupService $postupservice, Postup $postup)
{
$this->manager->remove($postupservice);
$this->manager->flush();
$postup->refreshCurrency();
$this->manager->persist($postup);
$this->manager->flush();
return $this->redirectToRoute('site_postups_edit', array('postup'=>$postup->getId(), 'step'=>3));
}
public function addNotification (User $user, $description) {
$notification = new Notification();
$notification->setUser($user);
$notification->setDescription($description);
$this->manager->persist($notification);
$this->manager->flush();
}
}
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Client;
use AppBundle\Entity\Notification;
use AppBundle\Entity\Otgruz;
use AppBundle\Entity\OtgruzProduct;
use AppBundle\Entity\OtgruzStatus;
use AppBundle\Entity\ProviderProduct;
use AppBundle\Entity\User;
use AppBundle\Form\Type\OtgruzCommentFormType;
use AppBundle\Form\Type\OtgruzEndFormType;
use AppBundle\Form\Type\OtgruzFilterFormType;
use AppBundle\Form\Type\OtgruzFormType;
use AppBundle\Form\Type\OtgruzProductFormType;
use Doctrine\ORM\Query;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
class OtgruzController extends InitializableController
{
/**
* @return RedirectResponse|Response
* @Config\Route("/otgruzs/index/{pagenum}", name = "site_otgruzs_index", defaults={ "pagenum": "1"})
*/
public function indexAction($pagenum=1)
{
$form=$this->createForm(new OtgruzFilterFormType());
$caption = null;
$form->handleRequest($this->request);
$otgruzsquery = $this->getRepository('Otgruz')->createQueryBuilder('o')
->where('o.deleted = 0')
->addOtgruzBy('o.status', 'ASC')
->addOtgruzBy('o.createdAt', 'ASC');
$otgruzsquerycount = $this->getRepository('Otgruz')->createQueryBuilder('o')
->select('COUNT(DISTINCT o.id)')
->where('o.deleted = 0');
if ($form->isSubmitted() && $form->isValid()) {
$id = $form->get('id')->getData();
$status=$form->get('status')->getData();
$user=$form->get('user')->getData();
}
if (!empty($id)) {
$otgruzsquery->andWhere('o.id = :id')->setParameter('id', $id);
$otgruzsquerycount->andWhere('o.id = :id')->setParameter('id', $id);
}
if (!empty($status)) {
$otgruzsquery->andWhere('o.status = :status')->setParameter('status', $status);
$otgruzsquerycount->andWhere('o.status = :status')->setParameter('status', $status);
}
if (!empty($user)) {
$otgruzsquery->andWhere('o.user = :user')->setParameter('user', $user);
$otgruzsquerycount->andWhere('o.user = :user')->setParameter('user', $user);
}
$count=$otgruzsquerycount->getQuery()->getSingleScalarResult();
$pages = floor($count / 20) + ($count % 20 > 0 ? 1 : 0);
if ($pages < 1) $pages = 1;
if ($pagenum > $pages) $pagenum = $pages;
$otgruzs = $otgruzsquery->setFirstResult(($pagenum - 1) * 20)
->setMaxResults(20)
->getQuery()->getResult();
$this->view['otgruzs'] = $otgruzs;
$this->view['form'] = $form->createView();
$this->view['page']=$pagenum;
$this->view['pages']=$pages;
$this->navigation = array('active' => 'otgruzs');
return $this->render('AppBundle:Otgruzs:index.html.twig');
}
/**
* @return RedirectResponse|Response
* @Config\Route("/otgruzs/add", name = "site_otgruzs_add")
*/
public function addAction()
{
$otgruz = new Otgruz();
$client_id=$this->request->get('client_id');
if (!(empty($client_id))) {
/** @var Client $client */
$client=$this->getRepository('Client')->findOneBy(array('id'=>$client_id));
$otgruz->setClient($client);
}
$form = $this->createForm(new OtgruzFormType(), $otgruz);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var OtgruzStatus $newstatus**/
$newstatus = $this->getRepository('OtgruzStatus')->findOneBy(array('id'=>1));
$otgruz->setStatus($newstatus);
$otgruz->setUser($this->user);
$this->manager->persist($otgruz);
$this->manager->flush();
$this->addNotice('success',
'otgruzs.html.twig',
array('notice' => 'added', 'caption' => $otgruz->getId())