LocomotiveController.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?php
  2. namespace app\controllers;
  3. use Yii;
  4. //use app\models\Accounts;
  5. use yii\rest\Controller;
  6. //use yii\web\Controller;
  7. use app\models\entity\Accounts;
  8. use app\models\LocomotiveModel;
  9. use app\models\EmployeesModel;
  10. use app\models\entity\Jobtypes;
  11. class LocomotiveController extends MainController
  12. {
  13. public function actionIndex()
  14. {
  15. /*
  16. $job_id = 21;
  17. $jobtypesEntity = Jobtypes::findOne($job_id);//->where(['id' => $job_id])->all();
  18. //var_dump(count($jobtypesEntity));
  19. $subtaskarr = array();
  20. foreach ( $jobtypesEntity->tasktype as $task) {
  21. var_dump($task->id);
  22. }
  23. die();
  24. $objectComponent = new \Infinitiweb\YiiDoctrine\Component();
  25. $entityManager = $objectComponent->entityManager;
  26. $companyEntity = $entityManager->find('Company', 1 );
  27. return $companyEntity->getId();
  28. *
  29. */
  30. }
  31. /*
  32. Запрос (от SMoPP в ЕИПП) Получить список актуальных замечаний по секции
  33. */
  34. public function actionGetsectionremarks()
  35. {
  36. $params['number'] = '0469В';
  37. $params['subnumber'] = '11385168';
  38. $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathListCurrentComments'];
  39. $locomotiveModel = new LocomotiveModel();
  40. $result = $locomotiveModel->getSectionRemarks($params,false);
  41. return json_decode($result);
  42. /* Полученый ответ
  43. * [{"remarkID":"6d7ba595-9ca1-11e9-80d5-005056011052"},
  44. * {"remarkID":"cfd434ae-9ca4-11e9-80d5-005056011052"},
  45. * {"remarkID":"36a56c64-9efd-11e9-80e7-0050560104a9"},
  46. * {"remarkID":"4e681e5d-9c8a-11e9-80d5-005056011052"}]
  47. */
  48. }
  49. /*
  50. Запрос (от SMoPP в ЕИПП) Получить список секций на дату – ПолучитьПланНаДату
  51. */
  52. public function actionGetsectionlist()
  53. {
  54. /*
  55. $arrayParams['place'] = Yii::$app->request->post('place');
  56. $arrayParams['date'] = Yii::$app->request->post('date');
  57. $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathListOfSections'];
  58. */
  59. $params['place'] = 'a84d0a15-08ec-11e5-829d-00155d6cab05';//2';
  60. //$params['place'] = '5fb47130-580c-11e7-aefa-00155d6cab05';
  61. $params['date'] = '1581324560';//$this->milliseconds();
  62. $locomotiveModel = new LocomotiveModel();
  63. $result = $locomotiveModel->getSectionList($params);
  64. return $result;
  65. /* Полученый ответ
  66. * <response>{"array":[]}</response>
  67. */
  68. }
  69. /*
  70. Запрос (от SMoPP в ЕИПП) Записать факт проведения приемки
  71. */
  72. public function actionAddcomplitedwork()
  73. {
  74. /*
  75. $params['number'] = Yii::$app->request->post('number');
  76. $params['subnumber'] = Yii::$app->request->post('subnumber');
  77. $params['diagnosticCard'] = Yii::$app->request->post('diagnosticCard');
  78. $params['inspectionId'] = Yii::$app->request->post('inspectionId');
  79. $params['isSCWorksNeeded'] = Yii::$app->request->post('isSCWorksNeeded');
  80. $params['startTime'] = Yii::$app->request->post('startTime');
  81. $params['endTime'] = Yii::$app->request->post('endTime');
  82. $params['worker'] = Yii::$app->request->post('worker');
  83. $params['engineer'] = Yii::$app->request->post('engineer');
  84. $params['otcEmployee'] = Yii::$app->request->post('otcEmployee');
  85. $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathExecuteReceiving'];
  86. */
  87. $params['number'] = '345'; // номер секции
  88. $params['subnumber'] = '123';
  89. $params['diagnosticCard'] = '123e4567-e89b-12d3-a456-426655440000';
  90. $params['inspectionId'] = '910'; // ид проекта
  91. $params['isSCWorksNeeded'] = 'true';
  92. $params['startTime'] = $this->seconds(); //начало выполнения первого таска
  93. $params['endTime'] = $this->seconds()+2000; // завершение последнего
  94. $params['worker'] = '2';
  95. $params['engineer'] = '27';
  96. $params['otcEmployee'] = '3';
  97. $locomotiveModel = new LocomotiveModel();
  98. $result = $locomotiveModel->addCompletedWork($params);
  99. return $result;
  100. //$result = $this->curlRequest($url,$params);
  101. }
  102. /*
  103. Запрос (от SMoPP в ЕИПП) Создать замечание секции по ДК в АСУ СГ
  104. */
  105. public function actionAddremark()
  106. {
  107. /*
  108. $arrayParams['number'] = Yii::$app->request->post('number');
  109. $arrayParams['subnumber'] = Yii::$app->request->post('subnumber');
  110. $arrayParams['diagnosticCard'] = Yii::$app->request->post('diagnosticCard');
  111. $arrayParams['date'] = Yii::$app->request->post('date');
  112. $arrayParams['worker'] = Yii::$app->request->post('worker');
  113. $arrayParams['source'] = Yii::$app->request->post('source');
  114. $arrayParams['description'] = Yii::$app->request->post('description');
  115. $arrayParams['isSCWorksNeeded'] = Yii::$app->request->post('isSCWorksNeeded');
  116. */
  117. $params['number'] = '2';
  118. $params['subnumber'] = '3';
  119. $params['diagnosticCard'] = '123e4567-e89b-12d3-a456-426655440000';
  120. $params['date'] = $this->seconds();
  121. $params['worker'] = '2';
  122. $params['source'] = '23';
  123. //$params['description'] = 'description';
  124. //$params['isSCWorksNeeded'] = 'true';
  125. $url = Yii::$app->params['api']['domain'] . Yii::$app->params['api']['pathCommentSection'];
  126. $locomotiveModel = new LocomotiveModel();
  127. $result = $locomotiveModel->addRemark($params);
  128. return $result;
  129. /* Полученый ответ
  130. * [{"remarkID":"tests_id_bdcb7ad66fc01b1f2f574d4b161402fb647153f0"}]
  131. */
  132. }
  133. public function actionGetsourcesofcoments()
  134. {
  135. $locomotiveModel = new LocomotiveModel();
  136. $result = $locomotiveModel->getSourcesOfComents();
  137. var_dump($result);die();
  138. return json_decode($result);
  139. }
  140. public function actionGetrepairsites()
  141. {
  142. $locomotiveModel = new LocomotiveModel();
  143. $result = $locomotiveModel->getRepairSites();
  144. //var_dump($result);die();
  145. return json_decode($result);
  146. }
  147. public function actionGetsldlist()
  148. {
  149. $locomotiveModel = new LocomotiveModel();
  150. $result = $locomotiveModel->getSldList();
  151. return json_decode($result);
  152. }
  153. }