Importing and showing Rimo Building and Home Status
This commit is contained in:
@@ -340,9 +340,21 @@
|
||||
</tr><tr>
|
||||
<th>Building External ID:</th>
|
||||
<td class="text-monospace"><?=$preorder->adb_hausnummer->rimo_id?>
|
||||
</tr><tr>
|
||||
<th>Building Execution State:</th>
|
||||
<td class="text-monospace"><?=$preorder->adb_hausnummer->rimo_ex_state?>
|
||||
</tr><tr>
|
||||
<th>Building Operational State:</th>
|
||||
<td class="text-monospace"><?=($preorder->adb_hausnummer->rimo_op_state != "Undefined") ? $preorder->adb_hausnummer->rimo_op_state : ""?>
|
||||
</tr><tr>
|
||||
<th>Home External ID:</th>
|
||||
<td class="text-monospace"><?=$preorder->adb_wohneinheit->extref?>
|
||||
</tr><tr>
|
||||
<th>Home Execution State:</th>
|
||||
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_ex_state?>
|
||||
</tr><tr>
|
||||
<th>Home Operational State:</th>
|
||||
<td class="text-monospace"><?=($preorder->adb_wohneinheit->rimo_op_state != "Undefined") ? $preorder->adb_wohneinheit->rimo_op_state : ""?>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -34,6 +34,8 @@ class ADBHausnummerModel {
|
||||
public $manual_update_by;
|
||||
public $manual_update_info;
|
||||
public $rimo_id;
|
||||
public $rimo_ex_state;
|
||||
public $rimo_op_state;
|
||||
public $rimo_fcp_name;
|
||||
|
||||
public $create = null;
|
||||
|
||||
@@ -13,6 +13,8 @@ class ADBWohneinheitModel {
|
||||
public $zusatz;
|
||||
public $bezeichner;
|
||||
public $nutzung;
|
||||
public $rimo_ex_state;
|
||||
public $rimo_op_state;
|
||||
public $patch_cluster;
|
||||
public $patch_shelf;
|
||||
public $patch_module;
|
||||
|
||||
39
db/migrations/20240701095219_adb_add_rimo_status.php
Normal file
39
db/migrations/20240701095219_adb_add_rimo_status.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AdbAddRimoStatus extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
$hn = $this->table("Hausnummer");
|
||||
$hn->addColumn("rimo_ex_state", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "rimo_id"]);
|
||||
$hn->addColumn("rimo_op_state", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "rimo_ex_state"]);
|
||||
$hn->update();
|
||||
|
||||
$we = $this->table("Wohneinheit");
|
||||
$we->addColumn("rimo_ex_state", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "nutzung"]);
|
||||
$we->addColumn("rimo_op_state", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "rimo_ex_state"]);
|
||||
$we->update();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
$this->table("Wohneinheit")->removeColumn("rimo_status")->save();
|
||||
$this->table("Hausnummer")->removeColumn("rimo_status")->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,15 +246,22 @@ foreach ($clusters as $cluster_data) {
|
||||
/*
|
||||
* Set Building Status based on Operational-/Executionstate
|
||||
*/
|
||||
$b_execution_state_id = $building->executionState->name;
|
||||
$b_execution_state_label = $building->executionState->userLabel;
|
||||
$b_executionstate_id = $building->executionState->name;
|
||||
$b_executionstate_label = $building->executionState->userLabel;
|
||||
$b_operationalstate_id = $building->operationalState->name;
|
||||
$b_operationalstate_label = $building->operationalState->userLabel;
|
||||
|
||||
if($b_executionstate_label != $hausnummer->rimo_ex_state) {
|
||||
$hausnummer->rimo_ex_state = $b_executionstate_label;
|
||||
$hausnummer->save();
|
||||
}
|
||||
if($b_operationalstate_label != $hausnummer->rimo_op_state) {
|
||||
$hausnummer->rimo_op_state = $b_operationalstate_label;
|
||||
$hausnummer->save();
|
||||
}
|
||||
|
||||
|
||||
if($b_execution_state_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_execution_state_id ($b_execution_state_label) [".$hausnummer->id."]\n";
|
||||
if($b_executionstate_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_executionstate_id ($b_executionstate_label) [".$hausnummer->id."]\n";
|
||||
$hausnummer->visibility = "private";
|
||||
$hausnummer->save();
|
||||
}
|
||||
@@ -293,7 +300,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$rimo_home_count = count($building->homes->item);
|
||||
|
||||
foreach ($building->homes->item as $home) {
|
||||
//print_r($home);//exit;
|
||||
//print_r($home);exit;
|
||||
$homes_count++;
|
||||
$home_rimo_id = $home->id;
|
||||
$home_name = $home->name;
|
||||
@@ -331,6 +338,15 @@ foreach ($clusters as $cluster_data) {
|
||||
* TODO: Status based on execution-/operational-state
|
||||
*/
|
||||
|
||||
if($home->executionState->userLabel != $unit->rimo_ex_state) {
|
||||
$unit->rimo_ex_state = $home->executionState->userLabel;
|
||||
$unit->save();
|
||||
}
|
||||
if($home->operationalState->userLabel != $unit->rimo_op_state) {
|
||||
$unit->rimo_op_state = $home->operationalState->userLabel;
|
||||
$unit->save();
|
||||
}
|
||||
|
||||
/*
|
||||
* update FTU data
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user