123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?php
- namespace app\controllers;
- use Yii;
- //use app\models\Accounts;
- use yii\rest\Controller;
- //use yii\web\Controller;
- use app\models\entity\Accounts;
- use app\models\LocomotiveModel;
- use app\models\EmployeesModel;
- use app\models\entity\Jobtypes;
- class LocomotiveController extends MainController
- {
-
-
- public function actionIndex()
- {
- /*
- $job_id = 21;
- $jobtypesEntity = Jobtypes::findOne($job_id);//->where(['id' => $job_id])->all();
- //var_dump(count($jobtypesEntity));
- $subtaskarr = array();
- foreach ( $jobtypesEntity->tasktype as $task) {
- var_dump($task->id);
- }
- die();
-
- $objectComponent = new \Infinitiweb\YiiDoctrine\Component();
- $entityManager = $objectComponent->entityManager;
- $companyEntity = $entityManager->find('Company', 1 );
- return $companyEntity->getId();
- *
- */
- }
-
- /*
- Запрос (от SMoPP в ЕИПП) Получить список актуальных замечаний по секции
-
- */
-
- public function actionGetsectionremarks()
- {
-
- $params['number'] = '0469В';
- $params['subnumber'] = '11385168';
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathListCurrentComments'];
-
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSectionRemarks($params,false);
- return json_decode($result);
-
- /* Полученый ответ
- * [{"remarkID":"6d7ba595-9ca1-11e9-80d5-005056011052"},
- * {"remarkID":"cfd434ae-9ca4-11e9-80d5-005056011052"},
- * {"remarkID":"36a56c64-9efd-11e9-80e7-0050560104a9"},
- * {"remarkID":"4e681e5d-9c8a-11e9-80d5-005056011052"}]
- */
-
-
- }
-
- /*
-
- Запрос (от SMoPP в ЕИПП) Получить список секций на дату – ПолучитьПланНаДату
-
- */
-
- public function actionGetsectionlist()
- {
- /*
- $arrayParams['place'] = Yii::$app->request->post('place');
- $arrayParams['date'] = Yii::$app->request->post('date');
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathListOfSections'];
-
- */
- $params['place'] = 'a84d0a15-08ec-11e5-829d-00155d6cab05';//2';
- //$params['place'] = '5fb47130-580c-11e7-aefa-00155d6cab05';
- $params['date'] = '1581324560';//$this->milliseconds();
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSectionList($params);
-
- return $result;
-
- /* Полученый ответ
- * <response>{"array":[]}</response>
- */
-
- }
-
-
- /*
-
- Запрос (от SMoPP в ЕИПП) Записать факт проведения приемки
-
- */
-
- public function actionAddcomplitedwork()
- {
-
- /*
- $params['number'] = Yii::$app->request->post('number');
- $params['subnumber'] = Yii::$app->request->post('subnumber');
- $params['diagnosticCard'] = Yii::$app->request->post('diagnosticCard');
- $params['inspectionId'] = Yii::$app->request->post('inspectionId');
- $params['isSCWorksNeeded'] = Yii::$app->request->post('isSCWorksNeeded');
- $params['startTime'] = Yii::$app->request->post('startTime');
- $params['endTime'] = Yii::$app->request->post('endTime');
- $params['worker'] = Yii::$app->request->post('worker');
- $params['engineer'] = Yii::$app->request->post('engineer');
- $params['otcEmployee'] = Yii::$app->request->post('otcEmployee');
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathExecuteReceiving'];
- */
- $params['number'] = '345'; // номер секции
- $params['subnumber'] = '123';
- $params['diagnosticCard'] = '123e4567-e89b-12d3-a456-426655440000';
- $params['inspectionId'] = '910'; // ид проекта
- $params['isSCWorksNeeded'] = 'true';
- $params['startTime'] = $this->seconds(); //начало выполнения первого таска
- $params['endTime'] = $this->seconds()+2000; // завершение последнего
- $params['worker'] = '2';
- $params['engineer'] = '27';
- $params['otcEmployee'] = '3';
-
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->addCompletedWork($params);
- return $result;
- //$result = $this->curlRequest($url,$params);
- }
-
-
- /*
-
- Запрос (от SMoPP в ЕИПП) Создать замечание секции по ДК в АСУ СГ
-
- */
-
- public function actionAddremark()
- {
- /*
- $arrayParams['number'] = Yii::$app->request->post('number');
- $arrayParams['subnumber'] = Yii::$app->request->post('subnumber');
- $arrayParams['diagnosticCard'] = Yii::$app->request->post('diagnosticCard');
- $arrayParams['date'] = Yii::$app->request->post('date');
- $arrayParams['worker'] = Yii::$app->request->post('worker');
- $arrayParams['source'] = Yii::$app->request->post('source');
- $arrayParams['description'] = Yii::$app->request->post('description');
- $arrayParams['isSCWorksNeeded'] = Yii::$app->request->post('isSCWorksNeeded');
- */
-
- $params['number'] = '2';
- $params['subnumber'] = '3';
- $params['diagnosticCard'] = '123e4567-e89b-12d3-a456-426655440000';
- $params['date'] = $this->seconds();
- $params['worker'] = '2';
- $params['source'] = '23';
- //$params['description'] = 'description';
- //$params['isSCWorksNeeded'] = 'true';
-
-
-
-
-
-
-
-
- $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathCommentSection'];
-
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->addRemark($params);
-
- return $result;
-
- /* Полученый ответ
- * [{"remarkID":"tests_id_bdcb7ad66fc01b1f2f574d4b161402fb647153f0"}]
- */
- }
-
- public function actionGetsourcesofcoments()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSourcesOfComents();
- var_dump($result);die();
- return json_decode($result);
- }
-
- public function actionGetrepairsites()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getRepairSites();
- //var_dump($result);die();
- return json_decode($result);
- }
-
- public function actionGetsldlist()
- {
- $locomotiveModel = new LocomotiveModel();
- $result = $locomotiveModel->getSldList();
- return json_decode($result);
- }
- }
|